public function eliminarAction()
 {
     $id = (int) $this->params()->fromRoute('id', 0);
     if (!$id) {
         return $this->redirect()->toRoute('admin', array('controller' => 'posterlabs', 'action' => 'index'));
     }
     $producto = new Posterlabs();
     $producto->setId($id);
     $this->getPosterlabsDao()->eliminare($producto);
     return $this->redirect()->toRoute('admin', array('controller' => 'posterlabs', 'action' => 'index'));
 }
 public function chiudisessioneAction()
 {
     $id = (int) $this->params()->fromRoute("id", 0);
     $datos = array('id' => $id, 'statosessione' => 0);
     $datos2 = array('posterlab_id' => $id, 'stato' => 0);
     $producto = new Posterlabs();
     $producto->exchangeArray($datos);
     $this->getPosterlabsDao()->chiudiSession($id);
     $registro = new Sessioni();
     $registro->exchangeArray($datos2);
     $this->getSessioniDao()->chiudisession($registro);
     return $this->redirect()->toRoute('application', array('controller' => 'index', 'action' => 'index'));
 }
 public function salvare(Posterlabs $posterlabs)
 {
     $generate = $this->randCode();
     $data = array('titolo' => $posterlabs->getTitolo(), 'password' => $generate, 'password2' => $generate, 'steps' => $posterlabs->getSteps(), 'nota' => $posterlabs->getNota(), 'durata' => $posterlabs->getDurata(), 'link' => $posterlabs->getLink(), 'statosessione' => $posterlabs->getStatosessione(), 'stato' => $posterlabs->getStato());
     if ($posterlabs->getRelatori() !== null) {
         $data['relatori_id'] = $posterlabs->getRelatori()->getId();
     }
     $id = (int) $posterlabs->getId();
     if ($id == 0) {
         $this->tableGateway->insert($data);
     } else {
         if ($this->tuttiPerId($id)) {
             if ($data['password'] != null) {
                 $this->tableGateway->update($data, array('id' => $id));
             } else {
                 $datos = array('titolo' => $posterlabs->getTitolo(), 'steps' => $posterlabs->getSteps(), 'nota' => $posterlabs->getNota(), 'durata' => $posterlabs->getDurata(), 'link' => $posterlabs->getLink(), 'statosessione' => $posterlabs->getStatosessione(), 'stato' => $posterlabs->getStato());
                 $this->tableGateway->update($datos, array('id' => $id));
             }
         } else {
             throw new \Exception('ID form non esistente');
         }
     }
 }