CMS  Version 3.9
custom_report.inc
Go to the documentation of this file.
1 <?php
2 
3 Fakoli::using("report");
4 
5 $report_id = $_GET["report_id"];
6 $edit = checkNumeric($_GET["edit"]);
7 $mode = $_POST["custom_report_mode"];
8 $target = checkIdentifier($_GET["target"]);
9 
10 if($report_id)
11 {
12  $customReport = ReportManager::load($report_id, $mode);
13 
14  $page->page_title = $customReport->title;
15 
16  if ($edit)
17  {
18  if ($mode == "save")
19  {
20  $customReport->save();
21  }
22 
23  $customReport->drawForm();
24  }
25  else
26  {
27  $customReport->generateReport();
28  }
29 }
30 else
31 {
32  if (!$target)
33  {
34  throw new FakoliException("No target specified");
35  }
36 
38 
39  $page->page_title = "Create a New Report";
40 
41  if ($method == "POST" || isset($_REQUEST["__excel"]))
42  {
43  if ($mode == "save")
44  {
45  $customReport->save();
46  redirect("custom_report?report_id={$customReport->report_id}&edit=1");
47  }
48  else
49  {
50  $customReport->generateReport();
51  }
52  }
53  else
54  {
55  $customReport->drawForm();
56  }
57 }
58 ?>
$_POST["owner_id"]
Definition: blog_form.inc:54
$mode
$edit
$report_id
$target
$page
Definition: help.inc:39
static createManager($target)
FakoliException is the base exception class for all Fakoli errors.
Definition: core.inc:53
static using()
Import the datamodels, views and manifest for the specified component(s).
Definition: core.inc:116
static load($report_id, $mode="")
$method
Pull out a simple reference to the request method.
Definition: core.inc:1573