Ticket #8075: listings_switch_favs.patch

File listings_switch_favs.patch, 2.0 KB (added by Tom Dexter <digitalaudiorock@…>, 16 years ago)
  • mythplugins/mythweb/modules/tv/list.php

     
    1515 * @subpackage  TV
    1616 *
    1717/**/
     18// Swap guide_favonly
     19    if (isset($_GET['guide_favonly'])) {
     20        $_SESSION['guide_favonly'] = (bool) $_GET['guide_favonly'];
     21        unset($_GET['guide_favonly']);
     22    }
     23// Create guide_favonly switch url
     24    $slist = array();
     25    if (isset($_REQUEST['time'])) $slist['time'] = $_REQUEST['time'];
     26    if (isset($_REQUEST['daytime'])) $slist['daytime'] = $_REQUEST['daytime'];
     27    if (isset($_REQUEST['date'])) $slist['date'] = $_REQUEST['date'];
     28    if (isset($_REQUEST['hour'])) $slist['hour'] = $_REQUEST['hour'];
     29    $dqs = http_build_query($slist);
     30    if ($dqs != '') $dqs = "&$dqs";
     31    if ($_SESSION['guide_favonly']) {
     32        $switchlabel = t('ALL channels');
     33        $switchval = 0;
     34    } else {
     35        $switchlabel = t('Favorite channels');
     36        $switchval = 1;
     37    }
     38    $favurl = '<a href="' . root_url . "tv/list?guide_favonly=$switchval" . $dqs . "\">$switchlabel</a>";
    1839
    1940// Were we passed a timestamp?  This is going to be the most common occurrence
    2041    if ($_REQUEST['time'])
  • mythplugins/mythweb/modules/tv/tmpl/default/list_data.php

     
    2424    ?></div>
    2525    <table id="x-jumpto" class="commandbox commands" border="0" cellspacing="0" cellpadding="0">
    2626    <tr>
     27        <td><?php echo $favurl;?></td>
    2728        <td class="x-jumpto"><?php echo t('Jump To') ?>:</td>
    2829        <td class="x-hour"><?php hour_select('id="hour_select" onchange="list_update($(\'hour_select\')[$(\'hour_select\').selectedIndex].value);"') ?></td>
    2930        <td class="x-day">