<?php
/**
 * @package linea21.core
 * @subpackage scale
 * @author linea21 <info@linea21.com>
 * @version $id SVN
 * @access public
 * @license http://opensource.org/licenses/gpl-3.0.html
 */

//////////// Check Inclusion de pages //////////// 
if (!function_exists('AuthenthificationProcess')){ 
include_once("../lib/lib_common.php");
ReloadIndex('admin');
}
////////////

$current_title=_t('scale','list');

$result=$sql_object->DBSelect($req_list2);

function display_scale($parent, $dep, $array, $rub_link) {
$html = "";
$prev_dep = 0;
 $link_sup=$rub_link."&amp;todo=sup&amp;id=";
	$link_mod=$rub_link."&amp;todo=mod&amp;id=";
	$link_det=$rub_link."&amp;todo=det&amp;id=";

if (!$dep && !$prev_dep) $html .= "\n<ul>\n";
foreach ($array as $item) {
  
    $current_id=$item['scale_id'];
		$current_denomination=formatText($item['scale_denomination'], '2HTML');
		
	if ($parent == $item['scale_root']) {
	if ($prev_dep < $dep) $html .= "\n<ul>\n";
	
	    $link =	"\t<a href=\"".$link_det.$current_id."\">".$current_denomination."</a>\n";	
	    if ($item['scale_root'] != 0) $link.="\t<a href=\"".$link_sup.$current_id."\" class=\"ico_sup\" title=\""._t('scale','sup')."\"></a>\n";
		$link.="\t<a href=\"".$link_mod.$current_id."\" class=\"ico_mod\" title=\""._t('scale','mod')."\"></a>\n";	
		
		
	$html .= "<li class=\"li".$dep."\">" . $link;
	$prev_dep = $dep;
	$html .= display_scale($item['scale_id'], ($dep + 1), $array, $rub_link);
	}
}
if (($prev_dep == $dep) && ($prev_dep != 0)) $html .= "</ul>\n</li>\n";
else if ($prev_dep == $dep) $html .= "</ul>\n";
else $html .= "</li>\n";
return $html;
}
?>
<div id="chemin">
	<ul>
		<li>
			<a href="index.php" class="chemin_home"><? echo _t('way','home'); ?></a>
		</li>
		<li>
			   <a href="<?php echo $rub_link; ?>" id="chemin_<? echo $rub; ?>" class="chemin_rub"><? echo _t('menu','scale'); ?></a>
		</li>
		<li>
			<span><? echo formatnavTitle($current_title); ?></span>
		</li>
	</ul>
</div>
<!--end barre haute -->
<?php
include_once(THEME_ADMIN_PATH."quickicons.php");
?>
<div class="contentcontainer">
<?php	include_once($dir."/menurub.php");	?>
<div id="content">
<h2><span class="semnone"><? echo formatTitleh2($current_title) ;?></span></h2>
<div id="tree">
<?
echo display_scale(0,0,$result, $rub_link);
?>
</div>
</div>
<?php include_once($dir."/help.php"); ?>
</div>
  
