_action, array('reorder', 'updateOrder'))) { if (is_numeric($idCategory = Qs_Request::getGetValue('idCategory'))) { $this->dataObj->addFilter(array('idCategory' => $idCategory)); } } } protected function _bindListColumns($list) { $list->addColumn('no', 'no', array('orderBy' => 'sorter')); $questionWidth = 750; if (count($this->dataObj->getCategories4Select()) && false === $this->_category) { $questionWidth = 600; $list->addColumn( 'text', 'category', array( 'orderBy' => 'category', 'attribs' => array('width' => 200) ) ); } $list->addColumn('text', 'question', array('orderBy' => 'question', 'truncateLength' => 256, 'attribs' => array('width' => $questionWidth))) ->addColumn('options', 'options'); } protected function _bindFormFields($form) { $form->addElement('select', 'idCategory', array('label' => 'Category')); $form->idCategory->setMultiOptions($this->dataObj->getCategories4Select()); $form->addElement('text', 'question', array('label' => 'Question', 'required' => true)); $form->addElement('htmlEditor', 'answer', array('label' => 'Answer', 'required' => true)); } protected function _bindFilterFields($form) { $form->addElement( 'select', 'idCategory', array( 'label' => 'Search', 'multiOptions' => array('' => 'All Categories') + $this->dataObj->getCategories4Select(), 'onchange' => 'this.form.submit()', ) ); parent::_bindFilterFields($form); $form->query->setLabel(''); return $this; } protected function _doNew() { $form = $this->_getNewForm(); $defaults = array(); $defaults['idCategory'] = Qs_Request::getGetValue('idCategory'); $form->setDefaults($defaults); $this->_renderMainForm($form); } protected function _getCategorySectionFullAlias() { if (null === $this->_categorySectionFullAlias) { $this->_categorySectionFullAlias = Qs_SiteMap::findFirst(null, array('type' => 'Faq_Category_Admin'), null, 'fullAlias'); } return $this->_categorySectionFullAlias; } protected function _getDefaultLinks() { $params = array('action' => 'new'); if (is_numeric($idCategory = $this->dataObj->getFilter('idCategory'))) { $params['idCategory'] = $idCategory; } $links = array(); $links[] = array('title' => 'Add New ' . $this->dataObj->itemName, 'url' => $this->url($params)); $params['action'] = 'reorder'; $links['reorder'] = array('title' => 'Reorder ' . $this->dataObj->itemsName, 'url' => $this->url($params)); if (!is_numeric($idCategory) && $this->dataObj->getCategoriesCount() > 1) { $links['reorder']['attribs'] = array( 'class' => 'warning', 'onclick' => "alert(' Please select one of the categories in the \"Search\" drop down above to reorder its items.'); return false" ); $links['reorder']['url'] = '#'; } $fullAlias = $this->_getCategorySectionFullAlias(); if (false !== $fullAlias) { $link = array('title' => 'Manage Categories', 'url' => $fullAlias); array_unshift($links, $link); } return $links; } }