// End of month to be shown $calSc->ecalClass =& $ecal_class; $calSc->setCalDate($dateArray); $calSc->catFilter = $cat_filter; //setScVar('event_calendar_shortcodes', 'ecalClass', &$ecal_class); // Give shortcodes a pointer to calendar class //callScFunc('event_calendar_shortcodes','setCalDate', $dateArray); // Tell shortcodes the date to display //setScVar('event_calendar_shortcodes', 'catFilter', $cat_filter); // Category filter //------------------------------------------------- // Start calculating text to display //------------------------------------------------- // time switch buttons $cal_text = $e107->tp->parseTemplate($CALENDAR_TIME_TABLE, FALSE, $calSc); // navigation buttons $nav_text = $e107->tp->parseTemplate($CALENDAR_NAVIGATION_TABLE, FALSE, $calSc); // We'll need virtually all of the event-related fields, so get them regardless. Just cut back on category fields $ev_list = $ecal_class->get_events($monthstart, $monthend, FALSE, $cat_filter, TRUE, '*', 'event_cat_name,event_cat_icon'); // We create an array $events[] which has a 'primary' index of each day of the current month - 1..31 potentially // For each day there is then a sub-array entry for each event // Note that the new class-based retrieval adds an 'is_recent' flag to the data if changed according to the configured criteria $events = array(); foreach ($ev_list as $row) { $row['startofevent'] = TRUE; // This sets 'large print' and so on for the first day of an event // check for recurring events in this month (could also use is_array($row['event_start']) as a test) if ($row['event_recurring'] != '0') { // There could be several dates for the same event, if its a daily/weekly event $t_start = $row['event_start']; foreach ($t_start as $ev_start) { // Need to save event, copy marker for date $row['event_start'] = $ev_start; $events[date('j', $ev_start)][] = $row;
$cal_current_year = $cal_datearray['year']; $numberdays = date("t", $ecal_class->cal_timedate); // number of days in this month $cal_monthstart = gmmktime(0, 0, 0, $cal_current_month, 1, $cal_current_year); // Time stamp for first day of month $cal_firstdayarray = getdate($cal_monthstart); $cal_monthend = gmmktime(0, 0, 0, $cal_current_month + 1, 1, $cal_current_year) - 1; // Time stamp for last day of month //$cal_thismonth = $cal_datearray['mon']; $cal_thisday = $cal_datearray['mday']; // Today $cal_events = array(); $cal_titles = array(); $cal_recent = array(); $cal_totev = 0; $ev_list = $ecal_class->get_events($cal_monthstart, $cal_monthend, TRUE, $cat_filter, $show_recurring, 'event_start, event_thread, event_title, event_recurring, event_allday', 'event_cat_icon'); $cal_totev = count($ev_list); // Generate an array, one element per day of the month, and assign events to them foreach ($ev_list as $cal_row) { if (is_array($cal_row['event_start'])) { $temp = $cal_row['event_start']; } else { $temp = array($cal_row['event_start']); } foreach ($temp as $ts) { // Split up any recurring events $cal_start_day = date('j', $ts); // Day of month for start // Mark start day of each event $cal_events[$cal_start_day][] = $cal_row['event_cat_icon']; // Only first is actually used
if ($sql->db_Select_gen($cal_qry)) { while ($thiscat = $sql->db_Fetch()) { $temp[] = $thiscat['event_cat_id']; $ec_category_list[] = $thiscat['event_cat_name']; } $cat_filter = implode(',', $temp); // Gives us a comma separated numeric set of categories } else { echo EC_LAN_100 . "<br /><br />"; exit; } } // $ec_start_date - earliest date of period // $ec_end_date - latest date of period // We'll potentially need virtually all of the event-related fields, so get them regardless. Just cut back on category fields $ev_list = $ecal_class->get_events($ec_start_date, $ec_end_date, FALSE, $cat_filter, TRUE, '*', 'event_cat_name,event_cat_icon'); // Now go through and multiply up any recurring records $tim_arr = array(); foreach ($ev_list as $k => $event) { if (is_array($event['event_start'])) { foreach ($event['event_start'] as $t) { $tim_arr[$t] = $k; } } else { $tim_arr[$event['event_start']] = $k; } } ksort($tim_arr); // Sort into time order if (isset($ec_qs[3])) { $ec_pdf_template = $ec_qs[3];