public function getFormAgrUsr($user_id = '') { $ess_profiles = new ess_profiles(); $profilesArray = array(); foreach ($ess_profiles->find() as $profile) { $profilesArray[$profile->id] = $profile->name; } $ess_system_users = new ess_system_users(); $myForm = new OPF_myForm('getFormAgrUsr'); if ($user_id) { $ess_system_users->find($user_id); $myForm->addDisabled('user_name'); } $myForm->styleClassForm = ''; $myForm->addText(OPF_myLang::getPhrase('OPF_ADMUSR_1'), 'user_name', $ess_system_users->user_name, 15); $myForm->addText(OPF_myLang::getPhrase('OPF_ADMUSR_2'), 'name', $ess_system_users->name, 15); $myForm->addText(OPF_myLang::getPhrase('OPF_ADMUSR_3'), 'lastname', $ess_system_users->lastname, 15); $myForm->addPassword(OPF_myLang::getPhrase('OPF_ADMUSR_4'), 'passwd1', $ess_system_users->passwd, 15); $myForm->addPassword(OPF_myLang::getPhrase('OPF_ADMUSR_5'), 'passwd', $ess_system_users->passwd, 15); $myForm->addSelect(OPF_myLang::getPhrase('OPF_ADMUSR_6'), 'profile_id', $profilesArray, $ess_system_users->profile_id); $status = false; if ($ess_system_users->status == 1) { $status = true; } $myForm->addCheckBox(OPF_myLang::getPhrase('OPF_ADMUSR_7'), 'status', $status); $myForm->addButton('btnsave', OPF_myLang::getPhrase('LABEL_BTN_SAVE'), 'save.gif'); $myForm->addEvent('btnsave', 'onclick', 'onClickSaveRecord', $user_id); return $myForm->getForm(1); }
public function onClickSave($datForm, $id = '') { if ($this->MYFORM_validate($datForm, array('name', 'description'))) { $ess_profiles = new ess_profiles(); if ($id) { $ess_profiles->find($id); } $ess_profiles->name = $datForm['name']; $ess_profiles->description = $datForm['description']; $ess_profiles->user_id = $_SESSION['user_id']; $ess_profiles->datetime = date("Y-m-d H:i:s"); if ($ess_profiles->save()) { $this->notificationWindow(OPF_myLang::getPhrase('MSG_CAMBIOS_GUARDADOS'), 3, 'ok'); $this->closeModalWindow(); $this->MYLIST_reload('lst_profiles'); } else { $this->messageBox($ess_profiles->getErrorLog(), 'error'); } } else { $this->notificationWindow(OPF_myLang::getPhrase('MSG_CAMPOS_REQUERIDOS'), 3, 'error'); } return $this->response; }
public function getFormAddModProfile($id = '') { $myForm = new OPF_myForm('FormAddModProfile'); $ess_profiles = new ess_profiles(); if ($id) { $ess_profiles->find($id); } $myForm->styleClassForm = ''; $myForm->addText(OPF_myLang::getPhrase('OPF_PROFILES_5'), 'name', $ess_profiles->name, 20, 50); $myForm->addTextArea(OPF_myLang::getPhrase('OPF_PROFILES_6'), 'description', $ess_profiles->description, 40, 6); $myForm->addButton('btn_save', OPF_myLang::getPhrase('LABEL_BTN_SAVE'), 'save.gif'); $myForm->addEvent('btn_save', 'onclick', 'onClickSave', $id); return $myForm->getForm(1); }