Example #1
0
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");
}
Example #2
0
(at your option) any later version.

mreporting is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with mreporting. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
Html::header($LANG['plugin_mreporting']["name"], '', "plugins", "mreporting");
$common = new PluginMreportingCommon();
/*** Regular Tab ***/
$reports = $common->getAllReports();
$tabs = array();
foreach ($reports as $classname => $report) {
    $tabs[$classname] = array('title' => $report['title'], 'url' => $CFG_GLPI['root_doc'] . "/plugins/mreporting/ajax/common.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&classname={$classname}");
}
/*** DEBUG Tab ***/
if (DEBUG_MREPORTING) {
    $tabs['debug'] = array('title' => "DEBUG", 'url' => $CFG_GLPI['root_doc'] . "/plugins/mreporting/ajax/debug.php");
}
if (count($tabs) > 0) {
    echo "<div id='tabspanel' class='center-h'></div>";
    Ajax::createTabs('tabspanel', 'tabcontent', $tabs, 'PluginMreportingCommon');
    $common->addDivForTabs();
} else {
    echo "<div class='center'><br>" . $LANG['plugin_mreporting']["error"][0] . "</div>";
}
Example #3
0
 /**
  * show not used Graphs dropdown
  * @name name of dropdown
  * @options array example $value
  *@return nothing
  **/
 static function dropdownGraph($name, $options = array())
 {
     $self = new self();
     $common = new PluginMreportingCommon();
     $rand = mt_rand();
     $select = "<select name='{$name}' id='dropdown_" . $name . $rand . "'>";
     $select .= "<option value='-1' selected>" . Dropdown::EMPTY_VALUE . "</option>";
     $i = 0;
     $reports = $common->getAllReports();
     foreach ($reports as $classname => $report) {
         foreach ($report['functions'] as $function) {
             if (!$self->getFromDBByFunctionAndClassname($function["function"], $classname)) {
                 $graphs[$classname][$function['category_func']][] = $function;
             }
         }
         if (isset($graphs[$classname])) {
             $count = count($graphs[$classname]);
             if ($count > 0) {
                 $select .= "<optgroup label=\"" . $report['title'] . "\">";
                 $count = count($graphs[$classname]);
                 if ($count > 0) {
                     foreach ($graphs[$classname] as $cat => $graph) {
                         $select .= "<optgroup label=\"" . $cat . "\">";
                         foreach ($graph as $k => $v) {
                             $comment = "";
                             if (isset($v["desc"])) {
                                 $comment = $v["desc"];
                                 $desc = " (" . $comment . ")";
                             }
                             $select .= "<option  title=\"" . Html::cleanInputText($comment) . "\" \n                                 value='" . $classname . ";" . $v["function"] . "'" . ($options['value'] == $classname . ";" . $v["function"] ? " selected " : "") . ">";
                             $select .= $v["title"] . $desc;
                             $select .= "</option>";
                             $i++;
                         }
                         $select .= "</optgroup>";
                     }
                 }
                 $select .= "</optgroup>";
             }
         }
     }
     $select .= "</select>";
     echo $select;
     return $rand;
 }