private function getForm()
 {
     $request = $this->getRequest();
     $id = $request->getQuery('id');
     $module = new Model_Contactscategories();
     if ($id) {
         $info = $module->getCategory($id);
     }
     if ($request->getPost('name')) {
         $this->view->name = $request->getPost('name');
     } elseif (isset($info)) {
         $this->view->name = $info['name'];
     } else {
         $this->view->name = '';
     }
     if ($request->getPost('text')) {
         $this->view->text = $request->getPost('text');
     } elseif (isset($info)) {
         $this->view->text = $info['text'];
     } else {
         $this->view->text = '';
     }
     if ($request->getPost('visible')) {
         $this->view->visible = $request->getPost('visible');
     } elseif (isset($info)) {
         $this->view->visible = $info['visible'];
     } else {
         $this->view->visible = 'true';
     }
 }
Example #2
0
 public function send_mailAction()
 {
     $this->noViewRenderer(true);
     $request = $this->getRequest();
     if ($request->isPost()) {
         if ($this->validateForm()) {
             $issue_id = $request->getPost('issue_id');
             if ($issue_id > 0) {
                 $category_issue = Model_Contactscategories::getCategory($issue_id);
                 $category = $category_issue['name'];
             } else {
                 $category = $this->translate('Not selected');
             }
             $request->setParams('issue', $category);
             $res = Model_Contacts::addContact($request->getParams());
             JO_Session::set('msg_success', $this->translate('The mail is sent successfully'));
         } else {
             JO_Session::set('msg_error', $this->error);
             JO_Session::set('data', $request->getParams());
         }
     }
     $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=contacts'));
 }