http://indepnet.net/ http://glpi-project.org ------------------------------------------------------------------------- LICENSE This file is part of GLPI. GLPI is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- */ /** @file * @brief */ include '../inc/includes.php'; Session::checkLoginUser(); Html::popHeader(__('Setup'), $_SERVER['PHP_SELF']); Search::manageGetValues('DocumentType'); Search::showList('DocumentType', $_GET); Html::popFooter();
/** * Launch export of datas * * @param $opt */ function export($opt) { global $LANG; switch ($opt['switchto']) { default: case 'png': $graph = new PluginMreportingGraphpng(); //check the format display charts configured in glpi $opt = $this->initParams($opt, true); $opt['export'] = 'png'; $opt['withdata'] = 1; break; case 'csv': $graph = new PluginMreportingGraphcsv(); $opt['export'] = 'csv'; $opt['withdata'] = 1; break; case 'odt': $graph = new PluginMreportingGraphpng(); $opt = $this->initParams($opt, true); $opt['export'] = 'odt'; break; case 'odtall': $graph = new PluginMreportingGraphpng(); $opt = $this->initParams($opt, true); $opt['export'] = 'odtall'; break; } //export all with odt if (isset($opt['classname'])) { if (isset($opt['check'])) { unset($_SESSION['glpi_plugin_mreporting_odtarray']); $reports = $this->getAllReports(false, $opt); foreach ($reports as $classname => $report) { foreach ($report['functions'] as $func) { foreach ($opt['check'] as $do => $to) { if ($do == $func['function'] . $classname) { //dynamic instanciation of class passed by 'short_classname' GET parameter $class = 'PluginMreporting' . $func['short_classname']; $obj = new $class(); $randname = $classname . $func['function']; if (isset($opt['date1']) && isset($opt['date2'])) { $s = strtotime($opt['date2']) - strtotime($opt['date1']); // If customExportDates exists in class : we configure the dates if (method_exists($obj, 'customExportDates')) { $opt = $obj->customExportDates($opt, $func['function']); } $_REQUEST['date1' . $randname] = $opt['date1']; $_REQUEST['date2' . $randname] = $opt['date2']; } //dynamic call of method passed by 'f_name' //GET parameter with previously instancied class $datas = $obj->{$func}['function'](); //show graph (pgrah type determined by //first entry of explode of camelcase of function name $title_func = $LANG['plugin_mreporting'][$func['short_classname']][$func['function']]['title']; $des_func = ""; if (isset($LANG['plugin_mreporting'][$func['short_classname']][$func['function']]['desc'])) { $des_func = $LANG['plugin_mreporting'][$func['short_classname']][$func['function']]['desc']; } if (isset($LANG['plugin_mreporting'][$func['short_classname']][$func['function']]['desc']) && isset($opt['date1']) && isset($opt['date2'])) { $des_func .= " - "; } if (isset($opt['date1']) && isset($opt['date2'])) { $des_func .= Html::convdate($opt['date1']) . " / " . Html::convdate($opt['date2']); } $options = array("short_classname" => $func['short_classname'], "f_name" => $func['function'], "class" => $opt['classname'], "gtype" => $func['gtype'], "randname" => $randname, "withdata" => $opt['withdata']); $show_label = 'always'; $params = array("raw_datas" => $datas, "title" => $title_func, "desc" => $des_func, "export" => $opt['export'], "opt" => $options); $graph->{'show' . $func['gtype']}($params); } } } } if (isset($_SESSION['glpi_plugin_mreporting_odtarray']) && !empty($_SESSION['glpi_plugin_mreporting_odtarray'])) { if (PluginMreportingPreference::atLeastOneTemplateExists()) { $template = PluginMreportingPreference::checkPreferenceTemplateValue(Session::getLoginUserID()); if ($template) { self::generateOdt($_SESSION['glpi_plugin_mreporting_odtarray']); } else { Html::popHeader($LANG['plugin_mreporting']["export"][0], $_SERVER['PHP_SELF']); echo "<div class='center'><br>" . $LANG['plugin_mreporting']["parser"][2] . "<br><br>"; Html::displayBackLink(); echo "</div>"; Html::popFooter(); } } else { Html::popHeader($LANG['plugin_mreporting']["export"][0], $_SERVER['PHP_SELF']); echo "<div class='center'><br>" . $LANG['plugin_mreporting']["parser"][3] . "<br><br>"; Html::displayBackLink(); echo "</div>"; Html::popFooter(); } } } else { //no selected data Html::popHeader($LANG['plugin_mreporting']["export"][0], $_SERVER['PHP_SELF']); echo "<div class='center'><br>" . $LANG['plugin_mreporting']["error"][3] . "<br><br>"; Html::displayBackLink(); echo "</div>"; Html::popFooter(); } } else { //dynamic instanciation of class passed by 'short_classname' GET parameter $classname = 'PluginMreporting' . $opt['short_classname']; $obj = new $classname(); //dynamic call of method passed by 'f_name' GET parameter with previously instancied class $datas = $obj->{$opt}['f_name'](); //show graph (pgrah type determined by first entry of explode of camelcase of function name $title_func = $LANG['plugin_mreporting'][$opt['short_classname']][$opt['f_name']]['title']; $des_func = ""; if (isset($LANG['plugin_mreporting'][$opt['short_classname']][$opt['f_name']]['desc'])) { $des_func = $LANG['plugin_mreporting'][$opt['short_classname']][$opt['f_name']]['desc']; } if (isset($LANG['plugin_mreporting'][$opt['short_classname']][$opt['f_name']]['desc']) && isset($_REQUEST['date1' . $opt['randname']]) && isset($_REQUEST['date2' . $opt['randname']])) { $des_func .= " - "; } if (isset($_REQUEST['date1' . $opt['randname']]) && isset($_REQUEST['date2' . $opt['randname']])) { $des_func .= Html::convdate($_REQUEST['date1' . $opt['randname']]) . " / " . Html::convdate($_REQUEST['date2' . $opt['randname']]); } $show_label = 'always'; $opt['class'] = $classname; $params = array("raw_datas" => $datas, "title" => $title_func, "desc" => $des_func, "export" => $opt['export'], "opt" => $opt); $graph->{'show' . $opt['gtype']}($params); } }