/vidcamara/controller/vid_camara_axispresetpos.control.php
https://gitlab.com/talueses/SIPVE · PHP · 221 lines · 104 code · 22 blank · 95 comment · 18 complexity · 99040438ea7d191fcbd3e2f47decbfc5 MD5 · raw file
- <?php
- /*******************************************************************************\
- * @copyright
- *
- * === SIPve ===
- * Sistema Integrado de Protección con capacidades de Videovigilancia
- * Control de Acceso y Carnetización para el resguardo físico de instalaciones.
- *
- * Copyright (C) 2012 Fundación Centro Nacional de Innovación Tecnológica, Cenit.
- * Dirección de Investigación, Desarrollo e Innovación.
- * Gilda Ramos.
- * José Medina.
- * Héctor Reverón.
- * David Concepción.
- * Ronald Delgado.
- * Jenner Fuentes.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either VERSION 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * Para mas información visite
- * @link http://repositorio.softwarelibre.gob.ve/ - RNA
- * @link http://sourceforge.net/projects/sipve/ - SourceForge
- * @link https://gitlab.com/talueses/SIPVE - Gitlab Repositorio.
- *
- \*******************************************************************************/
- ?>
- <?php
- require_once "../model/vid_camara_axispresetpos.model.php"; // Class MODEL VidCamaraAxispresetpos()
- require_once "../../inicio/controller/controller.php";// Class CONTROL Controller()
- /**
- * Description
- * @author David Concepcion
- */
- class ControlVidCamaraAxispresetpos extends Controller{
- /**
- * @var string mensaje de exito o error
- */
- var $mensaje = null;
- /**
- * @var string accion agregar, modificar o eliminar dato
- */
- var $accion = null;
- /**
- * @var array nombre de campos campos
- */
- var $campos = null;
- /**
- * @var string nombre de la entidad
- */
- var $entidad = null;
- /**
- * Establece la acción
- * @param string $accion Acción
- */
- public function setAccion($accion){
- $this->accion = $accion;
- }
- /**
- * @return string Devuelve la accion establecida
- */
- public function getAccion(){
- return $this->accion;
- }
- /**
- * Establece el nombre de los campos
- * @param string $name Nombre de la posicion del vector
- * @param string $value Valor de la posicion del vector
- */
- public function setCampos($name,$value){
- $this->campos[$name] = $value;
- }
- /**
- * @return array Devuelve el nombre de los campos establecido
- */
- public function getCampos($name){
- return $this->campos[$name];
- }
- /**
- * Establece la Entidad
- * @param string $entidad Entidad
- */
- public function setEntidad($entidad){
- $this->entidad = $entidad;
- }
- /**
- * @return string Devuelve la Entidad establecida
- */
- public function getEntidad(){
- return $this->entidad;
- }
-
- /**
- * Agregar o modificar un VidCamaraAxispresetpos
- * @return boolean Devuelve verdadero si se registra o actualiza correctamente
- */
- function setVidCamaraAxispresetpos(){
- //------------------ VALIDACION DE CAMPOS -----------------//
- if(!$this->sonValidosDatos()) return false;
- $obj = new VidCamaraAxispresetpos();
- //--------------------- DATOS --------------------------//
- $obj->setIdcamaraaxispresetpos($_REQUEST["idcamaraaxispresetpos"]);
-
- $obj->setIdcamara($_REQUEST["idcamara"]);
- $obj->setPresetnbr($_REQUEST["presetnbr"]);
- $obj->setPresetname($_REQUEST["presetname"]);
-
- if ($this->getAccion()=="agregar"){
- $exito = $obj->insertarRegistro();
- }
- if ($this->getAccion()=="modificar"){
- $exito = $obj->modificarRegistro($obj->getIdcamaraaxispresetpos($_REQUEST["idcamaraaxispresetpos"]));
- }
- // ------------------------------- MENSAJE ERROR --------------------------------//
- if(!$exito){
- if ($this->getAccion()=="agregar"){
- $this->mensaje = "El registro de ".$this->getEntidad()." no pudo ser creado: ".$obj->getMensaje();
- }
- if ($this->getAccion()=="modificar"){
- $this->mensaje = "El registro de ".$this->getEntidad()." no pudo ser modificado: ".$obj->getMensaje();
- }
- return false;
- }
- // ------------------------------- MENSAJE EXITO --------------------------------//
- if ($this->getAccion()=="agregar"){
- $this->mensaje = "El registro de ".$this->getEntidad()." fué creado exitosamente...";
- }
- if ($this->getAccion()=="modificar"){
- $this->mensaje = "El registro de ".$this->getEntidad()." fué modificado exitosamente...";
- }
- return true;
- }
- /**
- * === Eliminar VidCamaraAxispresetpos ===
- * @return boolean Devuelve verdadero si el proseco de eliminar se ejecuta exitosamente
- */
- function eliminarVidCamaraAxispresetpos(){
- // -------------------- ELIMINAR LECTORA ----------------------//
- $obj = new VidCamaraAxispresetpos();
- //--------------------- DATOS --------------------------//
- $obj->setIdcamaraaxispresetpos($_REQUEST["idcamaraaxispresetpos"]);
- $exito = $obj->eliminarRegistro($obj->getIdcamaraaxispresetpos($_REQUEST["idcamaraaxispresetpos"]));
- if(!$exito){
- $this->mensaje = "El registro de ".$this->getEntidad()." no pudo ser eliminado: ".$obj->getMensaje();
- return false;
- }
- $this->mensaje = "El registro de ".$this->getEntidad()." fué eliminado exitosamente...";
- return true;
- }
- /**
- * === Validacion Datos ===
- * @return boolean Devuelve verdadero si los datos estan correctos
- */
- function sonValidosDatos(){
- //------------------------------------------------------------------------------------------------------------//
- $datoName = "idcamara";
- $dato = (isset($_REQUEST[$datoName]) && trim($_REQUEST[$datoName])!=='')? trim($_REQUEST[$datoName]) : null;
- if($dato===null){
- $this->mensaje = "Falta introducir el campo ".$this->getCampos($datoName)." ";
- return false;
- }
- if(!$this->esNumerico($dato)){
- $this->mensaje = "El campo ".$this->getCampos($datoName)." introducido no es válido";
- return false;
- }
- //------------------------------------------------------------------------------------------------------------//
- $datoName = "presetnbr";
- $dato = (isset($_REQUEST[$datoName]) && trim($_REQUEST[$datoName])!=='')? trim($_REQUEST[$datoName]) : null;
- if($dato===null){
- $this->mensaje = "Falta introducir el campo ".$this->getCampos($datoName)." ";
- return false;
- }
- if(!$this->esNumerico($dato)){
- $this->mensaje = "El campo ".$this->getCampos($datoName)." introducido no es válido";
- return false;
- }
- //------------------------------------------------------------------------------------------------------------//
- $datoName = "presetname";
- $dato = (isset($_REQUEST[$datoName]) && trim($_REQUEST[$datoName])!=='')? trim($_REQUEST[$datoName]) : null;
- if($dato===null){
- $this->mensaje = "Falta introducir el campo ".$this->getCampos($datoName)." ";
- return false;
- }
- if(!$this->esAlfaNumerico($dato)){
- $this->mensaje = "El campo ".$this->getCampos($datoName)." introducido no es válido";
- return false;
- }
- //------------------------------------------------------------------------------------------------------------//
- return true;
- }
-
- }
- ?>