public function execute() { try { if (request::getInstance()->isMethod('POST')) { $nombre = request::getInstance()->getPost(loteTableClass::getNameField(loteTableClass::NOMBRE, true)); // $caracteres = validator::getInstance()->validatorCharactersSpecial($nombre); // // if ($caracteres == true) { // throw new PDOException(i18n::__(10005, null, 'errors', null, 10005)); // } loteTableClass::validatCreate($nombre); $data = array(loteTableClass::NOMBRE => $nombre); loteTableClass::insert($data); session::getInstance()->setSuccess(i18n::__('succesCreate', null, 'lote')); log::register(i18n::__('create'), loteTableClass::getNameTable()); routing::getInstance()->redirect('animal', 'indexLote'); } else { log::register(i18n::__('create'), loteTableClass::getNameTable(), i18n::__('errorCreateBitacora')); session::getInstance()->setError(i18n::__('errorCreate')); routing::getInstance()->redirect('animal', 'indexLote'); } } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
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(loteTableClass::getNameField(loteTableClass::NOMBRE, true), true); } if ($flag == true) { request::getInstance()->setMethod('GET'); routing::getInstance()->forward('animal', 'updateLote'); } }
public function execute() { try { if (request::getInstance()->isMethod('POST') and request::getInstance()->isAjaxRequest()) { $id = request::getInstance()->getPost(loteTableClass::getNameField(loteTableClass::ID, true)); $ids = array(loteTableClass::ID => $id); loteTableClass::delete($ids, true); $this->arrayAjax = array('code' => 11, 'msg' => 'La eliminacion ha sido exitosa'); $this->defineView('delete', 'lote', session::getInstance()->getFormatOutput()); log::register(i18n::__('delete'), loteTableClass::getNameTable()); session::getInstance()->setSuccess(i18n::__('succesDelete', null, 'lote')); } else { log::register(i18n::__('delete'), loteTableClass::getNameTable(), i18n::__('errorDeleteBitacora')); session::getInstance()->setError(i18n::__('errorDelete')); routing::getInstance()->redirect('animal', 'indexLote'); } } 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::__('lote', NULL, 'lote'); ?> :</th> <th> <input placeholder="<?php echo isset($objLote) == FALSE ? i18n::__('lote', NULL, 'lote') : ($objLote[0]->{$nombre} = ucwords($objLote[0]->{$nombre})); ?> " type="text" name="<?php echo loteTableClass::getNameField(loteTableClass::NOMBRE, true); ?> " ></th> </tr> <tr> <th colspan="2"> <div class="text-center"> <input type="submit" class="btn" value="<?php echo i18n::__(isset($objLote) == TRUE ? 'edit' : 'register', $culture = NULL, $dictionary = 'user'); ?> "> </div> </th> </tr> </table> </div>
<div class="modal-body"> ¿<?php echo i18n::__('confirmDelete'); ?> ? </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 loteTableClass::getNameField(loteTableClass::ID, true); ?> ', '<?php echo routing::getInstance()->getUrlWeb('animal', 'deleteLote'); ?> ')"><?php echo i18n::__('delete'); ?> </button> </div> </div> </div> <?php $countDetale++; ?>