_itemConfig = $options['config']; } parent::__construct($options); } /** * @return array */ protected function _getSliderOptions() { $cfg = $this->_itemConfig; unset($cfg['id']); $this->_prepareSliderOptions($cfg); $options = array( 'containerId' => 'wideSlide-' . $this->getIdItem(), 'slider' => array( 'loop' => $cfg['cycle'], 'autoPlay' => array( 'enabled' => $cfg['autoPlay'], 'delay' => $cfg['autoPlayDelay'], 'pauseOnHover' => $cfg['pauseOnHover'], 'stopAtAction' => $cfg['stopAtAction'], ), ), ); return $options; } /** * @param array $options * @return View */ protected function _prepareSliderOptions(array &$options) { foreach ($options as &$value) { if (is_array($value)) { $this->_prepareSliderOptions($value); } else { switch ($value) { case 'true': $value = true; break; case 'false': $value = false; break; default: if (is_numeric($value)) { if (preg_match('/^[0-9]+$/', $value)) { $value = (int) $value; } else { $value = (float) $value; } } break; } } } return $this; } protected function _doList() { $currentPage = \Qs_SiteMap::getPage(CURRENT_PAGE); $this->_getDataObj()->setFilter('pageId', $currentPage['id']); $item = $this->_getListItem(); if ($item['list']) { $item['listCount'] = count($item['list']); $this->_doc->addStyleSheet('css/thirdpart/royalslider.css'); $this->_doc->addStyleSheet('css/thirdpart/royalslider-default.css'); $this->_doc->addScript('js/royalslider/jquery.royalslider.js'); $this->_doc->addScript('js/royalslider/jquery.rs.bullets.js'); $this->_doc->addScript('js/royalslider/jquery.rs.animated-blocks.js'); $this->_doc->addScript('js/royalslider/jquery.rs.autoplay.js'); $this->_doc->addStyleSheet('css/modules/wideSlide.css'); $this->_doc->addScript('js/app/wideSlide/slide.js'); $options = $this->_getSliderOptions(); if (\App\WideSlide\AbstractObj::HOME_PAGE_ID != $currentPage['id']) { $options['slider']['imgWidth'] = $this->getConfig('imageAdditionalPages') ->get('width', \Qs_Config::APP_TYPE); $options['slider']['imgHeight'] = $this->getConfig('imageAdditionalPages') ->get('height', \Qs_Config::APP_TYPE); $item['pageTitle'] = $currentPage['menuTitle']; $item['tpl'] = $this->getTemplate('additional-list.tpl'); } $this->_doc->addInitObject('app.wideSlide.Slide', array($options), 'wideSlide' . $this->getIdItem()); $item['containerId'] = $options['containerId']; $this->_addItem($item); } $this->_postList(); return $this; } }