public function execute() { try { if (request::getInstance()->isMethod('POST')) { $descripcion = request::getInstance()->getPost(cargoBaseTableClass::getNameField(cargoBaseTableClass::DESCRIPCION, true)); cargoTableClass::validateCreate($descripcion); $data = array(cargoBaseTableClass::DESCRIPCION => $descripcion); cargoBaseTableClass::insert($data); session::getInstance()->setSuccess(i18n::__('succesCreate')); log::register(i18n::__('create'), cargoTableClass::getNameTable()); routing::getInstance()->redirect('personal', 'indexCargo'); } else { log::register(i18n::__('create'), cargoTableClass::getNameTable(), i18n::__('errorCreateBitacora')); session::getInstance()->setError(i18n::__('errorCreate')); routing::getInstance()->redirect('personal', 'indexCargo'); } } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
?> <?php $id = cargoTableClass::ID; ?> <?php $descripcion = cargoTableClass::DESCRIPCION; ?> <form method="post" action="<?php echo routing::getInstance()->getUrlWeb('personal', isset($objCargo) == TRUE ? 'updateCargo' : 'createCargo'); ?> "> <?php if (isset($objCargo)) { ?> <input type="hidden" name="<?php echo cargoBaseTableClass::getNameField(cargoBaseTableClass::ID, TRUE); ?> " value="<?php echo $objCargo[0]->{$id}; ?> "> <?php } ?> <div class="container"> <div class="row"> <div class="col-xs-6-offset-3"> <table class="table table-responsive ">
static function setPackage($package) { self::$package = $package; }