Ticket #7032: mythweb_playgroup_select.diff

File mythweb_playgroup_select.diff, 3.5 KB (added by gnome42, 4 years ago)
  • mythplugins/mythweb/modules/tv/classes/Schedule.php

    class Schedule { 
    388388/** 
    389389 * prints a <select> of the various playback groups available 
    390390/**/ 
    391     function playgroup_select($this_playgroup, $name = 'playgroup', $id = NULL, $js = NULL)    { 
     391    function playgroup_select($this_playgroup, $name = 'playgroup', &$schedule = NULL, $id = NULL, $js = NULL) { 
    392392    // Make sure we have some data 
    393393        static $playgroups = array(); 
    394394        if (!count($playgroups)) { 
    395395            global $db; 
    396             $sh = $db->query('SELECT name FROM playgroup ORDER BY name'); 
     396            $sh = $db->query('SELECT name FROM playgroup ORDER BY name = "Default" DESC, name'); 
    397397            while (list($group) = $sh->fetch_row()) { 
    398398                $playgroups[] = $group; 
    399399            } 
    400400            $sh->finish(); 
    401401        } 
     402    // Do PlayGroup titlematch 
     403        if (count($playgroups) > 1 && empty($this_playgroup) && is_object($schedule)) { 
     404            $this_playgroup =& $schedule->this_playgroup; 
     405            $sh = $db->query('SELECT DISTINCT name FROM playgroup 
     406                              WHERE name = ? OR name = ? OR (titlematch <> "" AND ? REGEXP titlematch) 
     407                              ORDER BY titlematch DESC', 
     408                             $schedule->title, $schedule->category, $schedule->title); 
     409            if (list($grp) = $sh->fetch_row()) 
     410                $this_playgroup = $grp; 
     411            $sh->finish(); 
     412        } 
     413        if (empty($this_playgroup)) 
     414            $this_playgroup = 'Default'; 
    402415    // Print the actual select 
    403416        echo "<select name=\"$name\""; 
    404417        if ($id) 
  • mythplugins/mythweb/modules/tv/tmpl/default/_advanced_options.php

     
    5757                <dt><?php echo t('Storage Group') ?>:</dt> 
    5858                <dd><?php storagegroup_select($schedule->storagegroup) ?></dd> 
    5959                <dt><?php echo t('Playback Group') ?>:</dt> 
    60                 <dd><?php playgroup_select($schedule->playgroup, 'playgroup') ?></dd> 
     60                <dd><?php playgroup_select($schedule->playgroup, 'playgroup', $schedule) ?></dd> 
    6161                <dt><?php echo t('Recording Priority') ?>:</dt> 
    6262                <dd><select name="recpriority"><?php 
    6363                    for ($i=99; $i>=-99; --$i) { 
  • mythplugins/mythweb/modules/tv/tmpl/default/set_playgroup.php

     
    1919<table border="0" cellspacing="0" cellpadding="0"> 
    2020<tr class="x-sep"> 
    2121    <th><?php echo t('Edit existing group') ?>:</th> 
    22     <td><?php playgroup_select($group['name'], 'playgroup', NULL, '$(\'chg_grp_form\').submit()') ?> 
     22    <td><?php playgroup_select($group['name'], 'playgroup', NULL, NULL, '$(\'chg_grp_form\').submit()') ?> 
    2323        <noscript><input type="submit" class="submit" value="<?php echo t('Edit') ?>"></noscript></td> 
    2424    <td><input type="submit" class="submit" name="new_group" value="<?php echo t('New Group') ?>"></td> 
    2525</tr>