2 namespace Utility\Service;
7 * Base reporting functionality.
15 * @var \Doctrine\ORM\EntityManager
22 protected $_title = null;
27 protected $_subject = null;
32 protected $_description = null;
36 protected $_format = null;
38 * Queries applied to the report.
41 protected $_queries = array();
46 protected $_headers = array();
48 * Fields to pull from dataset.
51 protected $_fields = array();
53 * Columns to provide totals for.
56 protected $_totals = array();
58 * Columns for currency format.
61 protected $_currencyFields = array();
63 * Notes to display at end of report.
66 protected $_notes = array();
68 * Chart from report data.
71 protected $_chart = array();
75 protected $_data = array();
78 * @var Struct_ActionRequest
80 protected $_request = null;
85 protected $_options = array();
90 protected $_input = array();
93 /* ---------------------------------------------------------------------- *\
95 \* ---------------------------------------------------------------------- */
97 * Process standard format request.
99 * @param array|object $options
101 public function process(array $input, $options, $data = null)
103 $this->em = \Utility\Registry::getEntityManager();
104 $this->_input = $input;
105 $this->_options = $options;
107 && $this->_data = $data;
115 public function build() {}
118 /* ---------------------------------------------------------------------- *\
119 * Specifically cater for Excel Report requirements.
120 \* ---------------------------------------------------------------------- */
122 * Retrieve report title.
125 public function getTitle()
127 return $this->_title;
131 * Retrieve report subject.
134 public function getSubject()
136 return $this->_subject;
140 * Retrieve report description.
143 public function getDescription()
145 return $this->_description;
149 * Retrieve report format.
152 public function getFormat()
154 return $this->_format;
158 * Retrieve queries to display at beginning of report.
161 public function getQueries()
163 return $this->_queries;
167 * Retrieve report column headers.
170 public function getHeaders()
172 return $this->_headers;
176 * Retrieve report fields.
179 public function getFields()
181 return $this->_fields;
185 * Retrieve report fields to receive total value at end of report.
188 public function getTotalFields()
190 return $this->_totals;
194 * Retrieve report fields to receive currency formatting.
197 public function getCurrencyFields()
199 return $this->_currencyFields;
203 * Retrieve notes to be added to end of report.
206 public function getNotes()
208 return $this->_notes;
212 * Retrieve chart specifications.
215 public function getChart()
217 return $this->_chart;
221 * Retrieve report data.
224 public function getData()
230 * Retrieve report data.
233 public function getDataIntersection()
235 $fields = array_flip($this->_fields);
236 foreach ($this->_data as $id => $row)
238 $this->_data[$id] = array_intersect_key($row, $fields);