Ticket #8075: mythweb_guide_channelgroups.diff
| File mythweb_guide_channelgroups.diff, 12.3 KB (added by , 16 years ago) |
|---|
-
mythweb/includes/config.php
41 41 $_SESSION['recorded_pixmaps'] = (tmpl == 'default') ? true : false; 42 42 43 43 // Guide settings 44 if (! isset($_SESSION['guide_favonly']))45 $_SESSION['guide_ favonly'] = false;44 if (!$_SESSION['guide_channelgroup']) 45 $_SESSION['guide_channelgroup'] = 0; 46 46 47 47 // The size of timeslots, in seconds (1800 = 30 minutes) 48 48 if ($_SESSION['timeslot_size'] < 300) { -
mythweb/modules/tv/set_session.php
29 29 $_SESSION['recorded_pixmaps'] = $_POST['recorded_pixmaps'] ? true : false; 30 30 if (isset($_POST['file_url_override'])) $_SESSION['file_url_override'] = trim(preg_replace('#^file://#', '', $_POST['file_url_override'])); 31 31 // Guide Settings 32 $_SESSION['guide_ favonly'] = $_POST['guide_favonly'] ? true : false;32 $_SESSION['guide_channelgroup'] = $_POST['guide_channelgroup']; 33 33 $_SESSION['timeslot_size'] = max(5, intVal($_POST['timeslot_size'])) * 60; 34 34 $_SESSION['num_time_slots'] = max(3, intVal($_POST['num_time_slots'])); 35 35 $_SESSION['timeslot_blocks'] = max(1, intVal($_POST['timeslot_blocks'])); … … 38 38 $_SESSION['star_character'] = $_POST['star_character']; 39 39 $_SESSION['recorded_paging'] = $_POST['recorded_paging']; 40 40 } 41 42 /** 43 * Prints a <select> of channel groups 44 /**/ 45 function channelgroup_select () { 46 global $db; 47 $sh = $db->query('SELECT grpid, name FROM channelgroupnames 48 WHERE EXISTS (SELECT * FROM channelgroup 49 WHERE channelgroup.grpid=channelgroupnames.grpid) ORDER BY name'); 50 echo "<select name=\"cgrp\">"; 51 echo '<option value="0"'; 52 if (!$_SESSION['guide_channelgroup']) echo ' SELECTED'; 53 echo '>'.t('All channels').'</option>'; 54 while ($grow = $sh->fetch_row()) { 55 echo '<option value="'.$grow[0].'"'; 56 if ($_SESSION['guide_channelgroup']==$grow[0]) echo ' SELECTED'; 57 echo '>'.htmlspecialchars($grow[1]).'</option>'; 58 } 59 $sh->finish(); 60 echo '</select>'; 61 } 62 -
mythweb/modules/tv/list.php
23 23 $list_starttime = unixtime(sprintf('%08d%04d00', $_REQUEST['date'], $_REQUEST['daytime'])); 24 24 // Did we get passed a date (and probably an hour, too)? 25 25 elseif(isset($_REQUEST['date'])) 26 $list_starttime = unixtime(sprintf('%08d%02d0000', $_REQUEST['date'], $_REQUEST['hour']));26 $list_starttime = unixtime(sprintf('%08d%02d0000', date('Ymd',$_REQUEST['date']), $_REQUEST['hour'])); 27 27 // Default value - just use the current time 28 28 else 29 29 $list_starttime = time(); … … 42 42 // Set a session variable so other sections know how to get back to this particular page 43 43 $_SESSION['list_time'] = $list_starttime; 44 44 45 // Set channel group 46 if (isset($_REQUEST['cgrp'])) $_SESSION['guide_channelgroup'] = $_REQUEST['cgrp']; 47 $list_channelgroup = $_SESSION['guide_channelgroup']; 45 48 // Populate the $Channels array 46 49 load_all_channels(); 47 50 … … 55 58 require_once tmpl_dir.'list.php'; 56 59 57 60 /** 61 * Prints a <select> of channel groups 62 /**/ 63 function channelgroup_select ($params = '') { 64 global $db; 65 $sh = $db->query('SELECT grpid, name FROM channelgroupnames 66 WHERE EXISTS (SELECT * FROM channelgroup 67 WHERE channelgroup.grpid=channelgroupnames.grpid) ORDER BY name'); 68 echo "<select name=\"cgrp\" $params>"; 69 echo '<option value="0"'; 70 if (!$_SESSION['guide_channelgroup']) echo ' SELECTED'; 71 echo '>'.t('All channels').'</option>'; 72 while ($grow = $sh->fetch_row()) { 73 echo '<option value="'.$grow[0].'"'; 74 if ($_SESSION['guide_channelgroup']==$grow[0]) echo ' SELECTED'; 75 echo '>'.htmlspecialchars($grow[1]).'</option>'; 76 } 77 $sh->finish(); 78 echo '</select>'; 79 } 80 81 /** 58 82 * Prints a <select> of the available hour range 59 83 /**/ 60 84 function hour_select($params = '') { -
mythweb/modules/tv/includes/channels.php
33 33 global $Callsigns; 34 34 $Channels = array(); 35 35 // Initialize the query 36 if ($_SESSION['guide_favonly']) 37 $sql = 'SELECT channel.* FROM channel, favorites WHERE channel.chanid = favorites.chanid AND'; 38 else 36 if ($_SESSION['guide_channelgroup']) { 37 $sql = 'SELECT channel.* FROM channel JOIN channelgroup ON channelgroup.chanid=channel.chanid ' . 38 'WHERE channelgroup.grpid=? AND'; 39 $params = array($_SESSION['guide_channelgroup']); 40 } else { 39 41 $sql = 'SELECT * FROM channel WHERE'; 42 $params = array(); 43 } 40 44 $sql .= ' channel.visible=1'; 41 45 $sql .= ' GROUP BY channel.channum, channel.callsign'; 42 46 // Sort … … 44 48 .($_SESSION["sortby_channum"] ? '' : 'channel.callsign, ') 45 49 .'(channel.channum + 0), channel.channum, channel.chanid'; // sort by channum as both int and string to grab subchannels 46 50 // Query 47 $sh = $db->query($sql );51 $sh = $db->query($sql, $params); 48 52 while ($channel_data = $sh->fetch_assoc()) { 49 53 $Channels[$channel_data['chanid']] = new Channel($channel_data); 50 54 if (empty($Callsigns[$channel_data['channum'].':'.$channel_data['callsign']])) … … 53 57 $sh->finish(); 54 58 // No channels returned? 55 59 if (empty($Channels)) { 56 unset($_SESSION['guide_favonly']); 60 $cgrp = $_SESSION['guide_channelgroup']; 61 $_SESSION['guide_channelgroup'] = 0; 57 62 trigger_error('No channels were detected. ' 58 .($ _SESSION['guide_favonly']63 .($cgrp 59 64 ? 'The "favorites only" option has now been turned off, please reload this page to try again.' 60 65 : 'Are you sure that MythTV is properly configured?'), 61 66 FATAL); -
mythweb/modules/tv/tmpl/default/set_session.php
42 42 </tr><tr class="x-sep"> 43 43 <td colspan="2"><?php echo t('Guide Settings') ?>:</th> 44 44 </tr><tr> 45 <th><?php echo t(' Only display favourite channels') ?>:</th>46 <td ><input class="radio" type="checkbox" title="In the program listing, only show channels marked as favourite channels" name="guide_favonly"<?php if ($_SESSION['guide_favonly']) echo ' CHECKED' ?>></td>45 <th><?php echo t('Channel group to display') ?>:</th> 46 <td><?php channelgroup_select(); ?></td> 47 47 </tr><tr> 48 48 <th><?php echo t('Max star rating for movies') ?>:</th> 49 49 <td><input type="text" size="5" name="max_stars" value="<?php echo intVal($_SESSION['max_stars']) ?>"></td> -
mythweb/modules/tv/tmpl/default/list_data.php
25 25 <table id="x-jumpto" class="commandbox commands" border="0" cellspacing="0" cellpadding="0"> 26 26 <tr> 27 27 <td class="x-jumpto"><?php echo t('Jump To') ?>:</td> 28 <td class="x-hour"><?php hour_select('id="hour_select" onchange="list_update($(\'hour_select\')[$(\'hour_select\').selectedIndex].value);"') ?></td> 28 <td class="x-cgrp"><?php channelgroup_select('id="cgrp_select" onchange="list_update('.$list_starttime.',$(\'cgrp_select\')[$(\'cgrp_select\').selectedIndex].value);"') ?></td> 29 <td class="x-hour"><?php hour_select('id="hour_select" onchange="list_update($(\'hour_select\')[$(\'hour_select\').selectedIndex].value,'.$list_channelgroup.');"') ?></td> 29 30 <td class="x-day"> 30 <a class="link" onclick="list_update(<?php echo $list_starttime - (24 * 60 * 60); ?>);">31 <a class="link" onclick="list_update(<?php echo ($list_starttime - (24 * 60 * 60)).','.$list_channelgroup; ?>);"> 31 32 <img src="<?php echo skin_url ?>img/left.gif" alt="<?php echo t('left'); ?>"> 32 33 </a> 33 <?php date_select('id="date_select" onchange="list_update($(\'date_select\')[$(\'date_select\').selectedIndex].value );"') ?>34 <a class="link" onclick="list_update(<?php echo $list_starttime + (24 * 60 * 60); ?>);">34 <?php date_select('id="date_select" onchange="list_update($(\'date_select\')[$(\'date_select\').selectedIndex].value,'.$list_channelgroup.');"') ?> 35 <a class="link" onclick="list_update(<?php echo ($list_starttime + (24 * 60 * 60)).','.$list_channelgroup; ?>);"> 35 36 <img src="<?php echo skin_url ?>img/right.gif" alt="<?php echo t('right'); ?>"> 36 37 </a> 37 38 </td> -
mythweb/modules/tv/tmpl/default/list.php
24 24 ?> 25 25 26 26 <script type="text/javascript"> 27 function list_update(timestamp ) {27 function list_update(timestamp, cgrp) { 28 28 ajax_add_request(); 29 29 new Ajax.Updater($('list_content'), 30 30 '<?php echo root_url ?>tv/list', 31 31 { 32 32 parameters: { 33 33 ajax: true, 34 time: timestamp 34 time: timestamp, 35 cgrp: cgrp 35 36 }, 36 37 onComplete: ajax_remove_request 37 38 } -
mythweb/modules/tv/tmpl/lite/set_session.php
28 28 </tr><tr> 29 29 <td colspan="2"><?php echo t('Guide Settings') ?>:</td> 30 30 </tr><tr> 31 <t d align="right"><?php echo t('Only display favourite channels') ?>:</td>32 <td ><input class="radio" type="checkbox" title="In the program listing, only show channels marked as favourite channels" name="guide_favonly"<?php if ($_SESSION['guide_favonly']) echo ' CHECKED' ?>></td>31 <th><?php echo t('Channel group to display') ?>:</th> 32 <td><?php channelgroup_select(); ?></td> 33 33 </tr><tr> 34 34 <td align="right"><?php echo t('Max star rating for movies') ?>:</td> 35 35 <td><input type="text" size="5" name="max_stars" value="<?php echo intVal($_SESSION['max_stars']) ?>"></td> -
mythweb/modules/tv/tmpl/lite/list.php
31 31 <tr> 32 32 33 33 <td nowrap align="center"><?php echo t('Jump To') ?>: </td> 34 <td><?php channelgroup_select() ?></td> 34 35 <td align="right"><?php echo t('Hour') ?>: </td> 35 36 <td><select name="hour" style="text-align: right"><?php 36 37 for ($h=0;$h<24;$h++) { … … 41 42 } 42 43 ?></select></td> 43 44 <td align="right"><?php echo t('Date') ?>: </td> 44 <td nowrap><?php date_select() ?></td>45 <td nowrap><?php date_select() ?></td> 45 46 <td align="center"><input type="submit" class="submit" value="<?php echo t('Jump') ?>"></td> 46 47 </tr> 47 48 </table>
