_initApplication(); return parent::exec(); } protected function _initApplication() { switch ($this->getConfig('type')) { case App_Partner_Form_Config::TYPE_BOTTOM: $this->_listTemplate = 'bottom-slider.tpl'; // swiper $this->_doc->addStyleSheet('css/thirdpart/swiper.css'); $this->_doc->addScript('js/swiper.js'); $this->_doc->addScript('js/app/partner/view.js'); $this->_doc->addInitObject('app.Partner.View'); break; case App_Partner_Form_Config::TYPE_SIDE_BANNER: $this->_listTemplate = 'side-banner.tpl'; break; default: $this->_listTemplate = 'list.tpl'; break; } return $this; } protected function _getListOptions() { $options = parent::_getListOptions(); $options['listTemplate'] = $this->_listTemplate; $options['viewAlias'] = $this->_getViewAlias(); return $options; } protected function _getViewPage($field = null, $default = null) { $page = Qs_SiteMap::findFirst(null, array('type' => 'Partner_'), array('type' => 'default')); return Qs_Array::get($page, $field, $default); } protected function _getViewAlias() { if (null == $this->_viewAlias) { $this->_viewAlias = $this->_getViewPage('fullAlias'); } return $this->_viewAlias; } public function getSideBlockItem(array $blockData = array()) { if (App_Partner_Form_Config::TYPE_SIDE_BANNER != $this->getConfig('type')) { return null; } $this->_initApplication(); $banner = $this->_getDataObj()->getRandomBanner(); if ($banner) { $item['tpl'] = $this->getTemplate($this->_listTemplate); $item['banner'] = $banner; return $item; } return null; } }