insertColLast('sorter', array( 'title'=>'#', 'order_by'=>'sorter', 'width'=>20, 'tpl'=>DB_LIST_CELL_TEXT, 'params'=>array('sorter'), )); $DB_List->insertColLast('question', array( 'title'=>'Question', 'order_by'=>'question', 'width'=>800, 'truncate_len'=>155, 'tpl'=>DB_LIST_CELL_TEXT, 'params'=>array('question'), )); $DB_List->insertColLast('options', array( 'title'=>'Options', 'tpl'=>DB_LIST_CELL_EDIT_DEL, 'edit_link'=>BASE_URL.'/'.CURR_PAGE.'?action=edit&id=', 'del_link'=>BASE_URL.'/'.CURR_PAGE.'?action=del&id=', 'params'=>array('id'), )); $DB_List->bind(); return true; } function _bindFormFields($form) { $form->addElement('textarea', 'question', 'Question', array('cols'=>80, 'rows'=>5)); $form->addElement('html_editor_basic', 'answer', 'Answer'); $form->addRuleRequired(array('question')); $form->addRuleRequired(array('answer'), 'server'); return $form; } function doNew() { $form = $this->_getNewForm(); $form->addRule('img', 'Image is required', 'uploadedfile'); $form->exec(); } function doEdit() { $this->DBObj->initFromDB(); $form = $this->_getEditForm(); $form->setDefaults($this->DBObj->getData()); $form->exec(); } function addLink() { $link = BASE_URL . '/' . CURR_PAGE; $addLink = array( 'tpl' => 'center_link.tpl', 'link_list' => array( array('title' => 'Click here to add a new '.$this->DBObj->itemName, 'link' => $link . '?action=new'), array('title' => 'Click here to reorder '.$this->DBObj->itemsName, 'link' => $link . '?action=reorder'), ), ); $this->Doc->addContent($addLink); } function doList() { $this->addLink(); $filterForm = $this->getFilterForm(); $filterForm->setTpl(BASE_PATH.'/tpl/Faq/filter.tpl'); $filterForm->exec(); $this->DBObj->setFilter($filterForm->getElementValue('query')); $this->_saveBackUrl(); require_once('class/DB/List/List.php'); $DB_List = new DB_List($this->Doc, $this->DBObj, $this->functionalFields); $DB_List->urlVarNames = array_keys($this->DBObj->filter); $DB_List->urlVarNames[] = 'ipp'; $this->_doListBind($DB_List); $DB_List->exec(); return true; } }