281 lines
8.5 KiB
PHP
Executable File
281 lines
8.5 KiB
PHP
Executable File
<?php
|
|
|
|
/**-----------------------------------------------
|
|
*
|
|
* Granilim (C) 2004-2006, Limousin expansion
|
|
* Limousin expansion contact@granilim.org
|
|
*
|
|
* This software is protected by copyright, please
|
|
* read the file COPYRIGHT.
|
|
* This program is distributed in the hope that it
|
|
* will be useful, but without any warranty; without
|
|
* even the implied warranty of merchantability or
|
|
* fitness for a particular purpose. Please
|
|
* read the file LICENCE.
|
|
*
|
|
* Fichier NavigationPrint.php
|
|
*
|
|
* Ce fichier contient la classe NavigationPrint
|
|
*<BR>
|
|
* @author Initiance <www.initiance.com|martial@initiance.com>
|
|
* @copyright Copyright © 2004-2006, Limousin expansion
|
|
* @since 2004/06/07
|
|
* @version 0.1
|
|
* @link www.granilim.org
|
|
* @package object_printing
|
|
* @subpackage NavigationPrint
|
|
*/
|
|
if ( !defined('SYSTEM_IN') )
|
|
{
|
|
die("Hacking attempt");
|
|
}
|
|
|
|
/**
|
|
* Classe NavigationPrint
|
|
*<p>cette classe permet la recuperation de l'NavigationPrint</p>
|
|
* @package object_printing
|
|
* @subpackage NavigationPrint
|
|
*/
|
|
class NavigationPrint extends Printing
|
|
{
|
|
|
|
//
|
|
// Constructor
|
|
//
|
|
/**
|
|
* Constructeur de la classe NavigationPrint
|
|
* @access public
|
|
*/
|
|
function NavigationPrint()
|
|
{
|
|
$this->__construct();
|
|
}
|
|
|
|
function __construct()
|
|
{
|
|
parent::__construct("1.0", "Olivier DEVAINE", "Affichage de la NavigationNode");
|
|
}
|
|
|
|
/**
|
|
* Remplace dans la template principale
|
|
* @access public
|
|
*/
|
|
function __print()
|
|
{
|
|
/* gestion du lib en fonction de la langue courante */
|
|
$currentCode=$GLOBALS["SYSTEM_USER_SESSION"]->langue->getCode();
|
|
$defaultCode=$GLOBALS["SYSTEM_DEFAULT_LANGUAGE_CODE"];
|
|
/* fin récupération des codes par defaut */
|
|
|
|
$MaTemplate = new ModeliXeQware($GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."object_printing/navigationprint/main.mxt");
|
|
$MaTemplate->SetModeliXe(true);
|
|
$MaTemplate->MxText("NavigationPrintName", getMessage("NavigationPrintName"));
|
|
$Node =$GLOBALS["SYSTEM_USER_SESSION"]->getNode($GLOBALS["SYSTEM_USER_SESSION"]->entryNodeId);
|
|
|
|
/* recuperation de l'image de la langue courante */
|
|
if (file_exists("data/image/icons/node/".strtolower($Node->getIcone())) && ($Node->getIcone()!=""))
|
|
{
|
|
$img="data/image/icons/node/".strtolower($Node->getIcone());
|
|
}else{
|
|
$img="data/image/icons/node/defaultnode.gif";
|
|
}
|
|
|
|
$urlToGo = formatUrlNode("navigationNode", $Node->getId());
|
|
|
|
/* pour l'url */
|
|
$MaTemplate->MxAttribut("nodeUrl", htmlentitiesconv($urlToGo));
|
|
$lib=$Node->getLibelle($currentCode);
|
|
if ($lib=="")
|
|
{
|
|
$lib=$Node->getLibelle($defaultCode);
|
|
}
|
|
|
|
$MaTemplate->MxImage("pictoNode", $img ,htmlentitiesconv($lib),"");
|
|
|
|
/* objet en cours */
|
|
if ($Node->getId()==nid())
|
|
$MaTemplate->MxAttribut("style", "NavigationSelected");
|
|
else
|
|
$MaTemplate->MxAttribut("style", "Navigation");
|
|
/* Fin des objets en cours */
|
|
|
|
$MaTemplate->MxText("nodeName", htmlentitiesconv($lib));
|
|
|
|
/* On affiche les noeuds suivants */
|
|
$forNode=$this->printForNode($GLOBALS["SYSTEM_USER_SESSION"]->entryNodeId);
|
|
$MaTemplate->MxText("Navigation", $forNode);
|
|
$data=$MaTemplate->MxWrite();
|
|
|
|
if ($forNode!="")
|
|
{
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("navigationprint", $data);
|
|
}else{
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("navigationprint", "");
|
|
}
|
|
}
|
|
|
|
/**
|
|
* affichage d'un noeud et de tous ses sous noeuds
|
|
* @access public
|
|
*/
|
|
function printForNode($nodeId, $modelixeMxt="navigationnode.mxt")
|
|
{
|
|
global $SERVER_NAME, $SCRIPT_NAME, $CONF_PERSISTANT_SECURE;
|
|
|
|
$MaTemplate = new ModeliXeQware($GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."object_printing/navigationprint/".$modelixeMxt);
|
|
$MaTemplate->SetModeliXe(true);
|
|
|
|
/* gestion du lib en fonction de la langue courante */
|
|
$currentCode=$GLOBALS["SYSTEM_USER_SESSION"]->langue->getCode();
|
|
$defaultCode=$GLOBALS["SYSTEM_DEFAULT_LANGUAGE_CODE"];
|
|
/* fin récupération des codes par defaut */
|
|
|
|
/**
|
|
* recuperation des "tools"
|
|
* recuperation des "reps"
|
|
* + merge des 2 tableaux
|
|
*/
|
|
$tabObj=array_merge($this->getNodeSon($nodeId), $this->getObjectSon($nodeId));
|
|
|
|
/* Pour le Tri/Nom */
|
|
$tabName=array();
|
|
for ($i=0; $i<count($tabObj);$i++)
|
|
{
|
|
if(!is_object($tabObj[$i])) // c un obj!!!!
|
|
{
|
|
$lib=$tabObj[$i][1]->getName($currentCode);
|
|
if ($lib=="")
|
|
{
|
|
$lib=$tabObj[$i][1]->getName($defaultCode);
|
|
}
|
|
}else{
|
|
$lib=$tabObj[$i]->getLibelle($currentCode);
|
|
if ($lib=="")
|
|
{
|
|
$lib=$tabObj[$i]->getLibelle($defaultCode);
|
|
}
|
|
}
|
|
$tabName[$i]=$lib;
|
|
}
|
|
asort($tabName);
|
|
reset($tabName);
|
|
while (list($i, $lib) = each($tabName))
|
|
{
|
|
/* en fonction de l'obj */
|
|
if(is_object($tabObj[$i])) // c un dir!!!!
|
|
{
|
|
/* recuperation de l'image de la langue courante */
|
|
if (file_exists("data/image/icons/node/".strtolower($tabObj[$i]->getIcone())) && ($tabObj[$i]->getIcone()!=""))
|
|
{
|
|
$img="data/image/icons/node/".strtolower($tabObj[$i]->getIcone());
|
|
}else{
|
|
$img="data/image/icons/node/defaultnode.gif";
|
|
}
|
|
|
|
/* on prepare l'url */
|
|
$urlToGo = formatUrlNode("navigationNode", $tabObj[$i]->getId());
|
|
|
|
/* pour l'url */
|
|
$MaTemplate->MxAttribut("bloc1.nodeUrl", ($urlToGo));
|
|
$lib=$tabObj[$i]->getLibelle($currentCode);
|
|
if ($lib=="")
|
|
{
|
|
$lib=$tabObj[$i]->getLibelle($defaultCode);
|
|
}
|
|
|
|
/*Fonction permettant de supprimer les numeros, le point et l'espace à l'affichage*/
|
|
// $lib = eregi_replace("^[[:space:]]*[a-z]+[.)".chr(176)."][[:space:]]+", "", $lib);
|
|
$lib = ltrim(substr( $lib, strpos($lib, ". "), strlen($lib) ), ". ");
|
|
$MaTemplate->MxImage("bloc1.pictoNode", $img ,htmlentitiesconv($lib),"");
|
|
|
|
/* objet en cours */
|
|
$bool=false;
|
|
$tabSon=$GLOBALS["SYSTEM_USER_SESSION"]->listUserNode->getSonOfNodeAllowed(eid(),$tabObj[$i]->getId());
|
|
for($l=0;$l<count($tabSon);$l++)
|
|
{
|
|
if ($tabSon[$l]->getId()==nid())
|
|
{
|
|
$bool=true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if ($tabObj[$i]->getId()==nid() || $bool==true)
|
|
$MaTemplate->MxAttribut("bloc1.class", "active");
|
|
else
|
|
$MaTemplate->MxAttribut("bloc1.class", "none");
|
|
/* Fin des objets en cours */
|
|
|
|
$MaTemplate->MxText("bloc1.nodeName", htmlentitiesconv($lib)."1");
|
|
// on récupére les sous niveau...
|
|
|
|
$ssLevel=$this->printForNode($tabObj[$i]->getId(), ( (($modelixeMxt=="navigationsub.mxt") || ($modelixeMxt=="navigationdiv.mxt")) && (($modelixeMxt!="navigationnode.mxt"))?"navigationdiv.mxt":"navigationsub.mxt"));
|
|
$MaTemplate->MxText("bloc1.nodeDir", $ssLevel);
|
|
}else{
|
|
/* recuperation de l'image de la langue courante */
|
|
if (file_exists("data/image/icons/object/".strtolower($tabObj[$i][1]->getIcone())) && ($tabObj[$i][1]->getIcone()!=""))
|
|
{
|
|
$img="data/image/icons/object/".strtolower($tabObj[$i][1]->getIcone());
|
|
}else{
|
|
$img="data/image/icons/object/defaultobject.gif";
|
|
}
|
|
|
|
$urlToGo = formatUrl($tabObj[$i][1]->getId(), $tabObj[$i][0]->getClassName(), $tabObj[$i][0]->getMethodName(),"","",$tabObj[$i][0]->getNodeId());
|
|
|
|
/* pour l'url */
|
|
$MaTemplate->MxAttribut("bloc1.nodeUrl", $urlToGo);
|
|
$lib=$tabObj[$i][1]->getName($currentCode);
|
|
|
|
if ($lib=="")
|
|
{
|
|
$lib=$tabObj[$i][1]->getName($defaultCode);
|
|
}
|
|
|
|
//$page -> MxImage(string $path, string $imageFile, [string $title], [string $imageAttribut], [string $getSize]);
|
|
$MaTemplate->MxImage("bloc1.pictoNode", $img ,htmlentitiesconv($lib), "");
|
|
|
|
/* objet en cours */
|
|
if ( ($tabObj[$i][1]->getId()==oid() ) && ( strtolower($tabObj[$i][0]->getClassName())==strtolower(className())) && (!(strpos(strtolower(methodName()), strtolower(str_replace("action","",$tabObj[$i][0]->getMethodName())))===false)) )
|
|
$MaTemplate->MxAttribut("bloc1.class", "active");
|
|
else
|
|
$MaTemplate->MxAttribut("bloc1.class", "none");
|
|
/* Fin des objets en cours */
|
|
|
|
/*Fonction permettant de supprimer les numeros, le point et l'espace à l'affichage*/
|
|
// $lib = eregi_replace("^[[:space:]]*[a-z]+[.)".chr(176)."][[:space:]]+", "", $lib);
|
|
$lib = ltrim(substr( $lib, strpos($lib, ". "), strlen($lib) ), ". ");
|
|
|
|
$MaTemplate->MxText("bloc1.nodeName", htmlentitiesconv($lib)."2");
|
|
$MaTemplate->MxText("bloc1.nodeDir", "");
|
|
}
|
|
$MaTemplate->MxBloc("bloc1", "loop");
|
|
}
|
|
if (count($tabName)!=0)
|
|
$data=$MaTemplate->MxWrite();
|
|
else
|
|
$data="";
|
|
return $data;
|
|
}
|
|
|
|
/**
|
|
* recupere les repertoires d'un noeud
|
|
* @access public
|
|
*/
|
|
function getNodeSon($nodeId)
|
|
{
|
|
$tab=$GLOBALS["SYSTEM_USER_SESSION"]->getSonOfNodeAllowed($nodeId);
|
|
return $tab;
|
|
}
|
|
|
|
/**
|
|
* recupere les fils d'un noeud depuis le noeud principal
|
|
* @access public
|
|
*/
|
|
function getObjectSon($nodeId)
|
|
{
|
|
$tab=$GLOBALS["SYSTEM_CONTROL"]->getListObjectForNavigation($nodeId);
|
|
return $tab;
|
|
}
|
|
}
|
|
?>
|