public function eliminaAction()
 {
     if (!$this->request->isPost()) {
         return "error";
     }
     $data = $this->getRequest()->getPost()->toArray();
     $id = (int) $data['posterlab'];
     $producto = new Interattivo();
     $producto->exchangeArray($data);
     $this->getInterattivoDao()->elimina2($producto);
     return $this;
 }
 public function guardarAction()
 {
     $values = \Zend\Json\Json::decode($this->getRequest()->getContent());
     $content = array();
     foreach ($values as $key) {
         $content[] = $key;
     }
     $nombre = $content[0];
     $session = $content[1];
     $messaggio = $content[2];
     $xposition = rand(2, 1000);
     $yposition = rand(3, 650);
     $zposition = rand(1, 100);
     $posiciones = $xposition . 'x' . $yposition . 'x' . $zposition;
     $posterlab = $this->getSessioniDao()->tuttiPerId($session)->getPosterlab();
     $actualposition = $this->getPosterlabsDao()->tuttiPerId($posterlab)->getActual();
     $risposta = $this->getContenutiDao()->cercaRisposta($posterlab)->getPosizione();
     //print_r($risposta);die;
     if ($actualposition == $risposta) {
         //risposte
         $color = 'blue';
         $tipo = 2;
         $coloretipo = 2;
     } else {
         //domande
         $color = 'yellow';
         $tipo = 1;
         $coloretipo = 1;
     }
     $patron = 'Y-m-d H:i';
     $fecha = new DateTime();
     $fechactual = $fecha->format($patron);
     $stato = 1;
     $productos = array('nome' => $nombre, 'messaggio' => $messaggio, 'color' => $color, 'xyz' => $posiciones, 'posterlab_id' => $posterlab, 'tipo' => $tipo, 'sessione' => $session, 'data' => $fechactual, 'stato' => $stato);
     $controllosession = $this->getSessioniDao()->tuttiPerIdAttivo($session)->getStato();
     ///tuttiPerIdAttivo
     if (!$controllosession == 1) {
         $json = new JsonModel(array('data' => 'error'));
         return $json;
     } else {
         $producto = new Interattivo();
         $producto->exchangeArray($productos);
         $nuevoid = $this->getInterattivoDao()->salvare($producto);
         //$salvado = $this->getInterattivoDao()->salvare($producto);
         if (!$nuevoid) {
             $json = new JsonModel(array('data' => 'error'));
             return $json;
         } else {
             $json = new JsonModel(array('data' => 'success', 'messaggio' => $messaggio, 'colore' => $coloretipo));
             return $json;
         }
     }
 }
 public function eliminarAction()
 {
     $id = (int) $this->params()->fromRoute('id', 0);
     if (!$id) {
         return $this->redirect()->toRoute('admin', array('controller' => 'interattivo', 'action' => 'index'));
     }
     $producto = new Interattivo();
     $producto->setId($id);
     $this->getInterattivoDao()->eliminare($producto);
     return $this->redirect()->toRoute('admin', array('controller' => 'interattivo', 'action' => 'index'));
 }
 public function elimina2(Interattivo $interattivo)
 {
     $data = array('stato' => $interattivo->getStato());
     $id = (int) $interattivo->getId();
     $stato = $interattivo->getStato();
     if ($this->tuttiPerId($id)) {
         $this->tableGateway->update(array('stato' => $stato), array('id' => $id));
     }
 }
 public function guardacatAction()
 {
     if (!$this->request->isPost()) {
         return "error";
     }
     $data = $this->getRequest()->getPost()->toArray();
     $id = (int) $data['id'];
     $producto = new Interattivo();
     $producto->exchangeArray($data);
     $this->getInterattivoDao()->salvare3($producto);
     print_r($data);
     die;
     return $this;
 }