[mythtv] Timeslot patch mythweb-0.11

John McEntee john at mcentee87.freeserve.co.uk
Fri Aug 22 21:52:14 EDT 2003


I am not a programmer, but I though the program listing page could be 
improved so I gave it a bash.

This patch makes it possible to merge the timeslots for the timeslot bar 
so I can have a resolution of 5 mins but only display every 15min on the 
time slot bar.

John



-------------- next part --------------
--- config/conf.php	2003-08-22 19:30:03.000000000 +0100
+++ config/conf.php	2003-08-22 19:42:06.000000000 +0100
@@ -49,13 +49,16 @@
	define('prefer_channum', true);
 
 // The number of time slots to display in the channel listing
-	define('num_time_slots', 12);
+	define('num_time_slots', 36);
 
 // the size of timeslots, in seconds (1800 = 30 minutes)
-	define('timeslot_size', 900);
+	define('timeslot_size', 300);
+
+// the number of time slots to merge together into one time stamp.
+	define('time_display', 3);
 
 // How many channels to skip between re-showing the timeslot bar
 	define('timeslotbar_skip', 15);
--- program_listing.php	2003-08-20 20:06:57.000000000 +0100
+++ program_listing.php	2003-08-22 19:41:14.000000000 +0100
@@ -22,7 +22,7 @@
 		$list_starttime = time();
 
 // Round *back* to the nearest timeslot size
-	$list_starttime -= $list_starttime % timeslot_size;
+	$list_starttime -= $list_starttime % (timeslot_size * time_display);
 
 // Setup the time slots
 	$list_endtime = $list_starttime;
@@ -32,6 +32,15 @@
 		$list_endtime += timeslot_size;	// skip to the next timeslot
 	}
 
+// Setup the time slots for header
+	$list_endtime = $list_starttime;
+	$Timeslots_head = array();
+	$j = 5;
+	for ($i = 0; $i < num_time_slots / time_display; $i++) {
+		$Timeslots_head[]  = $list_endtime;
+		$list_endtime += timeslot_size * time_display;	// skip to the next timeslot
+	}
+
 // Set a session variable so other sections know how to get back to this particular page
 	$_SESSION['list_time'] = $list_starttime;
 
@@ -51,7 +60,8 @@
 	$Page->print_header($list_starttime, $list_endtime);
 
 // Print the page content
-	$Page->print_timeslots($Timeslots, $list_starttime, $list_endtime, 'first');
+#	$Page->print_timeslots($Timeslots, $list_starttime, $list_endtime, 'first');
+	$Page->print_timeslots($Timeslots_head, $list_starttime, $list_endtime, 'first');
 
 // Go through each channel and load/print its info - use references to avoid "copy" overhead
 	$channel_count = 0;
@@ -69,7 +79,7 @@
 		unset($channel);
 	// Display the timeslot bar?
 		if ($channel_count % timeslotbar_skip == 0)
-			$Page->print_timeslots($Timeslots, $list_starttime, $list_endtime, $channel_count);
+			$Page->print_timeslots($Timeslots_head, $list_starttime, $list_endtime, $channel_count);
 	}
 
 // Display the listing page footer
--- themes/Default/program_listing.php	2003-08-22 19:14:00.000000000 +0100
+++ themes/Default/program_listing.php	2003-08-22 19:35:50.000000000 +0100
@@ -94,9 +94,9 @@
 #		$timeslot_anchor = 0;
 		$timeslot_anchor++;
 ?><tr>
-	<td class="menu" width="4%" align="right"><a href="program_listing.php?time=<?=$start_time - (timeslot_size * num_time_slots)?>#anchor<?=$timeslot_anchor?>" name="anchor<?=$timeslot_anchor?>"><img src="images/left.gif" border="0" alt="left"></a></td>
+	<td class="menu" width="4%" align="right"><a href="program_listing.php?time=<?=$start_time - (timeslot_size * num_time_slots * time_display)?>#anchor<?=$timeslot_anchor?>" name="anchor<?=$timeslot_anchor?>"><img src="images/left.gif" border="0" alt="left"></a></td>
 <?		foreach ($timeslots as $time) { ?>
-	<td class="menu" width="<?=(int)(96 / num_time_slots)?>%" align="center"><?=date('g:i', $time)?></td>
+	<td class="menu" colspan="<?=time_display?> width="<?=(int)(96 / (num_time_slots * time_display) )?>%" align="left"><?=date('g:i', $time)?></td>
 <?		} ?>
 	<td class="menu" width="2%"><a href="program_listing.php?time=<?=$start_time + (timeslot_size * num_time_slots)?>#anchor<?=$timeslot_anchor?>"><img src="images/right.gif" border="0" alt="right"></a></td>
 </tr><?


More information about the mythtv-dev mailing list