";?>
hasRight('sdi')) { echo "
";?>
false) { ?>
= $minChartValues) {?>
safeTruncate(50)->slugify(). '.png';
$js_dlChart = "
$( 'div.chart-container')
.on( 'mouseenter', function() {
$('.download-chart').fadeIn(100);
})
.on( 'mouseleave', function() {
$('.download-chart').fadeOut( 500 );
});";
footerAddInlineJS($js_dlChart);
?>
".mb_ucfirst(_t('dashboard','date'))."\n";
echo "".mb_ucfirst(_t('divers','by'))." \n";
echo "".mb_ucfirst(_t('dashboard','value'))." (".formatText($result_sdii[0]['sdii_unit'], '2HTML').")"." \n";
if($result_sdii[0]['sdii_value_type'] == 'multiple') echo "".mb_ucfirst(_t('dashboard','multivalue_distribution'))." \n";
echo "".mb_ucfirst(_t('dashboard','threshold_value'))." \n";
echo "".mb_ucfirst(_t('dashboard','rate'))." \n";
echo "".mb_ucfirst(_t('dashboard','comment'))." \n";
echo " \n";
?>
';
if(!empty($val['label'])) $current_val .= ''.formatText($val['label'], '2HTML'). ' : ';
$current_val .= ''.fnumber_format($val['value'], 'auto', false). ' ('.fnumber_format($val['_percentage'], 2, false).' %) ';
$current_val .= '';
$raw_multivalue .= formatText($val['label'], '2HTML') . ' : ' . $val['value'] . ' ';
}
// we display the total
if(!defined('CLIENT_CHARTS') || CLIENT_CHARTS != 1) {
$chartlink = override('../dashboard/pie.php').'?id='.$id.'&value='.$result_value[$i]['sdiv_id'].'&display=true';
} else {
$chartlink = SITE_ROOT_URL .'public/get-chart.php?id='.$id.'&type=donut&year='.substr(formatDate($result_value[$i]['date_p'], true), 0, 4).'&alternatives=all&share=1';
}
$current_val .= '';
$current_val .= mb_ucfirst(_t('dashboard', 'multivalue_total')) . ' : ' . fnumber_format($data[0]['_total'], 'auto', false) . ' ';
$current_val .= ' '._t('dashboard', 'to_detail_chart').' ';
$current_val .= '
';
$current_val_raw = $data[0]['_total'];
if($i == 0) {
$lastValue = $current_val_raw; // we store data to compute TCAM and global rate
$year_end = substr(formatDate($result_value[$i]['date_p'], true), 0, 4);
}
if($i == count($result_value)-1) {
$firstValue = $current_val_raw; // we store data to compute TCAM and global rate
$year_start = substr(formatDate($result_value[$i]['date_p'], true), 0, 4);
}
// we compute rate
if(isset($result_value[$i+1]['sdiv_multivalue'])) {
$dataPlusOne = unserialize($result_value[$i+1]['sdiv_multivalue']);
$evol = ($data[0]['_total'] - $dataPlusOne[0]['_total']) / $dataPlusOne[0]['_total'] * 100;
// _debug('rate : '. fnumber_format($evol, 2). ' % - details : ('.$data[0]['_total']. ' - ' . $dataPlusOne[0]['_total']. ') / '. $dataPlusOne[0]['_total']);
$evol = fnumber_format($evol, 2). ' %';
} else {
$evol = empty_nc('');
}
// indicator is NOT multivalues
} else {
// If indicator is boolean or qualitative
if($result_sdii[0]['sdii_nature'] == 'boolean' || $result_sdii[0]['sdii_nature'] == 'qualitative') {
$a = getBooleanValues($result_sdii[0]);
if($a) {
$index = array();
foreach ($a as $key => $value) {
array_push($index, $key);
}
$current_val .= $a[$result_value[$i]['sdiv_value']];
$current_val_raw = $result_value[$i]['sdiv_value'];
$maskminvalue = $a[min($index)];
$maskmaxvalue = $a[max($index)];
if(is_null($result_value[$i]['sdiv_threshold'])) $threshold = empty_none('');
else $threshold = $a[$result_value[$i]['sdiv_threshold']];
} else {
$current_val .= fnumber_format($result_value[$i]['sdiv_value'], 'auto', false);
$current_val_raw = $result_value[$i]['sdiv_value'];
}
} else {
$current_val .= fnumber_format($result_value[$i]['sdiv_value'], 'auto', false);
$current_val_raw = $result_value[$i]['sdiv_value'];
if($i == 0) {
$lastValue = $current_val_raw; // we store data to compute TCAM and global rate
$year_end = substr(formatDate($result_value[$i]['date_p'], true), 0, 4);
}
if($i == count($result_value)-1) {
$firstValue = $current_val_raw; // we store data to compute TCAM and global rate
$year_start = substr(formatDate($result_value[$i]['date_p'], true), 0, 4);
}
}
$evol = empty_nc('');
// we compute rate -
if($result_sdii[0]['sdii_nature'] == 'quantitative') {
if(isset($result_value[$i+1]['sdiv_value']) && is_numeric($result_value[$i+1]['sdiv_value'])) {
$evol = ($result_value[$i]['sdiv_value'] - $result_value[$i+1]['sdiv_value']) / $result_value[$i+1]['sdiv_value'] * 100;
// _debug('rate : '. fnumber_format($evol, 2). ' % - details : ('.$result_value[$i]['sdiv_value']. ' - ' . $result_value[$i+1]['sdiv_value']. ') / '. $result_value[$i+1]['sdiv_value']);
$evol = fnumber_format($evol, 2). ' %';
}
}
}
$threshold_raw = $default_threshold;
// default threshold values
if($result_sdii[0]['sdii_nature'] == 'quantitative') {
$threshold = empty_none(fnumber_format($default_threshold, 'auto', false));
} else {
if(is_null($default_threshold)) {
$threshold = empty_none('');
} else {
$threshold = $a[$default_threshold];
}
}
// if set, we get it from the table
if(!is_null($result_value[$i]['sdiv_threshold'])) {
if($result_sdii[0]['sdii_nature'] == 'boolean' || $result_sdii[0]['sdii_nature'] == 'qualitative') {
$threshold = $a[$result_value[$i]['sdiv_threshold']];
$threshold_raw = $result_value[$i]['sdiv_threshold'];
} else {
$threshold = fnumber_format($result_value[$i]['sdiv_threshold'], 'auto', false);
$threshold_raw = $result_value[$i]['sdiv_threshold'];
}
}
($result_value[$i]['sdiv_comment_display'] == 'Y') ? $comment_status = _t('dashboard', 'public') : $comment_status = _t('dashboard', 'private');
if(!empty($result_value[$i]['sdiv_comment'])) {
$comment = '';
}
echo "\n";
echo "". formatText($result_value[$i]['date_p'], '2HTML')." \n";
echo "". $result_value[$i]['user_login']." \n";
echo "". formatText($current_val, '2HTML');
if($result_sdii[0]['sdii_value_type'] == 'multiple') echo " ".$raw_multivalue." \n";
if ($result_value[$i]['sdiv_statut']=='D') {
echo "".mb_ucfirst(_t('statut','draft'))." ";
}
echo "\n";
echo "". $threshold." \n";
echo "". $evol." \n";
echo "". $comment." \n";
echo " \n";
echo " \n";
}
// Ability to sort table
addDynamicCSS('../lib/js/jquery.tablesorter/theme.default.css');
footerAddJS('../lib/js/jquery.tablesorter/jquery.tablesorter.min.js');
$str = '$("table.multisort").tablesorter({ });';
footerAddInlineJS($str);
?>
safeTruncate(50)->slugify();
$str = '$("#export-values li a").click(function() {
var format = $(this).attr("data-format");
var ignoreCol = []; // set columns to ignore
// if is multi-values table we dynamically change the content
if( $("#indicator-values").hasClass("multi-values") && format != "png") {
$el = $("#indicator-values").clone().attr("id", "indicator-values-clone"); // we create a clone
ignoreCol.push(7);
$el.find( "td.value" ).each(function( index ) {
// we replace all values by total value only
$( this ).text($( this ).find("p.value-total span.total-numeric").attr("data-total") );
});
$el.insertAfter("#export-values"); // if not displayed, the export does not work
} else {
$el = $("#indicator-values");
ignoreCol.push(7);
}
if(format == "png") $("html, body").scrollTop(0);
$el.tableExport(
{tableName:"'.mb_ucfirst($result_sdii[0]['sdii_name'] . ' - ' .$result_sdii[0]['sdii_unit'] . ' / '. $resultscale2[0]['scale_denomination']). '",type:format,escape:\'false\',ignoreColumn: ignoreCol,displayTableName:\'true\',htmlContent:\'false\',fileName:\'' . $slug_name . '\'});
return false;
});';
footerAddInlineJS($str);
?>
"._t('dashboard','novalue').": ".formatText($resultscale2[0]['scale_denomination'], '2HTML')."