742 lines
25 KiB
PHP
Executable File
742 lines
25 KiB
PHP
Executable File
<?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 package.template.php
|
|
* Ce fichier contient des methodes de gestion de la template principale+ affcihage d'éléments de saisie
|
|
*
|
|
* @author Rooty <www.rooty.me|rooty@rooty.me>
|
|
* @since 2018/07/06
|
|
* @link www.rooty.me
|
|
* @version 0.3
|
|
* @package package
|
|
* @subpackage template
|
|
* @copyright Copyright © 2009-2018, Rooty
|
|
*/
|
|
|
|
if ( !defined('SYSTEM_IN') )
|
|
{
|
|
die("Hacking attempt");
|
|
}
|
|
|
|
/**
|
|
* Fonction withBlocPath
|
|
*<P>Remplace un bloc de la template principale par un autre fichier de template<br>
|
|
* le chemin du fichier sera donné comme suit $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR'].$type."/".$classe."/".$action.".mxt"
|
|
* seul la classe et l'action sont obligatoires
|
|
*</P>
|
|
* @param chaine nom de la classe
|
|
* @param chaine nom de la methode (fichier sans le mxt)
|
|
* @param chaine type d'objet (/default object de coordination)
|
|
* @param chaine nom du bloc à remplacer (/default DATA)
|
|
* @return booleen
|
|
*/
|
|
function withBlocPath ($classe, $action, $type="object_coordination", $bloc="DATA")
|
|
{
|
|
$path=$GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR'].$type."/".strtolower($classe)."/".strtolower($action).".mxt";
|
|
|
|
if ( $GLOBALS["SYSTEM_TEMPLATE"]->isMxBloc($bloc) )
|
|
{
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc($bloc, "appe", $path);
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->WithMxPath($bloc, "relative");
|
|
return true;
|
|
}else{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
*function exitBloc : permet de sortir de revenir à la racine de modelixe pour la Template principale...
|
|
* @return booleen
|
|
*/
|
|
function exitBloc()
|
|
{
|
|
// Fin d'inclusion de la template
|
|
if (isset($GLOBALS["SYSTEM_TEMPLATE"]) && is_object($GLOBALS["SYSTEM_TEMPLATE"])){
|
|
if (get_class($GLOBALS["SYSTEM_TEMPLATE"])=="modelixe"){
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->WithMxPath(""); /* réinitialise le path Modelixe après utilisation */
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* fonction d'inclusion des titres de pages dans le bloc MX principal
|
|
* @return booleen
|
|
*/
|
|
function mxPageTitle($label, $compl=False)
|
|
{
|
|
if ( $GLOBALS["SYSTEM_TEMPLATE"]->isMxBloc("TITLELOAD") && isset($label) )
|
|
{
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("TITLELOAD", "modify", $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."headers/title.mxt");
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->WithMxPath("TITLELOAD", "appe");
|
|
|
|
if( !$compl )
|
|
{
|
|
if( getMessage($label) )
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("title", getMessage($label));
|
|
else
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("title", $label);
|
|
} else
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("title", getMessage($label)." ".$compl);
|
|
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->WithMxPath("");
|
|
return true;
|
|
} else {
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("TITLELOAD", "modify", $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."headers/title.mxt");
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxBloc("TITLELOAD", "delete");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* fonction d'inclusion des favicons de pages dans le bloc MX principal
|
|
* @return booleen
|
|
*/
|
|
function mxPageFavicon($favicon, $compl=False)
|
|
{
|
|
if ( $GLOBALS["SYSTEM_TEMPLATE"]->isMxBloc("FAVICONLOAD") && isset($favicon) )
|
|
{
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("FAVICONLOAD", "modify", $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."headers/favicon.mxt");
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->WithMxPath("FAVICONLOAD", "appe");
|
|
|
|
if( !$compl )
|
|
{
|
|
if( getMessage($favicon) )
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("linkFavicon", getMessage($favicon));
|
|
else
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("linkFavicon", $favicon);
|
|
} else
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("linkFavicon", getMessage($favicon)." ".$compl);
|
|
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->WithMxPath("");
|
|
return true;
|
|
} else {
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("FAVICONLOAD", "modify", $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."headers/favicon.mxt");
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxBloc("FAVICONLOAD", "delete");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* fonction d'inclusion des mots clés de pages dans le bloc MX principal
|
|
* @return booleen
|
|
*/
|
|
function mxPageKeywords($keywords, $compl=False)
|
|
{
|
|
if ( $GLOBALS["SYSTEM_TEMPLATE"]->isMxBloc("KEYWORDSLOAD") && isset($keywords) )
|
|
{
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("KEYWORDSLOAD", "modify", $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."headers/keywords.mxt");
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->WithMxPath("KEYWORDSLOAD", "appe");
|
|
|
|
if( !$compl )
|
|
{
|
|
if( getMessage($keywords) )
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("keywords", getMessage($keywords));
|
|
else
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("keywords", $keywords);
|
|
} else
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("keywords", getMessage($keywords)." ".$compl);
|
|
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->WithMxPath("");
|
|
return true;
|
|
} else {
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("KEYWORDSLOAD", "modify", $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."headers/keywords.mxt");
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxBloc("KEYWORDSLOAD", "delete");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* fonction d'inclusion des descriptions de pages dans le bloc MX principal
|
|
* @return booleen
|
|
*/
|
|
function mxPageDescription($description, $compl=False)
|
|
{
|
|
if ( $GLOBALS["SYSTEM_TEMPLATE"]->isMxBloc("DESCRIPTIONLOAD") && isset($description) )
|
|
{
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("DESCRIPTIONLOAD", "modify", $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."headers/description.mxt");
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->WithMxPath("DESCRIPTIONLOAD", "appe");
|
|
|
|
if( !$compl )
|
|
{
|
|
if( getMessage($description) )
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("description", getMessage($description));
|
|
else
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("description", $description);
|
|
} else
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("description", getMessage($description)." ".$compl);
|
|
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->WithMxPath("");
|
|
return true;
|
|
} else {
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("DESCRIPTIONLOAD", "modify", $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."headers/description.mxt");
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxBloc("DESCRIPTIONLOAD", "delete");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* fonction d'inclusion des descriptions de pages dans le bloc MX principal
|
|
* @return booleen
|
|
*/
|
|
function mxPageClassification($classification, $compl=False)
|
|
{
|
|
if ( $GLOBALS["SYSTEM_TEMPLATE"]->isMxBloc("CLASSIFICATIONLOAD") && isset($classification) )
|
|
{
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("CLASSIFICATIONLOAD", "modify", $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."headers/classification.mxt");
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->WithMxPath("CLASSIFICATIONLOAD", "appe");
|
|
|
|
if( !$compl )
|
|
{
|
|
if( getMessage($classification) )
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("description", getMessage($classification));
|
|
else
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("description", $classification);
|
|
} else
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("description", getMessage($classification)." ".$compl);
|
|
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->WithMxPath("");
|
|
return true;
|
|
} else {
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("CLASSIFICATIONLOAD", "modify", $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."headers/classification.mxt");
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxBloc("CLASSIFICATIONLOAD", "delete");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* fonction d'inclusion des descriptions de pages dans le bloc MX principal
|
|
* @return booleen
|
|
*/
|
|
function mxPageAuthor($author, $compl=False)
|
|
{
|
|
if ( $GLOBALS["SYSTEM_TEMPLATE"]->isMxBloc("AUTHORLOAD") && isset($author) )
|
|
{
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("AUTHORLOAD", "modify", $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."headers/author.mxt");
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->WithMxPath("AUTHORLOAD", "appe");
|
|
|
|
if( !$compl )
|
|
{
|
|
if( getMessage($author) )
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("description", getMessage($author));
|
|
else
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("description", $author);
|
|
} else
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("description", getMessage($author)." ".$compl);
|
|
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->WithMxPath("");
|
|
return true;
|
|
} else {
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("AUTHORLOAD", "modify", $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."headers/author.mxt");
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxBloc("AUTHORLOAD", "delete");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* fonction d'inclusion des headerss de pages dans le bloc MX principal
|
|
* @return booleen
|
|
*/
|
|
function mxPageHeaders($title, $keywords, $description, $classification, $author)
|
|
{
|
|
if( isset($title) && $title !="" && $title )
|
|
{
|
|
mxPageTitle($title);
|
|
return true;
|
|
} else {
|
|
|
|
return false;
|
|
}
|
|
|
|
if( isset($keywords) && is_array($keywords) )
|
|
{
|
|
mxPageKeywords($keywords);
|
|
return true;
|
|
} else {
|
|
|
|
return false;
|
|
}
|
|
|
|
if( isset($description) && $description !="" && $description )
|
|
{
|
|
mxPageDescription($description);
|
|
return true;
|
|
} else {
|
|
|
|
return false;
|
|
}
|
|
|
|
if( isset($classification) && is_array($classification) )
|
|
{
|
|
mxPageClassification($classification);
|
|
return true;
|
|
} else {
|
|
|
|
return false;
|
|
}
|
|
|
|
if( isset($author) && $author !="" && $author )
|
|
{
|
|
mxPageAuthor($author);
|
|
return true;
|
|
} else {
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* fonction d'inclusion des appels de feuilles de styles CSS
|
|
* @return booleen
|
|
*/
|
|
function mxCallCss($arrayCallCss)
|
|
{
|
|
if ( $GLOBALS["SYSTEM_TEMPLATE"]->isMxBloc("CSSLOAD") && is_array($arrayCallCss) && count($arrayCallCss)>0 )
|
|
{
|
|
// Auto loading of custom ccs file located in coordination object
|
|
if(is_file($GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."object_coordination/".strtolower($GLOBALS["SYSTEM_CONTROL"]->className)."/".strtolower($GLOBALS["SYSTEM_CONTROL"]->className).".css"))
|
|
{
|
|
$arrayCallCss[] = $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."object_coordination/".strtolower($GLOBALS["SYSTEM_CONTROL"]->className)."/".strtolower($GLOBALS["SYSTEM_CONTROL"]->className).".css";
|
|
}
|
|
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("CSSLOAD", "modify", $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."headers/css.mxt");
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->WithMxPath("CSSLOAD", "appe");
|
|
|
|
for ($j=0; $j<count($arrayCallCss); $j++)
|
|
{
|
|
if( is_string( $arrayCallCss[$j]) )
|
|
{
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("blocCSS".".hrefcss", $arrayCallCss[$j]);
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxBloc("blocCSS".".blocIntegrity", "delete");
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxBloc("blocCSS".".blocOrigin", "delete");
|
|
}elseif( is_array($arrayCallCss[$j]) )
|
|
{
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("blocCSS".".hrefcss", $arrayCallCss[$j]["href"]);
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("blocCSS".".blocIntegrity".".integrity", $arrayCallCss[$j]["integrity"]);
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("blocCSS".".blocOrigin".".origin", $arrayCallCss[$j]["origin"]);
|
|
}
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxBloc("blocCSS", "loop");
|
|
}
|
|
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->WithMxPath("");
|
|
return true;
|
|
} else {
|
|
// Auto loading of custom ccs file located in coordination object
|
|
if(is_file($GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."object_coordination/".strtolower($GLOBALS["SYSTEM_CONTROL"]->className)."/".strtolower($GLOBALS["SYSTEM_CONTROL"]->className).".css"))
|
|
{
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("CSSLOAD", "modify", $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."headers/css.mxt");
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->WithMxPath("CSSLOAD", "appe");
|
|
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("blocCSS".".hrefcss", $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."object_coordination/".strtolower($GLOBALS["SYSTEM_CONTROL"]->className)."/".strtolower($GLOBALS["SYSTEM_CONTROL"]->className).".css");
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxBloc("blocCSS".".blocIntegrity", "delete");
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxBloc("blocCSS".".blocOrigin", "delete");
|
|
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->WithMxPath("");
|
|
return true;
|
|
} else {
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("CSSLOAD", "modify", $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."headers/css.mxt");
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxBloc("CSSLOAD", "delete");
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* fonction d'inclusion des appels de scripts Javascript
|
|
* @return booleen
|
|
*/
|
|
function mxCallJs($arrayCallJs)
|
|
{
|
|
if ( $GLOBALS["SYSTEM_TEMPLATE"]->isMxBloc("JSLOAD") && is_array($arrayCallJs) && count($arrayCallJs)>0 )
|
|
// if ( is_array($arrayCallJs) && count($arrayCallJs)>0 )
|
|
{
|
|
// var_dump($arrayCallJs);
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("JSLOAD", "modify", $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."js.mxt");
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->WithMxPath("JSLOAD", "appe");
|
|
|
|
for ($j=0; $j<count($arrayCallJs); $j++)
|
|
{
|
|
if( is_string( $arrayCallJs[$j]) )
|
|
{
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("blocJS".".hrefjs", $arrayCallJs[$j]);
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxBloc("blocJS".".blocIntegrity", "delete");
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxBloc("blocJS".".blocOrigin", "delete");
|
|
}
|
|
elseif( is_array($arrayCallJs[$j]) )
|
|
{
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("blocJS".".hrefjs", $arrayCallJs[$j]["src"]);
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("blocJS".".blocIntegrity".".integrity", $arrayCallJs[$j]["integrity"]);
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("blocJS".".blocOrigin".".origin", $arrayCallJs[$j]["origin"]);
|
|
}
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxBloc("blocJS", "loop");
|
|
}
|
|
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->WithMxPath("");
|
|
return true;
|
|
} else {
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("JSLOAD", "modify", $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."js.mxt");
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("JSLOAD", 'delete');
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* fonction d'inclusion des appels de code Javascript brut
|
|
* @return booleen
|
|
*/
|
|
function mxRawJs($arrayRawJs)
|
|
{
|
|
// var_dump($arrayRawJs);
|
|
if ( $GLOBALS["SYSTEM_TEMPLATE"]->isMxBloc("JSRAWLOAD") && is_array($arrayRawJs) && count($arrayRawJs)>0 )
|
|
// if ( is_array($arrayRawJs) && count($arrayRawJs)>0 )
|
|
{
|
|
// var_dump($arrayRawJs);
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("JSRAWLOAD", "modify", $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."jsraw.mxt");
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->WithMxPath("JSRAWLOAD", "appe");
|
|
|
|
for ($j=0; $j<count($arrayRawJs); $j++)
|
|
{
|
|
// if( is_string( $arrayRawJs[$j]) )
|
|
// {
|
|
// var_dump($arrayRawJs);
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxText("blocRawJS".".contentjs", $arrayRawJs[$j]);
|
|
// }
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxBloc("blocRawJS", "loop");
|
|
}
|
|
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->WithMxPath("");
|
|
return true;
|
|
} else {
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("JSRAWLOAD", "modify", $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."jsraw.mxt");
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("JSRAWLOAD", 'delete');
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* affichage d'un object, ou tableau dans une template et à partir de block (la methode __mxPrint($block, $tpl) d'un objet permet d'ajouter des éléments d'affichage contextuels)
|
|
* @todo a tester absolument!!!
|
|
* @access public
|
|
* @return booleen
|
|
*/
|
|
function MxPrint($obj, $block, $tpl="")
|
|
{
|
|
$block=( ($block!="") && (substr($block, strlen($block)-1, 1)!=".") )?($block."."):$block;
|
|
$tpl=(is_object($tpl))?$tpl:$GLOBALS["SYSTEM_TEMPLATE"];
|
|
$tabToPrint=array();
|
|
|
|
if (is_object($obj)){
|
|
$tabToPrint=get_object_vars($obj);
|
|
|
|
if( in_array("__mxprint", get_class_methods(get_class($obj))) )
|
|
$obj->__mxPrint($block.strtoupper(get_class($obj)), $tpl);
|
|
|
|
}elseif(is_array($obj)){
|
|
$tabToPrint=$obj;
|
|
}
|
|
|
|
foreach($tabToPrint as $key=>$val){
|
|
if(is_object($val)){
|
|
MxPrint($block.strtoupper(get_class($val)), $tpl);
|
|
$tpl->MxBlock($block.strtoupper(get_class($val)), "loop");
|
|
}elseif(is_array($val)){
|
|
MxPrint($block.strtoupper($key), $tpl);
|
|
$tpl->MxBlock($block.strtoupper($key), "loop");
|
|
}else{
|
|
$tpl->MxText($block.$key, htmlentitiesconv($value) );
|
|
$tpl->MxAttribut($block.$key, htmlentitiesconv($value) );
|
|
}
|
|
}
|
|
|
|
if (is_object($obj)){
|
|
if( in_array("__mxprint", get_class_methods(get_class($obj))) ){
|
|
$obj->__mxPrint($block.strtoupper(get_class($obj)), $tpl);
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
*function printTabTreeGroup permet d'afficher une liste déroulante avec les groupes associés
|
|
*
|
|
*/
|
|
function printTabTreeGroup($tabTreeGroup, $selected, $MxBlocName="GROUP", $name="group_id", $opt='', $default='', $multiple='', $class='form')
|
|
{
|
|
global $SYSTEM_TEMPLATE;
|
|
|
|
/* gestion du lib en fonction de la langue courante */
|
|
$currentCode=$GLOBALS["SYSTEM_USER_SESSION"]->langue->getCode();
|
|
$defaultCode=$GLOBALS["SYSTEM_DEFAULT_LANGUAGE_CODE"];
|
|
$char="";
|
|
$tabSel=array();
|
|
|
|
for ($i=0; $i<count($tabTreeGroup); $i++)
|
|
{
|
|
$lib="";
|
|
$buff="";
|
|
|
|
/* Affichage du chemin si plusieurs entrées */
|
|
if (count($tabTreeGroup)>1)
|
|
{
|
|
$tabFather=$tabTreeGroup[$i]->getFatherArray();
|
|
$separ="";
|
|
for ($j=(count($tabFather)-1);$j>=0;$j--)
|
|
{
|
|
$buff=$separ.$tabTreeGroup[$i]->getLibelleFromGroup($tabFather[$j], $currentCode);
|
|
|
|
if ($buff=="")
|
|
$lib.=$separ.$tabTreeGroup[$i]->getLibelleFromGroup($tabFather[$j], $defaultCode);
|
|
else
|
|
$lib.=$buff;
|
|
$separ="/";
|
|
}
|
|
}else{
|
|
$lib=$tabTreeGroup[$i]->getLibelleFromGroup($tabTreeGroup[$i]->getId(), $currentCode);
|
|
if ($lib=="")
|
|
$lib=$tabTreeGroup[$i]->getLibelleFromGroup($tabTreeGroup[$i]->getId(), $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 = preg_replace("/^[[:space:]]*[a-z]+[.)".chr(176)."][[:space:]]+/i", "", $lib);
|
|
$tabSel[$tabTreeGroup[$i]->getId()]=$char.$lib;
|
|
$tabSel=printTreeGroupSon($tabSel, $tabTreeGroup[$i], $selected, $tabTreeGroup[$i]->getId(), "--", $MxBlocName);
|
|
}
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxSelect($MxBlocName, $name, $selected, $tabSel, $default, $multiple, $opt, "class=\"".$class."\"");
|
|
}
|
|
|
|
/**
|
|
*function PrintTabTreeGroup permet d'afficher une liste déroulante avec les groupes associés
|
|
*
|
|
*/
|
|
function printTreeGroupSon($tabSel, $TreeGroup, $selected, $id, $char="--", $MxBlocName="GROUP")
|
|
{
|
|
global $SYSTEM_TEMPLATE;
|
|
|
|
$charAdd="--";
|
|
$arrayLevel=$TreeGroup->getSonOfIdPereArray($id);
|
|
|
|
/* gestion du lib en fonction de la langue courante */
|
|
$currentCode=$GLOBALS["SYSTEM_USER_SESSION"]->langue->getCode();
|
|
$defaultCode=$GLOBALS["SYSTEM_DEFAULT_LANGUAGE_CODE"];
|
|
$tabName=array();
|
|
|
|
for ($i=0; $i<count($arrayLevel);$i++)
|
|
{
|
|
$lib=$TreeGroup->getLibelleFromGroup($arrayLevel[$i], $currentCode);
|
|
if ($lib=="")
|
|
$lib=$TreeGroup->getLibelleFromGroup($arrayLevel[$i], $defaultCode);
|
|
$tabName[$i]=$lib;
|
|
}
|
|
|
|
asort($tabName);
|
|
reset($tabName);
|
|
|
|
for ($i=0; $i<count($arrayLevel); $i++)
|
|
{
|
|
/*Fonction permettant de supprimer les numeros, le point et l'espace à l'affichage*/
|
|
// $tabName[$i] = eregi_replace("^[[:space:]]*[a-z]+[.)".chr(176)."][[:space:]]+", "", $tabName[$i]);
|
|
$tabName[$i] = preg_replace("/^[[:space:]]*[a-z]+[.)".chr(176)."][[:space:]]+/i", "", $tabName[$i]);
|
|
}
|
|
|
|
// while (list($i, $lib) = each($tabName))
|
|
foreach($tabName as $i => $lib)
|
|
{
|
|
$tabSel[$arrayLevel[$i]]=$char.$lib;
|
|
$tabSel=printTreeGroupSon($tabSel, $TreeGroup, $selected, $arrayLevel[$i], $char.$charAdd, $MxBlocName);
|
|
}
|
|
return $tabSel;
|
|
}
|
|
|
|
/**
|
|
*function PrintTabTreeNode permet d'afficher une liste déroulante avec les groupes associés
|
|
*
|
|
*/
|
|
function printTabTreeNode($tabTreeGroup, $selected, $MxBlocName="NODE", $name="node_id", $parentTree=false, $opt='', $default='', $attr='')
|
|
{
|
|
global $SYSTEM_TEMPLATE;
|
|
|
|
/* gestion du lib en fonction de la langue courante */
|
|
$currentCode=$GLOBALS["SYSTEM_USER_SESSION"]->langue->getCode();
|
|
$defaultCode=$GLOBALS["SYSTEM_DEFAULT_LANGUAGE_CODE"];
|
|
$tabSel=array();
|
|
|
|
for ($i=0; $i<count($tabTreeGroup); $i++)
|
|
{
|
|
if ($parentTree==true)
|
|
$tabFather=$tabTreeGroup[$i]->getFatherArray();
|
|
else
|
|
$tabFather=array($tabTreeGroup[$i]->getId());
|
|
|
|
$separ="";
|
|
|
|
for ($j=(count($tabFather)-1);$j>=0;$j--)
|
|
{
|
|
$lib=$separ.$tabTreeGroup[$i]->getLibelleFromNode($tabFather[$j], $currentCode);
|
|
if ($lib=="")
|
|
$lib=$separ.$tabTreeGroup[$i]->getLibelleFromNode($tabFather[$j], $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 = preg_replace("/^[[:space:]]*[a-z]+[.)".chr(176)."][[:space:]]+/i", "", $lib);
|
|
$tabSel[($tabFather[$j])]=$lib;
|
|
$separ.="--";
|
|
}
|
|
$tabSel=printTreeNodeSon($tabSel, $tabTreeGroup[$i], $selected, $tabTreeGroup[$i]->getId(), $separ, $MxBlocName);
|
|
}
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxSelect($MxBlocName, $name, $selected, $tabSel, $default, '', $opt, $attr);
|
|
}
|
|
|
|
/**
|
|
*function PrintTabTreeNode permet d'afficher une liste déroulante avec les groupes associés
|
|
* @return tableau
|
|
*/
|
|
function printTreeNodeSon($tabSel, $TreeGroup, $selected, $id, $char="--", $MxBlocName="NODE")
|
|
{
|
|
global $SYSTEM_TEMPLATE;
|
|
|
|
$charAdd="--";
|
|
$arrayLevel=$TreeGroup->getSonOfIdPereArray($id);
|
|
|
|
/* gestion du lib en fonction de la langue courante */
|
|
$currentCode=$GLOBALS["SYSTEM_USER_SESSION"]->langue->getCode();
|
|
$defaultCode=$GLOBALS["SYSTEM_DEFAULT_LANGUAGE_CODE"];
|
|
$tabName=array();
|
|
|
|
for ($i=0; $i<count($arrayLevel);$i++)
|
|
{
|
|
$lib=$TreeGroup->getLibelleFromNode($arrayLevel[$i], $currentCode);
|
|
|
|
if ($lib=="")
|
|
$lib=$TreeGroup->getLibelleFromNode($arrayLevel[$i], $defaultCode);
|
|
|
|
$tabName[$i]=$lib;
|
|
}
|
|
|
|
asort($tabName);
|
|
reset($tabName);
|
|
|
|
for ($i=0; $i<count($arrayLevel); $i++)
|
|
{
|
|
/*Fonction permettant de supprimer les numeros, le point et l'espace ïżœl'affichage*/
|
|
// $tabName[$i] = eregi_replace("^[[:space:]]*[a-z]+[.)".chr(176)."][[:space:]]+", "", $tabName[$i]);
|
|
$tabName[$i] = preg_replace("/^[[:space:]]*[a-z]+[.)".chr(176)."][[:space:]]+/i", "", $tabName[$i]);
|
|
}
|
|
|
|
// while (list($i, $lib) = each($tabName))
|
|
foreach($tabName as $i => $lib)
|
|
{
|
|
$tabSel[$arrayLevel[$i]]=$char.$lib;
|
|
$tabSel=printTreeNodeSon($tabSel, $TreeGroup, $selected, $arrayLevel[$i], $char.$charAdd, $MxBlocName);
|
|
}
|
|
return $tabSel;
|
|
}
|
|
|
|
/**
|
|
*function PrintTabUser permet d'afficher une liste déroulante avec les Utilisateurs associés
|
|
*<P>se sert de <br>
|
|
*MxAttribut : UserId<br>
|
|
*Optionnel<br>
|
|
*Mxtext : UserFirstName<br>
|
|
*MxText : UserLastName<br>
|
|
*MxText : UserLoginName
|
|
*</P>
|
|
*<P>Les utilisateurs sont triés par ordre Alpha sur le firstName</P>
|
|
* @param tableau objets utilisateurs
|
|
* @param entier identifiant du selectionné
|
|
* @param chaine nom du bloc Mx a utiliser
|
|
* @return booleen
|
|
*/
|
|
function printTabUser($tabUser, $selected, $MxBlocName="USER", $name="user_id", $opt='', $default='', $class='form')
|
|
{
|
|
global $SYSTEM_TEMPLATE;
|
|
|
|
/* Pour le Tri/Nom */
|
|
$tabName=array();
|
|
$tabValue=array();
|
|
|
|
for ($i=0; $i<count($tabUser);$i++)
|
|
{
|
|
$lib=$tabUser[$i]->getFirstName();
|
|
$tabName[$i]=$lib;
|
|
}
|
|
|
|
asort($tabName);
|
|
reset($tabName);
|
|
$j=0;
|
|
|
|
// Pour l'affichage
|
|
// while (list($i, $lib) = each($tabName))
|
|
foreach($tabName as $i => $lib)
|
|
{
|
|
if (is_object($tabUser[$i]))
|
|
{
|
|
$tabValue[$tabUser[$i]->getId()]=htmlentitiesconv($tabUser[$i]->getFirstName()." ".$tabUser[$i]->getLastName());
|
|
$j++;
|
|
}
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxSelect($MxBlocName, $name, $selected, $tabValue, $default, '', $opt, "class=\"".$class."\"");
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
*function PrintTabCommProfiles permet d'afficher une liste déroulante avec des Profils de communauté
|
|
*<P>se sert de <br>
|
|
*MxAttribut : UserId<br>
|
|
*Optionnel<br>
|
|
*Mxtext : UserFirstName<br>
|
|
*MxText : UserLastName<br>
|
|
*MxText : UserLoginName
|
|
*</P>
|
|
*<P>Les utilisateurs sont triés par ordre Alpha sur le firstName</P>
|
|
* @param tableau objets utilisateurs
|
|
* @param entier identifiant du selectionné
|
|
* @param chaine nom du bloc Mx a utiliser
|
|
* @return booleen
|
|
*/
|
|
function printTabCommProfiles($selected='', $MxBlocName="COMMPROFILES", $name="commprofile_id", $opt='', $default='Profil par défaut', $attr='')
|
|
{
|
|
global $SYSTEM_TEMPLATE;
|
|
$arrayCommProfiles = array("blog"=>"Blog", "asso"=>"Association", "steam"=>"Steam", "vitrine"=>"Vitrine", "ecommerce"=>"E-commerce");
|
|
|
|
asort($arrayCommProfiles);
|
|
// reset($arrayCommProfiles);
|
|
|
|
$GLOBALS['SYSTEM_TEMPLATE']->MxSelect($MxBlocName, $name, $selected, $arrayCommProfiles, $default, '', $opt, $attr);
|
|
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* lineStyle : applique les style de ligne des tableaux
|
|
* utiliser dans un block (tableau), l'attribut lineStyle qui fera référence aux classes: lineStyle1 && lineStyle2
|
|
* @param tableau objets utilisateurs
|
|
* @param entier identifiant du selectionné
|
|
* @param chaine nom du bloc Mx a utiliser
|
|
* @return booleen
|
|
*/
|
|
function lineStyle($block){
|
|
static $tab;
|
|
$tab[$block]=(isset($tab[$block])?$tab[$block]:0);
|
|
if( ($tab[$block]%2) && (isset($GLOBALS["SYSTEM_TEMPLATE"]))){
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut($block.".lineStyle", "lineStyle1");
|
|
}elseif((isset($GLOBALS["SYSTEM_TEMPLATE"]))){
|
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut($block.".lineStyle", "lineStyle2");
|
|
}
|
|
$tab[$block]++;
|
|
}
|
|
?>
|