echo _('Vous pouvez aussi copier ce profil et puis le corriger'); echo HtmlInput::hidden('p_id', $profile->p_id); echo HtmlInput::hidden('clone', 1); echo HtmlInput::submit("clonebt", "Copier"); echo '</form>'; echo '<form method="POST" id="delete_profile_frm" onsubmit="return confirm_box(this,\'' . _("vous confirmez") . '\')">'; echo _('Effacer ce profil'); echo HtmlInput::hidden('p_id', $profile->p_id); echo HtmlInput::hidden('delete_profil', 1); echo HtmlInput::submit("delete_profil", _("Effacer ce profil")); echo '</form>'; echo '</div>'; echo '<div class="myfieldset" style="display:none" id="profile_menu_div">'; //Menu / Module /plugin in this profile echo "<h1 class=\"legend\">" . _("Menu") . "</h2>"; $profile_menu = new Profile_Menu($cn); $profile_menu->p_id = $p_id; $profile_menu->display_profile_menu_detail(); echo '</div>'; echo '<div class="myfieldset" style="display:none" id="profile_print_div">'; echo "<h1 class=\"legend\">" . _("Impression") . "</h1>"; $profile_menu->printing(); echo $add_impression; echo '</div>'; echo '<div class="myfieldset" style="display:none" id="profile_gestion_div">'; echo "<h1 class=\"legend\">" . 'Groupe gestion' . "</h1>"; $profile_menu->available_profile(); echo '</div>'; echo '<div class="myfieldset" style="display:none" id="profile_repo_div">'; echo "<h1 class=\"legend\">" . _("Dépôt de stock accessible") . "</h1>"; $profile_menu->available_repository();
/** * insert into the table profile_menu for the given profile id and depending * of the module $p_module * @global type $cn * @param type $p_id profile.p_id * @param type $p_module menu_ref.me_code * @throws Exception 10 : profile absent , 20 module absent , 30 No parent menu */ function insert_profile_menu($p_id = 1, $p_module = 'EXT') { global $cn; //profile exists ? $profile = new Profile_sql($cn, $p_id); if ($profile->p_id != $p_id) { throw new Exception(_('Profil inexistant'), 10); } // Menu exists $module = new Menu_Ref($cn, $p_module); if ($module->me_code == null) { throw new Exception(_('Module inexistant'), 20); } // Dependency $dep_id = $cn->get_value('select pm_id from profile_menu where p_id=$1 and me_code = $2 ', array($p_id, $p_module)); // throw an exception if there is no dependency if ($dep_id == "") { throw new Exception(_('Pas de menu ') . $p_module, 30); } $profil_menu = new Profile_Menu($cn); $profil_menu->me_code = $this->me_code; $profil_menu->me_code_dep = $p_module; $profil_menu->p_type_display = 'S'; $profil_menu->p_id = $p_id; $profil_menu->pm_id_dep = $dep_id; $cnt = $profil_menu->count(' where p_id=$1 and me_code = $2', array($p_id, $this->me_code)); if ($cnt == 0) { $profil_menu->insert(); } }
} // Security if ($g_user->check_module('CFGPRO') == 0) { die; } // Check parameter $module = HtmlInput::default_value_get("dep", ""); $p_level = HtmlInput::default_value_get("p_level", 0); $p_id = HtmlInput::default_value_get('p_profile', -1); if ($module == "" || $p_id == -1 || isNumber($p_id) == 0 || isNumber($p_level) == 0) { echo _('Paramètre invalide'); return; } require_once NOALYSS_INCLUDE . '/class_profile_menu.php'; $p_level++; $profile = new Profile_Menu($cn); $profile->p_id = $p_id; $profile->display_module_menu($module, $p_level); //////////////////////////////////////////////////////////////////////////////// // EXAMPLE //////////////////////////////////////////////////////////////////////////////// /* if ($ac == 'save') // operation { $cn=new Database(dossier::id()); $todo=new Todo_List($cn); $id=HtmlInput::default_value_get("id", 0); // get variable $todo->set_parameter("id",$id); if ($id <> 0 ) { $todo->load(); } else