public function mvcjs() { $this->load->file('application/modules/app/security_profile/form/profile_form.php'); $frm_data = new Form_App_Security_Profile(); $params = array('link' => $this->link, 'linkx' => $this->linkx, 'permissions' => $this->permission->toArray(), 'profile_form_default' => $frm_data->toArray()); Helper_App_JS::showMVC('security_profile', $params); }
private function saveProfile() { $this->load->file('application/modules/app/security_profile/form/profile_form.php'); $resAjax = new Response_Ajax(); $frmData = new Form_App_Security_Profile(TRUE); try { if (empty($frmData->id_profile) && !$this->permission->create) { throw new Exception('No tiene permisos para guardar'); } if (!empty($frmData->id_profile) && !$this->permission->update) { throw new Exception('No tiene permisos para editar'); } if (!$frmData->isValid()) { throw new Exception('Debe ingresar la información en todos los campos'); } $eProfile = $frmData->getProfileEntity(); $oBus = Business_App_Profile::saveProfile($eProfile); $resAjax->isSuccess($oBus->isSuccess()); $resAjax->message($oBus->message()); } catch (Exception $e) { $resAjax->isSuccess(FALSE); $resAjax->message($e->getMessage()); $resAjax->form('profile', $frmData->toArray()); } echo $resAjax->toJsonEncode(); }