isSideBlock()) { $this->_showSideBlock(); return $this; } $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() { $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; } /** * @return mixed */ protected function _getListItem() { $item = parent::_getListItem(); if (($year = $this->getRestParam(0))) { $this->_doc->appendTitle($year); } return $item; } protected function _getListOptions() { $options = parent::_getListOptions(); $options['downloadLogUrl'] = $this->getConfig('downloadLogUrl'); return $options; } protected function _showSideBlock() { if ('y' !== Qs_SiteMap::findFirst(null, array('type' => 'Newsletter_'), array('type' => 'default'), 'enabled')) { return $this; } $this->_getList()->setLimit($this->getConfig('sideBlockItemsLimit', 3)); $this->_getList()->setListTemplate('sideBlock.tpl'); $item = $this->_getListItem(); if (empty($item['list'])) { return $this; } $this->_addItem($item); return $this; } 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(); } }