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