Changeset - 933c98416373
[Not reviewed]
default
0 2 0
Nathan Brink (binki) - 15 years ago 2011-03-29 21:47:40
ohnobinki@ohnopublishing.net
Support very early morning and late night classes much better. Fixes bug 101.
2 files changed with 12 insertions and 5 deletions:
0 comments (0 inline, 0 general)
inc/class.schedule.php
Show inline comments
 
@@ -388,18 +388,22 @@ class Schedule
 
		      $have_saturday = TRUE;
 
		    }
 

	
 
		  /* very late / very early classes */
 
		  while ($meeting->getEndTime() > $max_time)
 
		    {
 
		      $max_time += 30;
 
		      $max_time = sprintf("%04d", $max_time + 30);
 
		      while (substr($max_time, -2) >= 60)
 
			$max_time = sprintf("%02d%02d", substr($max_time, 0, 2) + 1, substr($max_time, -2) - 60);
 
		      $time[] = $max_time;
 
		    }
 
		  while ($meeting->getStartTime() < $min_time)
 
		    {
 
		      $min_time -= 30;
 
		      if (substr($min_time, -2) < 30)
 
			$min_time = sprintf("%02d%02d", substr($min_time, 0, 2) - 1, substr($min_time, -2) + 60);
 
		      $min_time = sprintf("%04d", $min_time - 30);
 
		      $time[] = $min_time;
 
		      $sort_time = TRUE;
 
		    }
 
		}
 
	  }
 
	/* ensure that early times are actually first ;-) */
scripts/scheduleInput.js
Show inline comments
 
@@ -130,13 +130,15 @@ function add_section_n(cnum, name, synon
 
	genOptionHtml("2000", "8:00 pm", stime) + genOptionHtml("2030", "8:30 pm", stime) +
 
	genOptionHtml("2100", "9:00 pm", stime);
 

	
 
    if (stime.length > 0)
 
    {
 
	var stime_end = stime.substr(2);
 
	if (stime_end != '00' && stime_end != '30')
 
	var stime_begin = stime.substr(0, 2);
 
	if (stime_end != '00' && stime_end != '30'
 
	   || stime_begin < 7 || stime_begin > 21)
 
	    section_html = section_html + genOptionHtml(stime, prettyTime(stime), stime);
 
    }
 

	
 
    section_html = section_html + '</select></td>\
 
<td><select class="selectRequired" name="postData[' + cnum + '][' + snum + '][end]"><option value="none"></option>' +
 
	genOptionHtml("0720", "7:20 am", etime) + genOptionHtml("0750", "7:50 am", etime) +
 
@@ -155,13 +157,15 @@ function add_section_n(cnum, name, synon
 
	genOptionHtml("2020", "8:20 pm", etime) + genOptionHtml("2050", "8:50 pm", etime) +
 
	genOptionHtml("2120", "9:20 pm", etime);
 

	
 
    if (etime.length > 0)
 
    {
 
	var etime_end = etime.substr(2);
 
	if (etime_end != '50' && etime_end != '20')
 
	var etime_begin = etime.substr(0, 2);
 
	if (etime_end != '50' && etime_end != '20'
 
	   || etime_begin < 7 || etime_begin > 21)
 
	    section_html = section_html + genOptionHtml(etime, prettyTime(etime), etime);
 
    }
 

	
 
    section_html = section_html + '</select></td>\
 
<td class="cbrow"><input type="checkbox" class="daysRequired" name="postData[' + cnum + '][' + snum + '][days][0]" value="1" ' + (days.m ? 'checked="checked"' : '') + ' /></td>\
 
<td class="cbrow"><input type="checkbox" class="daysRequired" name="postData[' + cnum + '][' + snum + '][days][1]" value="1" ' + (days.t ? 'checked="checked"' : '') + ' /></td>\
 
@@ -171,13 +175,12 @@ function add_section_n(cnum, name, synon
 
<td class="cbrow"><input type="checkbox" class="daysRequired" name="postData[' + cnum + '][' + snum + '][days][5]" value="1" ' + (days.s ? 'checked="checked"' : '') + ' /></td>' +
 
	'<td class="removeCell"><div class="deleteSection"><input type="button" value="x" class="gray" /></div></td><td class="emptyCell">' +
 
	'<input class="section-location-entry" type="hidden" name="postData[' + cnum + '][' + snum + '][location]" />' +
 
	'<input class="section-type-entry" type="hidden" name="postData[' + cnum + '][' + snum + '][type]" />' +
 
	'</td></tr>';
 

	
 

	
 
    jQuery('.pclass' + cnum).after(section_html);
 
    sectionsOfClass[cnum] ++;
 

	
 
    var section_tr = jQuery('.pclass' + cnum).next();
 
    /* store course_i in a place the newly added section will look for it */
 
    section_tr.data({course_i: cnum});
0 comments (0 inline, 0 general)