* @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(override('../dashboard/common.php', THEME_ADMIN_PATH)); include_once(override('../level/mysql.inc.php', THEME_ADMIN_PATH)); // we get levels $result=$sql_object->DBSelect(SQL_getLevelsList()); $sdi_object= new sdi; // we get indicators $sdi = $sql_object->DBSelect(SQL_getListSdi2("R")); // Number of records $bdd_nb_sdi = get_unique_indicators($sdi); $bdd_nb_sdi_display = '' .$bdd_nb_sdi['count'] .' ' . _t('sdi','nb_total').'
'. PHP_EOL; include_once('../class/class.tag.php'); // getting tags menu filter $otag = new tag(); $tags =$otag->getTags('indicator', -1, false); footerAddJS('../lib/js/jquery.nestable.js'); $js = ' $("div.dd").nestable({listNodeName: "ul"}).on("change", function() { console.log($(this).prop("id")); var json_text = $("#" + $(this).prop("id")).nestable("serialize"); console.log(json_text); $.get("../admin/_ajax_sort.php", { rub: "'.$rub.'", "sort-table": json_text }, function(data){ console.log(data); // replacing data.class by data["class"] for IE8 bug fix if(data["class"] == "succeed") { alertify.success(data.msg); } else { alertify.error(data.msg); } }, "json"); });'; footerAddInlineJS($js); /** * getMenuFilter() * * @param array $tags * @return string */ function getMenuFilter ($tags = array()) { footerAddJS('../lib/js/jquery-tag-filtering/jquery.tagfiltering.simo.js'); addDynamicCSS('../lib/js/jquery-tag-filtering/jquery.tagfiltering.simo.css'); // one call to apply many filters from several lists (ul) with same css class and using distincts data-* attributes // to comment if individual filtering are applied footerAddInlineJS('$("ul.filter-menu").tagfiltering({target_attr:"data-tags,data-types,data-strats", separator:";", callback:compute_values});'); $filter_menu = '
'._t('filter', 'content').'
'; $filter_menu .= ''; return $filter_menu; } /** * getTagsMenuFilter() * * get tags menu filter * * @param array $tags * @return string */ function getTypesMenuFilter($types) { $filter = ''; // we display filter if at least 1 values exists if (count($types) >= 1) { $options = ''; $a = array(); foreach ($types as $key => $val) { if (! in_array($key, $a)) { $options .= '
  • ' . formatText(mb_ucfirst($val), '2HTML') . '
  • '; array_push($a, $key); } } $filter .= sprintf('

    %s

    ', _t('filter', 'by_type'), $options); } return $filter; } /** * getTagsMenuFilter() * * get tags menu filter * * @param array $tags * @return string */ function getStrategicMenuFilter($entries) { $filter = ''; // we display filter if at least 1 values exists if (count($entries) >= 1) { $options = ''; foreach ($entries as $key => $val) { $options .= '
  • ' . formatText(mb_ucfirst($val), '2HTML') . '
  • '; } $filter .= sprintf('

    %s

    ', _t('filter', 'by_significance'), $options); } return $filter; } /** * getTagsMenuFilter() * * get tags menu filter * * @param array $tags * @return string */ function getTagsMenuFilter($tags) { $filter = ''; // we display filter if at least 2 values exists if (count($tags) > 1) { $options = ''; $a = array(); foreach ($tags as $item) { if (! in_array($item['tag_id'], $a)) { $options .= '
  • ' . $item['tag_name'] . '
  • '; array_push($a, $item['tag_id']); } } $filter .= sprintf('

    %s

    ', _t('filter', 'by_tag'), $options); } return $filter; } function display_level($parent, $dep, $array, $rub_link, $sdi) { $html = ""; $prev_dep = 0; $link_sup=$rub_link."&todo=sup&id="; $link_mod=$rub_link."&todo=mod&id="; $link_det=$rub_link."&todo=det&id="; $link_level="index.php?rub=level&todo=det&id="; if (!$dep && !$prev_dep) $html .= "\n\n"; else $html .= "\n"; return $html; } function display_orphans($rub_link, $sdi) { $html = ""; $link_sup=$rub_link."&todo=sup&id="; $link_mod=$rub_link."&todo=mod&id="; $link_det=$rub_link."&todo=det&id="; $level_label = _t('sdi', 'no_associated_level'); $disp_level_name = '' .formatText( _t('sdi', 'no_associated_level'), '2HTML'). ' '; // we prepare indicators if they are attached to current level $sdi_html = ''; if(is_array($sdi)) { for ($j=0; $j < count($sdi); $j++) { if ($sdi[$j]['sdii_level'] == 0) { // getting tags $otag = new tag (); $display_tags = $otag->getTags ( 'indicator', $sdi[$j]['sdii_id'], true, ';' ); $display_types = formatText(mb_ucfirst($GLOBALS['lang']['sdi']['select_type'][$sdi[$j]['sdii_type']]), '2HTML'); ($sdi[$j]['sdii_api_enabled'] == 'Y') ? $api = ' ' : $api =''; ($sdi[$j]['sdii_api_enabled'] == 'N' && !empty($sdi[$j]['sdii_api_url'])) ? $api = ' ' : $api = $api; if($sdi[$j]['sdii_to_dashboard'] == 'Y') $display_strat = formatText(mb_ucfirst(_t('sdi', 'attached_to_dashboard')), '2HTML'); else $display_strat = formatText(mb_ucfirst(_t('sdi', 'not_attached_to_dashboard')), '2HTML'); // we populate lists $sdi_html.="
  • \n"; $sdi_html.= "\t
     
    "; $sdi_html.="\t".cutText(formatText($sdi[$j]['sdii_name'], '2HTML'), 200, 1) ."".$api."\n"; if ($sdi[$j]['sdii_statut']=='D') $sdi_html.=" / "._t('statut','draft').""; if ($sdi[$j]['sdii_to_dashboard']=='Y') $sdi_html.=" / "._t('sdi','attached_to_dashboard').""; if(!empty($display_tags)) $sdi_html.= " "; if($sdi[$j]['sdii_type'] != 'not-set') $sdi_html.=''.formatText(mb_ucfirst($GLOBALS['lang']['sdi']['select_type'][$sdi[$j]['sdii_type']]), '2HTML').''; $sdi_html.="\t\n"; $sdi_html.="
    \n"; $sdi_html.="
  • \n"; } } if(!empty($sdi_html)) $sdi_html = sprintf("\n", $sdi_html); if(!empty($sdi_html)) $sdi_html = '
    ' . $sdi_html ; $html .= "\n\n"; } return $html; } $filter_menu = getMenuFilter($tags); ?>