} $company_id = $AppUI->getState('CalIdxCompany') !== null ? $AppUI->getState('CalIdxCompany') : $AppUI->user_company; $event_filter = $AppUI->checkPrefState('CalIdxFilter', w2PgetParam($_REQUEST, 'event_filter', ''), 'EVENTFILTER', 'my'); // get the passed timestamp (today if none) $date = w2PgetParam($_GET, 'date', null); // establish the focus 'date' $this_week = new CDate($date); $dd = $this_week->getDay(); $mm = $this_week->getMonth(); $yy = $this_week->getYear(); // prepare time period for 'events' $first_time = new CDate(Date_calc::beginOfWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY)); $first_time->setTime(0, 0, 0); $last_time = new CDate(Date_calc::endOfWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY)); $last_time->setTime(23, 59, 59); $prev_week = new CDate(Date_calc::beginOfPrevWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY)); $next_week = new CDate(Date_calc::beginOfNextWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY)); $links = array(); // assemble the links for the tasks require_once W2P_BASE_DIR . '/modules/calendar/links_tasks.php'; getTaskLinks($first_time, $last_time, $links, 50, $company_id); // assemble the links for the events require_once W2P_BASE_DIR . '/modules/calendar/links_events.php'; getEventLinks($first_time, $last_time, $links, 50); // get the list of visible companies $company = new CCompany(); $companies = $company->getAllowedRecords($AppUI->user_id, 'company_id,company_name', 'company_name'); $companies = arrayMerge(array('0' => $AppUI->_('All')), $companies); // setup the title block $titleBlock = new CTitleBlock('Week View', 'myevo-appointments.png', $m, "{$m}.{$a}"); $titleBlock->addCrumb('?m=calendar&date=' . $this_week->format(FMT_TIMESTAMP_DATE), 'month view');