Moderators: jmacgreg, michael, John
// Sorts by start_time of event, then by room_id
// For this to work, room_id must be added to the two places that
// the $event array is created.
// Unlike sortEvents, which this replaces, this ignores end_time (all
// of our time slots are the same)
function sortEventsThenRooms($a, $b)
{
foreach(array('start_time','room_id') as $value ) {
if ($value=="start_time") {
// compare start times
$start_a = strtotime("$a[$value]");
$start_b = strtotime("$b[$value]");
if($start_a != $start_b) { return ($start_a > $start_b) ? 1 : -1; }
}
else if ($value=="room_id") {
if ($a[$value] != $b[$value]) { return $a[$value] > $b[$value] ? 1: -1; }
}
}
return 0;
}Return to OCS Technical Support
Users browsing this forum: Exabot [Bot] and 3 guests