Пример #1
0
 public function formularioAdd()
 {
     $folleto = new Folleto();
     if (isset($_POST["submit"])) {
         // reaching via HTTP Post...
         // populate the Folleto object with data form the form
         $folleto->setTitulo($_POST["titulo"]);
         $folleto->setDescripcion($_POST["descripcion"]);
         $folleto->setFechaInicio($_POST["fechaInicio"]);
         $folleto->setFechaFin($_POST["fechaFin"]);
         $folleto->setAdministrador_idAdministrador(1);
         if (!$this->folletoMapper->folletoExists($_POST["titulo"])) {
             $this->folletoMapper->save($folleto);
             /*$this->view->setVariable("folleto", $folleto);
              */
             $fol = $this->folletoMapper->findById($_POST["titulo"]);
             $this->view->setVariable("fol", $fol);
             $this->view->render("viewFolleto", "view");
         }
     }
 }
Пример #2
0
 public function delete(Folleto $folleto)
 {
     $stmt = $this->db->prepare("DELETE from folleto WHERE idFolleto=?");
     $stmt->execute(array($folleto->getIdFolleto()));
 }