Trace: » Writing reports for version 1.2.1 or lower (GLPI 0.71.x)

Writing reports for version 1.2.1 or lower (GLPI 0.71.x)

Each new report is divided in several PHP files :

  • report/plugin_report.<yourreport>.php : your php file which contains the report logic
  • locales/report/plugin_report.<yourreport>.<locale>.php (for example plugin_report.example.en_GB.php) : contains all the locales needed for your report (if more locales are needed)
  • front/plugin_report.<yourreport>.php : configuration page, if needed by your report

Reports 1.2.1 or lower provides a SimpleReport function, which :

  • displays results of an sql request
  • export results in PDF, SLK or CSV
simpleReport($name, => report's name
             $sql, => sql query to execute
             $cols = array (), => array with <sql colunmn name> => glpi's locale
             $subname = "", => Sub title to be displayed
             $group = array (), => fields used to group results
             $mapping_values = array (), => possible values for a field (sse ticketsbypriority report) (only on reports 1.2.1)
             $additionnal_options = array () => (only in reports 1.2.1)
             );

You can find more examples of SimpleReport's use by looking at the serveral built in reports.