Ticket #7033: mythweb_recgroup_select.diff

File mythweb_recgroup_select.diff, 2.5 KB (added by Shane Shrybman, 11 years ago)
  • mythplugins/mythweb/modules/tv/classes/Schedule.php

    class Schedule { 
    461461/**
    462462 * prints a <select> of the various recgroups available
    463463/**/
    464     function recgroup_select($this_group, $name = 'recgroup') {
     464    function recgroup_select(&$schedule, $name = 'recgroup') {
     465        $this_group =& $schedule->recgroup;
    465466        static $groups = array();
    466         if (empty($this_group))
    467             $this_group = 'Default';
    468467    // Load the recording groups?
    469468        if (!count($groups)) {
    470469        // Default
    class Schedule { 
    483482            }
    484483            mysql_free_result($result);
    485484        }
     485    // Guess at default. Try category match etc..
     486        if (count($groups) > 1 && empty($this_group)) {
     487            global $db;
     488            $program = load_one_program($schedule->starttime, $schedule->chanid, $schedule->manualid);
     489            $sh = $db->query('SELECT DISTINCT recgroup FROM record
     490                             WHERE recgroup REGEXP ? OR recgroup REGEXP ? OR recgroup REGEXP ?',
     491                             $schedule->category, $program->category_type, $schedule->station);
     492            if (list($grp) = $sh->fetch_row())
     493                $this_group = $grp;
     494            $sh->finish();
     495        }
     496        if (empty($this_group))
     497            $this_group = 'Default';
    486498    // Print the <select>
    487499        echo "<select name=\"$name\">";
    488500        foreach($groups as $group => $group_name) {
  • mythplugins/mythweb/modules/tv/tmpl/default/_advanced_options.php

     
    5353                <dt><?php echo t('Transcoder') ?>:</dt>
    5454                <dd><?php transcoder_select($schedule->transcoder) ?></dd>
    5555                <dt><?php echo t('Recording Group') ?>:</dt>
    56                 <dd><?php recgroup_select($schedule->recgroup) ?></dd>
     56                <dd><?php recgroup_select($schedule) ?></dd>
    5757                <dt><?php echo t('Storage Group') ?>:</dt>
    5858                <dd><?php storagegroup_select($schedule->storagegroup) ?></dd>
    5959                <dt><?php echo t('Playback Group') ?>:</dt>