public function indexAction() { $siteId = $this->services->getUtilityService()->getSiteId(); $site = $this->services->getSiteService()->find($siteId); $result = array('site' => $site); return new ViewModel($result); }
public function usersAction() { $siteId = $this->services->getUtilityService()->getSiteId(); $site = $this->services->getSiteService()->find($siteId); $users = $this->getUsersTable($siteId, DbViewMembership::TABLE . '_' . DbViewMembership::JOINDATE, Order::DESCENDING, 1, 10); $authors = $this->getAuthorsTable($siteId, AuthorSummaryConsts::PAGES, Order::DESCENDING, 1, 10); $result = array('site' => $site, 'usersTable' => $users, 'authorsTable' => $authors); return new ViewModel($result); }
public function changesAction() { $siteId = $this->services->getUtilityService()->getSiteId(); $site = $this->services->getSiteService()->find($siteId); $fromControl = $this->dateIntervalForm->get(DateIntervalForm::FROM_DATE_NAME); $toControl = $this->dateIntervalForm->get(DateIntervalForm::TO_DATE_NAME); $lastDate = $site->getLastUpdate(); $lastDate->setTime(23, 59, 59); $fromControl->setAttribute('max', $lastDate->format('Y-m-d')); $toControl->setAttribute('max', $lastDate->format('Y-m-d')); $from = clone $lastDate; $from->sub(new \DateInterval('P1M')); $to = $lastDate; $fromControl->setValue($from->format('Y-m-d')); $toControl->setValue($to->format('Y-m-d')); $request = $this->getRequest(); if ($request->isPost()) { $this->dateIntervalForm->setData($request->getPost()); if ($this->dateIntervalForm->isValid()) { $from = \DateTime::createFromFormat('Y-m-d', $fromControl->getValue()); $to = \DateTime::createFromFormat('Y-m-d', $toControl->getValue()); } } $from->setTime(0, 0, 0); $to->setTime(23, 59, 59); $result = array('intervalForm' => $this->dateIntervalForm, 'site' => $site, 'members' => $this->getMembersData($siteId, $from, $to), 'pages' => $this->getPagesData($siteId, $from, $to), 'revisions' => $this->getRevisionsData($siteId, $from, $to), 'votes' => $this->getVotesData($siteId, $from, $to)); return new ViewModel($result); }