public function execute() { try { if (request::getInstance()->isMethod('POST') and request::getInstance()->isAjaxRequest()) { $id = request::getInstance()->getPost(registroPartoTableClass::getNameField(registroPartoTableClass::ID, true)); $ids = array(registroPartoTableClass::ID => $id); registroPartoTableClass::delete($ids, true); $this->arrayAjax = array('code' => 11, 'msg' => 'La eliminacion ha sido exitosa'); $this->defineView('delete', 'registroParto', session::getInstance()->getFormatOutput()); log::register(i18n::__('delete'), registroPartoTableClass::getNameTable()); session::getInstance()->setSuccess(i18n::__('succesDelete')); } else { log::register(i18n::__('delete'), registroPartoTableClass::getNameTable(), i18n::__('errorDeleteBitacora')); session::getInstance()->setError(i18n::__('errorDelete')); 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') and request::getInstance()->hasPost('chk')) { $idsToDelete = request::getInstance()->getPost('chk'); foreach ($idsToDelete as $id) { $ids = array(registroPartoTableClass::ID => $id); registroPartoTableClass::delete($ids, true); } log::register(i18n::__('delete'), registroPartoTableClass::getNameTable()); session::getInstance()->setSuccess(i18n::__('succesDelete', null, 'animal')); routing::getInstance()->redirect('animal', 'indexRegistroParto'); } else { log::register(i18n::__('errorDelete'), registroPartoTableClass::getNameTable()); session::getInstance()->setError(i18n::__('errorDeleteMasivo', null, 'user')); routing::getInstance()->redirect('animal', 'indexRegistroParto'); } } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }