public static function validatUpdate($nombre) { $flag = FALSE; $patron = "^[a-zA-Z0-9]{3,20}\$"; // if (!ereg($patron, $nombre)) { session::getInstance()->setError('campo nombre no permite carateres especiales'); $flag = true; session::getInstance()->setFirstCall(razaTableClass::getNameField(razaTableClass::NOMBRE_RAZA, true), true); } if ($flag == true) { request::getInstance()->setMethod('GET'); routing::getInstance()->forward('animal', 'updateRaza'); } }
public function execute() { try { if (request::getInstance()->isMethod('POST') and request::getInstance()->isAjaxRequest()) { $id = request::getInstance()->getPost(razaTableClass::getNameField(razaTableClass::ID, true)); $ids = array(razaTableClass::ID => $id); razaTableClass::delete($ids, true); $this->arrayAjax = array('code' => 11, 'msg' => 'La eliminacion ha sido exitosa'); $this->defineView('delete', 'raza', session::getInstance()->getFormatOutput()); log::register(i18n::__('delete'), razaTableClass::getNameTable()); session::getInstance()->setSuccess(i18n::__('succesDelete', null, 'raza')); } else { log::register(i18n::__('delete'), razaTableClass::getNameTable(), i18n::__('errorDeleteBitacora')); session::getInstance()->setError(i18n::__('errorDelete')); routing::getInstance()->redirect('animal', 'indexRaza'); } } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { if (request::getInstance()->isMethod('POST')) { $nombre = request::getInstance()->getPost(razaTableClass::getNameField(razaTableClass::NOMBRE_RAZA, true)); razaTableClass::validatCreate($nombre); $data = array(razaTableClass::NOMBRE_RAZA => $nombre); razaTableClass::insert($data); session::getInstance()->setSuccess(i18n::__('succesCreate', null, 'raza')); log::register(i18n::__('create'), razaTableClass::getNameTable()); routing::getInstance()->redirect('animal', 'indexRaza'); } else { log::register(i18n::__('create'), razaTableClass::getNameTable(), i18n::__('errorCreateBitacora')); session::getInstance()->setError(i18n::__('errorCreate')); routing::getInstance()->redirect('animal', 'indexRaza'); } } 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"> <table class="table table-responsive "> <tr> <th> <?php echo i18n::__('raza', NULL, 'raza'); ?> :</th> <th> <input placeholder="<?php echo isset($objRaza) == FALSE ? i18n::__('raza', NULL, 'raza') : ($objRaza[0]->{$nombre} = ucwords($objRaza[0]->{$nombre})); ?> " type="text" name="<?php echo razaTableClass::getNameField(razaTableClass::NOMBRE_RAZA, true); ?> " ></th> </tr> <tr> <th colspan="2"> <div class="text-center"> <input type="submit" class="btn" value="<?php echo i18n::__(isset($objRaza) == TRUE ? 'edit' : 'register', $culture = NULL, $dictionary = 'user'); ?> "> </div> </th> </tr> </table> </div>
<a href="#close" title="Close" class="close">X</a> <div class="modal-body"> <?php echo i18n::__('eliminarIndividual'); ?> </div> <div class="modal-footer"> <a href="#close2" title="Close" class="close2 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->{$id}; ?> , '<?php echo razaTableClass::getNameField(razaTableClass::ID, true); ?> ', '<?php echo routing::getInstance()->getUrlWeb('animal', 'deleteRaza'); ?> ')"> <?php echo i18n::__('delete'); ?> </button> </div> </div> </div> <?php $countDetale++; ?> <?php