Пример #1
0
 public function modificarAction()
 {
     $this->view->subtitle = $this->info->sitio->faqs->modificar->titulo;
     $eFAQ = new Faqs();
     if ($this->_request->isPost()) {
         Zend_Loader::loadClass('Zend_Filter_StripTags');
         $filter = new Zend_Filter_StripTags();
         $id = (int) $this->_request->getPost('id');
         $pregunta = trim($filter->filter($this->_request->getPost('pregunta')));
         $respuesta = trim($filter->filter($this->_request->getPost('respuesta')));
         if ($id !== false) {
             if ($pregunta != '' && $respuesta != '') {
                 $data = array('pregunta' => $pregunta, 'respuesta' => $respuesta, 'id_sitio' => $this->session->sitio->id);
                 $where = 'id = ' . $id;
                 $eFAQ->update($data, $where);
                 $this->_redirect('/admin/faqs/');
                 return;
             } else {
                 $this->view->faq = $eFAQ->fetchRow('id=' . $id);
             }
         }
     } else {
         $id = (int) $this->_request->getParam('id', 0);
         if ($id > 0) {
             $this->view->faq = $eFAQ->fetchRow('id=' . $id);
         }
     }
     $this->view->action = $this->info->sitio->faqs->modificar->action;
     $this->view->buttonText = $this->info->sitio->faqs->modificar->buttonText;
     $this->render();
 }