'sorter', 'defaultIpp' => 20); protected $_formDefaults = array( 'typePage' => 'all', 'blockType' => 'html', 'withLink' => 'n', 'colorClass' => 'gold' ); protected function _bindListColumns($list) { $list->addColumn('no', 'no') ->addColumn('text', 'title', array('orderBy' => 'title', 'title' => 'Header')) //->addColumn('html', 'content', array('attribs' => array('width' => 350))) ->addColumn('block_content', 'content', array('attribs' => array('width' => 350))) ->addColumn('page_list', 'pageList', array('title' => 'Show on pages', 'attribs' => array('width' => 300, 'valign' => 'top'))) ->addColumn('options', 'options', array('attribs' => array('width' => '120'))); return $this; } protected function _bindFormFields($form) { $pagesType4Select = array('all' => 'All Pages', 'custom' => 'Custom Pages'); $pageType = $this->_getData('typePage', $this->getFormDefaults('typePage')); $form->addElement('text', 'title', array('label' => 'Header', 'required' => true)); $form->addElement( 'select', 'blockType', array( 'label' => $this->dataObj->itemName . ' Type', 'multiOptions' => array('html' => 'Html', 'news' => 'News'), //'required' => true, 'onchange' => 'if (this.value == "html") {$("#fieldset-contentGroup > dl:first").removeClass("hidden");}' . 'else {$("#fieldset-contentGroup > dl:first").addClass("hidden");}', ) ); $form->addElement('htmlEditor', 'content', array('label' => 'Content', 'required' => true, 'height' => 235)); $form->addDisplayGroup(array('content'), 'contentGroup'); $form->addElement( 'select', 'colorClass', array( 'label' => 'Color', 'multiOptions' => array('gold' => 'Gold', 'purple' => 'Purple') ) ); $form->addElement( 'select', 'typePage', array( 'label' => 'Show on Pages', 'multiOptions' => $pagesType4Select, 'onchange' => "$('#" . $form->getAttrib('id') . ">dl:first').attr('class', " . "'rightblock-form_elements ' + this.value);" ) ); $form->addElement( 'multiCheckbox', 'idPage', array( 'columns' => 3, 'multiOptions' => $this->dataObj->getSitePage(0) ) ); $form->addElement( 'checkbox', 'withLink', array( 'label' => 'With Link', 'checkedValue' => 'y', 'uncheckedValue' => 'n', 'onclick' => 'if (this.checked) {$("#fieldset-linkGroup > dl:first").removeClass("hidden");}' . 'else {$("#fieldset-linkGroup > dl:first").addClass("hidden");}', 'decoration' => 'simple', ) ); $form->addElement( 'text', 'linkTitle', array( 'label' => 'Link Title', 'required' => true, ) ); $form->addElement( 'text', 'linkUrl', array('label' => 'Link Url', 'class' => 'text', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array('Url'), 'description' => 'Example: http://www.google.com') ); $form->addDisplayGroup( array('linkTitle', 'linkUrl'), 'linkGroup' ); $blockType = $this->_getData('blockType', $this->_formDefaults['blockType']); $form->content->setRequired($blockType === 'html'); $form->contentGroup->getDecorator('HtmlTag')->setOption('class', ($blockType === 'html') ? '' : 'hidden' ); $withLink = $this->_getData('withLink', $this->_formDefaults['withLink']); $form->linkGroup->getDecorator('HtmlTag')->setOption('class', ($withLink === 'y') ? '' : 'hidden' ); $form->linkTitle->setRequired($withLink === 'y'); $form->linkTitle->getDecorator('label')->setOption('class', 'required'); $form->linkUrl->setRequired($withLink === 'y'); $form->linkUrl->getDecorator('label')->setOption('class', 'required'); if ($pageType == 'custom') { $form->idPage->setRequired(); } $form->getDecorator('HtmlTag')->setOption('class', 'rightblock-form_elements ' . $pageType); return $this; } public function getFormDefaults($field = false) { return Qs_Array::get($this->_formDefaults, $field); } protected function _addListItem($list = null, $template = 'list.tpl') { $viewAlias = BASE_URL . '/' . Qs_SiteMap::find(null, array('type' => 'News_'), array('type' => 'default'), 'fullAlias'); $this->doc->assign('newsViewAlias', $viewAlias); parent::_addListItem($list, $template); return $this; } }