private function loadAcount() { $this->load->file('application/modules/app/user_settings/form/user_settings_form.php'); $resAjax = new Response_Ajax(); $id_user = $this->input->post('id_user'); try { //USER $oBusUser = Business_App_User::loadUser($id_user); if (!$oBusUser->isSuccess()) { throw new Exception($oBusUser->message()); } $dataUser = $oBusUser->data(); /* @var $eUser eUser */ $eUser = $dataUser['eUser']; //PERSON $oBusPerson = Business_App_Person::loadByPersonId($eUser->id_person); if (!$oBusPerson->isSuccess()) { throw new Exception($oBusPerson->message()); } $dataPerson = $oBusPerson->data(); /* @var $ePerson ePerson */ $ePerson = $dataPerson['ePerson']; //USER_PROFILE $oBusUserProfile = Business_App_User_Profile::loadUserProfile($eUser->id); if (!$oBusUserProfile->isSuccess()) { throw new Exception($oBusUserProfile->message()); } $dataUserProfile = $oBusUserProfile->data(); /* @var $eUserProfile eUserProfile */ $eUserProfile = $dataUserProfile['eUserProfile']; //COMPANY_BRANCH $oBusCompanyBranch = Business_App_User_Settings::listCompanyBranchsByUserProfile($eUserProfile->id_user, $eUserProfile->id_profile); if (!$oBusCompanyBranch->isSuccess()) { throw new Exception($oBusCompanyBranch->message()); } $dataCompanyBranchs = $oBusCompanyBranch->data(); $eCompanyBranchs = $dataCompanyBranchs['eCompanyBranchs']; $frm_data = new Form_App_User_Settings(); $frm_data->setUserEntity($eUser); $frm_data->setPersonEntity($ePerson); $frm_data->setUserProfileEntity($eUserProfile); $frm_data->setUserProfile_CompanyBranchEntity($eCompanyBranchs); $resAjax->isSuccess(TRUE); } catch (Exception $exc) { $resAjax->isSuccess(FALSE); $resAjax->message($exc->getMessage()); } $resAjax->form('acount', $frm_data->toArray()); echo $resAjax->toJsonEncode(); }
private function deletePictureProfile() { $resAjax = new Response_Ajax(); $id_user = Helper_App_Session::getUserId(); $oBus = Business_App_User_Profile::unLinkPictureProfile($id_user); $resAjax->isSuccess($oBus->isSuccess()); $resAjax->message($oBus->isSuccess() ? 'Imagen Eliminada con Exito' : $oBus->message()); $resAjax->data($oBus->data()); echo $resAjax->toJsonEncode(); }