true, 'defaultOrderBy' => 'sorter'); protected function _init() { $this->_messageTemplates[self::MSG_DATA_UNAVAILABLE] = '%itemName% is not available'; return parent::_init(); } protected function _callAction() { if (method_exists($this, $this->_actionMethod)) { $this->_setHeader(); } return parent::_callAction(); } protected function _doEdit() { $form = $this->_getEditForm(); $this->dataObj->initData(); if (null == $this->_getDataObj()->getData()) { $this->_setBackError(self::MSG_DATA_UNAVAILABLE); $this->_doBack(); } $data = $this->_getData4Form(); $form->setDefaults($data); $this->_renderMainForm($form); return $this; } protected function _doUpdate() { if (null === $this->_getDataObj()->getData()) { $this->_setBackError(self::MSG_DATA_UNAVAILABLE); $this->_doBack(); } return parent::_doUpdate(); } protected function _doDelete() { if (null === $this->_getDataObj()->getData()) { $this->_setBackError(self::MSG_DATA_UNAVAILABLE); $this->_doBack(); } parent::_doDelete(); } protected function _bindFormFields(Qs_Form $form) { $form->addElement( 'text', 'title', array( 'label' => 'Title', 'maxlength' => 255, 'required' => true ) ); $form->addElement( 'textarea', 'description', array( 'label' => 'Description', 'rows' => 5, ) ); return $this; } /** * @param Qs_ViewController_List $list * * @return $this */ protected function _bindListColumns($list) { $list->addColumn( 'no', 'no', array('title' => '#', 'orderBy' => 'sorter', 'attribs' => array('class' => 'text-center')) ); $list->addColumn( 'text', 'title', array('title' => 'Title', 'orderBy' => 'title') ); $list->addColumn( 'text', 'description', array('title' => 'Description', 'defaultText' => '-') ); $list->addColumn( 'options', 'options', array('attribs' => array('class' => 'option-th')) ); return $this; } }