PageRenderTime 45ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/modules/tv/tmpl/lite/recorded.php

https://github.com/fracmak/mythweb
PHP | 233 lines | 193 code | 18 blank | 22 comment | 39 complexity | a0d44a1bc5c9f90bb163f31faed47049 MD5 | raw file
  1. <?php
  2. /**
  3. * Show recorded programs.
  4. *
  5. * @license GPL
  6. *
  7. * @package MythWeb
  8. * @subpackage TV
  9. *
  10. /**/
  11. // Set the desired page title
  12. $page_title = 'MythWeb - '.t('Recorded Programs');
  13. // Custom headers
  14. $headers[] = '<link rel="stylesheet" type="text/css" href="'.skin_url.'/recorded.css" />';
  15. // Print the page header
  16. require 'modules/_shared/tmpl/'.tmpl.'/header.php';
  17. // Global variables used here
  18. global $All_Shows, $Total_Programs, $Total_Time, $Total_Used,
  19. $Groups, $Program_Titles;
  20. // Show the recgroup?
  21. if (count($Groups) > 1) {
  22. $recgroup_cols = 1;
  23. }
  24. else {
  25. $recgroup_cols = 0;
  26. }
  27. // Setup for grouping by various sort orders
  28. $group_field = $_SESSION['recorded_sortby'][0]['field'];
  29. if ($group_field == "") {
  30. $group_field = "airdate";
  31. } elseif ( ! (($group_field == "title") || ($group_field == "channum") || ($group_field == "airdate") || ($group_field == "recgroup")) ) {
  32. $group_field = "";
  33. }
  34. ?>
  35. <form id="change_title" action="<?php echo root_url ?>tv/recorded" method="get">
  36. <table id="title_choices" class="command command_border_l command_border_t command_border_b command_border_r" border="0" cellspacing="0" cellpadding="4" align="center">
  37. <tr>
  38. <?php if (count($Groups) > 1) { ?>
  39. <td><?php echo t('Show group') ?>:</td>
  40. <td><select name="recgroup">
  41. <option value=""><?php echo t('All groups') ?></option><?php
  42. foreach($Groups as $recgroup => $count) {
  43. echo '<option id="Group '.htmlspecialchars($recgroup).'" value="'.htmlspecialchars($recgroup).'"';
  44. if ($_GET['recgroup'] == $recgroup)
  45. echo ' SELECTED';
  46. echo '>'.html_entities($recgroup)
  47. .' ('.tn('$1 recording', '$1 recordings', $count)
  48. .')</option>';
  49. }
  50. ?>
  51. </select></td>
  52. <?php
  53. }
  54. ?>
  55. <td><?php echo t('Show recordings') ?>:</td>
  56. <td width="250" align="center"><select name="title">
  57. <option id="All recordings" value=""><?php echo t('All recordings') ?></option>
  58. <?php
  59. foreach($Program_Titles as $title => $count) {
  60. echo '<option id="Title '.htmlspecialchars($title).'" value="'.htmlspecialchars($title).'"';
  61. if ($_GET['title'] == $title)
  62. echo ' SELECTED';
  63. echo '>'.html_entities($title)
  64. .($count > 1 ? ' ('.tn('$1 episode', '$1 episodes', $count).')' : "")
  65. ."</option>\n";
  66. }
  67. ?>
  68. </select></td>
  69. <td><input type="submit" value="<?php echo t('Go') ?>"></td>
  70. </tr>
  71. </table>
  72. </form>
  73. <table id="recorded_list" border="0" cellpadding="0" cellspacing="0" class="list small">
  74. <tr class="menu">
  75. <?php
  76. if ($group_field != "")
  77. echo " <td class=\"list\" colspan=\"2\">&nbsp;</td>\n";
  78. ?>
  79. <th class="x-title"><?php echo get_sort_link('title', t('Title')) ?></td>
  80. <th class="x-subtitle"><?php echo get_sort_link('subtitle', t('Subtitle')) ?></td>
  81. <th class="x-programid"><?php echo get_sort_link('programid', t('Program ID')) ?></td>
  82. <th class="x-channum"><?php echo get_sort_link('channum', t('Channel')) ?></td>
  83. <th class="x-airdate"><?php echo get_sort_link('airdate', t('Airdate')) ?></td>
  84. <?php
  85. if ($recgroup_cols)
  86. echo ' <th class="x-recgroup">', get_sort_link('recgroup', t('Recording Group')), "</td>\n";
  87. ?>
  88. <th class="x-length"><?php echo get_sort_link('length', t('Length')) ?></td>
  89. <th class="x-filesize"><?php echo get_sort_link('file_size', t('File Size')) ?></td>
  90. </tr><?php
  91. $row = 0;
  92. $section = -1;
  93. $prev_group = '';
  94. $cur_group = '';
  95. foreach ($All_Shows as $show) {
  96. // Print a dividing row if grouping changes
  97. switch ($group_field) {
  98. case 'airdate':
  99. $cur_group = strftime($_SESSION['date_listing_jump'], $show->starttime);
  100. break;
  101. case 'recgroup':
  102. $cur_group = $show->recgroup;
  103. break;
  104. case 'channum':
  105. $cur_group = $show->channel->channum;
  106. break;
  107. case 'title':
  108. $cur_group = $show->title;
  109. break;
  110. }
  111. if ( $cur_group != $prev_group && $group_field != '' ) {
  112. $section++;
  113. $colspan = 10 + $recgroup_cols;
  114. print <<<EOM
  115. <tr id="breakrow_$section" class="list_separator">
  116. <td colspan="$colspan" class="list_separator">$cur_group</td>
  117. </tr>
  118. EOM;
  119. }
  120. echo "<tr id=\"inforow_$row\" class=\"recorded\">\n";
  121. if ($group_field != "")
  122. echo " <td class=\"list\" rowspan=\"2\">&nbsp;</td>\n";
  123. ?>
  124. <td rowspan="2" class="x-pixmap">
  125. <a class="x-pixmap" href="<?php echo $show->url ?>" title="<?php echo t('Direct Download') ?>"
  126. ><img src="<?php echo $show->thumb_url(100,0) ?>"></a>
  127. <a class="x-download"
  128. href="<?php echo video_url($show, true) ?>" title="<?php echo t('ASX Stream') ?>"
  129. ><img src="<?php echo skin_url ?>/img/play_sm.png"></a>
  130. <a class="x-download"
  131. href="<?php echo $show->url ?>" title="<?php echo t('Direct Download') ?>"
  132. ><img src="<?php echo skin_url ?>/img/video_sm.png"></a>
  133. </td>
  134. <td class="x-title"><?php echo '<a href="'.$show->url.'"'
  135. .($_SESSION['recorded_pixmaps'] ? '' : " name=\"$row\"")
  136. .'>'.$show->title.'</a>' ?></td>
  137. <td class="x-subtitle"><?php echo "<a href=\"$show->url\">"
  138. .$show->subtitle.'</a>' ?></td>
  139. <td class="x-programid"><?php echo $show->programid ?></td>
  140. <td class="x-channum"><?php echo $show->channel->channum, ' - ', $show->channel->name ?></td>
  141. <td class="x-airdate"><?php echo strftime($_SESSION['date_recorded'], $show->starttime) ?></td>
  142. <?php
  143. if ($recgroup_cols)
  144. echo " <td class=\"-recgroup\">$show->recgroup</td>\n";
  145. ?>
  146. <td class="x-length"><?php echo nice_length($show->length) ?></td>
  147. <td class="x-filesize"><?php echo nice_filesize($show->filesize) ?></td>
  148. <td class="x-commands" rowspan="2"><?php
  149. if ($show->endtime > time()) {
  150. echo '<a href="', root_url, 'tv/detail/', $show->chanid, '/', $show->starttime, '">',
  151. t('Still Recording: Edit'),
  152. "</a>\n ";
  153. }
  154. ?><a href="<?php echo root_url ?>tv/recorded?delete=yes&chanid=<?php echo $show->chanid ?>&starttime=<?php echo $show->recstartts ?>"
  155. title="<?php echo html_entities(t('Delete $1', preg_replace('/: $/', '', $show->title.': '.$show->subtitle))) ?>"
  156. ><?php echo t('Delete') ?></a>
  157. <a href="<?php echo root_url ?>tv/recorded?delete=yes&chanid=<?php echo $show->chanid ?>&starttime=<?php echo $show->recstartts ?>&forget_old=yes"
  158. title="<?php echo html_entities(t('Delete and rerecord $1', preg_replace('/: $/', '', $show->title.': '.$show->subtitle))) ?>"
  159. ><?php echo t('Delete + Rerecord') ?></a>
  160. </td>
  161. </tr><tr id="statusrow_<?php echo $row ?>" class="recorded">
  162. <td colspan="2" valign="top"><?php echo $show->description ?></td>
  163. <td colspan="<?php echo (false && $_SESSION['recorded_pixmaps'] ? 3 : 5) + $recgroup_cols ?>" class="x-progflags"><?php
  164. // Auto expire is not interactive in the lite template
  165. if ($show->auto_expire)
  166. echo '<img src="', skin_url, '/img/flags/autoexpire.png" title="', t('Auto Expire'), '">';
  167. // The rest of the flags are just for display
  168. if ($show->closecaptioned)
  169. echo '<img src="'.skin_url.'/img/flags/cc.png" title="'.t('Closed Captioning').'">';
  170. if ($show->stereo)
  171. echo '<img src="'.skin_url.'/img/flags/stereo.png" title="'.t('Stereo').'">';
  172. if ($show->hdtv)
  173. echo '<img src="'.skin_url.'/img/flags/hd.png" title="'.t('HD').'">';
  174. if ($show->has_commflag)
  175. echo '<img src="'.skin_url.'/img/flags/commflagged.png" title="'.t('Commercials Flagged').'">';
  176. if ($show->has_cutlist)
  177. echo '<img src="'.skin_url.'/img/flags/cutlist.png" title="'.t('Has Cutlist').'">';
  178. if ($show->bookmark)
  179. echo '<img src="'.skin_url.'/img/flags/bookmark.png" title="'.t('has Bookmark').'">';
  180. if ($show->is_watched)
  181. echo '<img src="'.skin_url.'/img/flags/watched.png" title="'.t('Watched').'">';
  182. ?></td>
  183. <?php if (false && $_SESSION['recorded_pixmaps']) { ?>
  184. <td colspan="2" class="x-download">
  185. <ul>
  186. <li><a href="<?php echo video_url($show, true) ?>">
  187. <img src="<?php echo skin_url ?>/img/play_sm.png"><?php echo t('ASX Stream') ?></a></li>
  188. <li><a href="<?php echo $show->url ?>">
  189. <img src="<?php echo skin_url ?>/img/video_sm.png"><?php echo t('Direct Download') ?></a></li>
  190. </ul>
  191. </td>
  192. <?php } ?>
  193. </tr><?php
  194. $prev_group = $cur_group;
  195. // Keep track of how many shows are visible in each section
  196. $row_count[$section]++;
  197. // Keep track of which shows are in which section
  198. $row_section[$row] = $section;
  199. // Increment row last
  200. $row++;
  201. }
  202. ?>
  203. </table>
  204. <?php
  205. echo '<p align="right" style="padding-right: 75px">'
  206. .t('$1 programs, using $2 ($3) out of $4 ($5 free).',
  207. '<span id="programcount">'.t($Total_Programs).'</span>',
  208. '<span id="diskused">'.nice_filesize($Total_Used).'</span>',
  209. '<span id="totaltime">'.nice_length($Total_Time).'</span>',
  210. '<span id="disksize">'.nice_filesize(disk_size).'</span>',
  211. '<span id="diskfree">'.nice_filesize(disk_size - disk_used).'</span>'
  212. )
  213. .'</p>';
  214. // Print the page footer
  215. require 'modules/_shared/tmpl/'.tmpl.'/footer.php';