示例#1
0
 public function indexAction()
 {
     $faqMapper = new FaqMapper();
     $this->getLayout()->getAdminHmenu()->add($this->getTranslator()->trans('menuFaqs'), array('action' => 'index'));
     if ($this->getRequest()->getPost('action') == 'delete' && $this->getRequest()->getPost('check_faqs')) {
         foreach ($this->getRequest()->getPost('check_faqs') as $faqId) {
             $faqMapper->delete($faqId);
         }
     }
     $this->getView()->set('faqs', $faqMapper->getFaqs());
 }
示例#2
0
 public function indexAction()
 {
     $categoryMapper = new CategoryMapper();
     $faqMapper = new FaqMapper();
     if ($this->getRequest()->getParam('catId')) {
         $category = $categoryMapper->getCategoryById($this->getRequest()->getParam('catId'));
         $this->getLayout()->getHmenu()->add($this->getTranslator()->trans('menuFaqs'), array('action' => 'index'))->add($category->getTitle(), array('action' => 'index', 'catId' => $category->getId()));
         $faqs = $faqMapper->getFaqs(array('cat_id' => $this->getRequest()->getParam('catId')));
     } else {
         $catId = $categoryMapper->getCategoryMinId();
         if ($catId != '') {
             $category = $categoryMapper->getCategoryById($catId->getId());
             $this->getLayout()->getHmenu()->add($this->getTranslator()->trans('menuFaqs'), array('action' => 'index'))->add($category->getTitle(), array('action' => 'index', 'catId' => $category->getId()));
             $faqs = $faqMapper->getFaqs(array('cat_id' => $catId->getId()));
             $this->getView()->set('firstCatId', $catId->getId());
         } else {
             $this->getLayout()->getHmenu()->add($this->getTranslator()->trans('menuFaqs'), array('action' => 'index'));
             $faqs = $faqMapper->getFaqs();
         }
     }
     $this->getView()->set('faqs', $faqs);
     $this->getView()->set('categorys', $categoryMapper->getCategories());
 }
示例#3
0
 public function delCatAction()
 {
     $faqMapper = new FaqMapper();
     $countFaqs = count($faqMapper->getFaqs(array('cat_id' => $this->getRequest()->getParam('id'))));
     if ($countFaqs == 0) {
         if ($this->getRequest()->isSecure()) {
             $categoryMapper = new CategoryMapper();
             $categoryMapper->delete($this->getRequest()->getParam('id'));
             $this->addMessage('deleteSuccess');
             $this->redirect(array('action' => 'index'));
         }
     } else {
         $this->addMessage('deleteFailed', 'danger');
         $this->redirect(array('action' => 'index'));
     }
 }