getConfig(); $item['tpl'] = 'Slide/view.tpl'; $item['width'] = $this->dataObj->imageWidth; $item['height'] = $this->dataObj->imageHeight; $item['idItem'] = $this->getIdItem(); $listOptions = array('order' => array('Slide.sorter')); $limit = intval($this->getConfig('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['title'] = htmlspecialchars($slide['title']); 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'], 'cropCenter' ); if ($slide['type'] == App_Slide_View::HTML_TYPE) { Qs_Smarty_File::setTemplate('Slide/slide.tpl'); $slide['content'] = Qs_Smarty_File::render($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', '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; } }