* @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'); } //////////// include_once("../lib/input_helpers.php"); include_once("../class/class.tag.php"); include_once("../dashboard/common.php"); include_once(override('../level/mysql.inc.php', THEME_ADMIN_PATH)); //////////// Check Droits utilisateur //////////// if (!$l21auth->hasRight('sdi')) ReloadIndex('admin'); //////////// if(defined('API_RETRIEVE') && API_RETRIEVE == 1) $apiclass = 'api-container-enabled'; else $apiclass = 'api-container-disabled'; // TextboxList CSS/JS inclusion addDynamicCSS(THEME_ADMIN_PATH.'css/TextboxList.css'); addDynamicCSS(THEME_ADMIN_PATH.'css/TextboxList.Autocomplete.css'); footerAddJS('../lib/js/TextboxList-jQuery/Source/GrowingInput.js'); footerAddJS('../lib/js/TextboxList-jQuery/Source/TextboxList.js'); footerAddJS('../lib/js/TextboxList-jQuery/Source/TextboxList.Autocomplete.js'); unit_javascript_validation(); // we get available tags list to display to user when hovering 'tags' label $alltags = new tag(); $availableTags = $alltags->getTags('indicator', -1, false, ',', true); $tags_list = ''; if(count($availableTags) > 0) { $l = ''; foreach($availableTags as $item) { $l .= ''.$item['tag_name'].''; } $tags_list = '
'.$l.'
'; } ?>
AddSdi($data_table_sdi, $sql_object); $result_e=$sdi_object->ModifyParam($result, $data_table_e, "E", $sql_object); $result_p=$sdi_object->ModifyParam($result, $data_table_p, "P", $sql_object); $result_r=$sdi_object->ModifyParam($result, $data_table_r, "R", $sql_object); // if attached tags are provided we store them in db if(!empty($data_table['tags']) && is_numeric($result)) { $otag = new tag(); $otag->addTags('indicator', $result, $data_table['tags']); } // finally, we import initial values if asked if(is_numeric($result) && $data_table_sdi['api-get-values'] == 'Y') { $sdi = $sql_object->DBSelect(SQL_getInfoSdi($result)); api_update_indicators($sdi, true); } $link_confirm="confirm.php?rub=".$rub."&todo=".$todo; if(is_numeric($result)) { // light-ui mode, we close the iframe if(!empty($http_params)) { echo ""; } else { header("Location: ".safe_redirect($link_confirm)); exit; } } else system_error(); } $form_type = -1; $form_nature = -1; $form_dashboard_viz = -1; $form_detail_viz = -1; $form_value_type = -1; $form_multiple_type = $GLOBALS['lang']['sdi']['select_multiple_type']['sum']; $form_mcolor = $sdi_object->get_ValuesColor(); // main value color $form_tcolor = $sdi_object->get_thresholdColor(); // threshold color $form_name = ''; $form_level = ''; $form_tags=''; $form_statut = ''; $mask_statut_P="checked=\"checked\""; $mask_statut_D=''; $mask_dashboard="checked=\"checked\""; $mask_threshold_relative = ""; $mask_api_enabled = ''; $form_api_url = ''; $form_api_datefield = ''; $form_api_valuefield = ''; $form_api_decimal = 0; $mask_api_getvalues = ''; $form_api_values_since = ''; //$form_range = ''; $form_description = ''; $form_comment = ''; $form_goal = ''; $form_consulting = ''; $form_unit = ''; $form_max_value = ''; $form_min_value = ''; $form_threshold_value = ''; $form_frequency = ''; $form_e_scale_compare = 0; $form_e_fiability = 0; $form_e_accessibility = 0; $form_e_lisibility = 0; $form_e_relevance = 0; $form_e_global_performance = 0; // assessments values $assessment_inputs = [0 => zero_asNC(0), 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5]; $form_p_name = ''; $form_p_service = ''; $form_p_description = ''; $form_p_incharge = ''; $form_p_address = ''; $form_p_phone = ''; $form_p_fax = ''; $form_p_email = ''; $form_r_title = ''; $form_r_body = ''; $form_r_referer_uri = ''; $form_r_mask_uri = ''; if (isset($_POST['valider1'])) { $table = array(); $table[0] = $_POST['sdi_name']; $table[1] = $_POST['description']; $table[2] = $_POST['comment']; $table[3] = $_POST['sdi_level']; //$table[4] = $_POST['range']; $table[4] = 0; $table[5] = $_POST['goal']; $table[6] = $_POST['consulting']; $table[7] = $_POST['unit']; $table[8] = $_POST['max_value']; $table[9] = $_POST['min_value']; $table[10]= $_POST['threshold_value']; $table[11]= $_POST['frequency']; $table[12]= $_POST['sdi_statut']; if (isset($_POST['threshold_relative'])) { $table[32] = "Y"; $mask_threshold_relative="checked=\"checked\""; } else { $table[32] = "N"; $mask_threshold_relative=""; } if (isset($_POST['attached_to_dashboard'])) { $table[33]="Y"; $mask_dashboard="checked=\"checked\""; } else { $table[33]="N"; $mask_dashboard=""; } $table[34]=$_POST['sdi_type']; $table['nature']=$_POST['sdi_nature']; $table[35] = $table['dashboard_viz'] = $_POST['sdi_dashboard_viz']; $table[36]=$_POST['sdi_detail_viz']; $table[37]=$_POST['sdi_value_type']; $table['multiple_type']=$_POST['sdi_multiple_type']; $table['tags']=$_POST['tags']; $table['mcolor']=$_POST['sdi_mcolor']; $table['tcolor']=$_POST['sdi_tcolor']; $table['api-url'] = $_POST['api-url']; $table['api-date-field'] = $_POST['api-date-field']; $table['api-value-field'] = $_POST['api-value-field']; $table['api-decimal'] = $_POST['api-decimal']; $table['api-get-values-since'] = $_POST['api-get-values-since']; // API forms fields handling if (isset($_POST['api-enabled'])) { $table['api-enabled']="Y"; $mask_api_enabled="checked=\"checked\""; } else { $table['api-enabled']="N"; $mask_api_enabled=""; } if (isset($_POST['api-get-values'])) { $table['api-get-values']="Y"; $mask_api_getvalues="checked=\"checked\""; } else { $table['api-get-values']="N"; $mask_api_getvalues=""; } $integrity = $sdi_object -> CheckDataIntegrity_info($table, true, 'nature'); $form_nature = $_POST['sdi_nature']; $form_type = $_POST['sdi_type']; $form_dashboard_viz = $_POST['sdi_dashboard_viz']; $form_detail_viz = $_POST['sdi_detail_viz']; $form_value_type = $_POST['sdi_value_type']; $form_multiple_type =$_POST['sdi_multiple_type']; $form_name = formatText($_POST['sdi_name'], '2FIELD'); $form_level = $_POST['sdi_level']; $form_statut= $_POST['sdi_statut']; //$form_range = $_POST['range']; $form_description = formatText($_POST['description'], '2FIELD'); $form_comment = formatText($_POST['comment'], '2FIELD'); $form_goal = formatText($_POST['goal'], '2FIELD'); $form_consulting = formatText($_POST['consulting'], '2FIELD'); $form_unit = formatText($_POST['unit'], '2FIELD'); $form_max_value =$_POST['max_value']; $form_min_value = $_POST['min_value']; $form_threshold_value = $_POST['threshold_value']; $form_frequency = $_POST['frequency']; $form_tags=$_POST['tags']; $form_mcolor = $_POST['sdi_mcolor']; $form_tcolor = $_POST['sdi_tcolor']; $form_api_url = formatText($_POST['api-url'], '2FIELD'); $form_api_datefield = formatText($_POST['api-date-field'], '2FIELD'); $form_api_valuefield = formatText($_POST['api-value-field'], '2FIELD'); $form_api_decimal = formatText($_POST['api-decimal'], '2FIELD'); $form_api_values_since = formatText($_POST['api-get-values-since'], '2FIELD'); if($form_statut=='D') $mask_statut_D="checked=\"checked\""; else $mask_statut_D=''; if($form_statut=='P') $mask_statut_P="checked=\"checked\""; else $mask_statut_P=''; $table = urlencode(serialize($table)); } if (isset($_POST['enregistrer2'])) { //intégrité des étapes 2,3,4 OK $integrity2 = 1; $integrity3 = 1; $integrity4 = 1; $table[0] = $_POST['sdi_name']; $table[1] = $_POST['description']; $table[2] = $_POST['comment']; $table[3] = $_POST['sdi_level']; //$table[4] = $_POST['range']; $table[4] = 0; $table[5] = $_POST['goal']; $table[6] = $_POST['consulting']; $table[7] = $_POST['unit']; $table[8] = $_POST['max_value']; $table[9] = $_POST['min_value']; $table[10]= $_POST['threshold_value']; $table[11]= $_POST['frequency']; $table[12]= $_POST['sdi_statut']; if (isset($_POST['threshold_relative'])) { $table[32]="Y"; $mask_threshold_relative="checked=\"checked\""; } else { $table[32]="N"; $mask_threshold_relative=""; } if (isset($_POST['attached_to_dashboard'])) { $table[33]="Y"; $mask_dashboard="checked=\"checked\""; } else { $table[33]="N"; $mask_dashboard=""; } $table[34]=$_POST['sdi_type']; $table['nature']=$_POST['sdi_nature']; $table[35] = $table['dashboard_viz'] = $_POST['sdi_dashboard_viz']; $table[36]=$_POST['sdi_detail_viz']; $table[37]=$_POST['sdi_value_type']; $table['multiple_type']=$_POST['sdi_multiple_type']; $table['tags']=$_POST['tags']; $table['mcolor']=$_POST['sdi_mcolor']; $table['tcolor']=$_POST['sdi_tcolor']; $table['api-url'] = $_POST['api-url']; $table['api-date-field'] = $_POST['api-date-field']; $table['api-value-field'] = $_POST['api-value-field']; $table['api-decimal'] = $_POST['api-decimal']; $table['api-get-values-since'] = $_POST['api-get-values-since']; // API forms fields handling if (isset($_POST['api-enabled'])) { $table['api-enabled']="Y"; $mask_api_enabled="checked=\"checked\""; } else { $table['api-enabled']="N"; $mask_api_enabled=""; } if (isset($_POST['api-get-values'])) { $table['api-get-values']="Y"; $mask_api_getvalues="checked=\"checked\""; } else { $table['api-get-values']="N"; $mask_api_getvalues=""; } // ugly array fill-up with 0 values for assessement values for ($z=13;$z<19;$z++){ $table[$z]=0; } // ugly array fill-up for ($z=19;$z<31;$z++){ $table[$z]=""; } $integrity = $sdi_object -> CheckDataIntegrity_info($table); $form_nature = $_POST['sdi_nature']; $form_type = $_POST['sdi_type']; $form_dashboard_viz = $_POST['sdi_dashboard_viz']; $form_detail_viz = $_POST['sdi_detail_viz']; $form_value_type = $_POST['sdi_value_type']; $form_multiple_type =$_POST['sdi_multiple_type']; $form_name = formatText($_POST['sdi_name'], '2FIELD'); $form_level = $_POST['sdi_level']; $form_statut= $_POST['sdi_statut']; //$form_range = $_POST['range']; $form_description = formatText($_POST['description'], '2FIELD'); $form_comment = formatText($_POST['comment'], '2FIELD'); $form_goal = formatText($_POST['goal'], '2FIELD'); $form_consulting = formatText($_POST['consulting'], '2FIELD'); $form_unit = formatText($_POST['unit'], '2FIELD'); $form_tags=$_POST['tags']; $form_max_value =$_POST['max_value']; $form_min_value = $_POST['min_value']; $form_threshold_value = $_POST['threshold_value']; $form_frequency = $_POST['frequency']; $form_mcolor = $_POST['sdi_mcolor']; $form_tcolor = $_POST['sdi_tcolor']; $form_api_url = formatText($_POST['api-url'], '2FIELD'); $form_api_datefield = formatText($_POST['api-date-field'], '2FIELD'); $form_api_valuefield = formatText($_POST['api-value-field'], '2FIELD'); $form_api_decimal = formatText($_POST['api-decimal'], '2FIELD'); $form_api_values_since = formatText($_POST['api-get-values-since'], '2FIELD'); if($form_statut=='D') $mask_statut_D="checked=\"checked\""; else $mask_statut_D=''; if($form_statut=='P') $mask_statut_P="checked=\"checked\""; else $mask_statut_P=''; $table = urlencode(serialize($table)); } if (isset($_POST['valider2'])) { $integrity = 1; $table = unserialize(urldecode($_POST['table'])); $table[13] = $_POST['e_scale_compare']; $table[14] = $_POST['e_fiability']; $table[15] = $_POST['e_accessibility']; $table[16] = $_POST['e_lisibility']; $table[17] = $_POST['e_relevance']; $table[18] = $_POST['e_global_performance']; $integrity2 = $sdi_object -> CheckDataIntegrity_eval($table); $form_e_scale_compare = $_POST['e_scale_compare']; $form_e_fiability = $_POST['e_fiability']; $form_e_accessibility = $_POST['e_accessibility']; $form_e_lisibility = $_POST['e_lisibility']; $form_e_relevance = $_POST['e_relevance']; $form_e_global_performance = $_POST['e_global_performance']; $table = urlencode(serialize($table)); } if (isset($_POST['valider3'])) { $integrity = 1; $integrity2 = 1; $table = unserialize(urldecode($_POST['table'])); $table[19] = $_POST['p_name']; $table[20] = $_POST['p_service']; $table[21] = $_POST['p_description']; $table[22] = $_POST['p_incharge']; $table[23] = $_POST['p_address']; $table[24] = str_replace(' ', '', $_POST['p_phone']); $table[25] = str_replace(' ', '', $_POST['p_fax']); $table[26] = $_POST['p_email']; $integrity3 = $sdi_object -> CheckDataIntegrity_provider($table); $form_p_name = formatText($_POST['p_name'], '2FIELD'); $form_p_service = formatText($_POST['p_service'], '2FIELD'); $form_p_description = formatText($_POST['p_description'], '2FIELD'); $form_p_incharge = formatText($_POST['p_incharge'], '2FIELD'); $form_p_address = formatText($_POST['p_address'], '2FIELD'); $form_p_phone = str_replace(' ', '', $_POST['p_phone']); $form_p_fax = str_replace(' ', '', $_POST['p_fax']); $form_p_email = $_POST['p_email']; $table = urlencode(serialize($table)); } if (isset($_POST['valider4'])) { $integrity = 1; $integrity2 = 1; $integrity3 = 1; $table = unserialize(urldecode($_POST['table'])); $table[27] = $_POST['r_title']; $table[28] = $_POST['r_body']; $table[29] = $_POST['r_referer_uri']; if ($_POST['r_mask_uri']=="")$table[30] = $table[29]; else $table[30]=$_POST['r_mask_uri']; $integrity4 = $sdi_object -> CheckDataIntegrity_reglementation($table); $form_r_title = formatText($_POST['r_title'], '2FIELD'); $form_r_body = formatText($_POST['r_body'], '2FIELD'); $form_r_referer_uri = $_POST['r_referer_uri']; if ($_POST['r_mask_uri']=="")$form_r_mask_uri = $form_r_referer_uri; else $form_r_mask_uri =$_POST['r_mask_uri']; $table = urlencode(serialize($table)); } // select-box des niveaux $data=$sql_object->DBSelect(SQL_getLevelsList()); $select_level=LevelSelectBox($data, "sdi_level", $form_level); $select_type=selectBox($lang['sdi']['select_type'], "sdi_type", $form_type); $select_nature=selectBox($lang['sdi']['select_nature'], "sdi_nature", $form_nature); $select_dashboard_viz = selectBox($lang['sdi']['select_dashboard_viz'], "sdi_dashboard_viz", $form_dashboard_viz, INDICATOR_DASHBOARD_VIZ); $select_detail_viz = selectBox($lang['sdi']['select_detail_viz'], "sdi_detail_viz", $form_detail_viz); $select_value_type = selectBox($lang['sdi']['select_value_type'], "sdi_value_type", $form_value_type); $select_multiple_type = selectBox($lang['sdi']['select_multiple_type'], "sdi_multiple_type", $form_multiple_type); ?> " + text + "<\/span>"); } else { $("#sdi_dashboard_viz option[value=\'sparkline\']").removeAttr("disabled"); $("#boolean-indic-notice").remove(); } }); // we call the function on loading page $("#sdi_nature").change(); $("#sdi_value_type").change(function() { if($(this).val() == "multiple") { var text = "'.sprintf(_t('sdi','multipleindicator_notice'), '#attached_to_dashboard').'"; $("#multiple-indic-notice").remove(); $("#sdi_value_type").after("" + text + "<\/span>"); $("#sdi_multiple_type_cont").fadeIn(); } else { $("#multiple-indic-notice").remove(); $("#sdi_multiple_type_cont").hide(); } }); // we call the function on loading page $("#sdi_value_type").change(); '; footerAddInlineJS($js); ?>
1
2
3
4

:

:
required /> />

/>

 : *
/>

/>

/>

1
2
3
4

1
2
3
4

1
2
3
4

isUrl()) $display_api_url = sprintf('%s', $display_api_url, $display_api_url); $display_api_datefield = formatText(empty_nc($table['api-date-field']), '2HTML'); $display_api_valuefield = formatText(empty_nc($table['api-value-field']), '2HTML'); $display_sdi_nature = formatText($lang['sdi']['select_nature'][$table['nature']], '2HTML'); $display_sdi_type = formatText($lang['sdi']['select_type'][$table[34]], '2HTML'); $display_sdi_dashboard_viz = formatText($lang['sdi']['select_dashboard_viz'][$table[35]], '2HTML'); $display_sdi_detail_viz = formatText($lang['sdi']['select_detail_viz'][$table[36]], '2HTML'); $display_sdi_value_type = formatText($lang['sdi']['select_value_type'][$table[37]], '2HTML'); $display_sdi_multiple_type = formatText($lang['sdi']['select_multiple_type'][$table['multiple_type']], '2HTML'); $multipleclass = ($table[37] != 'multiple') ? 'invisible' : ''; $record=$sql_object->DBSelect(SQL_getoneLevel($table[3])); isset($record[0]['level_name']) ? $display_sdi_level=formatText($record[0]['level_name'], '2HTML') : $display_sdi_level= _t('sdi', 'no_associated_level'). ' '; // if no associated label $table = urlencode(serialize($table)); ?>

:
:
:
:
:
:
' .get_html_colorbox($form_mcolor) . _t('dashboard','value') . '
' . get_html_colorbox($form_tcolor). _t('dashboard','threshold_value').'
'; ?>
:
:
:
:
:
*/ ?>
:
:
:
:
:
:

:
:
:
:
:
:

:
:
:
:
:
:

:
:
:
:
:
:

:
:
:
:
:
:
:
:

:
:
:
: