/** * Niveaux de prestations pour l'établissement courant * * @return self[] */ static function loadCurrentList() { $prestation = new self(); $prestation->group_id = CGroups::loadCurrent()->_id; return $prestation->loadMatchingList("nom"); }
static function loadChecklistGroup() { $list_group = new self(); $list_group->group_id = CGroups::loadCurrent()->_id; $list_group->actif = 1; $checklists_group = $list_group->loadMatchingList("title"); foreach ($checklists_group as $check_group) { $check_group->loadRefChecklist(); } return $checklists_group; }
/** * Build the class object permission tree for given user * Cache the result as static member * * @param int $user_id The concerned user, connected user if null * * @return void */ static function buildUser($user_id = null) { $user = CUser::get($user_id); // Never reload permissions for a given user if (isset(self::$users_perms[$user->_id])) { return; } $perm = new self(); // Profile specific permissions $perms["prof"] = array(); if ($user->profile_id) { $perm->user_id = $user->profile_id; $perms["prof"] = $perm->loadMatchingList(); } // User specific permissions $perm->user_id = $user->_id; $perms["user"] = $perm->loadMatchingList(); // Build final tree foreach ($perms as $_perms) { foreach ($_perms as $_perm) { self::$users_perms[$user->_id][$_perm->mod_id ? $_perm->mod_id : "all"] = array("permission" => $_perm->permission, "view" => $_perm->view); } } }