DBObj->getAnnouncementTitle(); if (!empty($announcementTitle)) { $this->Doc->content['DOC']['title'] .= '/' . smarty_modifier_truncate($announcementTitle); } } function _doListBind(&$DB_List) { $DB_List->def_order_by = 'added DESC'; $DB_List->urlVarNames[] = 'id_announcement'; $DB_List->insertColLast('added', array( 'title' => 'Added', 'order_by' => 'added', 'width' => 70, 'tpl' => DB_LIST_CELL_DATE, 'date_format' => '%b %e, %Y @ %l:%M%p', 'params' => array('added'), )); $DB_List->insertColLast('comment', array( 'title' => 'Comment', 'order_by' => 'member_name', 'width' => '400', 'tpl' => BASE_PATH . '/app/Announcement/Reply/tpl/headline.tpl', 'truncate_len' => 256, 'params' => array() )); $DB_List->insertColLast('approved', array( 'title' => 'Approved', 'order_by' => 'approved', 'width' => 60, 'values' => array('y' => 'Yes', 'n' => 'No'), 'tpl' => DB_LIST_CELL_LINK_ENUM, 'url' => BASE_URL . '/' . CURR_PAGE . '/?action=chopt&opt=approved&id_announcement=' . $this->DBObj->getIdAnnouncement() . '&id=', 'params' => array('approved', 'id') )); $DB_List->insertColLast('options', array( 'title' => 'Options', 'width' => 80, 'tpl' => DB_LIST_CELL_EDIT_DEL, 'edit_link' => BASE_URL . '/' . CURR_PAGE . '?action=edit&id_announcement=' . $this->DBObj->getIdAnnouncement() . '&id=', 'del_link' => BASE_URL . '/' . CURR_PAGE . '?action=del&id_announcement=' . $this->DBObj->getIdAnnouncement() . '&id=', 'params' => array('id'), )); $DB_List->bind(); } function addLink() { $link = BASE_URL . '/' . CURR_PAGE; $backUrl = $this->getBackUrl(PARENT_PAGE); if (empty($backUrl)) { $backUrl = BASE_URL . '/' . PARENT_PAGE; } $addLink = array( 'tpl' => 'center_link.tpl', 'link_list' => array( array('title' => '<< Back to Posts', 'link' => $backUrl), array('title' => 'Click here to add a new ' . $this->DBObj->itemName, 'link' => $link . '?action=new&id_announcement=' . $this->DBObj->getIdAnnouncement()), ), ); $this->Doc->addContent($addLink); } function _bindFormFields($form) { $form->addElement('hidden', 'id_announcement', $this->DBObj->getIdAnnouncement()); $form->addElement('static', 'member_name', 'Name'); $form->addElement('textarea', 'comment', 'Comment', array('rows' => 10, 'cols' => 80)); $form->addElement('advcheckbox', 'approved', ' ', 'Approved', null, array('n', 'y')); $form->addRuleRequired(array('comment')); return $form; } function _getNewForm() { $form = parent::_getNewForm(); $form->addElement('hidden', 'id_member'); return $form; } function doNew() { if (isset($_REQUEST['setBackUrl'])) { $this->setBackUrl(BASE_URL . '/' . CURR_PAGE . '?id_announcement=' . $_REQUEST['id_announcement']); } $form = $this->_getNewForm(); $adminData = $this->Doc->UserAuth->getData(); $data = array('approved' => 'y', 'member_name' => $adminData['name'], 'id_member' => -$adminData['id']); $form->setDefaults($data); $form->exec(); } function doEdit() { if (isset($_REQUEST['setBackUrl'])) { $this->setBackUrl(BASE_URL . '/' . CURR_PAGE . '?id_announcement=' . $_REQUEST['id_announcement']); } $this->DBObj->initFromDB(); $form = $this->_getEditForm(); $data = $this->DBObj->getData(); $data['member_name'] = $this->DBObj->getMemberName($data['id_member']); $form->setDefaults($data); $form->exec(); } function getFilterForm() { $form = new Form($this->Doc, 'form_search_announcement_reply', 'get', '', '_self', array('class' => 'form form_search_announcement_reply')); $form->tpl = BASE_PATH . '/tpl/Announcement/Reply/filter.tpl'; $form->setRendType(FORM_RENDERER_ARRAY_SMARTY); $form->addElement('hidden', 'id_announcement', $this->DBObj->getIdAnnouncement()); $form->addElement('select', 'search[approved]', null, array('' => 'All', 'y' => 'Yes', 'n' => 'No'), array('onchange' => 'this.form.submit();')); $form->addElement('text', 'search[query]'); $form->addElement('submit', 'submit_btn', 'Search', array('class' => 'btn')); $form->addElement('button', 'cancel_btn', 'Cancel', array( 'class' => 'btn', 'onclick' => "document.location.href='" . Constant::get('BASE_URL') . '/' . CURR_PAGE . "?id_announcement=" . $this->DBObj->getIdAnnouncement() . "'" )); return $form; } function doList() { $filterFrom = $this->getFilterForm(); $filter = $filterFrom->exportValues(); $this->DBObj->setFilter($filter['search']); $filterFrom->exec(); parent::doList(); } function _getBaseForm($method = 'post') { $form = parent::_getBaseForm($method); $form->cancelUrl = Constant::get('BASE_URL') . '/' . CURR_PAGE . "?action=cancel&id_announcement=" . $this->DBObj->getIdAnnouncement(); return $form; } }