3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * Report hooks that allow extending a particular report.
20 * Example: Adding new tables to log reports
22 class CRM_Report_BAO_Hook
{
25 * @var \CRM_Report_BAO_HookInterface[]
27 protected $_queryObjects = NULL;
30 * Singleton function used to manage this object.
34 public static function singleton() {
35 static $singleton = NULL;
37 $singleton = new CRM_Report_BAO_Hook();
43 * Get or build the list of search objects (via hook)
46 * Array of CRM_Report_BAO_Hook_Interface objects
48 public function getSearchQueryObjects() {
49 if ($this->_queryObjects
=== NULL) {
50 $this->_queryObjects
= [];
51 CRM_Utils_Hook
::queryObjects($this->_queryObjects
, 'Report');
53 return $this->_queryObjects
;
60 public function alterLogTables(&$reportObj, &$logTables) {
61 foreach (self
::getSearchQueryObjects() as $obj) {
62 $obj->alterLogTables($reportObj, $logTables);
72 public function logDiffClause(&$reportObj, $table) {
73 $contactIdClause = $join = '';
74 foreach (self
::getSearchQueryObjects() as $obj) {
75 list($cidClause, $joinClause) = $obj->logDiffClause($reportObj, $table);
80 $contactIdClause .= $cidClause;
83 return [$contactIdClause, $join];