public function isOwnerOnMod($menu_id) { $ess_profiles_detail = new ess_profiles_detail(); // Mejorar para encontar una similitud con el script $ess_profiles_detail->find('menu_id = ' . $menu_id . ' & profiles_id = ' . $_SESSION['profile_id']); $ess_menu = new ess_menu(); $ess_menu->find($menu_id); $this->strModName = $ess_menu->description; return $ess_profiles_detail->getNumRowsAffected(); }
public function getFormSetProfile($profile_id) { $ess_profiles_detail = new ess_profiles_detail(); $itemOnProfile = array(); foreach ($ess_profiles_detail->find('profiles_id = ' . $profile_id) as $row) { $itemOnProfile[$row->menu_id] = $row->id; } $this->walkItems(0); $myForm = new OPF_myForm('FormSetProfile'); $myForm->styleClassForm = ''; $myForm->useRowSeparator = true; foreach ($this->arrItems as $opt) { list($numSpaces, $id, $desc) = explode(':', $opt); for ($i = 0; $i < $numSpaces; ++$i) { $add = ' '; if ($i == $numSpaces - 1) { $add = '->'; } $myForm->addFreeObject('cm1_' . $i . '_' . $id, '', $add); $this->groups[] = 'cm1_' . $i . '_' . $id; } $sts = false; if (isset($itemOnProfile[$id])) { $sts = true; } $myForm->addCheckBox($desc, 'chk_' . $id, $sts); $this->groups[] = 'chk_' . $id; for ($j = $numSpaces + 1; $j < $this->maxCols + 1; ++$j) { $myForm->addComment('cm2_' . $j . '_' . $id, ' '); $this->groups[] = 'cm2_' . $j . '_' . $id; } } $myForm->addButton('btn_save_', OPF_myLang::getPhrase('LABEL_BTN_SAVE'), 'save.gif'); $myForm->addButton('btn_cancel_', OPF_myLang::getPhrase('LABEL_BTN_CANCEL'), 'cancel.gif'); $myForm->addEvent('btn_cancel_', 'onclick', 'onClickCancelConfirm'); $myForm->addEvent('btn_save_', 'onclick', 'onClickSaveProfileDet', $profile_id); $myForm->border = 0; $myForm->width = ($this->maxCols + 1) * 180; $myForm->addGroup('resources', OPF_myLang::getPhrase('OPF_PROFILES_4'), $this->groups, $this->maxCols + 1); return $myForm->getForm(2); }
public function onClickSaveProfileDet($datForm, $profile_id) { $ess_profiles_detail = new ess_profiles_detail(); $ess_profiles_detail->beginTransaction(); $ess_profiles_detail->delete('profiles_id = ' . $profile_id); $pref = 'chk_'; foreach ($datForm as $id => $chkList) { if (stripos($id, $pref) !== false) { if ($datForm[$id]) { $ess_profiles_detail->menu_id = substr($id, strlen($pref)); $ess_profiles_detail->profiles_id = $profile_id; $ess_profiles_detail->save(); } } } if ($ess_profiles_detail->endTransaction()) { $this->notificationWindow(OPF_myLang::getPhrase('MSG_CAMBIOS_GUARDADOS'), 3, 'ok'); $this->onClickCancel(); } else { $this->messageBox($ess_profiles_detail->getErrorLog(), 'error'); } return $this->response; }