<?php
/**
 * @package linea21.modules
 * @subpackage sdi
 * @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');
}
////////////

$result=$sql_object->DBSelect($req_list_theme);
$sdi_object= new sdi;
//$result_sdi=$sdi_object->GetListSdi($filter="R", $valueparam=0, $sql_object);
$req_sdi=SQL_getListSdi($filter="R", $valueparam=0);
$result_sdi = $sql_object -> DBSelect($req_sdi);

$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=";


$listing='<ul>'.END_LINE;

$current_sdtheme='';
for ($i=0;$i<count($result);$i++){
	if ($result[$i]['sdtheme_id']!=$current_sdtheme) {
	  if($i<>0) $listing.="</ul>\n</li>\n";
		$current_sdtheme=$result[$i]['sdtheme_id'];
		$listing.="<li class=\"li0\">\n";
		$listing.="\t<a  class=\"nolink\" href=\"#\">".formatText($result[$i]['sdtheme_name'], '2HTML')."</a>\n";
    $listing.="<ul>\n";
	}
	else 
	{
	$listing.="<li class=\"li1\">\n";
	$listing.="\t<a class=\"nolink\" href=\"#\">".cutText(formatText($result[$i]['theme_name'], '2HTML'), 90, 1)."</a>\n";
	$listing.="\n<ul>\n";
	
	for ($j=0;$j<count($result_sdi);$j++){
	if ($result[$i]['theme_id']==$result_sdi[$j]['sdii_theme']) {
	$listing.="<li class=\"li2\">\n";
	$listing.="\t<a href=\"".$link_det.$result_sdi[$j]['sdii_id']."\" title=\"".formatText($result_sdi[$j]['sdii_name'], '2HTML')."\">".cutText(formatText($result_sdi[$j]['sdii_name'], '2HTML'), 90, 1)."</a>\n";
	if ($result_sdi[$j]['sdii_statut']=='D') $listing.="<span class=\"state\">"._t('statut','draft')."</span>";
	$listing.="\t<a href=\"".$link_sup.$result_sdi[$j]['sdii_id']."\" title=\""._t('sdi','sup')."\" class=\"ico_sup\"></a>\n";
	$listing.="\t<a href=\"".$link_mod.$result_sdi[$j]['sdii_id']."\" title=\""._t('sdi','mod')."\" class=\"ico_mod\"></a>\n";
	$listing.="</li>\n";   
	}
	}
	$listing.="</ul>\n</li>\n";
	}
}
$listing.="</ul>\n";
?>
<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','sdi');?></a>
		</li>
		<li>
			<span><? echo _t('sdi','list'); ?></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">
<div id="tree">
<?
echo $listing;
?>
</div>
</div>
<?php include_once($dir."/help.php"); ?>
</div>
  
