Merge pull request #18517 from JMAConsulting/financial-issue-150
[civicrm-core.git] / CRM / Core / DAO / Dashboard.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Core/Dashboard.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
2562d09a 9 * (GenCodeChecksum:0404bd5bf3e04c20da16ec1950db8ac0)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the Dashboard entity.
f41f0342 14 */
e501603b 15class CRM_Core_DAO_Dashboard extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '3.1';
c3fc2621 18
e501603b 19 /**
f41f0342 20 * Static instance to hold the table name.
e501603b
TO
21 *
22 * @var string
23 */
fa45b5b9 24 public static $_tableName = 'civicrm_dashboard';
c3fc2621 25
e501603b 26 /**
f41f0342 27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 28 *
c3fc2621 29 * @var bool
e501603b 30 */
fa45b5b9 31 public static $_log = FALSE;
c3fc2621 32
e501603b 33 /**
e6ca0a57 34 * @var int
e501603b
TO
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * Domain for dashboard
40 *
e6ca0a57 41 * @var int
e501603b
TO
42 */
43 public $domain_id;
c3fc2621 44
e501603b
TO
45 /**
46 * Internal name of dashlet.
47 *
48 * @var string
49 */
50 public $name;
c3fc2621 51
e501603b
TO
52 /**
53 * dashlet title
54 *
55 * @var string
56 */
57 public $label;
c3fc2621 58
e501603b
TO
59 /**
60 * url in case of external dashlet
61 *
62 * @var string
63 */
64 public $url;
c3fc2621 65
e501603b
TO
66 /**
67 * Permission for the dashlet
68 *
69 * @var string
70 */
71 public $permission;
c3fc2621 72
e501603b
TO
73 /**
74 * Permission Operator
75 *
76 * @var string
77 */
78 public $permission_operator;
c3fc2621 79
e501603b
TO
80 /**
81 * fullscreen url for dashlet
82 *
83 * @var string
84 */
85 public $fullscreen_url;
c3fc2621 86
e501603b
TO
87 /**
88 * Is this dashlet active?
89 *
e6ca0a57 90 * @var bool
e501603b
TO
91 */
92 public $is_active;
c3fc2621 93
e501603b
TO
94 /**
95 * Is this dashlet reserved?
96 *
e6ca0a57 97 * @var bool
e501603b
TO
98 */
99 public $is_reserved;
c3fc2621 100
e501603b 101 /**
bf7df0ec 102 * Number of minutes to cache dashlet content in browser localStorage.
e501603b 103 *
e6ca0a57 104 * @var int
e501603b 105 */
bf7df0ec 106 public $cache_minutes;
c3fc2621 107
f263929f
CW
108 /**
109 * Element name of angular directive to invoke (lowercase hyphenated format)
110 *
111 * @var string
112 */
113 public $directive;
114
e501603b 115 /**
f41f0342 116 * Class constructor.
e501603b 117 */
c3fc2621 118 public function __construct() {
e501603b
TO
119 $this->__table = 'civicrm_dashboard';
120 parent::__construct();
121 }
c3fc2621 122
449c4e6b
CW
123 /**
124 * Returns localized title of this entity.
7b66c3b5
AH
125 *
126 * @param bool $plural
127 * Whether to return the plural version of the title.
449c4e6b 128 */
7b66c3b5
AH
129 public static function getEntityTitle($plural = FALSE) {
130 return $plural ? ts('Dashboards') : ts('Dashboard');
449c4e6b
CW
131 }
132
e501603b 133 /**
f41f0342 134 * Returns foreign keys and entity references.
e501603b
TO
135 *
136 * @return array
137 * [CRM_Core_Reference_Interface]
138 */
c3fc2621 139 public static function getReferenceColumns() {
346aaaba 140 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 141 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621 142 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
346aaaba 143 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 144 }
346aaaba 145 return Civi::$statics[__CLASS__]['links'];
e501603b 146 }
c3fc2621 147
e501603b
TO
148 /**
149 * Returns all the column names of this table
150 *
151 * @return array
152 */
c3fc2621 153 public static function &fields() {
346aaaba 154 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
155 Civi::$statics[__CLASS__]['fields'] = [
156 'id' => [
e501603b
TO
157 'name' => 'id',
158 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
159 'title' => ts('DashletID'),
160 'required' => TRUE,
a36434b9 161 'where' => 'civicrm_dashboard.id',
522a26c9 162 'table_name' => 'civicrm_dashboard',
163 'entity' => 'Dashboard',
164 'bao' => 'CRM_Core_BAO_Dashboard',
6a7e5e5d 165 'localizable' => 0,
2cbbebe8
A
166 'html' => [
167 'type' => 'Number',
168 ],
1fe423d6 169 'readonly' => TRUE,
a9d0587b 170 'add' => '3.1',
c3fc2621
CW
171 ],
172 'domain_id' => [
e501603b
TO
173 'name' => 'domain_id',
174 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 175 'title' => ts('Domain ID'),
215b423e 176 'description' => ts('Domain for dashboard'),
c3fc2621 177 'required' => TRUE,
a36434b9 178 'where' => 'civicrm_dashboard.domain_id',
522a26c9 179 'table_name' => 'civicrm_dashboard',
180 'entity' => 'Dashboard',
181 'bao' => 'CRM_Core_BAO_Dashboard',
6a7e5e5d 182 'localizable' => 0,
e501603b 183 'FKClassName' => 'CRM_Core_DAO_Domain',
2cbbebe8
A
184 'html' => [
185 'label' => ts("Domain"),
186 ],
c3fc2621 187 'pseudoconstant' => [
e501603b
TO
188 'table' => 'civicrm_domain',
189 'keyColumn' => 'id',
190 'labelColumn' => 'name',
e6ca0a57 191 ],
a9d0587b 192 'add' => '3.1',
c3fc2621
CW
193 ],
194 'name' => [
e501603b
TO
195 'name' => 'name',
196 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 197 'title' => ts('Dashlet Name'),
215b423e 198 'description' => ts('Internal name of dashlet.'),
e501603b
TO
199 'maxlength' => 64,
200 'size' => CRM_Utils_Type::BIG,
a36434b9 201 'where' => 'civicrm_dashboard.name',
522a26c9 202 'table_name' => 'civicrm_dashboard',
203 'entity' => 'Dashboard',
204 'bao' => 'CRM_Core_BAO_Dashboard',
6a7e5e5d 205 'localizable' => 0,
a9d0587b 206 'add' => '4.4',
c3fc2621
CW
207 ],
208 'label' => [
e501603b
TO
209 'name' => 'label',
210 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 211 'title' => ts('Dashlet Title'),
215b423e 212 'description' => ts('dashlet title'),
e501603b
TO
213 'maxlength' => 255,
214 'size' => CRM_Utils_Type::HUGE,
a36434b9 215 'where' => 'civicrm_dashboard.label',
522a26c9 216 'table_name' => 'civicrm_dashboard',
217 'entity' => 'Dashboard',
218 'bao' => 'CRM_Core_BAO_Dashboard',
6a7e5e5d 219 'localizable' => 1,
a9d0587b 220 'add' => '3.1',
c3fc2621
CW
221 ],
222 'url' => [
e501603b
TO
223 'name' => 'url',
224 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 225 'title' => ts('Dashlet URL'),
215b423e 226 'description' => ts('url in case of external dashlet'),
e501603b
TO
227 'maxlength' => 255,
228 'size' => CRM_Utils_Type::HUGE,
a36434b9 229 'where' => 'civicrm_dashboard.url',
522a26c9 230 'table_name' => 'civicrm_dashboard',
231 'entity' => 'Dashboard',
232 'bao' => 'CRM_Core_BAO_Dashboard',
6a7e5e5d 233 'localizable' => 0,
a9d0587b 234 'add' => '3.1',
c3fc2621
CW
235 ],
236 'permission' => [
e501603b
TO
237 'name' => 'permission',
238 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 239 'title' => ts('Dashlet Permission'),
215b423e 240 'description' => ts('Permission for the dashlet'),
e501603b
TO
241 'maxlength' => 255,
242 'size' => CRM_Utils_Type::HUGE,
a36434b9 243 'where' => 'civicrm_dashboard.permission',
522a26c9 244 'table_name' => 'civicrm_dashboard',
245 'entity' => 'Dashboard',
246 'bao' => 'CRM_Core_BAO_Dashboard',
6a7e5e5d 247 'localizable' => 0,
7a19c557 248 'serialize' => self::SERIALIZE_COMMA,
a9d0587b 249 'add' => '3.1',
c3fc2621
CW
250 ],
251 'permission_operator' => [
e501603b
TO
252 'name' => 'permission_operator',
253 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 254 'title' => ts('Dashlet Permission Operator'),
215b423e 255 'description' => ts('Permission Operator'),
e501603b
TO
256 'maxlength' => 3,
257 'size' => CRM_Utils_Type::FOUR,
a36434b9 258 'where' => 'civicrm_dashboard.permission_operator',
522a26c9 259 'table_name' => 'civicrm_dashboard',
260 'entity' => 'Dashboard',
261 'bao' => 'CRM_Core_BAO_Dashboard',
6a7e5e5d 262 'localizable' => 0,
a9d0587b 263 'add' => '3.1',
c3fc2621
CW
264 ],
265 'fullscreen_url' => [
e501603b
TO
266 'name' => 'fullscreen_url',
267 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 268 'title' => ts('Fullscreen URL'),
215b423e 269 'description' => ts('fullscreen url for dashlet'),
e501603b
TO
270 'maxlength' => 255,
271 'size' => CRM_Utils_Type::HUGE,
a36434b9 272 'where' => 'civicrm_dashboard.fullscreen_url',
522a26c9 273 'table_name' => 'civicrm_dashboard',
274 'entity' => 'Dashboard',
275 'bao' => 'CRM_Core_BAO_Dashboard',
6a7e5e5d 276 'localizable' => 0,
a9d0587b 277 'add' => '3.4',
c3fc2621
CW
278 ],
279 'is_active' => [
e501603b
TO
280 'name' => 'is_active',
281 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 282 'title' => ts('Is Dashlet Active?'),
215b423e 283 'description' => ts('Is this dashlet active?'),
a36434b9 284 'where' => 'civicrm_dashboard.is_active',
45a83e42 285 'default' => '0',
522a26c9 286 'table_name' => 'civicrm_dashboard',
287 'entity' => 'Dashboard',
288 'bao' => 'CRM_Core_BAO_Dashboard',
6a7e5e5d 289 'localizable' => 0,
a9d0587b 290 'add' => '3.1',
c3fc2621
CW
291 ],
292 'is_reserved' => [
e501603b
TO
293 'name' => 'is_reserved',
294 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 295 'title' => ts('Is Dashlet Reserved?'),
215b423e 296 'description' => ts('Is this dashlet reserved?'),
a36434b9 297 'where' => 'civicrm_dashboard.is_reserved',
45a83e42 298 'default' => '0',
522a26c9 299 'table_name' => 'civicrm_dashboard',
300 'entity' => 'Dashboard',
301 'bao' => 'CRM_Core_BAO_Dashboard',
6a7e5e5d 302 'localizable' => 0,
a9d0587b 303 'add' => '3.1',
c3fc2621
CW
304 ],
305 'cache_minutes' => [
bf7df0ec 306 'name' => 'cache_minutes',
e501603b 307 'type' => CRM_Utils_Type::T_INT,
c3fc2621 308 'title' => ts('Cache Minutes'),
215b423e 309 'description' => ts('Number of minutes to cache dashlet content in browser localStorage.'),
c3fc2621 310 'required' => TRUE,
a36434b9 311 'where' => 'civicrm_dashboard.cache_minutes',
bf7df0ec 312 'default' => '60',
522a26c9 313 'table_name' => 'civicrm_dashboard',
314 'entity' => 'Dashboard',
315 'bao' => 'CRM_Core_BAO_Dashboard',
6a7e5e5d 316 'localizable' => 0,
a9d0587b 317 'add' => '4.7',
c3fc2621 318 ],
f263929f
CW
319 'directive' => [
320 'name' => 'directive',
321 'type' => CRM_Utils_Type::T_STRING,
322 'title' => ts('Angular directive'),
323 'description' => ts('Element name of angular directive to invoke (lowercase hyphenated format)'),
324 'maxlength' => 255,
325 'size' => CRM_Utils_Type::HUGE,
326 'where' => 'civicrm_dashboard.directive',
327 'table_name' => 'civicrm_dashboard',
328 'entity' => 'Dashboard',
329 'bao' => 'CRM_Core_BAO_Dashboard',
330 'localizable' => 0,
331 'add' => '5.33',
332 ],
c3fc2621 333 ];
346aaaba 334 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 335 }
346aaaba 336 return Civi::$statics[__CLASS__]['fields'];
e501603b 337 }
c3fc2621 338
e501603b 339 /**
bd8e0b14 340 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
341 *
342 * @return array
bd8e0b14 343 * Array(string $name => string $uniqueName).
e501603b 344 */
c3fc2621 345 public static function &fieldKeys() {
bd8e0b14
TO
346 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
347 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 348 }
bd8e0b14 349 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 350 }
c3fc2621 351
e501603b
TO
352 /**
353 * Returns the names of this table
354 *
355 * @return string
356 */
c3fc2621 357 public static function getTableName() {
e501603b
TO
358 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
359 }
c3fc2621 360
e501603b
TO
361 /**
362 * Returns if this table needs to be logged
363 *
c3fc2621 364 * @return bool
e501603b 365 */
c3fc2621 366 public function getLog() {
e501603b
TO
367 return self::$_log;
368 }
c3fc2621 369
e501603b
TO
370 /**
371 * Returns the list of fields that can be imported
372 *
373 * @param bool $prefix
374 *
375 * @return array
376 */
c3fc2621
CW
377 public static function &import($prefix = FALSE) {
378 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dashboard', $prefix, []);
60808919 379 return $r;
e501603b 380 }
c3fc2621 381
e501603b
TO
382 /**
383 * Returns the list of fields that can be exported
384 *
385 * @param bool $prefix
386 *
387 * @return array
388 */
c3fc2621
CW
389 public static function &export($prefix = FALSE) {
390 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dashboard', $prefix, []);
60808919 391 return $r;
e501603b 392 }
c3fc2621 393
e7a6b91a
AS
394 /**
395 * Returns the list of indices
c3fc2621
CW
396 *
397 * @param bool $localize
398 *
399 * @return array
e7a6b91a
AS
400 */
401 public static function indices($localize = TRUE) {
c3fc2621 402 $indices = [];
e7a6b91a
AS
403 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
404 }
c3fc2621 405
e501603b 406}