示例#1
0
 public function addAction()
 {
     if ($this->getRequest()->isGet()) {
         $this->_faq = new SxModule_Faq();
     }
     if ($this->getRequest()->isPost()) {
         $proxyAll = new SxModule_Faq_Proxy();
         $pos = count($proxyAll->getAll($_SESSION['System']['lng']));
         $pos++;
         $this->_faq = new SxModule_Faq();
         $this->_faq->setParentId($this->_getParam('parentID'));
         $this->_faq->setActive($this->_getParam('active'));
         $this->_faq->setLng($_SESSION['System']['lng']);
         $this->_faq->setQuestion($this->_getParam('question'));
         $this->_faq->setPosition($pos);
         $this->_faq->setAnswer($this->_getParam('answer'));
         /* validate post */
         if ($this->_faq->isValid()) {
             $this->_faq->save();
             $flashMessenger = $this->_helper->getHelper('FlashMessenger');
             $flashMessenger->addMessage($this->admin_tmx->_('itemcreated'));
             $this->_helper->redirector->gotoSimple('index', 'faqcategory');
         }
     }
     $config = Zend_Registry::get('config');
     $this->view->messages = Sanmax_MessageStack::getInstance('SxModule_Faq');
     $this->view->item = $this->_faq;
     # Admin taal
     $systemAdmin = new Zend_Session_Namespace('SystemAdmin');
     $this->view->admin_tmx = $this->admin_tmx = new Zend_Translate('tmx', APPLICATION_ROOT . '/application/var/locale/admin/eyecatchers.tmx', $systemAdmin->lng);
     $this->view->admin_menu_tmx = $this->admin_menu_tmx = new Zend_Translate('tmx', APPLICATION_ROOT . '/application/var/locale/admin/menu.tmx', $systemAdmin->lng);
     $this->view->adminlngs = $adminlngs = $config->systemadmin->language;
 }