当前位置: 首页>>代码示例>>PHP>>正文


PHP Kernel::getNodeChilds方法代码示例

本文整理汇总了PHP中Kernel::getNodeChilds方法的典型用法代码示例。如果您正苦于以下问题:PHP Kernel::getNodeChilds方法的具体用法?PHP Kernel::getNodeChilds怎么用?PHP Kernel::getNodeChilds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Kernel的用法示例。


在下文中一共展示了Kernel::getNodeChilds方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _createContent

 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;
 }
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:51,代码来源:dashboardecole.zone.php

示例2: _createContent

 /**
  * Affiche la liste des personnes ayant des droits spécifiques sur un blog
  *
  * @author Christophe Beyer <cbeyer@cap-tic.fr>
  * @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;
 }
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:51,代码来源:showblogdroits.zone.php

示例3: _createContent

 /**
  * Affiche la liste déroulante avec toutes les écoles d'une ville
  *
  * @author Christophe Beyer <cbeyer@cap-tic.fr>
  * @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;
 }
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:33,代码来源:comboecoles.zone.php

示例4: getNodeParents

 /**
  * 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;
                     }
//.........这里部分代码省略.........
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:101,代码来源:kernel.class.php

示例5: view

 /**
  * 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);
 }
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:79,代码来源:comptes.actiongroup.php

示例6: getParentsFromEleve

 /**
  * Retourne les parents d'un �l�ve
  *
  * @author Christophe Beyer <cbeyer@cap-tic.fr>
  * @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;
 }
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:22,代码来源:annuaireservice.class.php

示例7: processWalk

 /**
  * walk
  *
  * DEBUG: Affichage des parents et enfants d'un noeud, pour valider le
  * fonctionnement des fonctions getNodeParents et getNodeChilds.
  * @author	Frédéric Mossmann <fmossmann@cap-tic.fr>
  * @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: " . $user_infos["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);
 }
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:84,代码来源:default.actiongroup.php

示例8: getNbElevesInClasse

 /**
  * Renvoie le nb d'élèves d'une classe
  *
  * @author Christophe Beyer <cbeyer@cap-tic.fr>
  * @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;
 }
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:20,代码来源:carnetservice.class.php

示例9: doDelete

 /**
  * Suppression effective d'un groupe
  *
  * @author Christophe Beyer <cbeyer@cap-tic.fr>
  * @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'));
 }
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:52,代码来源:groupe.actiongroup.php


注:本文中的Kernel::getNodeChilds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。