public function processRequest() { $request = $this->getRequest(); $user = $request->getUser(); // TODO: These should be user-based and navigable in the interface. $year = idate('Y'); $month = idate('m'); $holidays = id(new PhabricatorCalendarHoliday())->loadAllWhere('day BETWEEN %s AND %s', "{$year}-{$month}-01", "{$year}-{$month}-31"); $statuses = id(new PhabricatorUserStatus())->loadAllWhere('dateTo >= %d AND dateFrom <= %d', strtotime("{$year}-{$month}-01"), strtotime("{$year}-{$month}-01 next month")); $month_view = new AphrontCalendarMonthView($month, $year); $month_view->setUser($user); $month_view->setHolidays($holidays); $phids = mpull($statuses, 'getUserPHID'); $handles = $this->loadViewerHandles($phids); foreach ($statuses as $status) { $event = new AphrontCalendarEventView(); $event->setEpochRange($status->getDateFrom(), $status->getDateTo()); $name_text = $handles[$status->getUserPHID()]->getName(); $status_text = $status->getTextStatus(); $event->setUserPHID($status->getUserPHID()); $event->setName("{$name_text} ({$status_text})"); $event->setDescription($status->getStatusDescription($user)); $month_view->addEvent($event); } return $this->buildStandardPageResponse(array('<div style="padding: 2em;">', $month_view, '</div>'), array('title' => 'Calendar')); }