本文整理汇总了PHP中Kernel::sortNodeList方法的典型用法代码示例。如果您正苦于以下问题:PHP Kernel::sortNodeList方法的具体用法?PHP Kernel::sortNodeList怎么用?PHP Kernel::sortNodeList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kernel
的用法示例。
在下文中一共展示了Kernel::sortNodeList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAnnuaireHome
/**
* Renvoie l'entree de l'annuaire pour l'usager courant. Pour les parents, prends le home d'un des enfants. S'il n'y a pas d'enfant ou que le compte n'est rattache a rien, on l'envoie dans la 1e ville.
*
* @author Christophe Beyer <cbeyer@cap-tic.fr>
* @since 2006/12/20
* @return array Tableau avec [type] et [id] du noeud (BU_CLASSE, BU_ECOLE, BU_VILLE, BU_GVILLE)
*/
public function getAnnuaireHome()
{
// Recuperation de ses blocs, comme dans le dashboard
$nodes_all = Kernel::getNodeParents($this->user->type, $this->user->idEn);
$nodes_all = Kernel::sortNodeList($nodes_all);
//_dump($nodes_all);
$home = null;
foreach ($nodes_all as $node) {
if ($node['type'] == 'BU_CLASSE' || $node['type'] == 'BU_ECOLE' || $node['type'] == 'BU_VILLE' || $node['type'] == 'BU_GVILLE') {
$home = array('type' => $node['type'], 'id' => $node['id']);
break;
}
}
//_dump($home);
if (!$home && Kernel::isParent()) {
// Cas du parent d'�l�ve
$enfants = Kernel::getNodeParents(_currentUser()->getExtra('type'), _currentUser()->getExtra('id'));
while (list($k, $v) = each($enfants)) {
if ($v["type"] != "USER_ELE") {
continue;
}
// Pour chaque enfant...
//print_r($v);
if (is_array($v['link']->classe) && ($id = array_shift(array_keys($v['link']->classe)))) {
$home = array('type' => 'BU_CLASSE', 'id' => $id);
} elseif (is_array($v['link']->ecole) && ($id = array_shift(array_keys($v['link']->ecole)))) {
$home = array('type' => 'BU_ECOLE', 'id' => $id);
} elseif (is_array($v['link']->ville) && ($id = array_shift(array_keys($v['link']->ville)))) {
$home = array('type' => 'BU_VILLE', 'id' => $id);
}
if ($home) {
break;
}
}
}
if (!$home || Kernel::isAdmin()) {
// Si rattache a rien, on l'envoie dans la 1e ville
$sql = "SELECT MIN(id_vi) AS ville FROM kernel_bu_ville LIMIT 1";
$v = _doQuery($sql);
$home = array('type' => 'BU_VILLE', 'id' => $v[0]->ville);
}
//print_r($home);
return $home;
}
示例2: getNode
//.........这里部分代码省略.........
// 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);
}
示例3: processDefault
public function processDefault()
{
$tpl = new CopixTpl();
$tplModule = new CopixTpl();
if (!$this->user->connected) {
return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('welcome|default|'));
}
$tpl->assign('TITLE_PAGE', CopixI18N::get('kernel.title.accueilsimple'));
$nodes_all = Kernel::getNodeParents($this->user->type, $this->user->idEn);
$nodes_all = Kernel::sortNodeList($nodes_all);
// _dump($nodes_all);
$nodes = array();
foreach ($nodes_all as $node) {
if ($node['type'] == 'CLUB' && CopixConfig::exists('kernel|groupeAssistance') && ($groupeAssistance = CopixConfig::get('kernel|groupeAssistance')) && $node['id'] == $groupeAssistance) {
continue;
}
if ($node['type'] == 'CLUB' && $node['droit'] < 20) {
continue;
}
if (!isset($nodes[$node['type']])) {
$nodes[$node['type']] = array();
}
//module not initialized : loaded into inconito
if (!isset($nodes[$node['type']][$node['id']])) {
$nodes[$node['type']][$node['id']] = $node;
Kernel::createMissingModules($node['type'], $node['id']);
$nodes[$node['type']][$node['id']]['modules'] = Kernel::getModEnabled($node['type'], $node['id'], $this->user->type, $this->user->idEn, 0, count($nodes_all) > $this->conf_notification_maxnodes ? 0 : 1);
// Cas des groupes : on ajoute les membres et admin, selon les droits
if ($node['type'] == 'CLUB') {
$addModule = new CopixPPO();
$addModule->node_type = $node['type'];
$addModule->node_id = $node['id'];
$addModule->module_type = 'MOD_ADMIN';
$addModule->module_id = 0;
$addModule->module_nom = CopixI18N::get('groupe|groupe.group.admin');
$nodes[$node['type']][$node['id']]['modules'][] = $addModule;
}
/*
* ===== CONTENT GENERATION =====
*
*/
//cas parent élève
if ($node['type'] == 'USER_ELE') {
$contentNode = Kernel::getNodeParents($node['type'], $node['id']);
$contentNode = Kernel::filterNodeList($contentNode, 'BU_CLASSE');
if (empty($contentNode)) {
continue;
}
$contentNode = $contentNode[0];
} else {
$contentNode = $node;
}
//get content from db :
$content = $this->db->query('SELECT * FROM module_admindash WHERE id_zone = ' . $contentNode['id'] . ' AND type_zone = "' . $contentNode['type'] . '"')->toArray1();
// Get vocabulary catalog to use
$nodeVocabularyCatalogDAO = _ioDAO('kernel|kernel_i18n_node_vocabularycatalog');
$vocabularyCatalog = $nodeVocabularyCatalogDAO->getCatalogForNode($contentNode['type'], $contentNode['id']);
//if no content : get default content
if (empty($content['content'])) {
switch ($contentNode['type']) {
case 'BU_CLASSE':
case 'USER_ELE':
$content['content'] = CopixZone::process('kernel|dashboardClasse', array('idZone' => $contentNode['id'], 'catalog' => $vocabularyCatalog->id_vc));
break;
case 'BU_ECOLE':
$content['content'] = CopixZone::process('kernel|dashboardEcole', array('idZone' => $contentNode['id'], 'catalog' => $vocabularyCatalog->id_vc));
break;
case 'BU_VILLE':
$content['content'] = CopixZone::process('kernel|dashboardVille', array('idZone' => $contentNode['id'], 'catalog' => $vocabularyCatalog->id_vc));
break;
case 'CLUB':
$content['content'] = CopixZone::process('kernel|dashboardGrTravail', array('idZone' => $contentNode['id'], 'catalog' => $vocabularyCatalog->id_vc));
break;
case 'ROOT':
if ($contentNode['droit'] >= 60) {
$contentTpl = new CopixTpl();
$content['content'] = $contentTpl->fetch('zone.dashboard.root.tpl');
} else {
$contentTpl = new CopixTpl();
$content['content'] = $contentTpl->fetch('zone.dashboard.userext.tpl');
}
break;
default:
$content['content'] = '';
break;
}
}
//twitter integration
$twitterSrc = '';
if (!empty($content['social_stream'])) {
enic::to_load('social');
$twitter = new enicSocialTwitter();
$twitterSrc = $content['social_stream'];
}
//is admin :
$is_admin = $contentNode['droit'] >= 60;
//build html content
$content_tpl = new CopixTpl();
$content_tpl->assign('content', $content['content']);
if (!empty($content['picture'])) {
//.........这里部分代码省略.........