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