function plugin_init_reports()
{
    global $PLUGIN_HOOKS, $DB, $LANG;
    $PLUGIN_HOOKS['csrf_compliant']['reports'] = true;
    $plugin = new plugin();
    //Define only for bookmarks
    Plugin::registerClass('PluginReportsReport');
    Plugin::registerClass('PluginReportsStat');
    Plugin::registerClass('PluginReportsProfile', array('addtabon' => array('Profile')));
    if (Session::haveRight("config", UPDATE)) {
        $PLUGIN_HOOKS['config_page']['reports'] = 'front/config.form.php';
    }
    $PLUGIN_HOOKS['menu_entry']['reports'] = false;
    $PLUGIN_HOOKS['item_clone']['reports'] = array('Profile' => array('PluginReportsProfile', 'cloneProfile'));
    $rightreport = array();
    $rightstats = array();
    foreach (searchReport() as $report => $plug) {
        $field = 'plugin_reports_' . $report;
        if ($plug != 'reports') {
            $field = 'plugin_reports_' . $plug . "_" . $report;
        }
        if (Session::haveRight($field, READ)) {
            $tmp = $LANG["plugin_{$plug}"][$report];
            //If the report's name contains 'stat' then display it in the statistics page
            //(instead of Report page)
            if (isStat($report)) {
                if (!isset($PLUGIN_HOOKS['stats'][$plug])) {
                    $PLUGIN_HOOKS['stats'][$plug] = array();
                }
                $PLUGIN_HOOKS['stats'][$plug]["report/{$report}/{$report}.php"] = $tmp;
            } else {
                if (!isset($PLUGIN_HOOKS['reports'][$plug])) {
                    $PLUGIN_HOOKS['reports'][$plug] = array();
                }
                $PLUGIN_HOOKS['reports'][$plug]["report/{$report}/{$report}.php"] = $tmp;
            }
        }
    }
}
 /**
  * Look for all the plugins, and update rights if necessary
  */
 function updatePluginRights()
 {
     $tab = searchReport();
     $this->updateRights($tab);
     return $tab;
 }
示例#3
0
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with reports. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include_once "../../../inc/includes.php";
Plugin::load('reports');
Session::checkSeveralRightsOr(array("config" => "w", "profile" => "w"));
Html::header(__('Setup'), $_SERVER['PHP_SELF'], "config", "plugins");
echo "<div class='center'>";
echo "<table class='tab_cadre'>";
echo "<tr><th>" . __('Reports plugin configuration', 'reports') . "</th></tr>";
if (Session::haveRight("profile", "w")) {
    echo "<tr class='tab_bg_1 center'><td>";
    echo "<a href='report.form.php'>" . __('Reports plugin configuration', 'reports') . "</a>";
    echo "</td/></tr>\n";
}
if (Session::haveRight("config", "w")) {
    foreach (searchReport() as $report => $plug) {
        $url = getReportConfigPage($plug, $report);
        $file = GLPI_ROOT . getReportConfigPage($plug, $report);
        if (is_file($file)) {
            echo "<tr class='tab_bg_1 center'><td>";
            echo "<a href='" . $CFG_GLPI['root_doc'] . $url . "'>" . sprintf(__('%1$s: %2$s'), __('Report configuration'), $LANG['plugin_reports'][$report]);
            echo "</a></td/></tr>";
        }
    }
}
echo "</table></div>";
Html::footer();