* @version $Id$ * @access public * @license http://opensource.org/licenses/gpl-3.0.html */ //////////// Check Inclusion de pages //////////// if (!class_exists('auth')){ include_once("../lib/lib_common.php"); ReloadIndex('admin'); } //////////// if(!isset($_GET['id']) && !isset($_POST['id'])) { $id="1"; } else { if(isset($_POST['id'])) $id=$_POST['id']; if(isset($_GET['id'])) $id=$_GET['id']; } if(!isset($_GET['scale_id']) && !isset($_POST['scale_id'])) { $scale_id=1; } else { if(isset($_POST['scale_id'])) $scale_id=$_POST['scale_id']; if(isset($_GET['scale_id'])) $scale_id=$_GET['scale_id']; } //////////// Check Droits utilisateur //////////// if (!$l21auth->hasRight('dashboard') && !$l21auth->hasRight('indicator', $id)) ReloadIndex('admin'); //////////// include_once("../dashboard/common.php"); include_once("../dashboard/display.php"); include_once(override("../dashboard/chart-prepare.php")); footerAddJS('../lib/js/clipboard.js-2.0.10/dist/clipboard.min.js'); $str = " var clipboard = new ClipboardJS('.copy-chart-url'); clipboard.on('success', function(e) { alertify.success(\"" . _t('copy', 'url_copy_succeed') . "\"); }); clipboard.on('error', function(e) { alertify.error(\"" . _t('copy', 'url_copy_failed') . "\"); });"; footerAddInlineJS($str); $str = " var clipboard2 = new ClipboardJS('.copy-chart-iframe'); clipboard2.on('success', function(e) { alertify.success(\"" . _t('copy', 'embedcode_copy_succeed') . "\"); }); clipboard2.on('error', function(e) { alertify.error(\"" . _t('copy', 'embedcode_copy_failed') . "\"); });"; footerAddInlineJS($str); if(defined('CLIENT_CHARTS') && CLIENT_CHARTS == 1) { // footerAddJS('../lib/js/Highcharts-7.0.3/code/themes/grid-light.js'); includeHighCharts(['exporting', 'offline-exporting']); footerAddJS('../lib/js/generate-chart.js'); if(defined('EXPORT_CHART_SVG') && EXPORT_CHART_SVG == 1) { // code to generate SVG file to embed in PDF file $filename = $id . "_" . $scale_id; $js = 'function saveChart() { if($("#main-chart-container svg").length) { var svg = $("#main-chart-container svg")[0] var svgStr = new XMLSerializer().serializeToString(svg); var jqxhr = $.post( "../dashboard/_image_save.php", { svgcontent: svgStr, filename: "'. $filename .'" }, function() { // console.log( "chart is saved on server" ); }); } }'; footerAddInlineJS($js, false); footerAddInlineJS('setTimeout(saveChart, 3000);'); } } // getting chart sizes from config file list($cwidth, $cheight) = explode('x', CHART_DEFAULT_SIZE); $sdi_object= new sdi; //$result_sdii=$sdi_object->GetInfoSdi($id, $sql_object); //$result_e=$sdi_object->GetEvaluation( $id, $sql_object, $ID=-1); //$result_p=$sdi_object->GetProvider( $id, $sql_object, $ID=-1); //$result_r=$sdi_object->GetRules( $id, $sql_object, $ID=-1); $req_sdii=SQL_getInfoSdi($id); $result_sdii = $sql_object -> DBSelect($req_sdii); $indicator_multiple_type = formatText($result_sdii[0]['sdii_multiple_type'], '2HTML'); $level = formatText($result_sdii[0]['level_name'], '2HTML'); ($result_sdii[0]['sdii_level'] != 0) ? $level=formatText($result_sdii[0]['level_name'], '2HTML') : $level= _t('sdi', 'no_associated_level'). ' '; // if no associated label $level_label_att = formatText($result_sdii[0]['level_label'] . ' : ' . $result_sdii[0]['level_name'], '2ATT'); $level_label = '' .formatText($result_sdii[0]['level_label'], '2HTML'). ' '; if(defined('DISPLAY_LEVEL_LABEL') && DISPLAY_LEVEL_LABEL == 1) $disp_level_name = $level_label . $level; else $disp_level_name = $level; // Do record exists? if(!isset($result_sdii[0]['sdii_name'])) redirect_to('@module_default'); // setting $default_threshold value // By default initial value $default_threshold = $result_sdii[0]['sdii_threshold_value']; $req_sdir=SQL_getRules( $id, $sql_object, $ID=-1); $result_r = $sql_object -> DBSelect($req_sdir); $req_sdie=SQL_getEvaluation( $id, $sql_object, $ID=-1); $result_e = $sql_object -> DBSelect($req_sdie); $req_sdip=SQL_getProvider( $id, $sql_object, $ID=-1); $result_p = $sql_object -> DBSelect($req_sdip); $req_sdiav=SQL_getAllValue("SCA", $scale_id, $id); $result_value = $sql_object -> DBSelect($req_sdiav); $result_value = add_cumulative_value($result_value, $result_sdii[0]); // we add 'sdiv_cumulative_value' attribute if needed //$result_value=$sdi_object->GetAllValue("SCA", $scale_id, $id, $sql_object); $req_scale=SQL_getonescale($scale_id); $resultscale2 = $sql_object -> DBSelect($req_scale); $link_det=$rub_link."&todo=det&id="; $link_det_level="index.php?rub=level&todo=det&id="; $link_det_indicator="index.php?rub=sdi&todo=det&id="; $link_sup=$rub_link."&todo=sup&value_id="; $link_mod=$rub_link."&todo=mod&value_id="; $link_add=$rub_link."&todo=add&id="; $navtitle=_t('dashboard','det')." : ".$result_sdii[0]['sdii_name']; ($result_sdii[0]['sdii_api_enabled'] == 'Y') ? $api = ' ' : $api =''; ($result_sdii[0]['sdii_api_enabled'] == 'N' && !empty($result_sdii[0]['sdii_api_url'])) ? $api = ' ' : $api = $api; ?>

isSuperAdmin() && defined('API_RETRIEVE') && API_RETRIEVE == 1) { ?> ";?> 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 "\n"; echo "\n"; if($result_sdii[0]['sdii_value_type'] == 'multiple') echo "\n"; if($result_sdii[0]['sdii_value_type'] == 'unique' && $result_sdii[0]['sdii_unique_mode'] == 'cumulative') echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; ?> '; if (!empty($val['label'])) $current_val .= '' . formatText($val['label'], '2HTML') . ' : '; if(!is_null($val['value'])) { $current_val .= '' . fnumber_format($val['value'], 'auto', false) . ''; if ($indicator_multiple_type == 'sum') $current_val .= ' (' . fnumber_format($val['_percentage'], 2, false) . ' %)'; } else { $current_val .= '' . _t('dashboard', 'no_data') . ''; } $current_val .= '

'; $raw_multivalue .= formatText($val['label'], '2HTML') . ' : ' . $val['value'] . '
'; } } else { $current_val = _t('dashboard','no_data'); $raw_multivalue = _t('dashboard','no_data'); } // 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'; } // we display the total if $indicator_multiple_type == 'sum' if($indicator_multiple_type == 'sum') { $current_val .= '

'; if(!is_null($data[0]['_total'])) { $current_val .= mb_ucfirst(_t('dashboard', 'multivalue_total')) . ' : ' . fnumber_format($data[0]['_total'], 'auto', false) . ''; $current_val .= ' ' . _t('dashboard', 'to_detail_chart') . ''; } else { $current_val .= mb_ucfirst(_t('dashboard', 'multivalue_total')) . ' : ' . _t('dashboard', 'no_data') . ''; } $current_val .= '

'; $current_val_raw = $data[0]['_total']; } // we display the total if $indicator_multiple_type == 'mean' if($indicator_multiple_type == 'mean') { $current_val .= '

'; if(!is_null($data[0]['_mean'])) { $current_val .= mb_ucfirst(_t('dashboard', 'multivalue_mean')) . ' : ' . fnumber_format($data[0]['_mean'], 2, false) . ''; } else { $current_val .= mb_ucfirst(_t('dashboard', 'multivalue_mean')) . ' : ' . _t('dashboard', 'no_data') . ''; } $current_val .= '

'; $current_val_raw = $data[0]['_mean']; } // we display the total if $indicator_multiple_type == 'none' if($indicator_multiple_type == 'none') { $current_val .= ''; $current_val_raw = _t('sdi', 'multiple_type_none'); } if($indicator_multiple_type != 'none') { 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($indicator_multiple_type == 'mean') $rate_field = '_mean'; else $rate_field = '_total'; if(isset($result_value[$i+1]['sdiv_multivalue']) && $indicator_multiple_type != 'none') { $dataPlusOne = unserialize($result_value[$i+1]['sdiv_multivalue']); if($dataPlusOne[0][$rate_field] != 0) { $evol = ($data[0][$rate_field] - $dataPlusOne[0][$rate_field]) / $dataPlusOne[0][$rate_field] * 100; // _debug('rate : '. fnumber_format($evol, 2). ' % - details : ('.$data[0][$rate_field]. ' - ' . $dataPlusOne[0][$rate_field]. ') / '. $dataPlusOne[0][$rate_field]); $evol = fnumber_format($evol, 2). ' %'; } else { $evol = empty_nc(''); } } 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); } if(is_null($result_value[$i]['sdiv_value'])) { $current_val .= _t('dashboard', 'no_data'); $current_val_raw = $result_value[$i]['sdiv_value']; } else { $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 { if(is_null($result_value[$i]['sdiv_value'])) { $current_val .= mb_ucfirst(_t('dashboard', 'no_data')); $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']; } } } else { if(is_null($result_value[$i]['sdiv_value'])) { $current_val .= mb_ucfirst(_t('dashboard', 'no_data')); $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']) && $result_value[$i+1]['sdiv_value'] != 0) { if(!is_null($result_value[$i+1]['sdiv_value']) && !is_null($result_value[$i]['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) . ' %'; } else $evol = empty_nc(''); } else { $evol = empty_nc(''); } } } $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']; } } else { $threshold = empty_none(''); $threshold_raw = ''; } ($result_value[$i]['sdiv_comment_display'] == 'Y') ? $comment_status = _t('dashboard', 'public') : $comment_status = _t('dashboard', 'private'); $history = getIndicatorValueContributors($result_value[$i], $sql_object); if(!empty($history)) $history = sprintf('
', _t('dashboard', 'history_edition'), $history); if(!empty($result_value[$i]['sdiv_comment'])) { $comment = '
'; $comment .= ''; $comment .= '
'.ucfirst(_t('dashboard', 'comment')).' ('.$comment_status.') : '.$result_value[$i]['sdiv_comment'].'
'; $comment .= '
'; } echo "\n"; echo "\n"; echo "\n"; echo "\n"; if ($result_value[$i]['sdiv_statut']=='D') { echo "".mb_ucfirst(_t('statut','draft')).""; } echo "\n"; echo "\n"; echo "\n"; echo "\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); ?>
".mb_ucfirst(_t('divers','by'))."".mb_ucfirst(_t('dashboard','multivalue_value'))." (".formatText($result_sdii[0]['sdii_unit'], '2HTML').")"."".mb_ucfirst(_t('dashboard','multivalue_distribution'))."".mb_ucfirst(_t('dashboard','cumulative_value'))."".mb_ucfirst(_t('dashboard','threshold_value'))."".mb_ucfirst(_t('dashboard','rate'))."".mb_ucfirst(_t('dashboard','comment'))." 
". formatText($result_value[$i]['date_p'], '2HTML'). $history."". $result_value[$i]['user_login'] ."". formatText($current_val, '2HTML'); if($result_sdii[0]['sdii_value_type'] == 'unique' && $result_sdii[0]['sdii_unique_mode'] == 'cumulative') echo "". formatText(fnumber_format($result_value[$i]['sdiv_cumulative_value'], 'auto', false), '2HTML'); if(!empty($result_value[$i]['sdiv_analysis'])) { $analysis = '
'; $analysis .= ''; $analysis .= '
'.ucfirst(_t('dashboard', 'last_analysis')).' : '.$result_value[$i]['sdiv_analysis'].'
'; $analysis .= '
'; echo $analysis; } if($result_sdii[0]['sdii_value_type'] == 'multiple') echo "
".$raw_multivalue."". $threshold."". $evol."". $comment."
safeTruncate(50)->slugify(); $str = '$("#export-values li a").click(function() { var format = $(this).attr("data-format"); var ignoreCol = []; // set columns to ignore // we clone element and we ignore unwanted column $el = $("#indicator-values").clone().attr("id", "indicator-values-clone"); // we create a clone $el.find( ".no-export" ).remove(); // we remove unwanted elements inside $el ignoreCol.push(7); $el.insertAfter("#export-values"); // if not displayed, the export does not work // if is multi-values table we dynamically change the content if( $("#indicator-values").hasClass("multi-values") && format != "png") { $el.find( "td.value" ).each(function( index ) { // we replace all values by "data-value" attribute content $( this ).text( $(this).attr("data-value") ); }); $el.insertAfter("#export-values"); // if not displayed, the export does not work } 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')."
"; ?>
:
isSuperAdmin() && $result_sdii[0]['sdii_level'] != 0) echo "".$disp_level_name.""; else echo $disp_level_name; ?>
:
:
:

".mb_ucfirst(_t('sdi','min_value'))." (".formatText($result_sdii[0]['sdii_unit'], '2HTML').")"."\n"; echo "\n"; echo "\n"; echo "\n"; ?> \n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; ?>
".mb_ucfirst(_t('sdi','max_value'))." (".formatText($result_sdii[0]['sdii_unit'], '2HTML').")"."".mb_ucfirst(_t('sdi','initial_threshold_value'))." (".formatText($result_sdii[0]['sdii_unit'], '2HTML').")"."".mb_ucfirst(_t('sdi','frequency'))."
". $display_min."". $display_max."". $display_threshold ."". formatText(fnumber_format($result_sdii[0]['sdii_frequency'], 'auto', false), '2HTML')."
isUrl()) $display_api_url = sprintf('%s', $display_api_url, $display_api_url); $display_api_datefield = formatText(empty_nc($result_sdii[0]['sdii_api_datefield']), '2HTML'); $display_api_valuefield = formatText(empty_nc($result_sdii[0]['sdii_api_valuefield']), '2HTML'); if($result_sdii[0]['sdii_value_type'] == 'multiple') { $form_api_multimapping = unserialize($result_sdii[0]['sdii_api_multimapping']); $form_api_multimapping_field = ''; if(is_array($form_api_multimapping)) { foreach ($form_api_multimapping as $k => $v) { $form_api_multimapping_field .= '
'; $form_api_multimapping_field .= ''.mb_ucfirst($k). ' ⬌ '. $v. ''; $form_api_multimapping_field .= '
'; } } $display_api_valuefield = $form_api_multimapping_field; } ?>