getConfig('type') == App_Newsletter_Form_Config::TYPE_DEFAULT) { $paramsCount = count($this->_restParams); $years = $this->_getDataObj()->getYears4Select(); if ($paramsCount == 0) { if (!empty($years)) { $url = BASE_URL_LANGUAGE . '/' . CURRENT_PAGE_FINAL . '/' . reset($years); $this->redirect($url); } } else if ($paramsCount == 1 && in_array($this->_restParams[0], $years)) { $this->_getDataObj()->setFilter('year', $this->_restParams[0]); } else { $this->_doc->display404(); } } return parent::exec(); } protected function _doList() { if ($this->getConfig('type') == App_Newsletter_Form_Config::TYPE_DEFAULT) { $this->_addTabsItem(); $this->_addFilterItem(); } $this->_addListItem(); $this->_postList(); return $this; } protected function _addTabsItem() { $item = array(); $item['tpl'] = $this->getTemplate('years-tabs.tpl'); $item['years'] = $this->_getDataObj()->getYears4Select(); $item['url'] = BASE_URL_LANGUAGE . '/' . CURRENT_PAGE_FINAL; $item['current'] = $this->_getDataObj()->getFilter('year'); $this->_addItem($item); return $this; } /** * @param Qs_ViewController_List $list * @return mixed */ protected function _getListItem($list = null) { if (null == $list) { $list = $this->_getList(); } if ($this->getConfig('type') == App_Newsletter_Form_Config::TYPE_SMALL) { $list->setIpp($this->getConfig('smallListIpp')); $list->setListTemplate('small-list.tpl'); } $item = parent::_getListItem($list); $item['currentYear'] = $this->_getDataObj()->getFilter('year'); if (!$item['currentYear']) { $item['currentYear'] = date('Y'); } $item['downloadLogUrl'] = $this->_getDataObj()->getLogUrl($item['currentYear']); return $item; } /** * @param Qs_ViewController_List $list * @return App_Newsletter_View|Qs_ViewController */ protected function _addListItem($list = null) { $this->_addLinksItem(); $item = $this->_getListItem($list); $this->_addItem($item); return $this; } public function getSideBlockItem(array $blockData = array()) { $item = $this->_getListItem(); if (!empty($item['list'])) { return $item; } return null; } protected function _getLog() { if (null === $this->_log) { parent::_getLog(); $this->_log->setAction('list', 'Viewed ' . $this->_getDataObj()->getFilter('year') . ' Newsletters list'); $this->_log->setAction('download', 'Downloaded %itemTitle%'); } return $this->_log; } protected function _doDownloadAjax() { $this->_log(); $this->_displayJson(array('success' => true)); } protected function _doDownload() { $this->_do404(); } }