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);
 }
 public function authorListAction()
 {
     $result = array('success' => false);
     $siteId = (int) $this->params()->fromQuery('siteId', $this->services->getUtilityService()->getSiteId());
     $page = (int) $this->params()->fromQuery('page', 1);
     $perPage = (int) $this->params()->fromQuery('perPage', 10);
     $orderBy = $this->params()->fromQuery('orderBy', AuthorSummaryConsts::PAGES);
     $order = $this->params()->fromQuery('ascending', false);
     if ($order) {
         $order = Order::ASCENDING;
     } else {
         $order = Order::DESCENDING;
     }
     $table = $this->getAuthorsTable($siteId, $orderBy, $order, $page, $perPage);
     $renderer = $this->getServiceLocator()->get('ViewHelperManager')->get('partial');
     if ($renderer) {
         $result['success'] = true;
         $result['content'] = $renderer('partial/tables/table.phtml', array('table' => $table));
     }
     return new JsonModel($result);
 }
 public function generateConstsAction()
 {
     $this->services->getUtilityService()->generateDbConstants();
     return $this->redirect()->toRoute('home');
 }