Merge pull request #23213 from eileenmcnaughton/post
[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
c1e814c7 9 * (GenCodeChecksum:35f8b4725d70d269c6c23ed8f7e2b47d)
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 *
c1e814c7 106 * @var bool|string
28979d65
CW
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 *
c1e814c7 115 * @var bool|string
28979d65
CW
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?'),
c1e814c7 311 'required' => TRUE,
a36434b9 312 'where' => 'civicrm_dashboard.is_active',
45a83e42 313 'default' => '0',
522a26c9 314 'table_name' => 'civicrm_dashboard',
315 'entity' => 'Dashboard',
316 'bao' => 'CRM_Core_BAO_Dashboard',
6a7e5e5d 317 'localizable' => 0,
a9d0587b 318 'add' => '3.1',
c3fc2621
CW
319 ],
320 'is_reserved' => [
e501603b
TO
321 'name' => 'is_reserved',
322 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 323 'title' => ts('Is Dashlet Reserved?'),
215b423e 324 'description' => ts('Is this dashlet reserved?'),
c1e814c7 325 'required' => TRUE,
a36434b9 326 'where' => 'civicrm_dashboard.is_reserved',
45a83e42 327 'default' => '0',
522a26c9 328 'table_name' => 'civicrm_dashboard',
329 'entity' => 'Dashboard',
330 'bao' => 'CRM_Core_BAO_Dashboard',
6a7e5e5d 331 'localizable' => 0,
a9d0587b 332 'add' => '3.1',
c3fc2621
CW
333 ],
334 'cache_minutes' => [
bf7df0ec 335 'name' => 'cache_minutes',
e501603b 336 'type' => CRM_Utils_Type::T_INT,
c3fc2621 337 'title' => ts('Cache Minutes'),
215b423e 338 'description' => ts('Number of minutes to cache dashlet content in browser localStorage.'),
c3fc2621 339 'required' => TRUE,
a36434b9 340 'where' => 'civicrm_dashboard.cache_minutes',
bf7df0ec 341 'default' => '60',
522a26c9 342 'table_name' => 'civicrm_dashboard',
343 'entity' => 'Dashboard',
344 'bao' => 'CRM_Core_BAO_Dashboard',
6a7e5e5d 345 'localizable' => 0,
a9d0587b 346 'add' => '4.7',
c3fc2621 347 ],
f263929f
CW
348 'directive' => [
349 'name' => 'directive',
350 'type' => CRM_Utils_Type::T_STRING,
351 'title' => ts('Angular directive'),
352 'description' => ts('Element name of angular directive to invoke (lowercase hyphenated format)'),
353 'maxlength' => 255,
354 'size' => CRM_Utils_Type::HUGE,
355 'where' => 'civicrm_dashboard.directive',
356 'table_name' => 'civicrm_dashboard',
357 'entity' => 'Dashboard',
358 'bao' => 'CRM_Core_BAO_Dashboard',
359 'localizable' => 0,
360 'add' => '5.33',
361 ],
c3fc2621 362 ];
346aaaba 363 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 364 }
346aaaba 365 return Civi::$statics[__CLASS__]['fields'];
e501603b 366 }
c3fc2621 367
e501603b 368 /**
bd8e0b14 369 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
370 *
371 * @return array
bd8e0b14 372 * Array(string $name => string $uniqueName).
e501603b 373 */
c3fc2621 374 public static function &fieldKeys() {
bd8e0b14
TO
375 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
376 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 377 }
bd8e0b14 378 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 379 }
c3fc2621 380
e501603b
TO
381 /**
382 * Returns the names of this table
383 *
384 * @return string
385 */
c3fc2621 386 public static function getTableName() {
e501603b
TO
387 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
388 }
c3fc2621 389
e501603b
TO
390 /**
391 * Returns if this table needs to be logged
392 *
c3fc2621 393 * @return bool
e501603b 394 */
c3fc2621 395 public function getLog() {
e501603b
TO
396 return self::$_log;
397 }
c3fc2621 398
e501603b
TO
399 /**
400 * Returns the list of fields that can be imported
401 *
402 * @param bool $prefix
403 *
404 * @return array
405 */
c3fc2621
CW
406 public static function &import($prefix = FALSE) {
407 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dashboard', $prefix, []);
60808919 408 return $r;
e501603b 409 }
c3fc2621 410
e501603b
TO
411 /**
412 * Returns the list of fields that can be exported
413 *
414 * @param bool $prefix
415 *
416 * @return array
417 */
c3fc2621
CW
418 public static function &export($prefix = FALSE) {
419 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dashboard', $prefix, []);
60808919 420 return $r;
e501603b 421 }
c3fc2621 422
e7a6b91a
AS
423 /**
424 * Returns the list of indices
c3fc2621
CW
425 *
426 * @param bool $localize
427 *
428 * @return array
e7a6b91a
AS
429 */
430 public static function indices($localize = TRUE) {
c3fc2621 431 $indices = [];
e7a6b91a
AS
432 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
433 }
c3fc2621 434
e501603b 435}