".($user['id'] == 1 ? "" : "")." "; } protected static function get_form_autorisations_group($users, $selected=array()) { $form = ''; foreach ($users as $user) { $form .= static::get_form_autorisations_user($user, (in_array($user['id'], $selected) ? true : false)); } return $form; } protected static function format_id_list($list, $all=true) { $ids = array(); if($all) { foreach ($list as $users) { foreach($users as $user) { $ids[] = 'auto_'.$user['id']; } } } else { foreach($list as $user) { $ids[] = 'auto_'.$user['id']; } } return implode('|', $ids); } public static function get_form_autorisations($param_autorisations="1", $on_create=1) { global $msg; global $PMBuserid; if ($on_create) $param_autorisations.=" ".$PMBuserid ; $autorisations_donnees=explode(" ",$param_autorisations); $query = "SELECT userid, username, grp_id, grp_name FROM users LEFT JOIN users_groups ON users_groups.grp_id=users.grp_num order by grp_name, username "; $result = pmb_mysql_query($query); static::$all_users = array(); while ($row = pmb_mysql_fetch_object($result)) { if($row->grp_name) { static::$all_users[$row->grp_name][] = array('id' => $row->userid, 'name' =>$row->username); } else { static::$all_users[$msg[128]][] = array('id' => $row->userid, 'name' =>$row->username); } } $autorisations_users="
"; if(count(static::$all_users) > 1) { $i = 0; foreach (static::$all_users as $label=>$group) { $autorisations_users .= "
".$label."
".static::get_form_autorisations_group($group, $autorisations_donnees)."
"; $i++; } } else { foreach (static::$all_users as $label=>$group) { $autorisations_users .= "
".static::get_form_autorisations_group($group, $autorisations_donnees)."
"; } } $autorisations_users.="
"; return $autorisations_users; } } // fin de déclaration de la classe users