Nvd3Test » History » Version 1
Simon, 09/24/2015 09:57 PM
| 1 | 1 | Simon | h1. Nvd3Test |
|---|---|---|---|
| 2 | |||
| 3 | |||
| 4 | Tests de visualisation avec NVD3 |
||
| 5 | |||
| 6 | <pre> |
||
| 7 | <?php |
||
| 8 | /** |
||
| 9 | * Dashboard module |
||
| 10 | * |
||
| 11 | * Indicator detail page. Display all values entered for a specific indicators |
||
| 12 | * |
||
| 13 | * @package linea21\modules\dashboard |
||
| 14 | * @author $Author$ - linea21 <info@linea21.com> |
||
| 15 | * @version $Id$ |
||
| 16 | * @access public |
||
| 17 | * @license http://opensource.org/licenses/gpl-3.0.html |
||
| 18 | */ |
||
| 19 | |||
| 20 | //////////// Check Inclusion de pages //////////// |
||
| 21 | if (!class_exists('auth')){ |
||
| 22 | include_once("../lib/lib_common.php"); |
||
| 23 | ReloadIndex('admin'); |
||
| 24 | } |
||
| 25 | //////////// |
||
| 26 | |||
| 27 | if(!isset($_GET['id']) && !isset($_POST['id'])) { |
||
| 28 | $id="1"; |
||
| 29 | } else { |
||
| 30 | if(isset($_POST['id'])) $id=$_POST['id']; |
||
| 31 | if(isset($_GET['id'])) $id=$_GET['id']; |
||
| 32 | } |
||
| 33 | if(!isset($_GET['scale_id']) && !isset($_POST['scale_id'])) { |
||
| 34 | $scale_id=1; |
||
| 35 | } else { |
||
| 36 | if(isset($_POST['scale_id'])) $scale_id=$_POST['scale_id']; |
||
| 37 | if(isset($_GET['scale_id'])) $scale_id=$_GET['scale_id']; |
||
| 38 | } |
||
| 39 | |||
| 40 | //////////// Check Droits utilisateur //////////// |
||
| 41 | if (!$l21auth->hasRight('dashboard') && !$l21auth->hasRight('indicator', $id)) ReloadIndex('admin'); |
||
| 42 | //////////// |
||
| 43 | |||
| 44 | |||
| 45 | footerAddJS('../lib/js/d3/d3.min.js'); |
||
| 46 | addDynamicCSS('../lib/js/nvd3/build/nv.d3.min.css'); |
||
| 47 | footerAddJS('../lib/js/nvd3/build/nv.d3.min.js'); |
||
| 48 | ?> |
||
| 49 | <script> |
||
| 50 | $( document ).ready(function() { |
||
| 51 | |||
| 52 | |||
| 53 | /** |
||
| 54 | $('#chart svg').css({ |
||
| 55 | 'width' : '900px', |
||
| 56 | 'height' : '600px', |
||
| 57 | 'margin-top' : '3em' |
||
| 58 | }); |
||
| 59 | |||
| 60 | d3.json("../dashboard/test.json",function(error,data) { |
||
| 61 | |||
| 62 | var chart = nv.models.multiChart() |
||
| 63 | .margin({top: 30, right: 60, bottom: 50, left: 70}) |
||
| 64 | .color(d3.scale.category10().range()); |
||
| 65 | |||
| 66 | chart.xAxis |
||
| 67 | .tickFormat(d3.format(',f')); |
||
| 68 | |||
| 69 | chart.yAxis1 |
||
| 70 | .tickFormat(d3.format(',.1f')); |
||
| 71 | |||
| 72 | chart.yAxis2 |
||
| 73 | .tickFormat(d3.format(',.1f')); |
||
| 74 | |||
| 75 | |||
| 76 | d3.select('#chart svg') |
||
| 77 | .datum(data) |
||
| 78 | .transition().duration(500).call(chart); |
||
| 79 | |||
| 80 | nv.utils.windowResize(chart.update); |
||
| 81 | |||
| 82 | return chart; |
||
| 83 | |||
| 84 | }); |
||
| 85 | */ |
||
| 86 | |||
| 87 | /** |
||
| 88 | // code B |
||
| 89 | nv.addGraph(function() { |
||
| 90 | var chart = nv.models.linePlusBarChart() |
||
| 91 | .margin({top: 30, right: 60, bottom: 50, left: 70}) |
||
| 92 | //We can set x data accessor to use index. Reason? So the bars all appear evenly spaced. |
||
| 93 | .x(function(d,i) { return i }) |
||
| 94 | .y(function(d,i) {return d[1] }) |
||
| 95 | ; |
||
| 96 | |||
| 97 | chart.xAxis.tickFormat(function(d) { |
||
| 98 | var dx = data[0].values[d] && data[0].values[d][0] || 0; |
||
| 99 | return dx; |
||
| 100 | // return d3.time.format('%x')(new Date(dx)) |
||
| 101 | }); |
||
| 102 | chart.legendLeftAxisHint(" (L)"); |
||
| 103 | chart.legendRightAxisHint(" (R)") |
||
| 104 | |||
| 105 | //chart.forceX([0,30]); |
||
| 106 | chart.forceY([0,30]); |
||
| 107 | chart.xDomain([0, 30]); |
||
| 108 | //chart.yDomain([0, 30]); |
||
| 109 | // chart.yRange([23.1, 24.84]); |
||
| 110 | // chart.y1Axis.tickFormat(d3.format(',f')); |
||
| 111 | |||
| 112 | //chart.bars.forceY([0]); |
||
| 113 | chart.focusEnable(false); |
||
| 114 | |||
| 115 | d3.select('#chart svg') |
||
| 116 | .datum(data) |
||
| 117 | .transition() |
||
| 118 | .duration(0) |
||
| 119 | .call(chart); |
||
| 120 | |||
| 121 | nv.utils.windowResize(chart.update); |
||
| 122 | |||
| 123 | return chart; |
||
| 124 | }); |
||
| 125 | |||
| 126 | }); |
||
| 127 | */ |
||
| 128 | |||
| 129 | // STACKED |
||
| 130 | /** |
||
| 131 | // d3.json("../dashboard/test-stacked.json",function(error,data) { |
||
| 132 | d3.json("../dashboard/data-export.php?id=<?php echo $id; ?>&scale_id=<?php echo $scale_id; ?>",function(error,data) { |
||
| 133 | var colors = d3.scale.category20(); |
||
| 134 | |||
| 135 | console.log(data); |
||
| 136 | var chart; |
||
| 137 | nv.addGraph(function() { |
||
| 138 | chart = nv.models.stackedAreaChart() |
||
| 139 | .useInteractiveGuideline(true) |
||
| 140 | .x(function(d) { return d[0] }) |
||
| 141 | .y(function(d) { return d[1] }) |
||
| 142 | .controlLabels({stacked: "Stacked"}) |
||
| 143 | .duration(300); |
||
| 144 | |||
| 145 | //chart.xAxis.tickFormat(function(d) { return d3.time.format('%x')(new Date(d)) }); |
||
| 146 | //chart.yAxis.tickFormat(d3.format('f')); |
||
| 147 | |||
| 148 | chart.xAxis.tickFormat(function(d) { |
||
| 149 | var dx = data[0].values[d] && data[0].values[d][0] || 0; |
||
| 150 | return dx; |
||
| 151 | // return d3.time.format('%x')(new Date(dx)) |
||
| 152 | }); |
||
| 153 | |||
| 154 | chart.legend.vers('furious'); |
||
| 155 | |||
| 156 | d3.select('#chart svg') |
||
| 157 | .datum(data) |
||
| 158 | .transition().duration(1000) |
||
| 159 | .call(chart) |
||
| 160 | .each('start', function() { |
||
| 161 | setTimeout(function() { |
||
| 162 | d3.selectAll('#chart svg').each(function() { |
||
| 163 | if(this.__transition__) |
||
| 164 | this.__transition__.duration = 1; |
||
| 165 | }) |
||
| 166 | }, 0) |
||
| 167 | }); |
||
| 168 | |||
| 169 | nv.utils.windowResize(chart.update); |
||
| 170 | return chart; |
||
| 171 | }); |
||
| 172 | |||
| 173 | }); |
||
| 174 | */ |
||
| 175 | }); |
||
| 176 | </script> |
||
| 177 | |||
| 178 | <?php |
||
| 179 | $sdi_object= new sdi; |
||
| 180 | //$result_sdii=$sdi_object->GetInfoSdi($id, $sql_object); |
||
| 181 | //$result_e=$sdi_object->GetEvaluation( $id, $sql_object, $ID=-1); |
||
| 182 | //$result_p=$sdi_object->GetProvider( $id, $sql_object, $ID=-1); |
||
| 183 | //$result_r=$sdi_object->GetRules( $id, $sql_object, $ID=-1); |
||
| 184 | $req_sdii=SQL_getInfoSdi($id); |
||
| 185 | $result_sdii = $sql_object -> DBSelect($req_sdii); |
||
| 186 | |||
| 187 | // Do record exists? |
||
| 188 | if(!isset($result_sdii[0]['sdii_name'])) redirect_to('@module_default'); |
||
| 189 | |||
| 190 | // setting $default_threshold value |
||
| 191 | // By default initial value |
||
| 192 | $default_threshold = $result_sdii[0]['sdii_threshold_value']; |
||
| 193 | |||
| 194 | $req_sdir=SQL_getRules( $id, $sql_object, $ID=-1); |
||
| 195 | $result_r = $sql_object -> DBSelect($req_sdir); |
||
| 196 | |||
| 197 | $req_sdie=SQL_getEvaluation( $id, $sql_object, $ID=-1); |
||
| 198 | $result_e = $sql_object -> DBSelect($req_sdie); |
||
| 199 | |||
| 200 | $req_sdip=SQL_getProvider( $id, $sql_object, $ID=-1); |
||
| 201 | $result_p = $sql_object -> DBSelect($req_sdip); |
||
| 202 | |||
| 203 | $req_sdiav=SQL_getAllValue("SCA", $scale_id, $id); |
||
| 204 | $result_value = $sql_object -> DBSelect($req_sdiav); |
||
| 205 | |||
| 206 | //$result_value=$sdi_object->GetAllValue("SCA", $scale_id, $id, $sql_object); |
||
| 207 | $req_scale=SQL_getonescale($scale_id); |
||
| 208 | $resultscale2 = $sql_object -> DBSelect($req_scale); |
||
| 209 | |||
| 210 | $link_det=$rub_link."&todo=det&id="; |
||
| 211 | $link_det_level="index.php?rub=level&todo=det&id="; |
||
| 212 | $link_det_indicator="index.php?rub=sdi&todo=det&id="; |
||
| 213 | $link_sup=$rub_link."&todo=sup&value_id="; |
||
| 214 | $link_mod=$rub_link."&todo=mod&value_id="; |
||
| 215 | $link_add=$rub_link."&todo=add&id="; |
||
| 216 | $navtitle=_t('dashboard','det')." : ".$result_sdii[0]['sdii_name']; |
||
| 217 | //valeur du graphique |
||
| 218 | ?> |
||
| 219 | <div id="chemin"> |
||
| 220 | <ul> |
||
| 221 | <li><a href="index.php" class="chemin_home"><?php echo _t('way','home') ?></a></li> |
||
| 222 | <li><a href="<?php echo $rub_link; ?>" id="chemin_<?php echo $rub; ?>" class="chemin_rub"><?php echo _t('menu','dashboard')?></a></li> |
||
| 223 | <li><span><?php echo formatnavTitle($navtitle); ?></span></li> |
||
| 224 | </ul> |
||
| 225 | </div> |
||
| 226 | <!--end barre haute --> |
||
| 227 | |||
| 228 | <div class="contentcontainer"><?php |
||
| 229 | include_once(override($dir.'/menurub.php', THEME_ADMIN_PATH)); |
||
| 230 | ?> |
||
| 231 | <div id="content"> |
||
| 232 | <h2><?php echo formatTitleh2($result_sdii[0]['sdii_name']); ?></h2> |
||
| 233 | |||
| 234 | <!-- Unique value export --> |
||
| 235 | <form id="report" action="../export/report.php" method="post" class="visually-hidden"> |
||
| 236 | <input type="hidden" name="what" value="dashboard"> |
||
| 237 | <input type="hidden" name="quick_export" value="1"> |
||
| 238 | <input type="hidden" name="scale" value="all"> |
||
| 239 | <input type="hidden" name="sdi" value="det"> |
||
| 240 | <input type="hidden" name="eachsdi[]" value="<?php echo $id; ?>"> |
||
| 241 | <input type="hidden" name="graphic" value="1"> |
||
| 242 | <input type="hidden" name="table_value" value="1"> |
||
| 243 | <input type="hidden" name="notpublished" value="1"> |
||
| 244 | <input type="hidden" name="provider" value="1"> |
||
| 245 | <input type="hidden" name="reglementation" value="1"> |
||
| 246 | <input type="hidden" name="evaluation" value="1"> |
||
| 247 | <input type="hidden" name="format_report" value="word"><!-- pdf / word / html --> |
||
| 248 | <input type="hidden" name="sauver" value="1"> |
||
| 249 | </form> |
||
| 250 | <!-- dropdown container --> |
||
| 251 | <div class="dropdown export-button" id="export-report"> |
||
| 252 | <!-- trigger button --> |
||
| 253 | <button><i class="icon-export"></i> <?php echo _t('export', 'action'); ?></button> |
||
| 254 | <!-- dropdown menu --> |
||
| 255 | <ul class="dropdown-menu"> |
||
| 256 | <li><a href="#report" data-format="pdf"><i class="icon-file-pdf"></i> <?php echo _t('export', 'format', 'pdf'); ?></a></li> |
||
| 257 | <li><a href="#report" data-format="word"><i class="icon-file-word"></i> <?php echo _t('export', 'format', 'word'); ?></a></li> |
||
| 258 | <li><a href="#report" data-format="html"><i class="icon-html5"></i> <?php echo _t('export', 'format', 'html'); ?></a></li> |
||
| 259 | </ul> |
||
| 260 | </div> |
||
| 261 | <script> |
||
| 262 | $( "#export-report li a" ).click(function() { |
||
| 263 | var format = $(this).attr('data-format'); |
||
| 264 | $( "#report input[name=format_report]").val(format); |
||
| 265 | $( "#report" ).submit(); |
||
| 266 | return false; |
||
| 267 | }); |
||
| 268 | </script> |
||
| 269 | |||
| 270 | <div class="iconetodo2"> |
||
| 271 | <?php echo "<a href=\"".$link_add.$id."&scale_id=".$scale_id."\" title=\""._t('dashboard','add')."\" class=\"ico_add2\">";?><i class="icon-plus-circled"></i><span><?php echo _t('dashboard','add'); ?></span></a> |
||
| 272 | <?php if ($l21auth->isSuperAdmin()) { echo "<a href=\"".$link_det_indicator.$id."\" title=\""._t('sdi','det')."\" class=\"ico_generic2 no-action\">";?><i class="icon-eye"></i><span><?php echo _t('sdi','det'); ?></span></a><?php } ?> |
||
| 273 | </div> |
||
| 274 | |||
| 275 | <?php if ($result_value<>false) {?> <br /> |
||
| 276 | <?php if (count($result_value) > 2) {?> |
||
| 277 | <?php |
||
| 278 | $slugname = Stringy\Stringy::create($result_sdii[0]['sdii_name'].'_'.$resultscale2[0]['scale_denomination'], CHARSET)->safeTruncate(50)->slugify(). '.png'; |
||
| 279 | $js_dlChart = " |
||
| 280 | $( 'div.chart-container') |
||
| 281 | .on( 'mouseenter', function() { |
||
| 282 | $('.download-chart').fadeIn(100); |
||
| 283 | }) |
||
| 284 | .on( 'mouseleave', function() { |
||
| 285 | $('.download-chart').fadeOut( 500 ); |
||
| 286 | });"; |
||
| 287 | footerAddInlineJS($js_dlChart); |
||
| 288 | ?> |
||
| 289 | <!-- @simo --> |
||
| 290 | <div id="chart-container" style="min-width: 310px; height: 400px; margin: 0 auto"></div> |
||
| 291 | <div id="chart"> |
||
| 292 | <svg></svg> |
||
| 293 | </div> |
||
| 294 | |||
| 295 | <div class="chart-container"> |
||
| 296 | <img src="<?php echo override('../dashboard/graph.php')?>?id=<?php echo $id; ?>&scale_id=<?php echo $scale_id; ?>&display=true" id="imggraph" class="graph" alt="<?php echo _t('dashboard','all_value');?>" /> |
||
| 297 | <a class="download-chart ico_generic2" title="<?php echo mb_ucfirst(_t('dashboard', 'download_chart')); ?>" href="<?php echo override('../dashboard/graph.php')?>?id=<?php echo $id; ?>&scale_id=<?php echo $scale_id; ?>&display=true" download="<?php echo $slugname; ?>"><i class="icon-download"></i><span> <?php echo mb_ucfirst(_t('dashboard', 'download_chart')); ?></span></a> |
||
| 298 | </div> |
||
| 299 | <?php } ?> |
||
| 300 | <h2><?php echo formatTitleh2(_t('dashboard','all_value')." / ".$resultscale2[0]['scale_denomination']); ?></h2> |
||
| 301 | <?php |
||
| 302 | // check if we use multi-values or not |
||
| 303 | ($result_sdii[0]['sdii_value_type'] == 'multiple') ? $tclass = ' multi-values' : $tclass = ''; |
||
| 304 | ?> |
||
| 305 | <table class="multisort<?php echo $tclass; ?>" id="indicator-values"> |
||
| 306 | <thead> |
||
| 307 | <tr> |
||
| 308 | <?php |
||
| 309 | echo "<td>".mb_ucfirst(_t('dashboard','date'))."</td>\n"; |
||
| 310 | echo "<td>".mb_ucfirst(_t('divers','by'))."</td>\n"; |
||
| 311 | echo "<td>".mb_ucfirst(_t('dashboard','value'))." (".formatText($result_sdii[0]['sdii_unit'], '2HTML').")"."</td>\n"; |
||
| 312 | echo "<td>".mb_ucfirst(_t('dashboard','threshold_value'))."</td>\n"; |
||
| 313 | echo "<td>".mb_ucfirst(_t('dashboard','rate'))."</td>\n"; |
||
| 314 | echo "<td>".mb_ucfirst(_t('dashboard','comment'))."</td>\n"; |
||
| 315 | echo "<td class=\"sorter-false\"> </td>\n"; |
||
| 316 | ?> |
||
| 317 | </tr> |
||
| 318 | </thead> |
||
| 319 | <tbody> |
||
| 320 | <?php |
||
| 321 | for ($i=0;$i<count($result_value);$i++){ |
||
| 322 | $comment = ''; |
||
| 323 | $current_val = ''; |
||
| 324 | |||
| 325 | // indicator is multivalues |
||
| 326 | if(!empty($result_value[$i]['sdiv_multivalue'])) { |
||
| 327 | |||
| 328 | $data = unserialize($result_value[$i]['sdiv_multivalue']); |
||
| 329 | |||
| 330 | foreach($data as &$val) { |
||
| 331 | $current_val .= '<p class="indicator-multivalue">'; |
||
| 332 | if(!empty($val['label'])) $current_val .= formatText($val['label'], '2HTML'). ' : '; |
||
| 333 | $current_val .= fnumber_format($val['value'], 'auto', false). '<span class="value-percent"> ('.fnumber_format($val['_percentage'], 2, false).' %)</span>'; |
||
| 334 | $current_val .= '</p>'; |
||
| 335 | } |
||
| 336 | // we display the total |
||
| 337 | $current_val .= '<p class="value-total indicator-multivalue">'; |
||
| 338 | $current_val .= mb_ucfirst(_t('dashboard', 'multivalue_total')) . ' : <span class="total-numeric" data-total="'.$data[0]['_total'].'">' . fnumber_format($data[0]['_total'], 'auto', false) . '</span>'; |
||
| 339 | $current_val .= ' <span>(<a class="ajaxload" href="'. override('../dashboard/pie.php').'?id='.$id.'&value='.$result_value[$i]['sdiv_id'].'&display=true">'._t('dashboard', 'to_detail_chart').'</a>)</span>'; |
||
| 340 | $current_val .= '</p>'; |
||
| 341 | |||
| 342 | |||
| 343 | |||
| 344 | // we compute rate |
||
| 345 | if(isset($result_value[$i+1]['sdiv_multivalue'])) { |
||
| 346 | $dataPlusOne = unserialize($result_value[$i+1]['sdiv_multivalue']); |
||
| 347 | $evol = ($data[0]['_total'] - $dataPlusOne[0]['_total']) / $dataPlusOne[0]['_total'] * 100; |
||
| 348 | // _debug('rate : '. fnumber_format($evol, 2). ' % - details : ('.$data[0]['_total']. ' - ' . $dataPlusOne[0]['_total']. ') / '. $dataPlusOne[0]['_total']); |
||
| 349 | $evol = fnumber_format($evol, 2). ' %'; |
||
| 350 | } else { |
||
| 351 | $evol = empty_nc(''); |
||
| 352 | } |
||
| 353 | |||
| 354 | // indicator is NOT multivalues |
||
| 355 | } else { |
||
| 356 | |||
| 357 | // If indicator is boolean |
||
| 358 | if($result_sdii[0]['sdii_type'] == 'boolean') { |
||
| 359 | $a = getBooleanValues($result_sdii[0]); |
||
| 360 | if($a) { |
||
| 361 | $current_val .= $a[$result_value[$i]['sdiv_value']]; |
||
| 362 | $maskminvalue = $a[0]; |
||
| 363 | $maskmaxvalue = $a[1]; |
||
| 364 | |||
| 365 | } else { |
||
| 366 | $current_val .= fnumber_format($result_value[$i]['sdiv_value'], 'auto', false); |
||
| 367 | } |
||
| 368 | |||
| 369 | } else { |
||
| 370 | $current_val .= fnumber_format($result_value[$i]['sdiv_value'], 'auto', false); |
||
| 371 | } |
||
| 372 | |||
| 373 | // we compute rate |
||
| 374 | if(isset($result_value[$i+1]['sdiv_value']) && is_numeric($result_value[$i+1]['sdiv_value'])) { |
||
| 375 | $evol = ($result_value[$i]['sdiv_value'] - $result_value[$i+1]['sdiv_value']) / $result_value[$i+1]['sdiv_value'] * 100; |
||
| 376 | // _debug('rate : '. fnumber_format($evol, 2). ' % - details : ('.$result_value[$i]['sdiv_value']. ' - ' . $result_value[$i+1]['sdiv_value']. ') / '. $result_value[$i+1]['sdiv_value']); |
||
| 377 | $evol = fnumber_format($evol, 2). ' %'; |
||
| 378 | } else { |
||
| 379 | $evol = empty_nc(''); |
||
| 380 | } |
||
| 381 | } |
||
| 382 | |||
| 383 | // if set, we get it from the table |
||
| 384 | if(!is_null($result_value[$i]['sdiv_threshold'])) { |
||
| 385 | $threshold = fnumber_format($result_value[$i]['sdiv_threshold'], 'auto', false); |
||
| 386 | } else { |
||
| 387 | $threshold = fnumber_format($default_threshold, 'auto', false); |
||
| 388 | } |
||
| 389 | |||
| 390 | |||
| 391 | ($result_value[$i]['sdiv_comment_display'] == 'Y') ? $comment_status = _t('dashboard', 'public') : $comment_status = _t('dashboard', 'private'); |
||
| 392 | if(!empty($result_value[$i]['sdiv_comment'])) { |
||
| 393 | $comment = '<div class="valuecomment">'; |
||
| 394 | $comment .= '<img src="'.THEME_ADMIN_PATH.'images/indic-comment.png" />'; |
||
| 395 | $comment .= '<div class="cont"><strong>'.ucfirst(_t('dashboard', 'comment')).' ('.$comment_status.') :</strong> '.$result_value[$i]['sdiv_comment'].'</div>'; |
||
| 396 | $comment .= '</div>'; |
||
| 397 | } |
||
| 398 | echo "<tr>\n"; |
||
| 399 | echo "<td>". formatText($result_value[$i]['date_p'], '2HTML')."</td>\n"; |
||
| 400 | echo "<td>". $result_value[$i]['user_login']."</td>\n"; |
||
| 401 | echo "<td class=\"value\">". formatText($current_val, '2HTML'); |
||
| 402 | |||
| 403 | if ($result_value[$i]['sdiv_statut']=='D') { |
||
| 404 | echo "<span class=\"state\">".mb_ucfirst(_t('statut','draft'))."</span>"; |
||
| 405 | } |
||
| 406 | echo "</td>\n"; |
||
| 407 | echo "<td class=\"threshold\">". $threshold."</td>\n"; |
||
| 408 | echo "<td class=\"rate\">". $evol."</td>\n"; |
||
| 409 | echo "<td>". $comment."</td>\n"; |
||
| 410 | echo "<td><div class=\"iconetab\"><a href=\"".$link_sup.$result_value[$i]['sdiv_id']."&id=".$id."&scale_id=".$scale_id."\" title=\""._t('dashboard','sup')."\" class=\"ico_sup\"><i class=\"icon-trash\"></i><span>" . _t('dashboard','sup') . "</span></a>"; |
||
| 411 | echo "<a href=\"".$link_mod.$result_value[$i]['sdiv_id']."&id=".$id."&scale_id=".$scale_id."\" title=\""._t('dashboard','mod')."\" class=\"ico_mod\"><i class=\"icon-pencil\"></i><span>" . _t('dashboard','mod') . "</span></a></div></td>\n"; |
||
| 412 | echo "</tr>\n"; |
||
| 413 | |||
| 414 | } |
||
| 415 | |||
| 416 | // Ability to sort table |
||
| 417 | addDynamicCSS('../lib/js/jquery.tablesorter/theme.default.css'); |
||
| 418 | footerAddJS('../lib/js/jquery.tablesorter/jquery.tablesorter.min.js'); |
||
| 419 | $str = '$("table.multisort").tablesorter({ });'; |
||
| 420 | footerAddInlineJS($str); |
||
| 421 | ?> |
||
| 422 | </tbody> |
||
| 423 | </table> |
||
| 424 | |||
| 425 | <!-- dropdown container --> |
||
| 426 | <div class="dropdown export-button" id="export-values"> |
||
| 427 | <!-- trigger button --> |
||
| 428 | <button><i class="icon-export"></i> <?php echo _t('dashboard', 'export_values'); ?></button> |
||
| 429 | <!-- dropdown menu --> |
||
| 430 | <ul class="dropdown-menu"> |
||
| 431 | <li><a href="#export-values" data-format="excel"><i class="icon-file-excel"></i> <?php echo _t('export', 'format', 'excel'); ?></a></li> |
||
| 432 | <li><a href="#export-values" data-format="csv"><i class="icon-file-code"></i> <?php echo _t('export', 'format', 'csv'); ?></a></li> |
||
| 433 | <li><a href="#export-values" data-format="json"><i class="icon-file-code"></i> <?php echo _t('export', 'format', 'json'); ?></a></li> |
||
| 434 | <li><a href="#export-values" data-format="png"><i class="icon-file-image"></i> <?php echo _t('export', 'format', 'png'); ?></a></li> |
||
| 435 | </ul> |
||
| 436 | |||
| 437 | </div> |
||
| 438 | |||
| 439 | <?php |
||
| 440 | // Insert Javascript instructions to allow client Excel export |
||
| 441 | footerAddJS('../lib/js/tableExport.jquery.plugin/tableExport.min.js'); |
||
| 442 | footerAddJS('../lib/js/tableExport.jquery.plugin/libs/html2canvas/html2canvas.min.js'); |
||
| 443 | |||
| 444 | $slug_name = Stringy\Stringy::create($result_sdii[0]['sdii_name'], CHARSET)->safeTruncate(50)->slugify(); |
||
| 445 | |||
| 446 | |||
| 447 | $str = '$("#export-values li a").click(function() { |
||
| 448 | |||
| 449 | var format = $(this).attr("data-format"); |
||
| 450 | |||
| 451 | // if is multi-values table we dynamically change the content |
||
| 452 | if( $("#indicator-values").hasClass("multi-values") && format != "png") { |
||
| 453 | $el = $("#indicator-values").clone().attr("id", "indicator-values-clone"); // we create a clone |
||
| 454 | |||
| 455 | $el.find( "td.value" ).each(function( index ) { |
||
| 456 | // we replace all values by total value only |
||
| 457 | $( this ).text($( this ).find("p.value-total span.total-numeric").attr("data-total") ); |
||
| 458 | }); |
||
| 459 | |||
| 460 | $el.insertAfter("#export-values"); // if not displayed, the export does not work |
||
| 461 | } else { |
||
| 462 | $el = $("#indicator-values"); |
||
| 463 | } |
||
| 464 | $el.tableExport( |
||
| 465 | {tableName:"'.mb_ucfirst($result_sdii[0]['sdii_name']. ' / '. $resultscale2[0]['scale_denomination']) .'",type:format,escape:\'false\',ignoreColumn:\'[6]\',displayTableName:\'true\',htmlContent:\'false\',fileName:\'' . $slug_name . '\'}); |
||
| 466 | |||
| 467 | return false; |
||
| 468 | });'; |
||
| 469 | footerAddInlineJS($str); |
||
| 470 | ?> |
||
| 471 | |||
| 472 | |||
| 473 | <?php } |
||
| 474 | else echo "<div class=\"info\">"._t('dashboard','novalue').": ".formatText($resultscale2[0]['scale_denomination'], '2HTML')."</div>"; |
||
| 475 | ?> |
||
| 476 | |||
| 477 | <dl class="dl2"> |
||
| 478 | <dt><?php echo mb_ucfirst(_t('sdi','level')) ?> :</dt> |
||
| 479 | <dd><?php |
||
| 480 | if ($l21auth->isSuperAdmin()) |
||
| 481 | echo "<a href=\"".$link_det_level.$result_sdii[0]['sdii_level']."\" title=\"".formatText($result_sdii[0]['level_name'], '2HTML')."\">".formatText($result_sdii[0]['level_name'], '2HTML')."</a>"; |
||
| 482 | else echo formatText($result_sdii[0]['level_name'], '2HTML'); |
||
| 483 | ?></dd> |
||
| 484 | <dt><?php echo mb_ucfirst(_t('sdi','description')) ?> :</dt> |
||
| 485 | <dd><?php echo formatText($result_sdii[0]['sdii_description'], '2HTML');?></dd> |
||
| 486 | <dt><?php echo mb_ucfirst(_t('sdi','threshold_relative')) ?> :</dt> |
||
| 487 | <dd><?php |
||
| 488 | if ($result_sdii[0]['sdii_threshold_relative']=='Y') echo mb_ucfirst(_t('sdi','threshold_relative_Y')); |
||
| 489 | else echo mb_ucfirst(_t('sdi','threshold_relative_N')); |
||
| 490 | ?></dd> |
||
| 491 | </dl> |
||
| 492 | |||
| 493 | |||
| 494 | <h2><?php echo _t('sdi','info_mesure'); ?></h2> |
||
| 495 | |||
| 496 | <table> |
||
| 497 | <thead> |
||
| 498 | <tr> |
||
| 499 | <?php |
||
| 500 | echo "<td>".mb_ucfirst(_t('sdi','min_value'))." (".formatText($result_sdii[0]['sdii_unit'], '2HTML').")"."</td>\n"; |
||
| 501 | echo "<td>".mb_ucfirst(_t('sdi','max_value'))." (".formatText($result_sdii[0]['sdii_unit'], '2HTML').")"."</td>\n"; |
||
| 502 | echo "<td>".mb_ucfirst(_t('sdi','initial_threshold_value'))." (".formatText($result_sdii[0]['sdii_unit'], '2HTML').")"."</td>\n"; |
||
| 503 | echo "<td>".mb_ucfirst(_t('sdi','frequency'))."</td>\n"; |
||
| 504 | ?> |
||
| 505 | </tr> |
||
| 506 | </thead> |
||
| 507 | <tbody> |
||
| 508 | <?php |
||
| 509 | |||
| 510 | isset($maskminvalue) ? $display_min = $maskminvalue : $display_min = empty_nc(fnumber_format($result_sdii[0]['sdii_min_value'], 'auto', false)); |
||
| 511 | isset($maskmaxvalue) ? $display_max = $maskmaxvalue : $display_max = empty_nc(fnumber_format($result_sdii[0]['sdii_max_value'], 'auto', false)); |
||
| 512 | |||
| 513 | echo "<tr>\n"; |
||
| 514 | echo "<td>". $display_min."</td>\n"; |
||
| 515 | echo "<td>". $display_max."</td>\n"; |
||
| 516 | echo "<td>". formatText(empty_nc(fnumber_format($result_sdii[0]['sdii_threshold_value'], 'auto', false)), '2HTML')."</td>\n"; |
||
| 517 | echo "<td>". formatText(fnumber_format($result_sdii[0]['sdii_frequency'], 'auto', false), '2HTML')."</td>\n"; |
||
| 518 | echo "</tr>\n"; |
||
| 519 | ?> |
||
| 520 | </tbody> |
||
| 521 | </table> |
||
| 522 | |||
| 523 | <div class="toggle_title"> |
||
| 524 | <a href="" id="affinfoge"><?php echo mb_ucfirst(_t('dashboard','det_sdi'));?></a> |
||
| 525 | </div> |
||
| 526 | <div id="general" style="display: none;" class="mtm"> |
||
| 527 | <dl class="dl2"> |
||
| 528 | |||
| 529 | <?php /*<dt><?php echo mb_ucfirst(_t('sdi','range')) ?> : </dt> |
||
| 530 | <dd><?php echo formatText(empty_nc($result_sdii[0]['sdii_range']), '2HTML');?></dd> */ ?> |
||
| 531 | <dt><?php echo mb_ucfirst(_t('sdi','comment')) ?> :</dt> |
||
| 532 | <dd><?php echo formatText(empty_nc($result_sdii[0]['sdii_comment']), '2HTML');?></dd> |
||
| 533 | <dt><?php echo mb_ucfirst(_t('sdi','goal')) ?> :</dt> |
||
| 534 | <dd><?php echo formatText(empty_nc($result_sdii[0]['sdii_goal']), '2HTML');?></dd> |
||
| 535 | <dt><?php echo mb_ucfirst(_t('sdi','consulting')) ?> :</dt> |
||
| 536 | <dd><?php echo formatText(empty_nc($result_sdii[0]['sdii_consulting']), '2HTML');?></dd> |
||
| 537 | <dt><?php echo mb_ucfirst(_t('divers','statut')) ?> :</dt> |
||
| 538 | <dd><?php echo display_statut($result_sdii[0]['sdii_statut']);?></dd> |
||
| 539 | </dl> |
||
| 540 | </div> |
||
| 541 | |||
| 542 | <div class="toggle_title"> |
||
| 543 | <a href="#" id="affprovider"><?php echo _t('sdi','aff_sdi_p');?></a> |
||
| 544 | </div> |
||
| 545 | <div id="provider" style="display: none;" class="mtm"><?php if ($result_p[0]['sdip_name']=="") { |
||
| 546 | echo "<h2 class=\"info\">"._t('divers','nodata')."</h2>"; |
||
| 547 | }else {?> <?php |
||
| 548 | if(empty($result_p[0]['sdip_email'])) { |
||
| 549 | $mailto_provider = empty_nc($result_p[0]['sdip_email']); |
||
| 550 | } else { |
||
| 551 | $mailto_provider = "<a href=\"mailto:".formatText(empty_nc($result_p[0]['sdip_email']), '2HTML')."\" title=\"".formatText(empty_nc($result_p[0]['sdip_email']), '2HTML')."\">".formatText(empty_nc($result_p[0]['sdip_email']), '2HTML')."</a>"; |
||
| 552 | } |
||
| 553 | ?> |
||
| 554 | <h2><?php echo formatText(empty_nc($result_p[0]['sdip_name']), '2HTML');?></h2> |
||
| 555 | <dl class="dl2"> |
||
| 556 | <dt><?php echo mb_ucfirst(_t('sdi','p_service')) ?> :</dt> |
||
| 557 | <dd><?php echo formatText(empty_nc($result_p[0]['sdip_service']), '2HTML');?></dd> |
||
| 558 | <dt><?php echo mb_ucfirst(_t('sdi','p_incharge')) ?> :</dt> |
||
| 559 | <dd><?php echo formatText(empty_nc($result_p[0]['sdip_incharge']), '2HTML');?></dd> |
||
| 560 | <dt><?php echo mb_ucfirst(_t('sdi','p_address')) ?> :</dt> |
||
| 561 | <dd><?php echo formatText(empty_nc($result_p[0]['sdip_address']), '2HTML');?></dd> |
||
| 562 | <dt><?php echo mb_ucfirst(_t('sdi','p_phone')) ?> :</dt> |
||
| 563 | <dd><?php echo formatText(empty_nc($result_p[0]['sdip_phone']), '2HTML');?></dd> |
||
| 564 | <dt><?php echo mb_ucfirst(_t('sdi','p_fax')) ?> :</dt> |
||
| 565 | <dd><?php echo formatText(empty_nc($result_p[0]['sdip_fax']), '2HTML');?></dd> |
||
| 566 | <dt><?php echo mb_ucfirst(_t('sdi','p_email')) ?> :</dt> |
||
| 567 | <dd><?php echo $mailto_provider; ?></dd> |
||
| 568 | <dt><?php echo mb_ucfirst(_t('sdi','p_description')) ?> :</dt> |
||
| 569 | <dd><?php echo formatText(empty_nc($result_p[0]['sdip_description']), '2HTML');?></dd> |
||
| 570 | </dl> |
||
| 571 | <?php } ?></div> |
||
| 572 | |||
| 573 | <div class="toggle_title"> |
||
| 574 | <a href="#" id="affeval"><?php echo _t('sdi','aff_sdi_e');?></a> |
||
| 575 | </div> |
||
| 576 | <div id="evaluation" style="display: none;" class="mtm"> |
||
| 577 | <table> |
||
| 578 | <thead> |
||
| 579 | <tr> |
||
| 580 | <?php |
||
| 581 | echo "<td>".mb_ucfirst(_t('sdi','e_scale_compare'))."</td>\n"; |
||
| 582 | echo "<td>".mb_ucfirst(_t('sdi','e_fiability'))."</td>\n"; |
||
| 583 | echo "<td>".mb_ucfirst(_t('sdi','e_accessibility'))."</td>\n"; |
||
| 584 | echo "<td>".mb_ucfirst(_t('sdi','e_lisibility'))."</td>\n"; |
||
| 585 | echo "<td>".mb_ucfirst(_t('sdi','e_relevance'))."</td>\n"; |
||
| 586 | echo "<td>".mb_ucfirst(_t('sdi','e_global_performance'))."</td>\n"; |
||
| 587 | ?> |
||
| 588 | </tr> |
||
| 589 | </thead> |
||
| 590 | <tbody> |
||
| 591 | <?php echo "<tr>\n"; |
||
| 592 | echo "<td>". empty_nc($result_e[0]['sdie_scale_compare'])."</td>\n"; |
||
| 593 | echo "<td>". empty_nc($result_e[0]['sdie_fiability'])."</td>\n"; |
||
| 594 | echo "<td>". empty_nc($result_e[0]['sdie_accessibility'])."</td>\n"; |
||
| 595 | echo "<td>". empty_nc($result_e[0]['sdie_lisibility'])."</td>\n"; |
||
| 596 | echo "<td>". empty_nc($result_e[0]['sdie_relevance'])."</td>\n"; |
||
| 597 | echo "<td>". empty_nc($result_e[0]['sdie_global_performance'])."</td>\n"; |
||
| 598 | echo "</tr>\n"; |
||
| 599 | ?> |
||
| 600 | </tbody> |
||
| 601 | </table> |
||
| 602 | </div> |
||
| 603 | |||
| 604 | <div class="toggle_title"> |
||
| 605 | <a href="#" id="affreg"><?php echo _t('sdi','aff_sdi_r');?></a> |
||
| 606 | </div> |
||
| 607 | <div id="reglementation" style="display: none;" class="mtm"><?php if ($result_r[0]['sdir_title']=="") { |
||
| 608 | echo "<h2 class=\"info\">"._t('divers','nodata')."</h2>"; |
||
| 609 | }else {?> <?php |
||
| 610 | if(empty($result_r[0]['sdir_referer_uri'])) { |
||
| 611 | $rules_link = empty_nc($result_r[0]['sdir_referer_uri']); |
||
| 612 | } else { |
||
| 613 | $rules_link = "<a href=\"".formatText(empty_nc($result_r[0]['sdir_referer_uri']), '2HTML')."\" title=\"".formatText(empty_nc($result_r[0]['sdir_mask_uri']), '2HTML')."\" class=\"out\">".formatText(empty_nc($result_r[0]['sdir_mask_uri']), '2HTML')."</a>"; |
||
| 614 | } |
||
| 615 | ?> |
||
| 616 | <h2><?php echo formatText(empty_nc($result_r[0]['sdir_title']), '2HTML');?></h2> |
||
| 617 | |||
| 618 | <dl class="dl2"> |
||
| 619 | <dt><?php echo mb_ucfirst(_t('sdi','r_referer_uri')) ?> :</dt> |
||
| 620 | <dd><?php echo $rules_link; "</dd>"; ?> |
||
| 621 | </dl> |
||
| 622 | |||
| 623 | <div> |
||
| 624 | <?php echo formatText(empty_nc($result_r[0]['sdir_body']), '2HTML'); ?> |
||
| 625 | </div> |
||
| 626 | <?php } ?> |
||
| 627 | </div> |
||
| 628 | </div> <!-- closing #content --> |
||
| 629 | </div> <!-- closing .contentcontainer --> |
||
| 630 | |||
| 631 | <script type="text/javascript"> |
||
| 632 | $(document).ready(function() { |
||
| 633 | $(".ajaxload").colorbox({iframe:true, width:"650px", height:"600px"}); |
||
| 634 | $(".valuecomment").hover( |
||
| 635 | function() { |
||
| 636 | $('.cont', this).fadeIn(); |
||
| 637 | }, |
||
| 638 | function() { |
||
| 639 | $('.cont', this).hide(); |
||
| 640 | }); |
||
| 641 | }); |
||
| 642 | </script> |
||
| 643 | </pre> |