public function execute()
 {
     try {
         if (request::getInstance()->isMethod('POST')) {
             $fecha = request::getInstance()->getPost(registroPartoTableClass::getNameField(registroPartoTableClass::FECHA_NACIMIENTO, true));
             $hembras = request::getInstance()->getPost(registroPartoTableClass::getNameField(registroPartoTableClass::HEMBRAS_NACIDAS_VIVAS, true));
             $machos = request::getInstance()->getPost(registroPartoTableClass::getNameField(registroPartoTableClass::MACHOS_NACIDOS_VIVOS, true));
             $muertos = request::getInstance()->getPost(registroPartoTableClass::getNameField(registroPartoTableClass::NACIDOS_MUERTOS, true));
             //                $raza = request::getInstance()->getPost(registroPartoTableClass::getNameField(registroPartoTableClass::RAZA_ID, true));
             $animal_id = request::getInstance()->getPost(registroPartoTableClass::getNameField(registroPartoTableClass::ANIMAL_ID, true));
             //                $caracteres = validator::getInstance()->validatorCharactersSpecial($nombre);
             //
             //                if ($caracteres == true) {
             //                    throw new PDOException(i18n::__(10005, null, 'errors', null, 10005));
             //                }
             //                loteTableClass::validatCreate($nombre);
             $fieldsAnimal = array(hojaVidaTableClass::ANIMAL, hojaVidaTableClass::ID, hojaVidaTableClass::PARTO, hojaVidaTableClass::GENERO_ID);
             $whereAnimal = array(hojaVidaTableClass::ANIMAL => $animal_id, hojaVidaTableClass::GENERO_ID => 1);
             $objAnimal = hojaVidaTableClass::getAll($fieldsAnimal, true, null, null, null, null, $whereAnimal);
             //                print_r($objAnimal);
             //                exit();
             $flag = false;
             if ($objAnimal[0]->numero_parto > 5) {
                 session::getInstance()->setError("Disponible para la Venta");
                 $flag = true;
                 session::getInstance()->setFlash(animalTableClass::getNameField(animalTableClass::PESO, true), true);
             }
             if ($flag == true) {
                 request::getInstance()->setMethod('GET');
                 routing::getInstance()->forward('animal', 'insertRegistroParto');
             }
             $partosAnimal = $objAnimal[0]->numero_parto + 1;
             $idAnimalInventario = array(hojaVidaTableClass::ANIMAL => $animal_id);
             $dataAnimal = array(hojaVidaTableClass::PARTO => $partosAnimal);
             hojaVidaTableClass::update($idAnimalInventario, $dataAnimal);
             $data = array(registroPartoTableClass::FECHA_NACIMIENTO => $fecha, registroPartoTableClass::HEMBRAS_NACIDAS_VIVAS => $hembras, registroPartoTableClass::MACHOS_NACIDOS_VIVOS => $machos, registroPartoTableClass::NACIDOS_MUERTOS => $muertos, registroPartoTableClass::ANIMAL_ID => $animal_id);
             registroPartoTableClass::insert($data);
             session::getInstance()->setSuccess(i18n::__('succesCreate', null, 'parto'));
             log::register(i18n::__('create'), registroPartoTableClass::getNameTable());
             routing::getInstance()->redirect('animal', 'indexRegistroParto', array(hojaVidaTableClass::getNameField(hojaVidaTableClass::ANIMAL) => $animal_id));
         } else {
             log::register(i18n::__('create'), registroPartoTableClass::getNameTable(), i18n::__('errorCreateBitacora'));
             session::getInstance()->setError(i18n::__('errorCreate'));
             routing::getInstance()->redirect('animal', 'indexRegistroParto');
         }
     } catch (PDOException $exc) {
         session::getInstance()->setFlash('exc', $exc);
         routing::getInstance()->forward('shfSecurity', 'exception');
     }
 }
 public function execute()
 {
     try {
         if (request::getInstance()->isMethod('POST')) {
             // DATOS DE ANIMAL
             $numeroIdentificacion = request::getInstance()->getPost(animalTableClass::getNameField(animalTableClass::NUMERO, true));
             //validar si los campos estan vacios
             $datos = array($numeroIdentificacion);
             $validatorEmpty = validator::getInstance()->validateFieldsEmpty($datos);
             if ($validatorEmpty == false) {
                 throw new PDOException(i18n::__(10006, null, 'errors', null, 10006));
             }
             //Validar el formato de fecha
             //                $validacionFecha = validator::getInstance()->validateDate($fecha);
             //                if ($validacionFecha == true) {
             //                    throw new PDOException(i18n::__(10005, null, 'errors', null, 10005));
             //                }
             //Validar campos numericos
             //            $validacionNumericos = validator::getInstance()->validateCharactersNumber($peso);
             //            if ($validacionNumericos == true) {
             //                throw new PDOException(i18n::__(10005, null, 'errors', null, 10005));
             //            }
             //                $validacionNumericos = validator::getInstance()->validateCharactersNumber($edad);
             //                if ($validacionNumericos == true) {
             //                    throw new PDOException(i18n::__(10005, null, 'errors', null, 10005));
             //                }
             //Insertar la informacion del usuario
             $data = array(animalTableClass::LOTE_ID => 2, animalTableClass::NUMERO => $numeroIdentificacion);
             animalTableClass::insert($data);
             session::getInstance()->setSuccess(i18n::__('succesCreate', null, 'animal'));
             log::register(i18n::__('create'), animalTableClass::getNameTable());
             routing::getInstance()->redirect('animal', 'indexAnimal');
         } else {
             log::register(i18n::__('create'), animalTableClass::getNameTable(), i18n::__('errorCreateBitacora'));
             session::getInstance()->setError(i18n::__('errorCreate', null, 'animal'));
             routing::getInstance()->redirect('animal', 'indexAnimal');
         }
     } catch (PDOException $exc) {
         session::getInstance()->setFlash('exc', $exc);
         routing::getInstance()->forward('shfSecurity', 'exception');
     }
 }
 public static function validate($numero_identificacion, $lote)
 {
     $flag = false;
     $pattern = "/^((19|20)?[0-9]{2})[\\/|-](0?[1-9]|[1][012])[\\/|-](0?[1-9]|[12][0-9]|3[01])\$/";
     $dateNow = date("Y-m-d", strtotime("now"));
     if (!is_numeric($numero_identificacion)) {
         session::getInstance()->setError(i18n::__(10007, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(animalTableClass::getNameField(animalTableClass::PESO, true), true);
     }
     //        if (!is_numeric($peso)) {
     //            session::getInstance()->setError(i18n::__(10007, null, 'errors'));
     //            $flag = true;
     //            session::getInstance()->setFlash(animalTableClass::getNameField(animalTableClass::PESO, true), true);
     //        }
     //        if ($genero !== 1 or $genero !== 2) {
     //            session::getInstance()->setError(i18n::__(10009, null, 'errors', array('%campo%' => 'Genero')));
     //            $flag = true;
     //            session::getInstance()->setFlash(animalTableClass::getNameField(animalTableClass::GENERO_ID, true), true);
     //        }
     //        if (preg_match($pattern, $fecha_nacimiento) == false) {
     //            session::getInstance()->setError(i18n::__(10008, null, 'errors'));
     //            $flag = true;
     //            session::getInstance()->setFlash(animalTableClass::getNameField(animalTableClass::FECHA_NACIMIENTO, true), true);
     //        }
     if (!is_numeric($lote)) {
         session::getInstance()->setError(i18n::__(10007, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(animalTableClass::getNameField(animalTableClass::LOTE_ID, true), true);
     }
     //        if (!is_numeric($raza)) {
     //            session::getInstance()->setError(i18n::__(10007, null, 'errors'));
     //            $flag = true;
     //            session::getInstance()->setFlash(animalTableClass::getNameField(animalTableClass::RAZA, true), true);
     //        }
     if ($flag == true) {
         request::getInstance()->setMethod('GET');
         routing::getInstance()->forward('animal', 'insertAnimal');
     }
 }
 public function execute()
 {
     try {
         if (request::getInstance()->isMethod('POST')) {
             $id = request::getInstance()->getPost(animalTableClass::getNameField(animalTableClass::ID, true));
             $lote = request::getInstance()->getPost(animalTableClass::getNameField(animalTableClass::LOTE_ID, true));
             $ids = array(animalTableClass::ID => $id);
             $data = array(animalTableClass::LOTE_ID => $lote);
             animalTableClass::update($ids, $data);
             session::getInstance()->setSuccess(i18n::__('succesUpdate', null, 'animal'));
             log::register(i18n::__('update'), usuarioTableClass::getNameTable());
             routing::getInstance()->redirect('animal', 'indexAnimal');
         } else {
             log::register(i18n::__('update'), usuarioTableClass::getNameTable(), i18n::__('errorUpdateBitacora'));
             session::getInstance()->setError(i18n::__('errorUpdate', null, 'animal'));
             routing::getInstance()->redirect('animal', 'indexAnimal');
         }
     } catch (PDOException $exc) {
         session::getInstance()->setFlash('exc', $exc);
         routing::getInstance()->forward('shfSecurity', 'exception');
     }
 }
 public function execute()
 {
     try {
         if (request::getInstance()->isMethod('POST') and request::getInstance()->isAjaxRequest()) {
             $id = request::getInstance()->getPost(animalTableClass::getNameField(animalTableClass::ID, true));
             //$observacion = request::getInstance()->getPost(usuarioTableClass::getNameField(usuarioTableClass::OBSERVACION, true));
             $ids = array(animalTableClass::ID => $id);
             animalTableClass::delete($ids, true);
             $this->arrayAjax = array('code' => 11, 'msg' => 'La eliminacion ha sido exitosa');
             $this->defineView('delete', 'animal', session::getInstance()->getFormatOutput());
             log::register(i18n::__('delete'), usuarioTableClass::getNameTable());
             session::getInstance()->setSuccess(i18n::__('succesDelete', null, 'animal'));
         } else {
             log::register(i18n::__('delete'), animalTableClass::getNameTable(), i18n::__('errorDeleteBitacora'));
             session::getInstance()->setError(i18n::__('errorDelete', null, 'animal'));
             routing::getInstance()->redirect('animal', 'index');
         }
     } catch (PDOException $exc) {
         session::getInstance()->setFlash('exc', $exc);
         routing::getInstance()->forward('shfSecurity', 'exception');
     }
 }
    <div class="container">
        <div class="row">
            <div class="col-xs-6-offset-3">
                <div class="table-responsive">
                <table class="table table-bordered">    
                    <tr>
                        <?php 
if (!isset($objAnimal)) {
    ?>
                            <th> <?php 
    echo i18n::__('identification', null, 'animal');
    ?>
:</th>
                            <th> 
                                <input required  type="text"   name="<?php 
    echo animalTableClass::getNameField(animalTableClass::NUMERO, true);
    ?>
" >
                               
                            </th> </tr><tr>
                        <th colspan="2"> <font size="2">* <?php 
    echo i18n::__('oblig', null, 'animal');
    ?>
</font></th>
                        </tr>
                    <?php 
}
?>
                         

                  
                                <div class="modal-body">
                                    <?php 
    echo i18n::__('eliminarIndividual');
    ?>
                                </div>

                                <div class="modal-footer responsive">
                                    <a href="#close2" title="Close" class="btn btn-default fa fa-times-circle-o close2"><?php 
    echo i18n::__('cancel');
    ?>
</a>
                                    <button type="button" class="btn btn-primary fa fa-eraser" onclick="eliminar(<?php 
    echo $key->{$idAnimal};
    ?>
, '<?php 
    echo animalTableClass::getNameField(animalTableClass::ID, true);
    ?>
', '<?php 
    echo routing::getInstance()->getUrlWeb('animal', 'deleteAnimal');
    ?>
')"><?php 
    echo i18n::__('delete');
    ?>
</button>
                                </div>

                            </div>
                        </div>

                        </th>
                        </tr>