/**
  * getNode
  *
  * Affiche les informations d'un noeud et les utilisateurs qui y sont attachés.
  * @author	Frédéric Mossmann
  * @since	09.02.2006
  *
  */
 public function getNode()
 {
     if (CopixConfig::exists('kernel|gestionAutonomeEnabled') && CopixConfig::get('kernel|gestionAutonomeEnabled')) {
         return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('gestionautonome|default|showTree', array('type' => 'ROOT')));
     }
     $tpl = new CopixTpl();
     $tplGetNode = new CopixTpl();
     $pType = _request("type", 'ROOT');
     $pId = _request("id");
     $tpl->assign('TITLE_PAGE', CopixI18N::get('comptes.moduleDescription') . " » " . CopixI18N::get('comptes.title.getnode'));
     $petitpoucet = array();
     $droit = 0 + Kernel::getLevel($pType, $pId);
     switch ($pType) {
         case 'ROOT':
             $pId = 0;
             // ROOT
             $petitpoucet[] = array('txt' => 'Root');
             $childs = Kernel::getNodeChilds($pType, $pId);
             $childs = Kernel::filterNodeList($childs, 'USER_*');
             break;
         case 'BU_GRVILLE':
             $infos = Kernel::getNodeInfo($pType, $pId, false);
             // ROOT
             $petitpoucet[] = array('txt' => 'Root', 'url' => CopixUrl::get('comptes||getNode', array('type' => 'ROOT')));
             // BU_GRVILLE
             $petitpoucet[] = array('txt' => $infos['nom']);
             // Liste des "BU_VILLE"
             $childs = Kernel::getNodeChilds($pType, $pId);
             $childs = Kernel::filterNodeList($childs, 'USER_*');
             $droit = max($droit, Kernel::getLevel('ROOT', 0));
             break;
         case 'BU_VILLE':
             $infos = Kernel::getNodeInfo($pType, $pId, false);
             // Recherche des parents
             $parents = Kernel::getNodeParents($pType, $pId);
             $parent_grville = Kernel::filterNodeList($parents, 'BU_GRVILLE');
             // ROOT
             $petitpoucet[] = array('txt' => 'Root', 'url' => CopixUrl::get('comptes||getNode', array('type' => 'ROOT')));
             // BU_GRVILLE
             $petitpoucet[] = array('txt' => $parent_grville[0]['nom'], 'url' => CopixUrl::get('comptes||getNode', array('type' => $parent_grville[0]['type'], 'id' => $parent_grville[0]['id'])));
             // BU_VILLE
             $petitpoucet[] = array('txt' => $infos['nom']);
             // Liste des "BU_VILLE"
             $childs = Kernel::getNodeChilds($pType, $pId);
             $childs = Kernel::filterNodeList($childs, 'USER_*');
             $droit = max($droit, Kernel::getLevel('BU_GRVILLE', $parent_grville[0]["id"]));
             $droit = max($droit, Kernel::getLevel('ROOT', 0));
             break;
         case 'BU_ECOLE':
             $infos = Kernel::getNodeInfo($pType, $pId, false);
             // Recherche des parents
             $parents = Kernel::getNodeParents($pType, $pId);
             $parent_ville = Kernel::filterNodeList($parents, 'BU_VILLE');
             $parents = Kernel::getNodeParents($parent_ville[0]["type"], $parent_ville[0]["id"]);
             $parent_grville = Kernel::filterNodeList($parents, 'BU_GRVILLE');
             // ROOT
             $petitpoucet[] = array('txt' => 'Root', 'url' => CopixUrl::get('comptes||getNode', array('type' => 'ROOT')));
             // BU_GRVILLE
             $petitpoucet[] = array('txt' => $parent_grville[0]['nom'], 'url' => CopixUrl::get('comptes||getNode', array('type' => $parent_grville[0]['type'], 'id' => $parent_grville[0]['id'])));
             // BU_VILLE
             $petitpoucet[] = array('txt' => $parent_ville[0]['nom'], 'url' => CopixUrl::get('comptes||getNode', array('type' => $parent_ville[0]['type'], 'id' => $parent_ville[0]['id'])));
             // BU_ECOLE
             $petitpoucet[] = array('txt' => $infos['nom']);
             // Liste des "BU_VILLE"
             $childs = Kernel::getNodeChilds($pType, $pId);
             $childs = Kernel::filterNodeList($childs, 'USER_*');
             $droit = max($droit, Kernel::getLevel('BU_VILLE', $parent_ville[0]["id"]));
             $droit = max($droit, Kernel::getLevel('BU_GRVILLE', $parent_grville[0]["id"]));
             $droit = max($droit, Kernel::getLevel('ROOT', 0));
             break;
         case 'BU_CLASSE':
             $infos = Kernel::getNodeInfo($pType, $pId, false);
             // Recherche des parents
             $parents = Kernel::getNodeParents($pType, $pId);
             $parent_ecole = Kernel::filterNodeList($parents, 'BU_ECOLE');
             $parents = Kernel::getNodeParents($parent_ecole[0]["type"], $parent_ecole[0]["id"]);
             $parent_ville = Kernel::filterNodeList($parents, 'BU_VILLE');
             $parents = Kernel::getNodeParents($parent_ville[0]["type"], $parent_ville[0]["id"]);
             $parent_grville = Kernel::filterNodeList($parents, 'BU_GRVILLE');
             // ROOT
             $petitpoucet[] = array('txt' => 'Root', 'url' => CopixUrl::get('comptes||getNode', array('type' => 'ROOT')));
             // BU_GRVILLE
             $petitpoucet[] = array('txt' => $parent_grville[0]['nom'], 'url' => CopixUrl::get('comptes||getNode', array('type' => $parent_grville[0]['type'], 'id' => $parent_grville[0]['id'])));
             // BU_VILLE
             $petitpoucet[] = array('txt' => $parent_ville[0]['nom'], 'url' => CopixUrl::get('comptes||getNode', array('type' => $parent_ville[0]['type'], 'id' => $parent_ville[0]['id'])));
             // BU_ECOLE
             $petitpoucet[] = array('txt' => $parent_ecole[0]['nom'], 'url' => CopixUrl::get('comptes||getNode', array('type' => $parent_ecole[0]['type'], 'id' => $parent_ecole[0]['id'])));
             // BU_CLASSE
             $petitpoucet[] = array('txt' => $infos['nom']);
             // Liste des "BU_VILLE"
             $childs = Kernel::getNodeChilds($pType, $pId);
             //print_r($childs);
             $eleves = Kernel::filterNodeList($childs, 'USER_ELE');
             foreach ($eleves as $eleve) {
                 $parents = Kernel::getNodeChilds($eleve['type'], $eleve['id']);
                 $parents = Kernel::filterNodeList($parents, 'USER_RES');
                 foreach ($parents as $parent) {
                     $childs[] = $parent;
                 }
             }
             $childs = Kernel::filterNodeList($childs, 'USER_*');
             $droit = max($droit, Kernel::getLevel('BU_ECOLE', $parent_ecole[0]["id"]));
             $droit = max($droit, Kernel::getLevel('ROOT', 0));
             break;
         default:
             return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('comptes.error.badnodetype'), 'back' => CopixUrl::get('||')));
             break;
     }
     // Tri par type de noeud
     // $childs = Kernel::sortNodeList( $childs, 'type', array('USER_VIL','USER_ENS','USER_ADM','USER_ELE','USER_RES','USER_EXT') );
     $childs = Kernel::sortNodeList($childs, 'comptes');
     $childs = Kernel::uniqNodeList($childs);
     // Ajoute le type d'utilisateur en toute lettres.
     foreach ($childs as $child_key => $child_val) {
         $childs[$child_key]['type_nom'] = Kernel::Code2Name($child_val['type']);
     }
     if (isset($petitpoucet)) {
         $tplGetNode->assign('PETITPOUCET', Kernel::PetitPoucet($petitpoucet, " » "));
     }
     $tplGetNode->assign('NAVIGATION', CopixZone::process('comptes|navigation'));
     if ($droit >= 70) {
         $tplGetNode->assign('MAIN', CopixZone::process('comptes|userlist', array('childs' => $childs, 'type' => $pType, 'id' => $pId)));
     } else {
         $tplGetNode->assign('MAIN', CopixI18N::get('comptes.error.badrights'));
     }
     $result = $tplGetNode->fetch("getnode.tpl");
     $menu = array();
     $session = _sessionGet('modules|comptes|doLoginCreate|success');
     if ($session && is_array($session) && sizeof($session)) {
         $menu[] = array('txt' => CopixI18N::get('comptes.strings.showloginresult', sizeof($session)), 'url' => CopixUrl::get('comptes||getLoginResult'), 'size' => 160);
     }
     /*if( Kernel::getLevel( 'ROOT', 0 ) >= PROFILE_CCV_ADMIN ) {
           $menu[] = array( 'txt' => CopixI18N::get('comptes.strings.getext'), 'url' => CopixUrl::get ('comptes||getUserExt'), 'size'=>160 );
           $menu[] = array( 'txt' => CopixI18N::get('comptes.strings.getanim'), 'url' => CopixUrl::get ('comptes|animateurs|list'), 'size'=>120 );
       }
       if( count($menu) ) $tpl->assign ('MENU', $menu );*/
     $tpl->assign('MENU', $this->menu);
     $tpl->assign('MAIN', $result);
     return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
 }
 /**
  * Ré-génération des mots de passe d'une classe
  */
 public function processShowNewClassroomPasswords()
 {
     $ppo = new CopixPPO();
     $ppo->nodeId = _request('nodeId', null);
     // Récupération des paramètres
     if (is_null($ppo->nodeId)) {
         return CopixActionGroup::process('generictools|Messages::getError', array('message' => "Une erreur est survenue.", 'back' => CopixUrl::get('gestionautonome||showTree')));
     }
     $classroomDAO = _ioDAO('kernel|kernel_bu_ecole_classe');
     if (!($classroom = $classroomDAO->get($ppo->nodeId))) {
         return CopixActionGroup::process('generictools|Messages::getError', array('message' => "Une erreur est survenue.", 'back' => CopixUrl::get('gestionautonome||showTree')));
     }
     // Contrôle des droits
     $ppo->hasCredentialTeacherUpdate = _currentUser()->testCredential('module:classroom|' . $ppo->nodeId . '|teacher|update@gestionautonome');
     $ppo->hasCredentialStudentUpdate = _currentUser()->testCredential('module:classroom|' . $ppo->nodeId . '|student|update@gestionautonome');
     $ppo->hasCredentialPersonInChargeUpdate = _currentUser()->testCredential('module:classroom|' . $ppo->nodeId . '|person_in_charge|update@gestionautonome');
     if (!$ppo->hasCredentialPersonInChargeUpdate && !$ppo->hasCredentialStudentUpdate && !$ppo->hasCredentialPersonInChargeUpdate) {
         throw new CopixCredentialException();
     }
     // Infos du noeud
     $nodeInfos = Kernel::getNodeInfo('BU_CLASSE', $ppo->nodeId);
     // Breadcrumbs & titre
     $breadcrumbs = Kernel::generateBreadcrumbs($nodeInfos);
     $breadcrumbs[] = array('txt' => 'Re-génération des mots de passe');
     $ppo->breadcrumbs = Kernel::PetitPoucet($breadcrumbs, ' » ');
     $ppo->TITLE_PAGE = CopixConfig::get('gestionautonome|moduleTitle');
     $ppo->title = 'Réinitialisation des mots de passe';
     $ppo->msgSuccess = 'Modification effectuée !';
     $ppo->subTitle = 'Liste des comptes modifiés';
     // Récupération des comptes modifiés
     $ppo->accounts = _sessionGet('modules|gestionautonome|createAccount');
     // Récupérations des informations des modifications apportées
     $accountsInSession = _sessionGet('modules|gestionautonome|passwordsList');
     if (!is_array($accountsInSession)) {
         $accountsInSession = array();
     } else {
         $toDisplay = array();
         foreach ($accountsInSession as $lines) {
             foreach ($lines as $data) {
                 $toDisplay[] = $data;
             }
         }
         $ppo->accountsInSession = $toDisplay;
     }
     return _arPPO($ppo, 'account_listing.tpl');
 }