예제 #1
0
 public function FaqAction()
 {
     // Defaults
     $error = null;
     $status = null;
     $faqs = new Application_Model_Faqs();
     $list = $faqs->get();
     if ($this->request->isPost()) {
         // see what kind of action was taken
         $action = $this->request->action;
         $id = trim($this->request->id);
         $title = trim($this->request->title);
         $content = trim($this->request->content);
         $active = (bool) trim($this->request->active);
         switch ($action) {
             case 'Update':
                 if ($faqs->update($id, $title, $content, $active)) {
                     $status = true;
                 } else {
                     $error = $faqs->getError();
                 }
                 break;
             case 'Add':
                 if ($faqs->add($title, $content, $active)) {
                     $status = true;
                 } else {
                     $error = $faqs->getError();
                 }
                 break;
             default:
                 $error = 'Request not recognized, please try again.';
         }
     }
     $this->view->error = $error;
     $this->view->status = $status;
     $this->view->list = $list;
 }
예제 #2
0
 public function indexAction()
 {
     $faqs = new Application_Model_Faqs();
     $list = $faqs->get();
     $this->view->list = $list;
 }