1<?php 2/** 3 * The Recording object, and a couple of related subroutines. 4 * 5 * @license GPL 6 * 7 * @package MythWeb 8 * 9 **/ 10 11// Make sure the recording schedule type data gets loaded 12 require_once 'includes/recording_schedules.php'; 13 14// 15// Recordings class 16// 17class Recording { 18 var $recordid; 19 var $type; 20 var $chanid; 21 var $starttime; 22 var $endtime; 23 var $title; 24 var $subtitle; 25 var $description; 26 var $season; 27 var $episode; 28 var $category; 29 var $profile; 30 var $recgroup; 31 var $storagegroup; 32 var $recpriority; 33 var $autoexpire; 34 var $maxepisodes; 35 var $maxnewest; 36 var $dupin; 37 var $dupmethod; 38 var $startoffset; 39 var $endoffset; 40 var $progstart; 41 var $progend; 42 var $seriesid; 43 var $programid; 44 var $inetref; 45 var $texttype; 46 47 var $basename; 48 49 var $channel; 50 51 var $will_record = false; 52 var $record_daily = false; 53 var $record_weekly = false; 54 var $record_once = false; 55 var $record_always = false; 56 57 var $css_class; // css class, based on category and/or category_type 58 59 function __construct($recording_data) { 60 61 // SQL data 62 if (is_array($recording_data) && isset($recording_data['recordid'])) { 63 $this->recordid = $recording_data['recordid']; 64 $this->type = $recording_data['type']; 65 $this->chanid = $recording_data['chanid']; 66 $this->starttime = $recording_data['starttime_unix']; 67 $this->endtime = $recording_data['endtime_unix']; 68 $this->title = $recording_data['title']; 69 $this->subtitle = $recording_data['subtitle']; 70 $this->description = $recording_data['description']; 71 $this->season = $recording_data['season']; 72 $this->episode = $recording_data['episode']; 73 $this->category = $recording_data['category']; 74 $this->profile = $recording_data['profile']; 75 $this->recgroup = $recording_data['recgroup']; 76 $this->storagegroup = $recording_data['storagegroup']; 77 $this->recpriority = $recording_data['recpriority']; 78 $this->autoexpire = $recording_data['autoexpire']; 79 $this->maxepisodes = $recording_data['maxepisodes']; 80 $this->maxnewest = $recording_data['maxnewest']; 81 $this->dupin = $recording_data['dupin']; 82 $this->dupmethod = $recording_data['dupmethod']; 83 $this->startoffset = $recording_data['startoffset']; 84 $this->endoffset = $recording_data['endoffset']; 85 $this->seriesid = $recording_data['seriesid']; 86 $this->programid = $recording_data['programid']; 87 $this->inetref = $recording_data['inetref']; 88 $this->progstart = $recording_data['progstart']; 89 $this->progend = $recording_data['progend']; 90 $this->basename = $recording_data['basename']; 91 } 92 // Recording object data 93 else { 94 $tmp = @get_object_vars($recording_data); 95 if (is_array($tmp) && (count($tmp) > 0)) { 96 foreach ($tmp as $key => $value) { 97 $this->$key = $value; 98 } 99 } 100 } 101 102 // We get various recording-related information, too 103 switch ($this->type) { 104 case 1: $this->record_once = true; break; 105 case 2: $this->record_daily = true; break; 106 case 4: $this->record_always = true; break; 107 case 5: $this->record_weekly = true; break; 108 case 6: $this->record_findone = true; break; 109 } 110 111 // Add a generic "will record" variable, too 112 $this->will_record = ($this->record_daily 113 || $this->record_weekly 114 || $this->record_once 115 || $this->record_findone 116 || $this->record_always ) ? true : false; 117 // Turn type int a word 118 $this->texttype = $GLOBALS['RecTypes'][$this->type]; 119 // Do we have a chanid? Load some info about it 120 if ($this->chanid && !isset($this->channel)) 121 $this->channel =& Channel::find($this->chanid); 122 123 // Find out which css category this recording falls into 124 if ($this->chanid != '') 125 $this->css_class = category_class($this); 126 } 127 function Recording($recording_data) { 128 self::__construct($recording_data); 129 } 130 131} 132