* @version $Id$ * @access public * @license http://opensource.org/licenses/gpl-3.0.html */ include_once("../config/define.php"); include_once("../dashboard/common.php"); include_once("../dashboard/".SQL.".inc.php"); include_once(override("../dashboard/chart-prepare.php")); include_once('../languages/' . U_L . '/lang_dashboard.' . CHARSET . '.php'); include_once('../languages/' . U_L . '/lang_sdi.' . CHARSET . '.php'); include_once('../languages/' . U_L . '/lang_common.' . CHARSET . '.php'); if(MOD_DEBUG == 1) $csuffix = '?v='. time(); else $csuffix= ''; // getting chart sizes from config file list($cwidth, $cheight) = explode('x', CHART_DEFAULT_SIZE); isset($_GET['id']) && isset($_GET['id'])? $id = formatText($_GET['id'], '2FIELD') : die('no given id'); if(!is_numeric($_GET['id'])) die ('no way'); isset($_GET['scale']) ? $scale = formatText($_GET['scale'], '2FIELD') : $scale = 1; isset($_GET['year']) ? $year = formatText($_GET['year'], '2FIELD') : $year = null; isset($_GET['type']) ? $type = formatText($_GET['type'], '2FIELD') : $type = null; isset($_GET['width']) ? $width = formatText($_GET['width'], '2FIELD') : $width = $cwidth; // should be '%' isset($_GET['height']) ? $height = formatText($_GET['height'], '2FIELD') : $height = $cheight; isset($_GET['unit']) && in_array($_GET['unit'], array('%', 'px')) ? $unit = formatText($_GET['unit'], '2FIELD') : $unit = 'px';// pixel is default unit isset($_GET['notitle']) ? $notitle = 1 : $notitle = 0; isset($_GET['stack-type']) ? $stacktype = formatText($_GET['stack-type'], '2FIELD') : $stacktype = 'normal'; // auto values, pixel and % units are supported if($width != 'auto') { // if unit is not set into width / height we set it if(!Stringy\Stringy::create($width, CHARSET)->endsWith('px') && !Stringy\Stringy::create($width, CHARSET)->endsWith('%')) { $width .= $unit; } } if($height != 'auto') { // if unit is not set into width / height we set it if(!Stringy\Stringy::create($height, CHARSET)->endsWith('px') && !Stringy\Stringy::create($height, CHARSET)->endsWith('%')) { $height .= $unit; } } // we get indicator's info $indicator = $sql_object -> DBSelect(SQL_getInfoSdi($id)); // we get indicator's values $values = $sql_object -> DBSelect(SQL_getAllValue("SCA", $scale, $id)); // we create an array to populate and send to javascript $obj = []; $obj['site-language'] = U_L; $obj['indicator-notitle'] = $notitle; $obj['indicator-name'] = formatText($indicator[0]['sdii_name'], '2HTML'); $obj['indicator-force-min'] = cast_number($indicator[0]['sdii_force_chart_min']); $obj['indicator-frequency'] = $indicator[0]['sdii_frequency']; $obj['indicator-type'] = $indicator[0]['sdii_value_type']; $obj['indicator-unique-mode'] = $indicator[0]['sdii_unique_mode']; $obj['indicator-multiple-type'] = $indicator[0]['sdii_multiple_type']; $obj['indicator-multiple-mode'] = $indicator[0]['sdii_multiple_mode']; $obj['indicator-default-vis'] = $indicator[0]['sdii_detail_viz']; $obj['indicator-stack-type'] = $stacktype; if(is_null($year)) { !is_null($type) && in_array($type, array_keys($GLOBALS['lang']['sdi']['select_detail_viz'])) ? $obj['indicator-wanted-vis'] = $type : $obj['indicator-wanted-vis'] = $indicator[0]['sdii_detail_viz']; } else { // we try to generate a multiple indicator chart for a given year !is_null($type) && in_array($type, array_keys($GLOBALS['lang']['viz'])) ? $obj['indicator-wanted-vis'] = $type : $obj['indicator-wanted-vis'] = array_keys($GLOBALS['lang']['viz'])[1]; } $obj['indicator-wanted-year'] = $year; // if not set, takes null value $obj['indicator-serie-name'] = formatText(_t('dashboard', 'value'), '2HTML'); $obj['indicator-threshold-name'] = formatText(_t('dashboard', 'threshold_value'), '2HTML'); $obj['indicator-mean-name'] = formatText(_t('dashboard', 'multivalue_mean'), '2HTML'); $obj['indicator-unit'] = $indicator[0]['sdii_unit']; $obj['indicator-negative-notice'] = formatText(_t('dashboard', 'negative_values_notice')); $obj['dates'] = array(); $obj['data'] = array(); $obj['thresholds'] = array(); if($obj['indicator-wanted-vis'] == 'donut') { $obj['indicator-wanted-vis'] = 'pie'; $obj['vis-pie-size'] = '60%'; } $cdata = prepare_chart_data($indicator, $obj, $values); ?>