Ticket #9850: filters.2.diff
| File filters.2.diff, 9.1 KB (added by , 14 years ago) |
|---|
-
modules/_shared/lang/English.lang
diff --git a/modules/_shared/lang/English.lang b/modules/_shared/lang/English.lang index b7b2f2c..d0bfd6d 100644
a b 1 "New episode" 2 "Identifiable episode" 3 "First showing" 4 "Primetime" 5 "Commercial free" 6 "High definition" 7 "This Episode" 8 "Post Processing" 9 "Schedule Options" 1 10 "" 2 11 "# Tracks" 3 12 "$1 B" -
modules/tv/classes/Schedule.php
diff --git a/modules/tv/classes/Schedule.php b/modules/tv/classes/Schedule.php index 7129da5..f3454c4 100644
a b class Schedule extends MythBase { 51 51 public $findid; 52 52 public $transcoder; 53 53 public $parentid; 54 public $filter; 54 55 55 56 public $playgroup; 56 57 public $prefinput; … … class Schedule extends MythBase { 63 64 public $will_record = false; 64 65 public $css_class; // css class, based on category and/or category_type 65 66 67 68 /** 69 * Intended to be called as Schedule::availableRecordFilters() 70 * 71 * @return array sorted list of record filters available to the system keyed by filterid 72 /**/ 73 public static function availableRecordFilters() { 74 static $cache = array(); 75 if (empty($cache)) { 76 global $db; 77 $cache = $db->query_keyed_list_assoc('filterid', 78 'SELECT filterid,description,newruledefault 79 FROM recordfilter 80 ORDER BY filterid'); 81 } 82 return $cache; 83 } 84 85 /** 86 * 87 * @return an array of the filters for this Schedule. Array includes 88 * a property called "enabled" to indicate if the filter is enabled. 89 * If this is not a real schedule "enabled" is from the newruledefault 90 * property 91 * 92 /**/ 93 public function recordFilters() { 94 $filters = array(); 95 foreach (Schedule::availableRecordFilters() as $id => $filter) { 96 $filters[$id] = $filter; 97 // if this is a real schedule, use the filter property 98 if ($this->recordid) { 99 $mask = 1 << $id; 100 $filters[$id]['enabled'] = ($this->filter & $mask) == $mask; 101 102 // otherwise it's not a real schedule, so use the default value 103 } else { 104 $filters[$id]['enabled'] = $filter['newruledefault']; 105 } 106 } 107 108 return $filters; 109 } 110 66 111 public static function findAll($sort = true) { 67 112 global $db; 68 113 $orderby = ''; … … class Schedule extends MythBase { 236 281 findday,findtime,findid,autotranscode,parentid,transcoder, 237 282 autouserjob1,autouserjob2,autouserjob3,autouserjob4,autometadata, 238 283 playgroup,storagegroup,prefinput, 239 next_record,last_record,last_delete,inetref,season,episode )284 next_record,last_record,last_delete,inetref,season,episode,filter) 240 285 VALUES (?,?,?, 241 286 FROM_UNIXTIME(?),FROM_UNIXTIME(?),FROM_UNIXTIME(?),FROM_UNIXTIME(?), 242 ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,? )',287 ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', 243 288 _or($this->recordid, 0, true), 244 289 _or($this->type, 0, true), 245 290 $this->chanid, … … class Schedule extends MythBase { 286 331 _or($this->last_delete, '00:00:00' ), 287 332 _or($this->inetref, '' ), 288 333 _or($this->season, 0 ), 289 _or($this->episode, 0 ) 334 _or($this->episode, 0 ), 335 _or($this->filter, 0 ) 290 336 ); 291 337 // Get the id that was returned 292 338 $recordid = $sh->insert_id(); -
modules/tv/detail.php
diff --git a/modules/tv/detail.php b/modules/tv/detail.php index 5b444d9..a63d818 100644
a b 162 162 redirect_browser(root_url.'tv/detail/'.$program->chanid.'/'.$program->recstartts); 163 163 } 164 164 165 // Load the utility/display functions for scheduling 166 require_once 'includes/schedule_utils.php'; 167 165 168 // The user tried to update the recording settings - update the database and the variable in memory 166 169 if (isset($_POST['save'])) { 167 170 if ($schedule) { … … 234 237 $schedule->inetref = $_POST['inetref']; 235 238 $schedule->season = intval($_POST['season']); 236 239 $schedule->episode = intval($_POST['episode']); 240 $schedule->filter = generateFilter(); 237 241 238 242 // Keep track of the parent recording for overrides 239 243 if ($_POST['record'] == rectype_override) { … … 348 352 $program->load_jobs(); 349 353 } 350 354 351 // Load the utility/display functions for scheduling352 require_once 'includes/schedule_utils.php';353 354 355 // Setup some vars for the ipod template 355 356 $Page_Previous_Location = root_url.'tv/list_shows_in_title_and_group?group='.urlencode($program->recgroup).'&title='.urlencode($program->title); 356 357 $Page_Previous_Location_Name = $program->title; -
modules/tv/includes/schedule_utils.php
diff --git a/modules/tv/includes/schedule_utils.php b/modules/tv/includes/schedule_utils.php index eb1ec4f..d5f3af3 100644
a b 11 11 /**/ 12 12 13 13 /** 14 * Generates a schedule filter paramater from the POST parameters 15 /**/ 16 function generateFilter() { 17 $total = 0; 18 foreach (Schedule::availableRecordFilters() as $id => $filter) { 19 $enabled = intval($_POST["recordfilter_$id"]); 20 $total |= $enabled << $id; 21 } 22 return $total; 23 } 24 25 /** 14 26 * Prints a <select> of the available recording inputs 15 27 /**/ 16 28 function input_select($selected, $ename='prefinput') { -
modules/tv/tmpl/default/_advanced_options.php
diff --git a/modules/tv/tmpl/default/_advanced_options.php b/modules/tv/tmpl/default/_advanced_options.php index 6054165..4754c6b 100644
a b 351 351 <dd><input type="text" id="season" class="quantity" name="season" value="<?php echo html_entities($schedule->season) ?>"></dd> 352 352 <dt><?php echo t('Episode') ?>:</dt> 353 353 <dd><input type="text" id="episode" class="quantity" name="episode" value="<?php echo html_entities($schedule->episode) ?>"></dd> 354 <fieldset> 355 <legend><?php echo t('Filters') ?></legend> 356 <?php 357 foreach ($schedule->recordFilters() as $id => $filter) { 358 ?> 359 <dt><label for="recordfilter_$id"><?php echo t($filter['description']) ?>:</label></dt> 360 <dd><input type="checkbox" class="radio" id="recordfilter_<?php echo $id ?>" name="recordfilter_<?php echo $id ?>"<?php if ($filter['enabled']) echo ' CHECKED' ?> value="1"></dd> 361 <?php } ?> 362 </fieldset> 363 <fieldset> 364 <legend><?php echo t('Post Processing') ?></legend> 354 365 <dt><label for="autometadata"><?php echo t('Look up Metadata') ?>:</label></dt> 355 366 <dd><input type="checkbox" class="radio" id="autometadata" name="autometadata"<?php if ($schedule->autometadata) echo ' CHECKED' ?> value="1"></dd> 356 367 <dt><label for="autocommflag"><?php echo t('Auto-flag commercials') ?>:</label></dt> … … 365 376 <dd><input type="checkbox" class="radio" id="autouserjob3" name="autouserjob3"<?php if ($schedule->autouserjob3) echo ' CHECKED' ?> value="1"></dd> 366 377 <dt><label for="autouserjob4"><?php echo setting('UserJobDesc4') ?>:</label></dt> 367 378 <dd><input type="checkbox" class="radio" id="autouserjob4" name="autouserjob4"<?php if ($schedule->autouserjob4) echo ' CHECKED' ?> value="1"></dd> 379 </fieldset> 380 <fieldset> 381 <legend><?php echo t('Schedule Options') ?></legend> 368 382 <dt><label for="inactive"><?php echo t('Inactive') ?>:</label></dt> 369 383 <dd><input type="checkbox" class="radio" id="inactive" name="inactive"<?php if ($schedule->inactive) echo ' CHECKED' ?> value="1"></dd> 370 384 <dt><label for="autoexpire"><?php echo t('Auto-expire recordings') ?>:</label></dt> … … 379 393 <dt><?php echo t('End Late') ?>:</dt> 380 394 <dd><input type="text" class="quantity" name="endoffset" value="<?php echo html_entities($schedule->endoffset) ?>"> 381 395 <?php echo t('minutes') ?></dd> 396 </fieldset> 382 397 </dl> 383 398 384 399 <div style="display: none;" id="message-dialog"> -
modules/tv/tmpl/default/schedules.php
diff --git a/modules/tv/tmpl/default/schedules.php b/modules/tv/tmpl/default/schedules.php index eafd188..9c7f273 100644
a b 18 18 // Print the page header 19 19 require 'modules/_shared/tmpl/'.tmpl.'/header.php'; 20 20 21 22 21 // No schedules defined? 23 22 if (!is_array($the_schedules) || !count($the_schedules)) { 24 23 echo '<div id="no_schedules">',
