Пример #1
0
 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()
 {
     $this->getConfig();
     $menu = $this->config['parametros']['menu1'];
     $this->layout()->menu = $menu;
     if (!$this->request->isPost()) {
         return $this->redirect()->toRoute('admin', array('controller' => 'interattivo', 'action' => 'index'));
     }
     $xposition = rand(2, 1000);
     $yposition = rand(3, 850);
     $zposition = rand(1, 100);
     //print_r($xposition.'x'.$yposition.'x'.$zposition);die;
     $patron = 'Y-m-d H:i';
     $fecha = new DateTime();
     $form = new Interact("interact");
     $form->get('posterlab')->setValueOptions($this->getInterattivoDao()->obtenerPosterlabsSelect());
     //print_r($this->llenarListaTipo());die;
     $form->get('tipo')->setValueOptions($this->llenarListaTipo());
     $form->get('data')->setValue($fecha->format($patron));
     $form->get('sessione')->setValue(0);
     $form->get('color')->setValueOptions($this->llenarColor());
     $form->get('nome')->setValue('default');
     $form->get('xyz')->setValue($xposition . 'x' . $yposition . 'x' . $zposition);
     $form->setInputFilter(new InteractValidator());
     $data = $this->getRequest()->getPost()->toArray();
     $form->setData($data);
     // Validando el form
     if (!$form->isValid()) {
         $modelView = new ViewModel(array('title' => 'Aggiorno', 'form' => $form, 'volver' => 'Indietro', 'titulo' => 'Modifica contenuto'));
         $modelView->setTemplate('admin/interattivo/crear');
         return $modelView;
     }
     $dataForms = $form->getData();
     $dataForms['posterlab_id'] = $dataForms['posterlab'];
     $producto = new Interattivo();
     //print_r($dataForms);die;
     $producto->exchangeArray($dataForms);
     $this->getInterattivoDao()->salvare($producto);
     return $this->redirect()->toRoute('admin', array('controller' => 'interattivo', 'action' => 'index'));
 }
Пример #3
0
 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 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;
 }