connected()) throw new Exception('Vous devez être connecté pour accéder à cette fonctionnalité',401); $accountMenu[]= array( 'sort' =>1, 'url' => 'account.php?section=directory', 'icon' => 'fas fa-angle-right', 'label' => 'Annuaire', ); } function directory_get_contacts(){ $users = User::getAll(); $userMapping = array(); foreach ($users as $user) { $userMapping[$user->login] = array( 'object'=>$user, 'values' => array( 'Nom' => strtoupper($user->name).' '.$user->firstname, 'Email' => ''.$user->mail.'', 'Fixe' => ''.$user->phone.'', 'Portable (pro)' => ''.$user->mobile.'' ) ); } Plugin::callHook('directory_list',array(&$userMapping)); $columns = array(); $reference = array(); foreach ($userMapping as $infos) { if(isset($infos['values']) && count($infos['values']) > count($reference)) $reference = $infos['values']; } if(!empty($reference)) $columns = array_keys($reference); //Tri par ordre alphabétique uasort($userMapping, function($a, $b){ return strcmp($a['object']->name, $b['object']->name); }); return array($columns,$userMapping); } //cette fonction comprends toutes les actions du plugin qui ne nécessitent pas de vue html require_once(__DIR__.SLASH.'action.php'); function directory_plugin_page(){ global $myUser,$_; if(!isset($_['section']) || $_['section']!='directory') return; if($myUser!=false){ list($columns,$userMapping) = directory_get_contacts(); ?>