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