public function mvcjs() { $this->load->file('application/modules/app/system_setting_param/form/setting_param_form.php'); $data = new Form_App_System_Setting_Param(); $params = array('link' => $this->link, 'linkx' => $this->linkx, 'permissions' => $this->permission->toArray(), 'data_setting_param_default' => $data->toArray()); Helper_App_JS::showMVC('system_setting_param', $params); }
private function saveParam() { $this->load->file('application/modules/app/system_setting_param/form/setting_param_form.php'); $resAjax = new Response_Ajax(); $frm_data = new Form_App_System_Setting_Param(TRUE); $logo = 'logo'; $id_system = Helper_Config::getSystemId(); try { if (!$this->permission->update) { throw new Exception('No tiene permisos para editar/actualizar'); } if (!$frm_data->isValid()) { throw new Exception('Debe ingresar la información en todos los campos'); } if (!isset($_FILES[$logo])) { $oBusUploadLogo = Business_App_Configuration_System::uploadLogo($id_system, $logo); if (!$oBusUploadLogo->isSuccess()) { throw new Exception($oBusUploadLogo->message()); } } $oBusLoadLogo = Business_App_Configuration_System::loadLogo($id_system); if (!$oBusLoadLogo->isSuccess()) { throw new Exception($oBusLoadLogo->message()); } $dataLogo = $oBusLoadLogo->data(); $eConfigurationSystem = $frm_data->getConfigurationSystemEntity(); $eConfigurationSystem->id = $id_system; $eConfigurationSystem->logo = $dataLogo['uri']; $frm_data->logo = $eConfigurationSystem->logo; $oBus = Business_App_Configuration_System::saveConfigurationSystem($eConfigurationSystem); if (!$oBus->isSuccess()) { throw new Exception($oBus->message()); } $resAjax->isSuccess(TRUE); $resAjax->message($oBus->message()); } catch (Exception $ex) { $resAjax->isSuccess(FALSE); $resAjax->message($ex->getMessage()); } $resAjax->form('setting', $frm_data->toArray()); echo $resAjax->toJsonEncode(); }