'image', 'effect' => 'fade', 'interval' => 5, 'effectDuration' => 500, 'enableButtons' => 'n', 'autoHideToolbar' => 'n', 'showArrows' => 'n', 'autostart' => 'y', 'enablePaginator' => 'n', 'limit' => '', 'paginatorOptions' => array( 'pageLinks' => '', 'linkWidth' => '', 'template' => '', ), ); $this->slideType = $this->getConfig('slideType'); $this->slideType = (empty($this->slideType)) ? 'image' : $this->slideType; $config = $this->getConfig(); $config = (empty($config)) ? $defConfig : $config; $item = $scriptOptions = $config; $this->dataObj->slideType = $this->slideType; $item['tpl'] = 'Slide/view.tpl'; if ($this->slideType == 'html') { $item['width'] = $this->dataObj->imageWidth; $item['height'] = $this->dataObj->imageHeight; } else { $item['width'] = $this->dataObj->smallImageWidth; $item['height'] = $this->dataObj->smallImageHeight; } $item['idItem'] = $this->getIdItem(); $listOptions = array('order' => array('Slide.sorter')); $limit = intval($config['limit']); if ($limit) { $listOptions['limit'] = $limit; } $list = $this->dataObj->getList($listOptions); if (empty($list)) { return false; } if (is_array($list) && !empty($list)) { foreach ($list as &$slide) { $slide['hotSpotMap'] = 'empty'; $slide['title'] = htmlspecialchars($slide['title']); $slide['idItem'] = $this->getIdItem(); if ($slide['backgroundImage']) { $slide['backgroundImage'] = Qs_ImageFs::get( $slide['backgroundImage'], $item['width'], $item['height'] ); } $slide['image'] = Qs_ImageFs::get( $slide['image'], $item['width'], $item['height'] ); if ($slide['type'] == App_Slide_View::HTML_TYPE) { Qs_Smarty_File::setTemplate('Slide/slide.tpl'); $slide['content'] = Qs_Smarty_File::render($slide); //vdie($slide); } } unset($slide); } $item['slides'] = $list; foreach ($scriptOptions as $field => &$value) { if (in_array($value, array('y', 'n'))) { $value = ('y' == $value); } } if ($scriptOptions['enablePaginator']) { $this->doc->addStylesheet('css/yui-build/paginator.css'); $this->doc->addScript('js/lib/yui-build/paginator.js'); } $scriptOptions['idItem'] = $item['idItem']; $scriptOptions['slides'] = $item['slides']; $scriptOptions['debug'] = Qs_Constant::get('DEBUG'); $scriptOptions['width'] = $item['width']; $scriptOptions['height'] = $item['height']; $this->_addItem($item); $this->doc->addStylesheet('css/slide.css') ->addScript('js/app/slide.js') ->addInitFunction('App_Slide.prototype.init', array($scriptOptions)); return $this; } public function fillConfigForm($form) { $form->addElement( 'select', 'slideType', array( 'label' => 'Slide Type', 'multiOptions' => array('html' => 'Home Page', 'image' => 'Other Pages'), ) ); $form->addElement( 'select', 'effect', array( 'label' => 'Effect', 'multiOptions' => $this->dataObj->getDSlideEffect4Select() ) ); $form->addElement( 'text', 'interval', array('label' => 'Interval', 'required' => true, 'class' => 'digit', 'size' => 5) ); $form->interval->getDecorator('ViewHelper')->setAdditionalHtmlAfterElement(' seconds'); $form->interval->addValidator('Int', true); $checkboxDecorators = array( 'ViewHelper', 'Errors', array('decorator' => 'Label', 'options' => array('placement' => 'APPEND')), 'DtDdWrapper' ); $form->addElement( 'text', 'effectDuration', array('label' => 'Effect Duration', 'required' => true, 'class' => 'digit', 'size' => 5) ); $form->effectDuration->getDecorator('ViewHelper')->setAdditionalHtmlAfterElement(' miliseconds'); $form->effectDuration->addValidator('Int', true); $form->addElement( 'checkbox', 'enableButtons', array('label' => 'Show Player Buttons', 'checkedValue' => 'y', 'uncheckedValue' => 'n', 'decorators' => $checkboxDecorators) ); $form->addElement( 'checkbox', 'autoHideToolbar', array('label' => 'Auto Hide Toolbar', 'checkedValue' => 'y', 'uncheckedValue' => 'n', 'decorators' => $checkboxDecorators) ); $form->addElement( 'checkbox', 'showArrows', array('label' => 'Show Arrows', 'checkedValue' => 'y', 'uncheckedValue' => 'n', 'decorators' => $checkboxDecorators) ); $form->addElement( 'checkbox', 'autostart', array('label' => 'Autostart', 'checkedValue' => 'y', 'uncheckedValue' => 'n', 'decorators' => $checkboxDecorators) ); $form->addElement( 'checkbox', 'enablePaginator', array( 'label' => 'Show Paginator', 'checkedValue' => 'y', 'uncheckedValue' => 'n', 'decorators' => $checkboxDecorators ) ); $form->addElement('text', 'limit', array('label' => 'Limit Slides', 'class' => 'digit', 'size' => 5)); $form->limit->getDecorator('ViewHelper') ->setAdditionalHtmlAfterElement(' (leave blank to have no limits)'); $paginatorOptions = new Qs_Form_SubForm(array('legend' => 'Paginator Options')); $paginatorOptions->addElement( 'text', 'pageLinks', array('label' => 'Links Count', 'required' => false, 'class' => 'digit', 'size' => 5) ); $paginatorOptions->pageLinks->getDecorator('ViewHelper') ->setAdditionalHtmlAfterElement(' (leave blank to calculate automatically)'); $paginatorOptions->pageLinks->addValidator('Int', true); $paginatorOptions->addElement( 'text', 'linkWidth', array('label' => 'Link Width', 'class' => 'digit', 'size' => 5) ); $paginatorOptions->linkWidth->getDecorator('ViewHelper')->setAdditionalHtmlAfterElement(' px'); $paginatorOptions->linkWidth->addValidator('Int', true); $paginatorOptions->addElement( 'text', 'template', array( 'label' => 'Template', 'description' => 'Constants: {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}' ) ); $form->addSubForm($paginatorOptions, 'paginatorOptions'); return $this; } protected function _addItem($item) { $item['templatePath'] = $this->_getTemplatePath(); if ($this->slideType == 'image') { $this->doc->addItem($item, 'TOP_ITEMS'); } else { $this->doc->addItem($item); } return $this; } }