164 lines
4.6 KiB
PHP
164 lines
4.6 KiB
PHP
|
<?php
|
||
|
|
||
|
/**-----------------------------------------------
|
||
|
*
|
||
|
* Rooty, 2018 <rooty@rooty.me>
|
||
|
*
|
||
|
*
|
||
|
* 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 ObjectEntryNodePrint.php
|
||
|
*
|
||
|
* Ce fichier contient la classe ObjectEntryNodePrint
|
||
|
*
|
||
|
* @author Initiance <www.initiance.com|martial@initiance.com>
|
||
|
* @copyright Copyright © 2009-2018, Rooty
|
||
|
* @since 2004/06/07
|
||
|
* @version 0.3
|
||
|
* @link www.rooty.me
|
||
|
* @package object_printing
|
||
|
* @subpackage ObjectEntryNodePrint
|
||
|
*/
|
||
|
|
||
|
if ( !defined('SYSTEM_IN') )
|
||
|
{
|
||
|
die("Hacking attempt");
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Classe ObjectEntryNodePrint
|
||
|
*<p>Cette classe permet la recuperation des ObjectPrint</p>
|
||
|
* @package object_printing
|
||
|
* @subpackage ObjectEntryNodePrint
|
||
|
*/
|
||
|
|
||
|
class ObjectEntryNodePrint extends Printing
|
||
|
{
|
||
|
//
|
||
|
// Constructor
|
||
|
//
|
||
|
/**
|
||
|
* Constructeur de la classe ObjectPrint
|
||
|
* @access public
|
||
|
*/
|
||
|
function ObjectEntryNodePrint()
|
||
|
{
|
||
|
$this->__construct();
|
||
|
}
|
||
|
|
||
|
function __construct()
|
||
|
{
|
||
|
parent::__construct("1.0", "Olivier DEVAINE", "Affichage de l'Object");
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Remplace dans la template principale
|
||
|
* @access public
|
||
|
*/
|
||
|
function __print()
|
||
|
{
|
||
|
$this->printForNode($GLOBALS["SYSTEM_USER_SESSION"]->navigationNodeId);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* affichage d'un noeud et de tous ses sous noeuds
|
||
|
* @access public
|
||
|
*/
|
||
|
function printForNode($nodeId)
|
||
|
{
|
||
|
global $SERVER_NAME, $SCRIPT_NAME, $CONF_PERSISTANT_SECURE;
|
||
|
$tabObject =$this->getObjectSon(eid());
|
||
|
|
||
|
if (count($tabObject)<=0)
|
||
|
return "";
|
||
|
|
||
|
$MaTemplate = new ModeliXe($GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."object_printing/objectentrynodeprint/object.mxt");
|
||
|
$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 */
|
||
|
|
||
|
$MaTemplate->MxText("ObjectPrintName", getMessage("ObjectPrintName"));
|
||
|
$MaTemplate->WithMxPath("bloc1", "relative");
|
||
|
|
||
|
/* Pour le Tri/Nom */
|
||
|
$tabName=array();
|
||
|
|
||
|
for ($i=0; $i<count($tabObject);$i++)
|
||
|
{
|
||
|
$lib=$tabObject[$i][1]->getName($currentCode);
|
||
|
if ($lib=="")
|
||
|
{
|
||
|
$lib=$tabObject[$i][1]->getName($defaultCode);
|
||
|
}
|
||
|
$tabName[$i]=$lib;
|
||
|
}
|
||
|
asort($tabName);
|
||
|
reset($tabName);
|
||
|
while (list($i, $lib) = each($tabName))
|
||
|
{
|
||
|
/* recuperation de l'image de la langue courante */
|
||
|
if (file_exists($GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."media/picto/object/".strtolower($tabObject[$i][1]->getIcone())) && ($tabObject[$i][1]->getIcone()!=""))
|
||
|
{
|
||
|
$img=$GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."media/picto/object/".strtolower($tabObject[$i][1]->getIcone());
|
||
|
}else{
|
||
|
$img=$GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."media/picto/object/defaultobject.gif";
|
||
|
}
|
||
|
|
||
|
$urlToGo = formatUrl($tabObject[$i][1]->getId(), $tabObject[$i][0]->getClassName(), $tabObject[$i][0]->getMethodName());
|
||
|
|
||
|
/* pour l'url */
|
||
|
$MaTemplate->MxAttribut("objectUrl", ($urlToGo));
|
||
|
|
||
|
$lib=$tabObject[$i][1]->getName($currentCode);
|
||
|
|
||
|
if ($lib=="")
|
||
|
{
|
||
|
$lib=$tabObject[$i][1]->getName($defaultCode);
|
||
|
}
|
||
|
|
||
|
//$page -> MxImage(string $path, string $imageFile, [string $title], [string $imageAttribut], [string $getSize]);
|
||
|
$MaTemplate->MxImage("pictoObject", $img ,htmlentitiesconv($lib)," border='0'");
|
||
|
|
||
|
/* objet en cours */
|
||
|
if ( ($tabObject[$i][1]->getId()==oid() ) && ( strtolower($tabObject[$i][0]->getClassName())==strtolower(className())) && (!(strpos(strtolower(methodName()), strtolower(str_replace("action","",$tabObject[$i][0]->getMethodName())))===false)) )
|
||
|
$MaTemplate->MxAttribut("style", "ObjectSelected");
|
||
|
else
|
||
|
$MaTemplate->MxAttribut("style", "Object");
|
||
|
/* Fin des objets en cours */
|
||
|
|
||
|
/*Fonction permettant de supprimer les numeros, le point et l'espace à l'affichage*/
|
||
|
// if( !strstr("0.", $lib) )
|
||
|
$lib = eregi_replace("^[[:space:]]*[a-z]+[.)".chr(176)."][[:space:]]+", "", $lib);
|
||
|
// else
|
||
|
// $lib = "";
|
||
|
|
||
|
// var_dump($lib);
|
||
|
|
||
|
$MaTemplate->MxText("objectName", htmlentitiesconv($lib));
|
||
|
$MaTemplate->MxBloc("", "loop");
|
||
|
}
|
||
|
$data=$MaTemplate->MxWrite();
|
||
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("objectentrynodeprint", $data); // Et voila!!!!!
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* recupere les fils d'un noeud depuis le noeud principal
|
||
|
* @access public
|
||
|
*/
|
||
|
function getObjectSon($nodeId)
|
||
|
{
|
||
|
$tab=$GLOBALS["SYSTEM_CONTROL"]->getListObjectForNavigation($nodeId);
|
||
|
return $tab;
|
||
|
}
|
||
|
}
|
||
|
?>
|