CGCalendar Sort Upcoming List SOLVED
Posted: Fri Jan 24, 2014 1:42 pm
I have used this technique successfully many times before but in this case is it not working and I cannot see why? I am trying to sort the array in my upcoming list in the CGCalendar module. I am using the following UDT:
So this should sort the foreach loop so that the event titles are in order. It does not work though. Could it because there is something special about the array?
Anyone have any ideas?
Code: Select all
if (!function_exists('do_sort')) {
function do_sort($a, $b) {
return $a->event_title > $b->event_title;
}
}
$data = $params['data'];
usort($data, 'do_sort');
$smarty->assign('sorted', $data);
Code: Select all
Array (
[event_id] => 750
[event_title] => Dirty Habit
[event_summary] =>
[event_details] =>
[event_date_start] => 2014-02-22 20:00:00
[event_date_end] =>
[event_parent_id] => 731
[event_recur_period] =>
[event_date_recur_end] =>
[event_created_by] => -106
[event_create_date] => 2014-01-24 10:49:00 [event_modified_date] => 2014-01-24 10:49:00 [event_recur_nevents] => [event_recur_interval] => [event_recur_weekdays] => [event_recur_monthdays] => [event_allows_overlap] => 1
)