<?php

// Attempt to force some caching, will make secondary views so much faster.
header('Cache-Control: max-age-' . ($_REQUEST['starttime'] - time() + 604800));
header('Pragma: ');
header('Expires: ' . date('D, d M Y H:i:s e', $_REQUEST['starttime'] + 604800));
header('Content-Type: application/json');
$program = load_one_program($_REQUEST['starttime'], $_REQUEST['chanid'], false);
echo json_encode(array('id' => 'program-' . $_REQUEST['chanid'] . '-' . $_REQUEST['starttime'], 'info' => $program->details_list()));
Exemple #2
0
// Load the program info, unless a schedule was requested
$program = null;
if (empty($_GET['recordid'])) {
    // Starttime in the past -- See if it's a recording
    if ($_GET['starttime'] < time()) {
        $record = MythBackend::find()->queryProgramRows('QUERY_RECORDING TIMESLOT ' . $_GET['chanid'] . ' ' . unix2mythtime($_GET['starttime']), 1);
        if (is_array($record[0])) {
            $prog = new Program($record[0]);
            if ($_GET['chanid'] == $prog->chanid && $_GET['starttime'] == $prog->recstartts) {
                $program =& $prog;
            }
        }
    }
    // Load the program
    if (empty($program) || !$program->recstartts) {
        $program =& load_one_program($_GET['starttime'], $_GET['chanid'], $_GET['manualid']);
    }
}
// Get the schedule for this recording, if one exists
if ($program->recordid) {
    $schedule =& Schedule::find($program->recordid);
} elseif ($_GET['recordid']) {
    $schedule =& Schedule::find($_GET['recordid']);
} else {
    $schedule = new Schedule(NULL);
}
// Handle custom search schedules.  This will cause the "cancel" or "don't"
// option to be selected as "schedule via custom search"
if ($schedule->search && $schedule->search != searchtype_manual) {
    $schedule->type = null;
}
Exemple #3
0
/**
 * prints a <select> of the various recgroups available
/**/
function recgroup_select(&$schedule, $name = 'recgroup')
{
    $this_group =& $schedule->recgroup;
    static $groups = array();
    // Load the recording groups?
    if (!count($groups)) {
        // Default
        $groups['Default'] = t('Default');
        // Current recgroups
        $result = mysql_query('SELECT DISTINCT recgroup FROM recorded ' . 'WHERE recgroup != "LiveTV" AND recgroup != "Deleted" UNION ' . 'SELECT DISTINCT recgroup FROM record ' . 'WHERE recgroup != "LiveTV" AND recgroup != "Deleted" ' . 'ORDER BY recgroup;');
        while (list($group) = mysql_fetch_row($result)) {
            if (empty($group) || $group == 'Default') {
                continue;
            }
            $groups[$group] = $group;
        }
        mysql_free_result($result);
    }
    // Guess at default. Try category match etc..
    if (count($groups) > 1 && empty($this_group)) {
        global $db;
        $program = load_one_program($schedule->starttime, $schedule->chanid, $schedule->manualid);
        $sh = $db->query('SELECT DISTINCT recgroup FROM record
                             WHERE recgroup REGEXP ? OR recgroup REGEXP ? OR recgroup REGEXP ?', $schedule->category, $program->category_type, $schedule->station);
        if (list($grp) = $sh->fetch_row()) {
            $this_group = $grp;
        }
        $sh->finish();
    }
    if (empty($this_group)) {
        $this_group = 'Default';
    }
    // Print the <select>
    echo "<select name=\"{$name}\">";
    foreach ($groups as $group => $group_name) {
        echo '<option value="', html_entities($group), '"';
        if ($this_group == $group) {
            echo ' SELECTED';
        }
        echo '>', html_entities($group_name), '</option>';
    }
    if (!$groups[$this_group]) {
        echo '<option value="', html_entities($this_group), '" SELECTED', '>', html_entities($this_group), '</option>';
    }
    echo '</select>';
}