function plugin_init_mreporting() { global $PLUGIN_HOOKS; $PLUGIN_HOOKS['redirect_page']['mreporting'] = 'front/download.php'; /* CRSF */ $PLUGIN_HOOKS['csrf_compliant']['mreporting'] = true; /* Profile */ $PLUGIN_HOOKS['change_profile']['mreporting'] = array('PluginMreportingProfile', 'changeProfile'); Plugin::registerClass('PluginMreportingNotification', array('notificationtemplates_types' => true)); //Plugin::registerClass('PluginMreportingNotificationTargetNotification'); if (Session::getLoginUserID()) { Plugin::registerClass('PluginMreportingProfile', array('addtabon' => 'Profile')); if ($_SESSION['glpiactiveprofile']['interface'] != "helpdesk") { Plugin::registerClass('PluginMreportingPreference', array('addtabon' => array('Preference'))); } /* Reports Link */ if (plugin_mreporting_haveRight("reports", "r")) { $menu_entry = "front/central.php"; $PLUGIN_HOOKS['menu_entry']['mreporting'] = $menu_entry; $PLUGIN_HOOKS['submenu_entry']['mreporting']['search'] = $menu_entry; } /* Configuration Link */ if (plugin_mreporting_haveRight("config", "w")) { $config_entry = 'front/config.php'; $PLUGIN_HOOKS['config_page']['mreporting'] = $config_entry; $PLUGIN_HOOKS['submenu_entry']['mreporting']['config'] = $config_entry; $PLUGIN_HOOKS['submenu_entry']['mreporting']['options']['config']['links']['config'] = '/plugins/mreporting/' . $config_entry; $PLUGIN_HOOKS['submenu_entry']['mreporting']['options']['config']['links']['add'] = '/plugins/mreporting/front/config.form.php'; } /* Show Reports in standart stats page */ if (class_exists('PluginMreportingCommon')) { $mreporting_common = new PluginMreportingCommon(); $reports = $mreporting_common->getAllReports(); if ($reports !== false) { foreach ($reports as $report) { foreach ($report['functions'] as $func) { $PLUGIN_HOOKS['stats']['mreporting'][$func['min_url_graph']] = $func['title']; } } } } } if (class_exists('PluginMreportingProfile')) { // only if plugin activated $PLUGIN_HOOKS['pre_item_purge']['mreporting'] = array('Profile' => array('PluginMreportingProfile', 'purgeProfiles')); } // Add specific files to add to the header : javascript $PLUGIN_HOOKS['add_javascript']['mreporting'][] = "lib/protovis/protovis.min.js"; $PLUGIN_HOOKS['add_javascript']['mreporting'][] = "lib/protovis-msie/protovis-msie.min.js"; $PLUGIN_HOOKS['add_javascript']['mreporting'][] = "lib/protovis-extjs-tooltips.js"; //Add specific files to add to the header : css $PLUGIN_HOOKS['add_css']['mreporting'] = array("mreporting.css"); }
/** * end Graph : Show graph datas array, setup link, export * * @params $options ($opt, export, datas, unit, labels2, flip_data) */ static function endGraph($options) { global $LANG, $CFG_GLPI; $opt = array(); $export = false; $datas = array(); $unit = ''; $labels2 = array(); $flip_data = false; foreach ($options as $k => $v) { ${$k} = $v; } $randname = false; if (isset($opt['randname']) && $opt['randname'] !== false) { $randname = $opt['randname']; $_REQUEST['short_classname'] = $opt['short_classname']; $_REQUEST['f_name'] = $opt['f_name']; $_REQUEST['gtype'] = $opt['gtype']; $_REQUEST['randname'] = $opt['randname']; //End Script for graph display //if $randname exists $config = PluginMreportingConfig::initConfigParams($opt['f_name'], "PluginMreporting" . $opt['short_classname']); if (!$export && ($config['graphtype'] == 'GLPI' && $CFG_GLPI['default_graphtype'] == 'svg' || $config['graphtype'] == 'SVG')) { echo "}\n showGraph{$randname}();\n </script>"; echo "</div>"; } } $request_string = PluginMreportingMisc::getRequestString($_REQUEST); if ($export != "odtall") { if ($randname !== false && !$export) { $show_graph = PluginMreportingConfig::showGraphConfigValue($opt['f_name'], $opt['class']); self::showGraphDatas($datas, $unit, $labels2, $flip_data, $show_graph); } if (!$export) { if (isset($_REQUEST['f_name']) && $_REQUEST['f_name'] != "test") { echo "<div class='graph_bottom'>"; echo "<span style='float:left'>"; echo "<br><br>"; PluginMreportingMisc::showNavigation(); echo "</span>"; echo "<span style='float:right'>"; if (plugin_mreporting_haveRight('config', 'w')) { echo "<b>" . $LANG['plugin_mreporting']["config"][0] . "</b> : "; echo " <a href='config.form.php?name=" . $opt['f_name'] . "&classname=" . $opt['class'] . "' target='_blank'>"; echo "<img src='../pics/config.png' class='title_pics'/></a>"; } if ($randname !== false) { echo "<br><br>"; echo "<form method='post' action='export.php?{$request_string}' \n style='margin: 0; padding: 0' target='_blank' id='export_form'>"; echo "<b>" . __("Export") . "</b> : "; $params = array('myname' => 'ext', 'ajax_page' => $CFG_GLPI["root_doc"] . "/plugins/mreporting/ajax/dropdownExport.php", 'class' => __CLASS__, 'span' => 'show_ext', 'gtype' => $_REQUEST['gtype'], 'show_graph' => $show_graph, 'randname' => $randname); self::dropdownExt($params); echo "<span id='show_ext'>"; echo "</span>"; Html::Closeform(); } echo "</span>"; } echo "<div style='clear:both;'></div>"; echo "</div>"; if (isset($_REQUEST['f_name']) && $_REQUEST['f_name'] != "test") { echo "</div></div>"; } } if ($randname == false) { echo "</div>"; } } //destroy specific palette unset($_SESSION['mreporting']['colors']); }
/** * add First config Link *@return nothing **/ static function addFirstconfigLink() { global $LANG, $CFG_GLPI; $buttons = array(); $title = _n("User", "Users", 2); if (plugin_mreporting_haveRight('config', 'w')) { $buttons["config.php?new=1"] = $LANG['plugin_mreporting']["config"][10]; $title = ""; } Html::displayTitle($CFG_GLPI["root_doc"] . "/plugins/mreporting/pics/config2.png", _n("User", "Users", 2), $title, $buttons); }