* @version $id SVN
* @access public
* @license http://opensource.org/licenses/gpl-3.0.html
*/
include_once(themePath('../dashboard/' . SQL . '.inc.php'));
/**
* DisplayListValues()
* affichage du tableau de bord
* @param integer $id_filter
* @param integer $filter
* @return
**/
if(!function_exists('DisplayListValues')) {
function DisplayListValues($id_filter = -1, $filter = -1)
{
$result = $GLOBALS['sql_object'] -> DBSelect(SQL_getListtheme());
$result_sdi = $GLOBALS['sql_object'] -> DBSelect(SQL_getListSdi("P", $valueparam = 0));
$listing = "";
$a='';
$current_sdtheme = '';
for ($i = 0;$i < count($result);$i++) {
if ($result[$i]['sdtheme_id'] != $current_sdtheme && $current_sdtheme <> '') {
$listing .= "" . END_LINE;
$listing .= "" . END_LINE;
}
if ($result[$i]['sdtheme_id'] != $current_sdtheme) {
$a++;
$current_sdtheme = $result[$i]['sdtheme_id'];
$listing .= "
" . formatText($result[$i]['sdtheme_name'], '2HTML') . "
".END_LINE;
$listing .= '' . END_LINE;
$listing .= '' . END_LINE;
$listing .= '' . END_LINE;
$listing .= ''._t('dashboard','graphic_value').' | ' . END_LINE;
//$listing .= ''._t('dashboard','numeric_value').' | ' . END_LINE;
$listing .= ''._t('dashboard','tendencies_value').' | ' . END_LINE;
$listing .= ''._t('dashboard','label_value').' | ' . END_LINE;
$listing .= '
' . END_LINE;
$listing .= '' . END_LINE;
$listing .= '' . END_LINE;
}
for ($j = 0;$j < count($result_sdi);$j++) {
if ($result[$i]['theme_id'] == $result_sdi[$j]['sdii_theme']) {
$link_det_sdi= array('rub'=> $GLOBALS['links'][U_L]['dashboard']['linkvalue'],'id'=>$result_sdi[$j]['sdii_id'], 'parentid'=> $id_filter, 'name' => $result_sdi[$j]['sdii_name']);
$listing .= "" . END_LINE;
$aff_bare = getRuler($id_filter, $filter, $result_sdi[$j]['sdii_id'], $result_sdi[$j]['sdii_max_value'], $result_sdi[$j]['sdii_min_value'], $result_sdi[$j]['sdii_threshold_value'], $result_sdi[$j]['sdii_unit'], $result_sdi[$j]['sdii_threshold_relative'], $link_det_sdi);
$listing .= $aff_bare;
$listing .= "" . formatText(cutText($result_sdi[$j]['sdii_name'], 53), '2HTML') . " | " . END_LINE;
$listing .= "
" . END_LINE;
}
}
}
$listing .= "" . END_LINE;
$listing .= "
" . END_LINE;
echo $listing;
}
}
/**
* getPositionfromValue()
* traitement de la valeur d'un IDD pour valeur du curseur en CSS
* @param $value
* @param $max_value
* @param $min_value
* @param $threshold_value
* @param $threshold_relative
* @return
**/
if(!function_exists('getPositionfromValue')) {
function getPositionfromValue ($value, $max_value, $min_value, $threshold_value, $threshold_relative)
{
if ($max_value == 0) $max_value = 0.000001;
if ($min_value == 0) $min_value = 0.000001;
if ($threshold_relative == 'Y') {
$unitup = 50 / ($max_value - $threshold_value);
$unitdown = 50 / ($threshold_value - $min_value);
if ($value > $threshold_value) $result = 50 + (($value - $threshold_value) * $unitup);
else $result = 50 - (($threshold_value - $value) * $unitdown);
} else {
if(($max_value - $threshold_value) <> 0) $unitdown = 50 / ($max_value - $threshold_value);
if(($threshold_value - $min_value) <> 0) $unitup = 50 / ($threshold_value - $min_value);
if ($value > $threshold_value) $result = 50 - (($value - $threshold_value) * $unitdown);
else $result = 50 + (($threshold_value - $value) * $unitup);
}
return (int)$result;
}
}
/**
* getRuler()
* affichage du curseur et compteur pour un IDD
* @param integer $scale_id
* @param $filter
* @param $id
* @param $max_value
* @param $min_value
* @param $threshold_value
* @param $unit
* @param $threshold_relative
* @param $link_det_sdi
* @return
**/
if(!function_exists('getRuler')) {
function getRuler($scale_id = 1, $filter, $id, $max_value, $min_value, $threshold_value, $unit, $threshold_relative, $link_det_sdi)
{
$result_value = $GLOBALS['sql_object'] -> DBSelect(SQL_getAllValue("SCD", $scale_id, $id));
if ($result_value <> false) {
$value_cursor1 = getPositionfromValue ($result_value[0]['sdiv_value'], $max_value, $min_value, $threshold_value, $threshold_relative);
$value_cursor = 116 - $value_cursor1;
} else $value_cursor1 = "";
if ($result_value == false) {
$listing = " | " . END_LINE;
$listing .= " | " . END_LINE;
//$listing .= " | " . END_LINE;
} else {
$listing = " ".
" ".ucfirst(_t('dashboard','value'))." : ".$result_value[0]['sdiv_value']." ".$unit." ".
" ".ucfirst(_t('sdi','min_value'))." : ".$min_value." ".$unit." ".
" ".ucfirst(_t('sdi','max_value'))." : ".$max_value." ".$unit." ".
" ".ucfirst(_t('sdi','threshold_value'))." : ".$threshold_value." ".$unit." ".
" ".
"" . END_LINE;
$listing .= " | " . END_LINE;
if (isset($result_value[1]['sdiv_value'])) {
if ($result_value[0]['sdiv_value'] >= $result_value[1]['sdiv_value']) $listing .= " | " . END_LINE;
else $listing .= " | " . END_LINE;
} else $listing .= " | " . END_LINE;
//$listing .= " (" . (int)$result_value[0]['sdiv_value'] . ") | " . END_LINE;
}
return $listing;
}
}
/**
* DisplayOneSdi()
* affichage d'un indicateur et infos résumé
* @param $sdi_id
* @param $scale_id
* @return
**/
if(!function_exists('DisplayOneSdi')) {
function DisplayOneSdi($sdi_id, $scale_id)
{
echo GetSdiTitle($sdi_id, $scale_id);
echo getDashboardNavigation($sdi_id,$scale_id);
echo GetAllValue($sdi_id, $scale_id);
echo GetOneSdiInfo($sdi_id);
}
}
/**
* DisplayOneSdirules()
* affichage d'un indicateur et toutes ses infos
* @param $sdi_id
* @param $scale_id
* @return
**/
if(!function_exists('DisplayOneSdirules')) {
function DisplayOneSdirules($sdi_id, $scale_id)
{
echo GetSdiTitle($sdi_id, $scale_id);
echo getDashboardNavigation($sdi_id,$scale_id);
echo GetOneSdiRules($sdi_id);
}
}
/**
* DisplayOneSdievaluation()
* affichage d'un indicateur et toutes ses infos
* @param $sdi_id
* @param $scale_id
* @return
**/
if(!function_exists('DisplayOneSdievaluation')) {
function DisplayOneSdievaluation($sdi_id, $scale_id)
{
echo GetSdiTitle($sdi_id, $scale_id);
echo getDashboardNavigation($sdi_id,$scale_id);
echo GetOneSdiEvaluation($sdi_id);
}
}
/**
* DisplayOneSdiprovider()
* affichage d'un indicateur et toutes ses infos
* @param $sdi_id
* @param $scale_id
* @return
**/
if(!function_exists('DisplayOneSdiprovider')) {
function DisplayOneSdiprovider($sdi_id, $scale_id)
{
echo GetSdiTitle($sdi_id, $scale_id);
echo getDashboardNavigation($sdi_id,$scale_id);
echo GetOneSdiProvider($sdi_id);
}
}
/**
* GetAllValue()
* afficahge de l'ensemble des valeurs publiques d'un IDD
* @param $sdi_id
* @param $scale_id
* @return
**/
if(!function_exists('GetAllValue')) {
function GetAllValue($sdi_id, $scale_id)
{
$result_value = $GLOBALS['sql_object'] -> DBSelect(SQL_getAllValue("SCD", $scale_id, $sdi_id));
$result_sdi_value = $GLOBALS['sql_object'] -> DBSelect(SQL_getInfoSdiforvalue($sdi_id));
$content = '' . END_LINE;
$content .= '
'._t('dashboard','historic').'
' . END_LINE;
$content .= '
'._t('sdi','threshold_value').' : '.$result_sdi_value[0]['sdii_threshold_value'].' '.$result_sdi_value[0]['sdii_unit'].'
' . END_LINE;
if ($result_value <> false) {
if (count($result_value) > 2) {
$content .= '
'._t('dashboard','rep_graph').'
' . END_LINE;
$content .= "

" . END_LINE;
}
$content .= '
'._t('dashboard','value').'
' . END_LINE;
$content .= '
' . END_LINE;
$content .= '' . END_LINE;
$content .= '' . END_LINE;
$content .= ""._t('dashboard','date')." | " . END_LINE;
$content .= ""._t('dashboard','value')." (".$result_sdi_value[0]['sdii_unit'].") | " . END_LINE;
$content .= ""._t('dashboard','comment')." | " . END_LINE;
$content .= "
" . END_LINE;
$content .= "" . END_LINE;
$content .= "" . END_LINE;
for ($i = 0;$i < count($result_value);$i++) {
$comment = '';
if(!empty($result_value[$i]['sdiv_comment']) && $result_value[$i]['sdiv_comment_display']=='Y') {
$comment = '';
}
$content .= "" . END_LINE;
$content .= "" . formatText($result_value[$i]['date_p'], '2HTML') . " | " . END_LINE;
$content .= "" . formatText($result_value[$i]['sdiv_value'], '2HTML') . " | " . END_LINE;
$content .= "". $comment. " | \n";
$content .= "
" . END_LINE;
}
$content .= "" . END_LINE;
$content .= "
" . END_LINE;
$content .= '
' . END_LINE;
return $content;
}
}
}
/**
* GetSdiTitle()
* affichage nom d'un indicateur
* @param $sdi_id
* @param $scale_id
* @return
**/
if(!function_exists('GetSdiTitle')) {
function GetSdiTitle($sdi_id, $scale_id)
{
$link_self= array('rub'=> $GLOBALS['links'][U_L]['dashboard']['linkvalue'],'id' => $sdi_id, 'parentid' => $_REQUEST['parentid']);
$data_sdi = $GLOBALS['sql_object'] -> DBSelect(SQL_getOnesdiname($sdi_id));
$data_scale = $GLOBALS['sql_object'] -> DBSelect(SQL_getonescale($scale_id));
$sdi_name = formatText($data_sdi[0]['sdii_name'], '2HTML');
$sdi_description = formatText($data_sdi[0]['sdii_description'], '2HTML');
$scale_name = formatText(cutText($data_scale[0]['scale_denomination'], 150), '2HTML');
$content = '' . END_LINE;
$content .= '
' . $sdi_name . '
' . END_LINE;
$content .='
'.END_LINE;
$content .= formatted_permalink($link_self);
$content .='
'.END_LINE;
$content .= '
' . $sdi_description . '
' . END_LINE;
$content .= '
échelle : ' . $scale_name . '
' . END_LINE;
$content .= '
' . END_LINE;
return $content;
}
}
/**
* GetOneSdiInfo()
* récupération des infos générales d'un indicateur
* @param $sdi_id
* @return
**/
if(!function_exists('GetOneSdiInfo')) {
function GetOneSdiInfo($sdi_id)
{
$data = $GLOBALS['sql_object'] -> DBSelect(SQL_getInfoSdi($sdi_id));
$sdi_name = formatText($data[0]['sdii_name'], '2HTML');
$sdi_theme = formatText(cutText($data[0]['theme_name'], 150), '2HTML');
$sdi_description = formatText($data[0]['sdii_description'], '2HTML');
$sdi_comment = formatText($data[0]['sdii_comment'], '2HTML');
$sdi_goal = formatText($data[0]['sdii_goal'], '2HTML');
$sdi_consulting = formatText($data[0]['sdii_consulting'], '2HTML');
$content = '' . END_LINE;
$content .= '
'._t('dashboard','det_sdi2').'
' . END_LINE;
$content .= '
'._t('sdi','goal_public').'
' . END_LINE;
$content .= '
' . $sdi_goal . '
' . END_LINE;
$content .= '
'._t('sdi','consulting_public').'
' . END_LINE;
$content .= '
' . $sdi_consulting . '
' . END_LINE;
$content .= '
' . END_LINE;
return $content;
}
}
/**
* GetOneSdiRules()
* récupération des réglementations d'un indicateur
* @param $sdi_id
* @return
**/
if(!function_exists('GetOneSdiRules')) {
function GetOneSdiRules($sdi_id)
{
$result_r = $GLOBALS['sql_object'] -> DBSelect(SQL_getRules($sdi_id, $GLOBALS['sql_object'], -1));
$r_title = formatText($result_r[0]['sdir_title'], '2HTML');
$r_body = formatText($result_r[0]['sdir_body'], '2HTML');
if(!empty($result_r[0]['sdir_referer_uri'])) {
$url = "" . formatText($result_r[0]['sdir_mask_uri'], '2HTML') . "";
}
$content = '' . END_LINE;
$content .= '
'._t('sdi','r_body').'
' . END_LINE;
if ($result_r[0]['sdir_title'] == "") {
$content .= "
"._t('divers','nodata')."
" . END_LINE;
} else {
$content .= "
" . $r_title . "
" . END_LINE;
$content .= "
" . $r_body . "
" . END_LINE;
if(isset($url)) {
$content .= "
" . $url . "
" . END_LINE;
}
}
$content .= '
' . END_LINE;
return $content;
}
}
/**
* GetOneSdiEvaluation()
* récupération des critères d'évaluation d'un indicateur
* @param $sdi_id
* @return
**/
if(!function_exists('GetOneSdiEvaluation')) {
function GetOneSdiEvaluation($sdi_id)
{
$result_e = $GLOBALS['sql_object'] -> DBSelect(SQL_getEvaluation($sdi_id, $GLOBALS['sql_object'], -1));
$content = '' . END_LINE;
$content .= '
'._t('sdi','e_title').'
' . END_LINE;
$content .= '
' . END_LINE;
$content .= '' . END_LINE;
$content .= '' . END_LINE;
$content .= ""._t('sdi','e_scale_compare')." | " . END_LINE;
$content .= ""._t('sdi','e_fiability')." | " . END_LINE;
$content .= ""._t('sdi','e_accessibility')." | " . END_LINE;
$content .= ""._t('sdi','e_lisibility')." | " . END_LINE;
$content .= ""._t('sdi','e_relevance')." | " . END_LINE;
$content .= ""._t('sdi','e_global_performance')." | " . END_LINE;
$content .= "
" . END_LINE;
$content .= "" . END_LINE;
$content .= "" . END_LINE;
$content .= "" . END_LINE;
$content .= "" . $result_e[0]['sdie_scale_compare'] . " | " . END_LINE;
$content .= "" . $result_e[0]['sdie_fiability'] . " | " . END_LINE;
$content .= "" . $result_e[0]['sdie_accessibility'] . " | " . END_LINE;
$content .= "" . $result_e[0]['sdie_lisibility'] . " | " . END_LINE;
$content .= "" . $result_e[0]['sdie_relevance'] . " | " . END_LINE;
$content .= "" . $result_e[0]['sdie_global_performance'] . " | " . END_LINE;
$content .= "
" . END_LINE;
$content .= "" . END_LINE;
$content .= "
" . END_LINE;
$content .= '
' . END_LINE;
return $content;
}
}
/**
* GetOneSdiProvider()
* récupération des infos du fournisseurs d'un indicateur
* @param $sdi_id
* @return
**/
if(!function_exists('GetOneSdiProvider')) {
function GetOneSdiProvider($sdi_id)
{
$result_p = $GLOBALS['sql_object'] -> DBSelect(SQL_getProvider($sdi_id, $GLOBALS['sql_object'], -1));
$p_name = formatText($result_p[0]['sdip_name'], '2HTML');
$p_description = formatText($result_p[0]['sdip_description'], '2HTML');
$content = '' . END_LINE;
$content .= '
'._t('sdi','p_title').'
' . END_LINE;
if ($result_p[0]['sdip_name'] == "") {
$content .= "
"._t('divers','nodata')."
" . END_LINE;
} else {
$content .= '
' . $p_name . '
' . END_LINE;
$content .= '
' . $p_description . '
' . END_LINE;
}
$content .= '
' . END_LINE;
return $content;
}
}
/**
* getDataVizMode()
* return a link to switch display mode
* @param $scale_id
* @return string
* @todo remove or use to display tabular data
**/
if(!function_exists('getDataVizMode')) {
function getDataVizMode($scale_id)
{
$link_aff_classic = HrefMaker(array('rub' => $GLOBALS['links'][U_L]['dashboard']['linkvalue'], 'id' => $scale_id));
$link_aff_young = HrefMaker(array('rub' => $GLOBALS['links'][U_L]['dashboard-anim']['linkvalue'], 'id' => $scale_id));
$content = '' . END_LINE;
$content .= '
'._t('dashboard','mode_aff').' : ';
if (ActiveItemKey($GLOBALS['activeitem']) == 'dashboard')
$content .= '
'._t('dashboard','mode_aff_class').' ' . END_LINE;
else $content .= '
'._t('dashboard','mode_aff_class').' ' . END_LINE;
if (ActiveItemKey($GLOBALS['activeitem']) == 'dashboard-anim')
$content .= '
'._t('dashboard','mode_aff_young').' ' . END_LINE;
else $content .= '
'._t('dashboard','mode_aff_young').' ' . END_LINE;
$content .= '
' . END_LINE;
return $content;
}
}
/**
* getDashboardNavigation()
* Return a string with the internal navigation
* @param int
* @param int
* @return string
**/
if(!function_exists('getDashboardNavigation')) {
function getDashboardNavigation($sdi_id,$scale_id)
{
$data = $GLOBALS['sql_object'] -> DBSelect(SQL_getOnesdiname($sdi_id));
$link_aff_info = HrefMaker(array('rub' => $GLOBALS['links'][U_L]['dashboard']['linkvalue'],'id' => $sdi_id, 'parentid' => $scale_id, 'name' => $data[0]['sdii_name']));
$link_aff_rules = HrefMaker(array('rub' => $GLOBALS['links'][U_L]['dashboard-rules']['linkvalue'], 'id' => $sdi_id, 'parentid' => $scale_id, 'name' => $data[0]['sdii_name']));
$link_aff_provider = HrefMaker(array('rub' => $GLOBALS['links'][U_L]['dashboard-provider']['linkvalue'],'id' => $sdi_id, 'parentid' => $scale_id, 'name' => $data[0]['sdii_name']));
$link_aff_evaluation = HrefMaker(array('rub' => $GLOBALS['links'][U_L]['dashboard-assessment']['linkvalue'], 'id' => $sdi_id, 'parentid' => $scale_id, 'name' => $data[0]['sdii_name']));
$content ="". END_LINE;
$content .="
". END_LINE;
$content .="
". END_LINE;
return $content;
}
}
?>