Beispiel #1
0
 private function onAdd()
 {
     $form = $this->formAdd();
     if (false !== ($error = $form->validate($this->module))) {
         return $error . $this->templateAdd();
     }
     $faq = new GWF_HelpdeskFAQ(array('hdf_id' => 0, 'hdf_tid' => 0, 'hdf_question' => $form->getVar('question'), 'hdf_answer' => $form->getVar('answer'), 'hdf_langid' => $form->getVar('lang')));
     if (false === $faq->insert()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)) . $this->templateAdd();
     }
     return $this->module->message('msg_faq_add');
 }
Beispiel #2
0
 private static function addNewFAQTicket(Module_Helpdesk $module, array $ticket)
 {
     if (false === ($faq = GDO::table('GWF_HelpdeskFAQ')->getByTID($ticket['hdt_id']))) {
         $faq = new GWF_HelpdeskFAQ(array('hdf_id' => 0, 'hdf_tid' => $ticket['hdt_id'], 'hdf_question' => $ticket['hdt_other'] === '' ? 'DEFAULT TITLE' : '', 'hdf_answer' => '', 'hdf_langid' => 0));
         if (false === $faq->insert()) {
             return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         }
         return $module->message('msg_new_faq');
     } else {
         //			if (false === $faq->saveVars(array(
         //			))) {
         //				return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         //			}
     }
     return '';
 }
Beispiel #3
0
 private function formEdit(GWF_HelpdeskFAQ $faq)
 {
     $data = array('lang' => array(GWF_Form::SELECT, GWF_LangSelect::single(1, 'lang', $faq->getVar('hdf_langid')), $this->module->lang('th_lang'), $this->module->lang('tt_lang')), 'question' => array(GWF_Form::STRING, $faq->getVar('hdf_question'), $this->module->lang('th_question')), 'answer' => array(GWF_Form::MESSAGE, $faq->getVar('hdf_answer'), $this->module->lang('th_answer')), 'delete_confirm' => array(GWF_Form::CHECKBOX, false, $this->module->lang('th_confirm_del')), 'delete_confirm_v' => array(GWF_Form::VALIDATOR), 'add' => array(GWF_Form::SUBMITS, array('edit' => $this->module->lang('btn_edit_faq'), 'delete' => $this->module->lang('btn_rem_faq'))));
     return new GWF_Form($this, $data);
 }