<?php
/**
 * @package linea21.modules
 * @subpackage dashboard
 * @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;
$req_sdi = SQL_getListSdi($filter = "R", $valueparam = 0);
$result_sdi = $sql_object->DBSelect($req_sdi);

/**
 * DEBUG_informations
 * to access debug informations
 * uncomment code and change the value 
 * of form action to post data
 * on the same page
 */
/**
if (isset($_POST['valider'])) {
    if (isset($_POST['graphic'])) $graphic = 1;
    else $graphic = 'N';

    if (isset($_POST['table_value'])) $table_value = $_POST['table_value'];
    else $table_value = 'non';

    if (isset($_POST['notpublished'])) $notpublished = $_POST['notpublished'];
    else $notpublished = 'N';

    if (isset($_POST['provider'])) $provider = $_POST['provider'];
    else $provider = 'N';

    if (isset($_POST['reglementation'])) $reglementation = $_POST['reglementation'];
    else $reglementation = 'N';

    if (isset($_POST['evaluation'])) $evaluation = $_POST['evaluation'];
    else $evaluation = 'N';

    if ($_POST['scale']=='det')
	{	
		print_r($_POST['eachscale']);
	}
	else echo "scale ALL<br>\n"; 

    if ($_POST['sdi']=='det')
	{
		while (list(, $value) = each ($_POST['eachsdi'])) {
	    echo "sdi Valeur: $value<br>\n";
	  	}
	}
	else echo "sdi ALL<br>\n"; 


    $report_title = $_POST['title_report'];
    $report_author = $_POST['author'];
    $report_mail = $_POST['mail_author'];
    $report_service = $_POST['service_author'];
    $report_adress = $_POST['adresse_author'];

    echo "<br />" . $graphic;
    echo "<br />" . $table_value;
    echo "<br />" . $notpublished;
    echo "<br />" . $provider;
    echo "<br />" . $reglementation;
    echo "<br />" . $evaluation;
    echo "<br />" . $report_title;
    echo "<br />" . $report_author;
    echo "<br />" . $report_mail;
    echo "<br />" . $report_service;
    echo "<br />" . $report_adress;
    echo "<br />" . $_POST['scale'];
    echo "<br />" . $_POST['sdi'];
}
*/

if (!isset($_REQUEST['scale_id'])) {
    $scale_id = 1;
} else {
    $scale_id = $_REQUEST['scale_id'];
} 

$listing = ""; 
// affichage liste échelle
$resultscale = $sql_object->DBSelect($req_list_scale);
$listing .= "<div class=\"h2sdtheme\"><h2>" . $GLOBALS['lang']['dashboard']['rap_scale_choice'] . "</h2></div>";

$listing .= "<div class=\"sdtheme\"><ul>\n";
$listing .= "\t<li>\n";
$listing .= "<input type=\"radio\" name=\"scale\" value=\"all\"  onclick=\"ShowReportScale('')\" checked=\"checked\" id=\"scale_all\" />
			<span class=\"listrap\">" . $GLOBALS['lang']['dashboard']['rap_scale_all'] . "</span>\n";
$listing .= "<br /><input type=\"radio\" name=\"scale\" value=\"det\" onclick=\"ShowReportScale('display_scale')\" id=\"scale_det\"  />
			<span class=\"listrap\">" . $GLOBALS['lang']['dashboard']['rap_scale_det'] . " </span>\n";
$listing .= "\t</li></ul>\n";
$listing .= "</div>\n";

$listing .= "<div class=\"divrap\" id=\"display_scale\" style=\"display:none;\">\n";
$listing .= "<ul>\n";
for ($i = 0;$i < count($resultscale);$i++) {
    $listing .= "\t<li>\n";
    $listing .= "<input type=\"checkbox\" name=\"eachscale[]\" id=\"eachscale" . $resultscale[$i]['scale_id'] . "\" value=\"" . $resultscale[$i]['scale_id'] . "\" />
			<span class=\"listrap\">" . formatText($resultscale[$i]['scale_denomination'], '2HTML') . "</span>\n";
    $listing .= "\t</li>\n";
} 
$listing .= "</ul>\n";
$listing .= "</div>\n"; 
// affichage liste indicateur en fonction des thèmes
$current_sdtheme = '';
$listing .= "<div class=\"h2sdtheme\"><h2>" . $GLOBALS['lang']['dashboard']['rap_sdi_choice'] . "</h2></div>";

$listing .= "<div class=\"sdtheme\"><ul>\n";
$listing .= "\t<li>\n";
$listing .= "<input type=\"radio\" name=\"sdi\" value=\"all\"  onclick=\"ShowReportSdi('')\" checked=\"checked\" id=\"sdi_all\"/>
			<span class=\"listrap\">" . $GLOBALS['lang']['dashboard']['rap_sdi_all'] . "</span>\n";
$listing .= "<br /><input type=\"radio\" name=\"sdi\" value=\"det\"  onclick=\"ShowReportSdi('display_sdi')\" id=\"sdi_det\" />
			<span class=\"listrap\">" . $GLOBALS['lang']['dashboard']['rap_sdi_det'] . "</span>\n";
$listing .= "\t</li></ul>\n";
$listing .= "</div>\n";

$listing .= "<div class=\"divrap\" id=\"display_sdi\" style=\"display:none;\">\n";
$listing .= "<ul>\n";
for ($i = 0;$i < count($result);$i++) {
    for ($j = 0;$j < count($result_sdi);$j++) {
        if ($result[$i]['theme_id'] == $result_sdi[$j]['sdii_theme']) {
            $listing .= "\t<li>\n";
            $listing .= "<input type=\"checkbox\" name=\"eachsdi[]\" id=\"eachsdi" . $result_sdi[$j]['sdii_id'] . "\" value=\"" . $result_sdi[$j]['sdii_id'] . "\" /><span class=\"listrap\">" . formatText($result_sdi[$j]['sdii_name'], '2HTML') . "</span>\n";
            if ($result_sdi[$j]['sdii_statut'] == 'D') $listing .= "<span class=\"state\">" . $GLOBALS['lang']['statut']['draft'] . "</span>\n";
            $listing .= "\t</li>\n";
        } 
    } 
} 
$listing .= "</ul>\n";
$listing .= "</div>\n"; 
// affichage liste infos
$listing .= "<div class=\"h2sdtheme\"><h2>" . $GLOBALS['lang']['dashboard']['rap_comp_choice'] . "</h2></div>";
$listing .= "<div class=\"sdtheme\">\n";
$listing .= "\t<ul><li>\n";

$listing .= "<input type=\"checkbox\" name=\"graphic\" id=\"graphic\" checked=\"checked\" />
			<span class=\"listrap\">" . $GLOBALS['lang']['dashboard']['rap_graph_values'] . "</span>\n";
$listing .= "\t</li>\n";
$listing .= "\t<li>\n";
$listing .= "<input type=\"checkbox\" name=\"table_value\" id=\"table_value\" checked=\"checked\" />
			<span class=\"listrap\">" . $GLOBALS['lang']['dashboard']['rap_table_values'] . "</span>\n";
$listing .= "\t</li>\n";
$listing .= "\t<li>\n";
$listing .= "<input type=\"checkbox\" name=\"notpublished\" id=\"notpublished\" checked=\"checked\" />
			<span class=\"listrap\">" . $GLOBALS['lang']['dashboard']['rap_notpublished_values'] . "</span>\n";
$listing .= "\t</li>\n";
$listing .= "\t<li>\n";
$listing .= "<input type=\"checkbox\" name=\"provider\" id=\"provider\" checked=\"checked\" />
			<span class=\"listrap\">" . $GLOBALS['lang']['dashboard']['rap_provider_info'] . "</span>\n";
$listing .= "\t</li>\n";
$listing .= "\t<li>\n";
$listing .= "<input type=\"checkbox\" name=\"reglementation\" id=\"reglementation\" checked=\"checked\" />
			<span class=\"listrap\">" . $GLOBALS['lang']['dashboard']['rap_rules_info'] . "</span>\n";
$listing .= "\t</li>\n";
$listing .= "\t<li>\n";
$listing .= "<input type=\"checkbox\" name=\"evaluation\" id=\"evaluation\" checked=\"checked\" />
			<span class=\"listrap\">" . $GLOBALS['lang']['dashboard']['rap_eval_info'] . "</span>\n";
$listing .= "\t</li>\n";
$listing .= "\t<li>\n";
$listing .= "<input type=\"checkbox\" name=\"summary\" id=\"summary\" checked=\"checked\" />
			<span class=\"listrap\">" . $GLOBALS['lang']['dashboard']['rap_summary_info'] . "</span>\n";
$listing .= "\t</li>\n";
$listing .= "\t<li>\n";
$listing .= "<input type=\"checkbox\" name=\"publi_info\" id=\"publi_info\" checked=\"checked\" />
			<span class=\"listrap\">" . $GLOBALS['lang']['dashboard']['rap_publi_info'] . "</span>\n";
$listing .= "\t</li>\n";
$listing .= "\t</ul>\n";
$listing .= "</div>\n";

?>
<div id="chemin">
	<ul>
		<li>
			<a href="index.php"><?php echo $GLOBALS['lang']['way']['home'];
?></a>
		</li>
		<li>
			<a href="<?php echo $rub_link;
?>"><?php echo $GLOBALS['lang']['menu']['dashboard'];
?></a>
		</li>
		<li>
			<span><?php echo $GLOBALS['lang']['dashboard']['rap'];
?></span>
		</li>
	</ul>
</div>
  <!--end barre haute -->
<?php
include_once("quickicons.php");

?>
<div class="contentcontainer">
<?php include_once($dir . "/menurub.php");
?>
<div id="content">
<h2><?php echo $GLOBALS['lang']['dashboard']['rap'];
?></h2>			
<form id="addrap" action="../report_sdi/sdi_report.php" method="post">
<p>
<label for="title_report"><?php echo $GLOBALS['lang']['dashboard']['rap_title'];
?> : </label>
<input name="title_report" type="text" class="textfield" id="title_report" maxlength="255" value="<?php // echo $form_task;?>
" />
</p>
<p>
<label for="author"><?php echo $GLOBALS['lang']['dashboard']['rap_author'];
?> : </label>
<input name="author" type="text" class="textfield" id="author" maxlength="255" value="<?php // echo $form_task;?>
" />
</p>
<p>
<label for="mail_author"><?php echo $GLOBALS['lang']['dashboard']['rap_mail_author'];
?> : </label>
<input name="mail_author" type="text" class="textfield" id="mail_author" maxlength="255" value="<?php // echo $form_task;?>
" />
</p>
<p>
<label for="service_author"><?php echo $GLOBALS['lang']['dashboard']['rap_service'];
?> : </label>
<input name="service_author" type="text" class="textfield" id="service_author" maxlength="255" value="<?php // echo $form_task;?>
" />
</p>
<p>
<label for="adress_author"><?php echo $GLOBALS['lang']['dashboard']['rap_adress'];
?> : </label>
<textarea id="adress_author" name="adress_author" class="largetextfield" <?php echo AREA_SETTINGS; ?>><?php // echo $form_task_details;?>
</textarea>
</p>
<?php
echo $listing;

?>
<div>
	<input name="annuler" type="submit" value="<?php echo $GLOBALS['lang']['btn']['annul']; ?>" class="button" id="annuler" />
	<input name="generer" type="submit" value="<?php echo $GLOBALS['lang']['dashboard']['rap_generate'] ; ?>" class="button" id="generer" />
	<input name="sauver" type="submit" value="<?php echo $GLOBALS['lang']['dashboard']['rap_save'] ; ?>" class="button" id="sauver" />
</div>
	</form>
</div>
<?php include_once($dir . "/help.php");
?>
</div>
  
