'image', 'linkType' => 'none', 'show' => 'y', ); public function setSlideType($type) { $this->dataObj->setType($type); return $this; } protected function _bindListColumns($list) { $list->addColumn('no', 'no', array('orderBy' => 'sorter')) ->addColumn( 'text', 'typeTitle', array('title' => 'Type', 'orderBy' => 'type', 'attribs' => array('width' => 100, 'align' => 'center')) ) ->addColumn('text', 'title', array('title' => 'Reference Name', 'orderBy' => 'title')) ->addColumn( 'image', 'image', array( 'title' => 'Slide/Background Image', 'attribs' => array('width' => 250), 'imageAttribs' => array('width' => 190, 'height' => 90), ) ) ->addColumn( 'link_enum', 'show', array( 'title' => 'Show', 'orderBy' => 'show', 'attribs' => array('width' => 60), 'values' => array('y' => 'Yes', 'n' => 'No'), ) ) ->addColumn('options', 'options'); return $this; } protected function _bindFormFields($form) { $form->addElement('text', 'title', array('label' => 'Reference Name', 'required' => true)); $type = $this->_getData('type', $this->getFormDefaults('type')); $form->addElement( 'select', 'type', array( 'label' => 'Type', 'multiOptions' => $this->dataObj->getDSlideType4Select(), 'required' => true, 'value' => $type, 'separator' => ' ', 'onchange' => "$('dl:first', this.form).attr('class', this.value);", ) ); $form->addElement( 'htmlEditor', 'html', array( 'label' => 'HTML Content', 'toolbarSet' => 'Basic', 'required' => (in_array($this->_action, array('new', 'edit')) || 'html' == $type) ) ); $form->addElement( 'extendedImage', 'image', array('label' => 'Slide Image', 'required' => (in_array($this->_action, array('new', 'edit')) || 'image' == $type), 'resize' => $this->dataObj->imageWidth . 'x' . $this->dataObj->imageHeight . 'cc', ) ); $form->image->addValidator('File_IsImage'); $form->image->getValidator('File_IsImage')->setMessage( 'Uploaded file type is wrong', Zend_Validate_File_IsImage::FALSE_TYPE ); $form->addElement( 'extendedImage', 'backgroundImage', array('label' => 'Background Image', 'required' => false, 'resize' => $this->dataObj->imageWidth . 'x' . $this->dataObj->imageHeight . 'cc', ) ); $linkType = $this->_getData('linkType', $this->getFormDefaults('linkType')); $form->addElement( 'select', 'linkType', array( 'label' => 'Type', 'multiOptions' => array('none' => 'No Link', 'url' => 'URL', 'cms' => 'Site Page'), 'required' => true, 'value' => $linkType, 'separator' => ' ', 'onchange' => "$('#fieldset-linkTypeGroup>dl:first').attr('class', this.value);", ) ); $form->addElement('text', 'url', array('label' => 'Url', 'class' => 'text', 'validators' => array('url'))); $form->addElement('text', 'linkText', array('label' => 'Link Text', 'class' => 'text')); $form->url->setDescription('Example: http://www.google.com'); if ($linkType == 'url') { $form->url->setRequired(); } $form->addElement('select', 'idPage', array('label' => 'Site Page', 'escapeLabel' => false)); $form->idPage->setMultiOptions(App_Cms_Obj::getInstance()->getParent4Select(0)); $form->addDisplayGroup( array('linkType', 'url', 'idPage', 'linkText'), 'linkTypeGroup', array('legend' => 'Link') ); $form->linkTypeGroup->getDecorator('HtmlTag')->setOption('class', $linkType); $form->addElement('checkbox', 'showFilter', array('label' => 'Green filter', 'decoration' => 'simple')); $form->addElement('checkbox', 'show', array('label' => 'Show', 'decoration' => 'simple')); return $this; } protected function _renderMainForm($form) { $this->doc->addStylesheet('css/admin-slide.css'); $form->getDecorator('HtmlTag')->setOption('class', $form->type->getValue()); return parent::_renderMainForm($form); } }