* @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'); } //////////// //////////// Check Droits utilisateur //////////// if (!$l21auth->hasRight('sdi')) ReloadIndex('admin'); //////////// include_once('../class/class.tag.php'); // 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'); include_once("../lib/input_helpers.php"); include_once(override('../level/mysql.inc.php', THEME_ADMIN_PATH)); if(!isset($_GET['id']) && !isset($_POST['id'])) { $id="1"; } else { if(isset($_REQUEST['id'])) $id=$_REQUEST['id']; } $link_mod_e=$rub_link."&todo=mod_e&id="; $link_mod_r=$rub_link."&todo=mod_r&id="; $link_mod_p=$rub_link."&todo=mod_p&id="; // 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 = '
'; } // getting tags from given project $otag = new tag(); $form_tags = $otag->getTags('indicator', $id, true); if (isset($_POST['enregistrer'])) { $data_table = unserialize(urldecode($_POST['data_table'])); $sdi_object= new sdi; $result=$sdi_object->ModifySdi($id, $data_table, $sql_object); if($result) { $otag->modifyTags('indicator', $id, $data_table['tags']); } $link_confirm="confirm.php?rub=".$rub."&todo=".$todo."&id=".$id; if(isset($result)) header("Location: ".safe_redirect($link_confirm)); else system_error(); } $sdi_object= new sdi; $req_sdii=SQL_getInfoSdi($id); $data_form_sdi = $sql_object -> DBSelect($req_sdii); // Do record exists? if(!isset($data_form_sdi[0]['sdii_name'])) redirect_to('@module_default'); $form_name = formatText($data_form_sdi[0]['sdii_name'], '2FIELD'); $form_level = $data_form_sdi[0]['sdii_level']; //$form_range = $data_form_sdi[0]['sdii_range']; $form_description = formatText($data_form_sdi[0]['sdii_description'], '2FIELD'); $form_comment = formatText($data_form_sdi[0]['sdii_comment'], '2FIELD'); $form_goal = formatText($data_form_sdi[0]['sdii_goal'], '2FIELD'); $form_consulting = formatText($data_form_sdi[0]['sdii_consulting'], '2FIELD'); $form_unit = formatText($data_form_sdi[0]['sdii_unit'], '2FIELD'); $form_max_value = $data_form_sdi[0]['sdii_max_value']; $form_min_value = $data_form_sdi[0]['sdii_min_value']; $form_threshold_value = $data_form_sdi[0]['sdii_threshold_value']; $form_frequency = $data_form_sdi[0]['sdii_frequency']; $form_type = $data_form_sdi[0]['sdii_type']; $form_nature = $data_form_sdi[0]['sdii_nature']; $form_dashboard_viz = $data_form_sdi[0]['sdii_dashboard_viz']; $form_detail_viz = $data_form_sdi[0]['sdii_detail_viz']; $form_value_type = $data_form_sdi[0]['sdii_value_type']; if($data_form_sdi[0]['sdii_statut']=='D') $mask_statut_D="checked=\"checked\""; else $mask_statut_D=''; if($data_form_sdi[0]['sdii_statut']=='P') $mask_statut_P="checked=\"checked\""; else $mask_statut_P=''; if($data_form_sdi[0]['sdii_to_dashboard']=='Y') $mask_dashboard="checked=\"checked\""; else $mask_dashboard=''; if($data_form_sdi[0]['sdii_threshold_relative']=='Y') $mask_threshold_relative="checked=\"checked\""; else $mask_threshold_relative=''; 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[13]="Y"; $mask_threshold_relative="checked=\"checked\""; } else { $table[13]="N"; $mask_threshold_relative=""; } if (isset($_POST['attached_to_dashboard'])) { $table[14]="Y"; $mask_dashboard="checked=\"checked\""; } else { $table[14]="N"; $mask_dashboard=""; } $table[15]=$_POST['sdi_type']; $table[16]=$_POST['sdi_dashboard_viz']; $table[17]=$_POST['sdi_detail_viz']; $table[18]=$_POST['sdi_value_type']; $table['tags']=$_POST['tags']; $table['nature']=$_POST['sdi_nature']; $sdi_object = new sdi; $integrity = $sdi_object -> CheckDataIntegrity_info($table, true, 15); $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_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_threshold_relative=$table[13]; $form_frequency = $_POST['frequency']; $form_tags = $_POST['tags']; 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)); } // select-box des niveaux $data=$sql_object->DBSelect(SQL_getLevelsList()); $select_level=LevelSelectBox($data, "sdi_level", $form_level); $select_nature=selectBox($lang['sdi']['select_nature'], "sdi_nature", $form_nature); $select_type=selectBox($lang['sdi']['select_type'], "sdi_type", $form_type); $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); $req_list_sdiname=SQL_getOnesdiname($id); $data_sdi_name = $sql_object -> DBSelect($req_list_sdiname); $navtitle=_t('sdi','mod')." : ".$data_sdi_name[0]['sdii_name']; ?> " + 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(); '; footerAddInlineJS($js); ?> DBSelect(SQL_getoneLevel($table[3])); $display_sdi_level=formatText($record[0]['level_name'], '2HTML'); if ($table[13]=='Y') $display_sdi_threshold_relative = _t('sdi','threshold_relative_Y'); else $display_sdi_threshold_relative = _t('sdi','threshold_relative_N'); if ($table[14]=='Y') $display_attached_to_dashboard = _t('divers','yes'); else $display_attached_to_dashboard = _t('divers','no'); $display_sdi_type = formatText($lang['sdi']['select_type'][$table[15]], '2HTML'); $display_sdi_nature = formatText($lang['sdi']['select_nature'][$table['nature']], '2HTML'); $display_sdi_dashboard_viz = formatText($lang['sdi']['select_dashboard_viz'][$table[16]], '2HTML'); $display_sdi_detail_viz = formatText($lang['sdi']['select_detail_viz'][$table[17]], '2HTML'); $display_sdi_value_type = formatText($lang['sdi']['select_value_type'][$table[18]], '2HTML'); $table = urlencode(serialize($table)); ?>