global $locale_char_set; // retrieve any state parameters if (isset($_REQUEST['company_id'])) { $AppUI->setState('CalIdxCompany', (int) w2PgetParam($_REQUEST, 'company_id', 0)); } $company_id = $AppUI->getState('CalIdxCompany') !== null ? $AppUI->getState('CalIdxCompany') : $AppUI->user_company; // Using simplified set/get semantics. Doesn't need as much code in the module. $event_filter = $AppUI->checkPrefState('CalIdxFilter', w2PgetParam($_REQUEST, 'event_filter', 'my'), 'EVENTFILTER', 'my'); // get the passed timestamp (today if none) $date = w2PgetParam($_GET, 'date', null); $today = new w2p_Utilities_Date(); $today->convertTZ($AppUI->getPref('TIMEZONE')); $today = $today->format(FMT_TIMESTAMP_DATE); // establish the focus 'date' $this_week = new w2p_Utilities_Date($date); $dd = $this_week->getDay(); $mm = $this_week->getMonth(); $yy = $this_week->getYear(); // prepare time period for 'events' $first_time = new w2p_Utilities_Date(Date_Calc::beginOfWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY)); $first_time->setTime(0, 0, 0); $last_time = new w2p_Utilities_Date(Date_Calc::endOfWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY)); $last_time->setTime(23, 59, 59); $prev_week = new w2p_Utilities_Date(Date_Calc::beginOfPrevWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY)); $next_week = new w2p_Utilities_Date(Date_Calc::beginOfNextWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY)); $links = array(); // assemble the links for the tasks $links = getTaskLinks($first_time, $last_time, $links, 50, $company_id); // assemble the links for the events $links += getEventLinks($first_time, $last_time, $links, 50); $hooks = new w2p_System_HookHandler($AppUI);
$AppUI->redirect('m=public&a=access_denied'); } global $tab, $locale_char_set, $date; $AppUI->savePlace(); $company_id = $AppUI->processIntState('CalIdxCompany', $_REQUEST, 'company_id', $AppUI->user_company); $event_filter = $AppUI->checkPrefState('CalIdxFilter', w2PgetParam($_REQUEST, 'event_filter', ''), 'EVENTFILTER', 'my'); $tab = $AppUI->processIntState('CalDayViewTab', $_GET, 'tab', isset($tab) ? $tab : 0); // get the prefered date format $df = $AppUI->getPref('SHDATEFORMAT'); // get the passed timestamp (today if none) $ctoday = new w2p_Utilities_Date(); $today = $ctoday->format(FMT_TIMESTAMP_DATE); $date = w2PgetParam($_GET, 'date', $today); // establish the focus 'date' $this_day = new w2p_Utilities_Date($date); $dd = $this_day->getDay(); $mm = $this_day->getMonth(); $yy = $this_day->getYear(); // get current week $this_week = Date_calc::beginOfWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY); // prepare time period for 'events' $first_time = clone $this_day; $first_time->setTime(0, 0, 0); $last_time = clone $this_day; $last_time->setTime(23, 59, 59); $prev_day = new w2p_Utilities_Date(Date_calc::prevDay($dd, $mm, $yy, FMT_TIMESTAMP_DATE)); $next_day = new w2p_Utilities_Date(Date_calc::nextDay($dd, $mm, $yy, FMT_TIMESTAMP_DATE)); // get the list of visible companies $company = new CCompany(); global $companies; $companies = $company->getAllowedRecords($AppUI->user_id, 'company_id,company_name', 'company_name');
/** * Tests getDay with invalid day, this *should* break */ public function testGetDayInvalidDay() { $date = new w2p_Utilities_Date('2010-11-34 11:00:00'); $this->assertEquals(34, $date->getDay()); }