<?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.
*
*
* @author Rooty <www.rooty.me|rooty@rooty.me>
* @since 2005/03/09
* @link www.rooty.me
* @version 0.3
* @package package
* @subpackage tabe
* @copyright Copyright &copy; 2004-2005, Initiance
*/

if ( !defined('SYSTEM_IN') )
{
 die("Hacking attempt");
}

/**
*function printTabeAdmin permet d'afficher les onglets d'administration pour chaque brique
*<P>L'ordre ou indice des tableau doivent être correspondant</P>
*<P>La syntaxe Mx doit être la suivante :<br>
*&lt;mx:bloc id="TabeB"&gt;<BR/>
*	&lt;TD valign="bottom"&gt;<BR/>
*	&lt;TABLE border="0" mXattribut="class:TabeView"  mXattribut="cellpadding:TabeViewCell" cellspacing="0"&gt;<BR/>
*	&lt;TR&gt;<BR/>
*		&lt;TD&gt;<img mXattribut="src:pictoTabe" border="0"/&gt;&lt;/TD&gt;<BR/>
*		&lt;TD&gt;<a mXattribut="href:UrlTabeView"  mXattribut="class:ClassTabeView"&gt;&lt;mx:text id="TabeNameView"/&gt;&lt;/a&gt;<BR/></TD&gt;<BR/>
*	&lt;/TR&gt;<BR/>
*	&lt;/TABLE&gt;<BR/>
*	&lt;/TD&gt;<BR/>
*&lt;/mx:bloc id="TabeB"&gt;<BR/>
*</P>
*<P>Les styles css utilisés sont:<br>
*WindowTabeData
*WindowTabeDataSelected
*</P>
* @param chaine nom du bloc modelixe
* @param tableau libelles des onglets
* @param tableau url des onglets
* @param tableau picto des onglets
* @param tableau tableau de tableau des action des onglets
* @param chaine servant pour une selection d'un paramètre autre que la méthode
* @param chaine nom du style css selectionné
* @param chaine nom du style css / défaut
* @return booleen
*/
function printTabeAdmin($MxBlocName, $tabTabe, $TabUrlTabe, $tabPictoTabe, $tabAction, $flag_param="*", $styleSelected="nav-item font-weight-bold active", $style="nav-item font-weight-bold")
{
	global $SYSTEM_TEMPLATE;
	$selected = "";

	if($flag_param == "*"){
        $selected = $GLOBALS["SYSTEM_CONTROL"]->methodName;
	} else {
        $selected = $flag_param;
	}

	for ($i=0; $i<count($tabTabe); $i++)
	{
		for ($j=0; $j<count($tabAction[$i]);$j++)
		{
			$tabAction[$i][$j]=strtolower($tabAction[$i][$j]);
		}

		if(in_array(strtolower($selected),$tabAction[$i]))
		{
// 			$GLOBALS['SYSTEM_TEMPLATE']->MxAttribut($MxBlocName.".pictoTabe", $GLOBALS["SYSTEM_TEMPLATE_PATH"].$GLOBALS["SYSTEM_TEMPLATE_DIR"]."media/picto/".$tabPictoTabe[$i]);
			$GLOBALS['SYSTEM_TEMPLATE']->MxText($MxBlocName.".pictoTabe", $tabPictoTabe[$i]);
			$GLOBALS['SYSTEM_TEMPLATE']->MxAttribut($MxBlocName.".UrlTabeView", $TabUrlTabe[$i]);
			$GLOBALS['SYSTEM_TEMPLATE']->MxText($MxBlocName.".TabeNameView", getMessage($tabTabe[$i]));
			$GLOBALS['SYSTEM_TEMPLATE']->MxAttribut($MxBlocName.".TabeNameView", getMessage($tabTabe[$i]));

			/* Presentation */
			$GLOBALS['SYSTEM_TEMPLATE']->MxAttribut($MxBlocName.".ClassTabeView", "nav-link text-nowrap active");
			$GLOBALS['SYSTEM_TEMPLATE']->MxAttribut($MxBlocName.".TabeViewCell",2);
			$GLOBALS['SYSTEM_TEMPLATE']->MxAttribut($MxBlocName.".TabeView", $styleSelected);

			/* Pour l'élément séléectionné, appel a la balise $MxBlocNameTabeNameView */
// 			$GLOBALS['SYSTEM_TEMPLATE']->MxAttribut($MxBlocName."pictoTabe", $GLOBALS["SYSTEM_TEMPLATE_PATH"].$GLOBALS["SYSTEM_TEMPLATE_DIR"]."media/picto/".$tabPictoTabe[$i]);
			$GLOBALS['SYSTEM_TEMPLATE']->MxText($MxBlocName."pictoTabe", $tabPictoTabe[$i]);
			$GLOBALS['SYSTEM_TEMPLATE']->MxAttribut($MxBlocName."UrlTabeView", $TabUrlTabe[$i]);
			$GLOBALS['SYSTEM_TEMPLATE']->MxText($MxBlocName."TabeNameView", getMessage($tabTabe[$i]));
			$GLOBALS['SYSTEM_TEMPLATE']->MxAttribut($MxBlocName."TabeNameView", getMessage($tabTabe[$i]));
		}
		else
		{
// 			$GLOBALS['SYSTEM_TEMPLATE']->MxAttribut($MxBlocName.".pictoTabe", $GLOBALS["SYSTEM_TEMPLATE_PATH"].$GLOBALS["SYSTEM_TEMPLATE_DIR"]."media/picto/".$tabPictoTabe[$i]);
			$GLOBALS['SYSTEM_TEMPLATE']->MxText($MxBlocName.".pictoTabe", $tabPictoTabe[$i]);
			$GLOBALS['SYSTEM_TEMPLATE']->MxAttribut($MxBlocName.".UrlTabeView", $TabUrlTabe[$i]);
			$GLOBALS['SYSTEM_TEMPLATE']->MxText($MxBlocName.".TabeNameView", getMessage($tabTabe[$i]));
			$GLOBALS['SYSTEM_TEMPLATE']->MxAttribut($MxBlocName.".TabeNameView", getMessage($tabTabe[$i]));

			/* Presentation */
			$GLOBALS['SYSTEM_TEMPLATE']->MxAttribut($MxBlocName.".ClassTabeView", "nav-link text-nowrap");
			$GLOBALS['SYSTEM_TEMPLATE']->MxAttribut($MxBlocName.".TabeViewCell",1);
			$GLOBALS['SYSTEM_TEMPLATE']->MxAttribut($MxBlocName.".TabeView", $style);
		}
		$GLOBALS['SYSTEM_TEMPLATE']->MxBloc($MxBlocName, "loop");
	}
	return true;
}
?>