$seconds_to_add_in_next_month = 86400 * $day_of_next_month; // need to cast it to int because Pear::Date_Span::set down the line // fails to set the seconds correctly $first_day_of_next_month->addSeconds((int) $seconds_to_add_in_next_month); $last_time->setDay($first_day_of_next_month->getDay()); $last_time->setMonth($first_day_of_next_month->getMonth()); $last_time->setYear($first_day_of_next_month->getYear()); } $links = array(); // assemble the links for the tasks require_once W2P_BASE_DIR . '/modules/planner/links_tasks.php'; getTaskLinks($first_time, $last_time, $links, 20, $company_id); // assemble the links for the events require_once W2P_BASE_DIR . '/modules/planner/links_events.php'; getEventLinks($first_time, $last_time, $links, 20); $hooks = new w2p_Core_HookHandler($AppUI); $hooks->links = $links; $links = $hooks->calendar_links(); // create the main calendar $cal = new w2p_Output_MonthCalendar($date); $cal->setStyles('motitle', 'mocal'); $cal->setLinkFunctions('clickDay', 'clickWeek'); $cal->setEvents($links); echo $cal->show(); //echo '<pre>';print_r($cal);echo '</pre>'; // create the mini previous and next month calendars under $minical = new w2p_Output_MonthCalendar($cal->prev_month); $minical->setStyles('minititle', 'minical'); $minical->showArrows = false; $minical->showWeek = false; $minical->clickMonth = true;
require_once W2P_BASE_DIR . '/includes/db_adodb.php'; $AppUI = new w2p_Core_CAppUI(); $token = w2PgetParam($_GET, 'token', ''); $token = preg_replace("/[^A-Za-z0-9]/", "", $token); $format = w2PgetParam($_GET, 'format', 'ical'); $userId = CUser::getUserIdByToken($token); $AppUI->loadPrefs($userId); $AppUI->user_id = $userId; $AppUI->setUserLocale(); @(include_once W2P_BASE_DIR . '/locales/' . $AppUI->user_locale . '/locales.php'); include_once W2P_BASE_DIR . '/locales/core.php'; $defaultTZ = w2PgetConfig('system_timezone', 'Europe/London'); $defaultTZ = '' == $defaultTZ ? 'Europe/London' : $defaultTZ; date_default_timezone_set($defaultTZ); switch ($format) { //TODO: We only output in vCal, are there others we need to consider? case 'vcal': default: $format = 'vcal'; header('Content-Type: text/calendar'); header('Content-disposition: attachment; filename="calendar.ics"'); break; } if ($userId > 0) { $myTimezoneName = date('e'); $calendarHeader = "BEGIN:VCALENDAR\nPRODID:-//web2project//EN\nVERSION:2.0\nCALSCALE:GREGORIAN\nMETHOD:PUBLISH\nX-WR-TIMEZONE:Europe/London\n"; $calendarFooter = "END:VCALENDAR"; $hooks = new w2p_Core_HookHandler($AppUI); $buffer = $hooks->calendar(); echo $calendarHeader . $buffer . $calendarFooter; }