public function _createContent(&$toReturn)
 {
     //load TPL
     $tpl = new CopixTpl();
     //get the id for current zone (force int)
     $idZone = $this->getParam('idZone') * 1;
     $catalog = $this->getParam('catalog');
     $enseignants = array();
     $oEns = array();
     //check the matrix right for current classe :
     if ($this->matrix->ecole($idZone)->_right->enseignant->voir) {
         $annuaireService =& CopixClassesFactory::Create('annuaire|AnnuaireService');
         //get the children's node
         $childNodeDatas = Kernel::getNodeChilds('BU_ECOLE', $idZone, false, array('skip_user' => true));
         //if the child is a CLASSE get the enseignant
         foreach ($childNodeDatas as $child) {
             if ($child['type'] == 'BU_CLASSE') {
                 $enseignants[] = $annuaireService->getEnseignantInClasse($child['id']);
             }
         }
         /*
          * delete the multiple ereg
          */
         $uniqueEnsId = array();
         foreach ($enseignants as $enseignant) {
             foreach ($enseignant as $ens) {
                 //check if the ens is already ereg
                 if (in_array($ens['id'], $uniqueEnsId)) {
                     continue;
                 } else {
                     $oEns[] = $ens;
                     $uniqueEnsId[] = $ens['id'];
                 }
             }
         }
         /*
          * get the school's picture
          */
         $pic = $this->model->query('SELECT photo FROM module_fiches_ecoles WHERE id = ' . $idZone)->toString();
         $tpl->assign('ens', $oEns);
         $tpl->assign('pic', $pic);
         $tpl->assign('idZone', $idZone);
         $tpl->assign('catalog', $catalog);
         //return the html content
         $toReturn = $tpl->fetch('zone.dashboard.ecole.tpl');
         return true;
     }
     //if the uses have no right : display a default tpl
     $toReturn = $tpl->fetch('zone.dashboard.noRight.tpl');
     return true;
 }
 /**
  * Affiche la liste des personnes ayant des droits spécifiques sur un blog
  *
  * @author Christophe Beyer <*****@*****.**>
  * @since 2007/05/31
  * @param object $blog Blog (recordset)
  * @param integer $kind Numéro générique de la rubrique (ne pas y toucher)
  * @param string $attribs Attributs HTML de la liste (STYLE, ONCHANGE...)
  */
 public function _createContent(&$toReturn)
 {
     //Getting the user.
     //Create Services, and DAO
     $tpl = new CopixTpl();
     $blog = $this->getParam('blog', null);
     $kind = $this->getParam('kind', null);
     $droit = $this->getParam('droit', null);
     $errors = $this->getParam('errors');
     $membres = $this->getParam('membres');
     $droit = $this->getParam('droit');
     //Kernel::deb("droit=$droit");
     //print_r($blog);
     // On vérifie le droit d'être ici
     if (!BlogAuth::canMakeInBlog("ADMIN_DROITS", $blog)) {
         return false;
     }
     $groupeService =& CopixClassesFactory::Create('groupe|groupeService');
     $childs = Kernel::getNodeChilds("MOD_BLOG", $blog->id_blog);
     foreach ($childs as $k => $v) {
         //print_r($v);
         $userInfo = Kernel::getUserInfo($v["type"], $v["id"]);
         $childs[$k]["login"] = $userInfo["login"];
         $childs[$k]["nom"] = $userInfo["nom"];
         $childs[$k]["prenom"] = $userInfo["prenom"];
         $childs[$k]["droitnom"] = $groupeService->getRightName($v['droit']);
     }
     //print_r($childs);
     $tplHome = new CopixTpl();
     //$tplHome->assign ('groupe', $groupe[0]);
     $tpl->assign('kind', $kind);
     $tpl->assign('droit', $droit);
     $tpl->assign('list', $childs);
     $tpl->assign('errors', $errors);
     $tpl->assign('membres', $membres);
     $tpl->assign('linkpopup', CopixZone::process('annuaire|linkpopup', array('field' => 'membres')));
     $tpl->assign('droit_values', array(PROFILE_CCV_VALID => $groupeService->getRightName(PROFILE_CCV_VALID), PROFILE_CCV_MODERATE => $groupeService->getRightName(PROFILE_CCV_MODERATE)));
     $tpl->assign('blog', $blog);
     // retour de la fonction :
     $toReturn = $tpl->fetch('blog.show.droits.tpl');
     return true;
 }
 /**
  * Affiche la liste déroulante avec toutes les écoles d'une ville
  *
  * @author Christophe Beyer <*****@*****.**>
  * @since 2006/01/06
  * @param integer $ville Id de la ville
  * @param integer $value Valeur actuelle de la combo
  * @param string $fieldName Nom du champ de type SELECT qui en résulte
  * @param string $attribs Attributs HTML de la liste (STYLE, ONCHANGE...)
  */
 public function _createContent(&$toReturn)
 {
     $tpl = new CopixTpl();
     $ville = $this->getParam('ville') ? $this->getParam('ville') : NULL;
     $value = $this->getParam('value') ? $this->getParam('value') : 0;
     $fieldName = $this->getParam('fieldName') ? $this->getParam('fieldName') : NULL;
     $attribs = $this->getParam('attribs') ? $this->getParam('attribs') : NULL;
     $ecoles = array();
     $childs = Kernel::getNodeChilds('BU_VILLE', $ville);
     foreach ($childs as $child) {
         if ($child['type'] == 'BU_ECOLE') {
             $node = Kernel::getNodeInfo($child['type'], $child['id'], false);
             //print_r($node);
             $ecoles[] = array('id' => $child['id'], 'nom' => $node['nom']);
         }
     }
     $tpl->assign('items', $ecoles);
     $tpl->assign('value', $value);
     $tpl->assign('fieldName', $fieldName);
     $tpl->assign('attribs', $attribs);
     $toReturn = $tpl->fetch('comboecoles.tpl');
     return true;
 }
Ejemplo n.º 4
0
 /**
  * Nodes : Retourne les noeuds parents (ecole->ville)
  * INPUT  : noeud (type+id)
  * OUTPUT : noeuds (array type+id)
  */
 public function getNodeParents($type, $id)
 {
     if (DEBUG) {
         $backtrace = debug_backtrace();
         $backtrace_array = array();
         $continue = true;
         foreach ($backtrace as $backtrace_item) {
             $backtrace_array[] = $backtrace_item['class'] . "::" . $backtrace_item['function'];
             if ($backtrace_item['class'] != 'Kernel') {
                 break;
             }
         }
         file_put_contents('/tmp/iconito.log', date("Y-m-d H:i:s -- ") . implode(" >> ", array_reverse($backtrace_array)) . " ({$type}, {$id})" . "\n", FILE_APPEND);
     }
     // if(DEBUG) file_put_contents('/tmp/iconito.log', "getNodeParents($type, $id)\n", FILE_APPEND );
     //print_r ("getNodeParents( $type, $id )<br>");
     //die();
     if (1) {
         //La donnee níest pas en cache, on traite la demande.
         $return = array();
         switch ($type) {
             case "BU_GRVILLE":
                 $return[] = array("type" => "ROOT", "id" => 0);
                 break;
             case "BU_VILLE":
                 // Ville --(1)--> Groupe de ville
                 $vil_dao = _dao("kernel|kernel_tree_vil");
                 if ($ville = $vil_dao->get($id)) {
                     $return[] = array("type" => "BU_GRVILLE", "id" => $ville->vil_id_grville);
                 }
                 break;
             case "BU_ECOLE":
                 // Ecole --(1)--> Ville
                 $eco_dao = _dao("kernel|kernel_tree_eco");
                 if ($ecole = $eco_dao->get($id)) {
                     $return[] = array("type" => "BU_VILLE", "id" => $ecole->eco_id_ville);
                 }
                 break;
             case "BU_CLASSE":
                 // Classe --(1)--> Ecole
                 $cla_dao = _dao("kernel|kernel_tree_cla");
                 if ($classe = $cla_dao->get($id)) {
                     $return[] = array("type" => "BU_ECOLE", "id" => $classe->cla_ecole);
                 }
                 break;
             case "CLUB":
                 // Voir la table des nodes
                 // Groupe de travail --(1)--> Noeud (classe, ecole, etc.)
                 $dao = _dao("kernel|kernel_link_groupe2node");
                 if ($res = $dao->get($id)) {
                     $return[] = array("type" => $res->node_type, "id" => $res->node_id);
                 }
                 break;
             case "USER_ENS":
                 // Enseignant --(n)--> Classes/Ecoles
             // Enseignant --(n)--> Classes/Ecoles
             case "USER_VIL":
                 // Agent de ville --(1?)--> Ville
             // Agent de ville --(1?)--> Ville
             case "USER_ADM":
                 // Administratif ecole --(n)--> Ecoles
                 $dao = _dao("kernel|kernel_bu_personnel_entite");
                 $res = $dao->getById($id);
                 foreach ($res as $key => $val) {
                     switch ($val->pers_entite_type_ref) {
                         case "ECOLE":
                             // Enseignant --(n)--> Ecoles (directeur)
                             $role2droit = array(1 => PROFILE_CCV_WRITE, 2 => PROFILE_CCV_ADMIN, 3 => PROFILE_CCV_WRITE);
                             $return[] = array("type" => "BU_ECOLE", "id" => $val->pers_entite_reference, "droit" => $role2droit[$val->pers_entite_role]);
                             // Patch pour acces directeur dans les classes
                             if (CopixConfig::exists('|conf_DirClasse') && CopixConfig::get('|conf_DirClasse')) {
                                 // Enseignant --(n)--> Classes (directeur)
                                 $node_list = Kernel::getNodeChilds("BU_ECOLE", $val->pers_entite_reference);
                                 $classe_list = Kernel::filterNodeList($node_list, "BU_CLASSE");
                                 if (sizeof($classe_list)) {
                                     foreach ($classe_list as $classe) {
                                         $return[] = array("type" => "BU_CLASSE", "id" => $classe['id'], "droit" => PROFILE_CCV_ADMIN);
                                     }
                                 }
                             }
                             break;
                         case "CLASSE":
                             // Enseignant --(n)--> Classes
                             $role2droit = array(1 => PROFILE_CCV_ADMIN, 2 => PROFILE_CCV_ADMIN);
                             $return[] = array("type" => "BU_CLASSE", "id" => $val->pers_entite_reference, "droit" => $role2droit[$val->pers_entite_role]);
                             break;
                         case "VILLE":
                             $role2droit = array(4 => PROFILE_CCV_ADMIN);
                             $return[] = array("type" => "BU_VILLE", "id" => $val->pers_entite_reference, "droit" => $role2droit[$val->pers_entite_role]);
                             break;
                         case "GVILLE":
                             $role2droit = array(5 => PROFILE_CCV_ADMIN);
                             $return[] = array("type" => "BU_GRVILLE", "id" => $val->pers_entite_reference, "droit" => $role2droit[$val->pers_entite_role]);
                             break;
                     }
                 }
                 break;
             case "USER_ELE":
                 // Eleve --(n)--> Classes
                 $dao = _dao("kernel|kernel_bu_ele_affect");
                 $res = $dao->getByEleve($id);
                 foreach ($res as $key => $val) {
                     $return[] = array("type" => "BU_CLASSE", "id" => $val->affect_classe, "droit" => PROFILE_CCV_WRITE);
                 }
                 // Ecole (lecture) ?
                 // ? Pour toutes les classes, ajouter les parents de "USER_ELE_CLASSE,X"
                 break;
                 // Utilisateurs locaux (hors BU) --(n)--> Noeuds (ecoles, classes, clubs, etc.)
             // Utilisateurs locaux (hors BU) --(n)--> Noeuds (ecoles, classes, clubs, etc.)
             case "USER_EXT":
                 $alreadyOnRoot = false;
                 $dao = _dao("kernel|kernel_link_user2node");
                 $res = $dao->getByUser($type, $id);
                 foreach ($res as $key => $val) {
                     if (preg_match("/^BU_(.+)\$/", $val->node_type, $regs)) {
                         $return[] = array("type" => $val->node_type, "id" => $val->node_id, "droit" => $val->droit);
                     }
                 }
                 break;
             default:
                 break;
         }
         // Responsable --(n)--> BÈnÈficiaire (limitÈ ‡ parent --> enfants)
         if ($type == "USER_RES") {
             $dao = _dao("kernel|kernel_bu_res2ele");
             $res = $dao->getByResponsable('responsable', $id);
             foreach ($res as $key => $val) {
                 if ($val->res2ele_type_beneficiaire != "eleve") {
                     continue;
                 }
                 $parents = Kernel::getNodeParents('USER_ELE', $val->res2ele_id_beneficiaire);
                 $parent = Kernel::filterNodeList($parents, "BU_CLASSE");
                 $nom_classe = '';
                 if (count($parent)) {
                     if (!isset($parent[0]['nom'])) {
                         continue;
                     }
                     $nom_classe = $parent[0]['nom'];
                 }
                 $return[] = array("type" => "USER_ELE", "id" => $val->res2ele_id_beneficiaire, "droit" => $val->res2ele_auth_parentale ? PROFILE_CCV_ADMIN : PROFILE_CCV_READ, "res2ele_type" => $val->res2ele_type_beneficiaire, "res2ele_auth_parentale" => $val->res2ele_auth_parentale, "nom_classe" => $nom_classe);
             }
         }
         if (preg_match("/^USER_(.+)\$/", $type)) {
             $dao = _dao("kernel|kernel_link_user2node");
             $res = $dao->getByUser($type, $id);
             foreach ($res as $key => $val) {
                 // Utilisateurs --(n)--> Groupes de travail (clubs)
                 if ($val->node_type == "CLUB") {
                     $ok = true;
                     if ($val->debut && $val->debut > date("Ymd")) {
                         $ok = false;
                     }
                     if ($val->fin && $val->fin < date("Ymd")) {
                         $ok = false;
                     }
                     $droit = $ok ? $val->droit : 19;
                     // CB Remplacer 30 par constante
                     $return[] = array("type" => $val->node_type, "id" => $val->node_id, "droit" => $droit);
                 } elseif ($val->node_type == "ROOT") {
                     $return[] = array("type" => $val->node_type, "id" => 0, "droit" => $val->droit);
                 } elseif (preg_match("/^BU_(.+)\$/", $val->node_type)) {
                     $ok = true;
                     if ($val->debut && $val->debut > date("Ymd")) {
                         $ok = false;
                     }
                     if ($val->fin && $val->fin < date("Ymd")) {
                         $ok = false;
                     }
                     if ($ok) {
                         $return[] = array("type" => $val->node_type, "id" => $val->node_id, "droit" => $val->droit);
                     }
                 }
                 // Utilisateurs --(n)--> Modules
                 /*
                 if( ereg( "^MOD_(.+)$", $val->node_type ) ) {
                 $ok = true;
                 if ($val->debut && $val->debut>date("Ymd")) $ok = false;
                 if ($val->fin   && $val->fin  <date("Ymd")) $ok = false;
                 $droit = ($ok) ? $val->droit : 0; // CB Remplacer 30 par constante
                 $return[]=array("type"=>$val->node_type, "id"=>$val->node_id,"droit"=>$droit);
                 }
                 */
             }
             // Rustine CB 25/08/2010 On ajoute un droit de lecture sur le groupe d'assistance
             if ($type == _currentUser()->getExtra('type') && $id == _currentUser()->getExtra('id') && CopixConfig::exists('kernel|groupeAssistance') && ($groupeAssistance = CopixConfig::get('kernel|groupeAssistance'))) {
                 $return[] = array("type" => 'CLUB', "id" => $groupeAssistance, "droit" => PROFILE_CCV_READ);
                 //print_r($return);
             }
             //// Ajoute le club Edito aux admins et admins fonctionnels
             //
             // Si on est admin (fonctionnel ou super-admin)
             if ($type == _currentUser()->getExtra('type') && $id == _currentUser()->getExtra('id') && Kernel::isAdmin()) {
                 $conf_Edito_type = null;
                 if (CopixConfig::exists('default|conf_Edito_type')) {
                     $conf_Edito_type = CopixConfig::get('default|conf_Edito_type');
                 }
                 $conf_Edito_id = null;
                 if (CopixConfig::exists('default|conf_Edito_id')) {
                     $conf_Edito_id = CopixConfig::get('default|conf_Edito_id');
                 }
                 // Si l'édito est configuré dans le module.xml
                 if ($conf_Edito_type && $conf_Edito_id) {
                     $edito_found = false;
                     // On vérifie si l'édito est déjà dans la liste...
                     foreach ($return as $key => $val) {
                         if ($val['type'] == $conf_Edito_type && $val['id'] == $conf_Edito_id) {
                             // ...si oui, on garde le droit le plus élevé
                             $return[$key]['droit'] = max(PROFILE_CCV_ADMIN, $val['droit']);
                             $edito_found = true;
                         }
                     }
                     // ...sinon on l'ajoute
                     if (!$edito_found) {
                         $return[] = array("type" => $conf_Edito_type, "id" => $conf_Edito_id, "droit" => PROFILE_CCV_ADMIN);
                     }
                 }
             }
             // echo "<pre>"; print_r($return); die();
         }
         // Ajoute les infos aux donnÈes sur les enfants
         foreach ($return as $key => $val) {
             $infos = Kernel::getNodeInfo($val['type'], $val['id'], false);
             if ($infos) {
                 // VÈrifie qu'il y a des infos...
                 foreach ($infos as $info_key => $info_val) {
                     if (!isset($return[$key][$info_key])) {
                         // Evite les effacements...
                         $return[$key][$info_key] = $info_val;
                     }
                 }
             }
         }
     }
     // Suppression des classes dans les annees scolaires passees...
     foreach ($return as $key => $val) {
         if ($val['type'] == 'BU_CLASSE' && isset($val['ALL'])) {
             if (!$val['ALL']->annee_current || !$val['ALL']->cla_is_validee || $val['ALL']->cla_is_supprimee) {
                 unset($return[$key]);
             }
         }
     }
     // _dump($return);
     reset($return);
     return $return;
 }
 /**
  * L'annuaire (TODO temporaire)
  */
 public function view()
 {
     $annuaireService =& CopixClassesFactory::Create('annuaire|AnnuaireService');
     $classe = _request("classe");
     $id = 1;
     $type = "BU_ECOLE";
     $ecole = Kernel::getNodeInfo($type, $id, false);
     //print_r($ecole);
     $classes = $enseignants = $directeur = array();
     $result = Kernel::getNodeChilds($type, $id);
     foreach ($result as $key => $value) {
         //print_r($value);
         if ($value["type"] == "BU_CLASSE") {
             $nodeInfo = Kernel::getNodeInfo($value["type"], $value["id"], false);
             $result[$key]["info"] = $nodeInfo;
             // Enseignants
             $childs = Kernel::getNodeChilds($value["type"], $value["id"]);
             //print_r($childs);
             $enseignants = array();
             foreach ($childs as $child) {
                 if ($child["type"] == "USER_ENS") {
                     $userInfo = Kernel::getUserInfo($child["type"], $child["id"]);
                     // print_r($userInfo);
                     $enseignants[] = $userInfo;
                 }
             }
             $result[$key]["enseignants"] = $enseignants;
             $classes[] = $result[$key];
         } elseif ($value["type"] == "USER_ENS") {
             $droit = Kernel::getLevel($type, $id, $value["type"], $value["id"]);
             if ($droit >= PROFILE_CCV_ADMIN) {
                 $nodeInfo = Kernel::getUserInfo($value["type"], $value["id"]);
                 //print_r($nodeInfo);
                 $result[$key]["info"] = $nodeInfo;
                 //$enseignants[] = $result[$key];
                 $directeur = $result[$key];
             }
         }
     }
     //print_r($directeur);
     $ecole["directeur"] = $directeur;
     //print_r($ecole);
     $id = $classe;
     $type = "BU_CLASSE";
     $classe = Kernel::getNodeInfo($type, $id, false);
     $eleves = $enseignants = array();
     $result = Kernel::getNodeChilds($type, $id);
     foreach ($result as $key => $value) {
         if ($value["type"] == "USER_ELE") {
             $nodeInfo = Kernel::getUserInfo($value["type"], $value["id"]);
             $result[$key]["info"] = $nodeInfo;
             //print_r($result[$key]);
             $eleves[] = $result[$key];
         } elseif ($value["type"] == "USER_ENS") {
             $userInfo = Kernel::getUserInfo($value["type"], $value["id"]);
             //print_r($userInfo);
             $enseignants[] = $userInfo;
         }
     }
     //print_r($eleves);
     $classe["eleves"] = $annuaireService->order_tab_eleves($eleves);
     $classe["enseignants"] = $annuaireService->order_tab_enseignants($enseignants);
     //$classe["enseignants"]=($enseignants);
     //print_r($classe);
     $tplListe = new CopixTpl();
     $tplListe->assign('ecole', $ecole);
     $tplListe->assign('classes', $classes);
     $tplListe->assign('classe', $classe);
     $tplListe->assign('annu', "<pre>" . $return_str . "</pre>");
     $result = $tplListe->fetch("view.tpl");
     $tpl = new CopixTpl();
     $tpl->assign('TITLE_PAGE', $ecole["nom"] . " (" . $ecole["desc"] . ")");
     $tpl->assign("MAIN", $result);
     $tpl->assign('MENU', $this->menu);
     return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
 }
 /**
  * Retourne les parents d'un �l�ve
  *
  * @author Christophe Beyer <*****@*****.**>
  * @since 2006/01/23
  * @param integer $eleve Id de l'�l�ve
  * @return array Tableau avec les parents
  */
 public function getParentsFromEleve($eleve)
 {
     $res = array();
     $parents = Kernel::getNodeChilds('USER_ELE', $eleve);
     foreach ($parents as $parent) {
         //print_r($parent);
         $userInfo = Kernel::getUserInfo($parent['type'], $parent['id']);
         //print_r($userInfo);
         $tmp = array_merge($parent, $userInfo);
         $res[] = $tmp;
     }
     //print_r($res);
     return $res;
 }
 /**
  * walk
  *
  * DEBUG: Affichage des parents et enfants d'un noeud, pour valider le
  * fonctionnement des fonctions getNodeParents et getNodeChilds.
  * @author	Frédéric Mossmann <*****@*****.**>
  * @see getNodeParents( $type, $id )
  * @see getNodeChilds( $type, $id )
  */
 public function processWalk()
 {
     $tpl = new CopixTpl();
     $tpl->assign('TITLE_PAGE', "Walk");
     $return_left = "";
     $return_center = "";
     $return_right = "";
     if (_request("type")) {
         $type = _request("type");
         $id = _request("id");
     } else {
         if (_currentUser()->getExtra('type') && _currentUser()->getExtra('id')) {
             $type = _currentUser()->getExtra('type');
             $id = _currentUser()->getExtra('id');
         } else {
             $type = "USER_ELE";
             $id = 3777;
         }
     }
     $result = Kernel::getNodeParents($type, $id);
     foreach ($result as $key => $value) {
         $return_left .= '<a href="' . CopixUrl::get('kernel||walk', array("type" => $value["type"], "id" => $value["id"])) . '">';
         $return_left .= $value["type"] . "/" . $value["id"];
         if (isset($value["droit"]) && $value["droit"]) {
             $return_left .= ' (' . $value["droit"] . ')';
         }
         $return_left .= '</a>';
         // $tmp = Kernel::getNodeChilds( $value["type"], $value["id"] );
         // if( sizeof($tmp) ) $return_left .= " (".sizeof($tmp).")";
         $return_left .= '<br />';
     }
     $result = Kernel::getNodeChilds($type, $id);
     foreach ($result as $key => $value) {
         // $tmp = Kernel::getNodeChilds( $value["type"], $value["id"] );
         // if( sizeof($tmp) ) $return_right .= "(".sizeof($tmp).") ";
         $return_right .= '<a href="' . CopixUrl::get('kernel||walk', array("type" => $value["type"], "id" => $value["id"])) . '">';
         $return_right .= $value["type"] . "/" . $value["id"];
         if (isset($value["droit"]) && $value["droit"]) {
             $return_right .= ' (' . $value["droit"] . ')';
         }
         $return_right .= '</a>';
         $return_right .= '<br />';
     }
     $return_center .= $type . "/" . $id;
     if (ereg("^USER_", $type)) {
         $user_infos = Kernel::getUserInfo($type, $id);
         if (isset($user_infos["login"])) {
             $return_center .= "<br />Login: "******"login"];
         }
         if (isset($user_infos["nom"]) && isset($user_infos["prenom"])) {
             $return_center .= "<br />(";
             $return_center .= $user_infos["prenom"] . " " . $user_infos["nom"];
             $return_center .= ")";
         }
     } else {
         $node_infos = Kernel::getNodeInfo($type, $id, false);
         if (isset($node_infos["nom"])) {
             $return_center .= "<br />" . $node_infos["nom"];
         }
         if (isset($node_infos["desc"])) {
             $return_center .= "<br />(";
             if (strlen($node_infos["desc"]) > 45) {
                 $return_center .= substr($node_infos["desc"], 0, 40) . "...";
             } else {
                 $return_center .= $node_infos["desc"];
             }
             $return_center .= ")";
         }
     }
     $return_str = '<center><h3>' . $return_center . '</h3></center>';
     $return_str .= '<table width="100%"><tr><td valign="top" align="left"><strong>Parents</strong></td><td valign="top" align="right"><strong>Childs</strong></td></tr>';
     $return_str .= '<tr><td valign="top" align="left">' . $return_left . '</td><td valign="top" align="right">' . $return_right . '</td></tr></table>';
     $tpl->assign('MAIN', "<pre>" . $return_str . "</pre>");
     return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
 }
 /**
  * Renvoie le nb d'élèves d'une classe
  *
  * @author Christophe Beyer <*****@*****.**>
  * @since 2006/05/18
  * @param integer $classe Id de la classe
  * @return integer Nb d'léèves
  */
 public function getNbElevesInClasse($classe)
 {
     $childs = Kernel::getNodeChilds("BU_CLASSE", $classe);
     $res = 0;
     while (list($k, $child) = each($childs)) {
         if ($child["type"] != "USER_ELE") {
             continue;
         }
         $res++;
     }
     return $res;
 }
 /**
  * Suppression effective d'un groupe
  *
  * @author Christophe Beyer <*****@*****.**>
  * @since 2005/11/16
  * @see getDelete()
  * @param integer $id Id du groupe
  */
 public function doDelete()
 {
     $dao = CopixDAOFactory::create("groupe");
     $kernel_service =& CopixClassesFactory::Create('kernel|kernel');
     $groupeService =& CopixClassesFactory::Create('groupe|groupeService');
     $errors = array();
     $id = $this->getRequest('id', null);
     $groupe = $dao->getGroupe($id);
     if (!$groupe) {
         $errors[] = CopixI18N::get('groupe|groupe.error.noGroup');
     }
     $mondroit = $kernel_service->getLevel("CLUB", $id);
     if (!$groupeService->canMakeInGroupe('ADMIN', $mondroit)) {
         $errors[] = CopixI18N::get('kernel|kernel.error.noRights');
     }
     if ($errors) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $errors), 'back' => CopixUrl::get('groupe||')));
     } else {
         // On supprime ses modules
         $his_modules = Kernel::getModEnabled("CLUB", $id);
         foreach ($his_modules as $k => $node) {
             list(, $module) = explode("_", $node->module_type);
             $module = strtolower($module);
             $classeModule =& CopixClassesFactory::create($module . '|Kernel' . $module);
             if (method_exists($classeModule, "delete")) {
                 $classeModule->delete($node->module_id);
             }
         }
         // On supprime tous les noeuds
         $daoKernelModEnabled = CopixDAOFactory::create("kernel|kernel_mod_enabled");
         $daoKernelModEnabled->delByNode("CLUB", $id);
         // On supprime le rattachement du groupe
         $daoLinkGroupe2Node = CopixDAOFactory::create("kernel|kernel_link_groupe2node");
         $daoLinkGroupe2Node->delete($id);
         // On supprime les membres/droits
         $childs = Kernel::getNodeChilds("CLUB", $id);
         foreach ($childs as $user) {
             Kernel::setLevel("CLUB", $id, $user["type"], $user["id"], 0);
         }
         // On supprime le groupe lui-m�me
         $dao->delete($id);
     }
     return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('groupe||getListMy'));
 }