Add "labelField" metadata to entities
[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
8ab43c93 9 * (GenCodeChecksum:da79552cec455b6d3347a9eab6fbd5ba)
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,
a9d0587b 166 'add' => '3.1',
c3fc2621
CW
167 ],
168 'domain_id' => [
e501603b
TO
169 'name' => 'domain_id',
170 'type' => CRM_Utils_Type::T_INT,
c3fc2621 171 'title' => ts('Dashlet Domain'),
215b423e 172 'description' => ts('Domain for dashboard'),
c3fc2621 173 'required' => TRUE,
a36434b9 174 'where' => 'civicrm_dashboard.domain_id',
522a26c9 175 'table_name' => 'civicrm_dashboard',
176 'entity' => 'Dashboard',
177 'bao' => 'CRM_Core_BAO_Dashboard',
6a7e5e5d 178 'localizable' => 0,
e501603b 179 'FKClassName' => 'CRM_Core_DAO_Domain',
c3fc2621 180 'pseudoconstant' => [
e501603b
TO
181 'table' => 'civicrm_domain',
182 'keyColumn' => 'id',
183 'labelColumn' => 'name',
e6ca0a57 184 ],
a9d0587b 185 'add' => '3.1',
c3fc2621
CW
186 ],
187 'name' => [
e501603b
TO
188 'name' => 'name',
189 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 190 'title' => ts('Dashlet Name'),
215b423e 191 'description' => ts('Internal name of dashlet.'),
e501603b
TO
192 'maxlength' => 64,
193 'size' => CRM_Utils_Type::BIG,
a36434b9 194 'where' => 'civicrm_dashboard.name',
522a26c9 195 'table_name' => 'civicrm_dashboard',
196 'entity' => 'Dashboard',
197 'bao' => 'CRM_Core_BAO_Dashboard',
6a7e5e5d 198 'localizable' => 0,
a9d0587b 199 'add' => '4.4',
c3fc2621
CW
200 ],
201 'label' => [
e501603b
TO
202 'name' => 'label',
203 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 204 'title' => ts('Dashlet Title'),
215b423e 205 'description' => ts('dashlet title'),
e501603b
TO
206 'maxlength' => 255,
207 'size' => CRM_Utils_Type::HUGE,
a36434b9 208 'where' => 'civicrm_dashboard.label',
522a26c9 209 'table_name' => 'civicrm_dashboard',
210 'entity' => 'Dashboard',
211 'bao' => 'CRM_Core_BAO_Dashboard',
6a7e5e5d 212 'localizable' => 1,
a9d0587b 213 'add' => '3.1',
c3fc2621
CW
214 ],
215 'url' => [
e501603b
TO
216 'name' => 'url',
217 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 218 'title' => ts('Dashlet URL'),
215b423e 219 'description' => ts('url in case of external dashlet'),
e501603b
TO
220 'maxlength' => 255,
221 'size' => CRM_Utils_Type::HUGE,
a36434b9 222 'where' => 'civicrm_dashboard.url',
522a26c9 223 'table_name' => 'civicrm_dashboard',
224 'entity' => 'Dashboard',
225 'bao' => 'CRM_Core_BAO_Dashboard',
6a7e5e5d 226 'localizable' => 0,
a9d0587b 227 'add' => '3.1',
c3fc2621
CW
228 ],
229 'permission' => [
e501603b
TO
230 'name' => 'permission',
231 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 232 'title' => ts('Dashlet Permission'),
215b423e 233 'description' => ts('Permission for the dashlet'),
e501603b
TO
234 'maxlength' => 255,
235 'size' => CRM_Utils_Type::HUGE,
a36434b9 236 'where' => 'civicrm_dashboard.permission',
522a26c9 237 'table_name' => 'civicrm_dashboard',
238 'entity' => 'Dashboard',
239 'bao' => 'CRM_Core_BAO_Dashboard',
6a7e5e5d 240 'localizable' => 0,
7a19c557 241 'serialize' => self::SERIALIZE_COMMA,
a9d0587b 242 'add' => '3.1',
c3fc2621
CW
243 ],
244 'permission_operator' => [
e501603b
TO
245 'name' => 'permission_operator',
246 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 247 'title' => ts('Dashlet Permission Operator'),
215b423e 248 'description' => ts('Permission Operator'),
e501603b
TO
249 'maxlength' => 3,
250 'size' => CRM_Utils_Type::FOUR,
a36434b9 251 'where' => 'civicrm_dashboard.permission_operator',
522a26c9 252 'table_name' => 'civicrm_dashboard',
253 'entity' => 'Dashboard',
254 'bao' => 'CRM_Core_BAO_Dashboard',
6a7e5e5d 255 'localizable' => 0,
a9d0587b 256 'add' => '3.1',
c3fc2621
CW
257 ],
258 'fullscreen_url' => [
e501603b
TO
259 'name' => 'fullscreen_url',
260 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 261 'title' => ts('Fullscreen URL'),
215b423e 262 'description' => ts('fullscreen url for dashlet'),
e501603b
TO
263 'maxlength' => 255,
264 'size' => CRM_Utils_Type::HUGE,
a36434b9 265 'where' => 'civicrm_dashboard.fullscreen_url',
522a26c9 266 'table_name' => 'civicrm_dashboard',
267 'entity' => 'Dashboard',
268 'bao' => 'CRM_Core_BAO_Dashboard',
6a7e5e5d 269 'localizable' => 0,
a9d0587b 270 'add' => '3.4',
c3fc2621
CW
271 ],
272 'is_active' => [
e501603b
TO
273 'name' => 'is_active',
274 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 275 'title' => ts('Is Dashlet Active?'),
215b423e 276 'description' => ts('Is this dashlet active?'),
a36434b9 277 'where' => 'civicrm_dashboard.is_active',
45a83e42 278 'default' => '0',
522a26c9 279 'table_name' => 'civicrm_dashboard',
280 'entity' => 'Dashboard',
281 'bao' => 'CRM_Core_BAO_Dashboard',
6a7e5e5d 282 'localizable' => 0,
a9d0587b 283 'add' => '3.1',
c3fc2621
CW
284 ],
285 'is_reserved' => [
e501603b
TO
286 'name' => 'is_reserved',
287 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 288 'title' => ts('Is Dashlet Reserved?'),
215b423e 289 'description' => ts('Is this dashlet reserved?'),
a36434b9 290 'where' => 'civicrm_dashboard.is_reserved',
45a83e42 291 'default' => '0',
522a26c9 292 'table_name' => 'civicrm_dashboard',
293 'entity' => 'Dashboard',
294 'bao' => 'CRM_Core_BAO_Dashboard',
6a7e5e5d 295 'localizable' => 0,
a9d0587b 296 'add' => '3.1',
c3fc2621
CW
297 ],
298 'cache_minutes' => [
bf7df0ec 299 'name' => 'cache_minutes',
e501603b 300 'type' => CRM_Utils_Type::T_INT,
c3fc2621 301 'title' => ts('Cache Minutes'),
215b423e 302 'description' => ts('Number of minutes to cache dashlet content in browser localStorage.'),
c3fc2621 303 'required' => TRUE,
a36434b9 304 'where' => 'civicrm_dashboard.cache_minutes',
bf7df0ec 305 'default' => '60',
522a26c9 306 'table_name' => 'civicrm_dashboard',
307 'entity' => 'Dashboard',
308 'bao' => 'CRM_Core_BAO_Dashboard',
6a7e5e5d 309 'localizable' => 0,
a9d0587b 310 'add' => '4.7',
c3fc2621 311 ],
f263929f
CW
312 'directive' => [
313 'name' => 'directive',
314 'type' => CRM_Utils_Type::T_STRING,
315 'title' => ts('Angular directive'),
316 'description' => ts('Element name of angular directive to invoke (lowercase hyphenated format)'),
317 'maxlength' => 255,
318 'size' => CRM_Utils_Type::HUGE,
319 'where' => 'civicrm_dashboard.directive',
320 'table_name' => 'civicrm_dashboard',
321 'entity' => 'Dashboard',
322 'bao' => 'CRM_Core_BAO_Dashboard',
323 'localizable' => 0,
324 'add' => '5.33',
325 ],
c3fc2621 326 ];
346aaaba 327 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 328 }
346aaaba 329 return Civi::$statics[__CLASS__]['fields'];
e501603b 330 }
c3fc2621 331
e501603b 332 /**
bd8e0b14 333 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
334 *
335 * @return array
bd8e0b14 336 * Array(string $name => string $uniqueName).
e501603b 337 */
c3fc2621 338 public static function &fieldKeys() {
bd8e0b14
TO
339 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
340 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 341 }
bd8e0b14 342 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 343 }
c3fc2621 344
e501603b
TO
345 /**
346 * Returns the names of this table
347 *
348 * @return string
349 */
c3fc2621 350 public static function getTableName() {
e501603b
TO
351 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
352 }
c3fc2621 353
e501603b
TO
354 /**
355 * Returns if this table needs to be logged
356 *
c3fc2621 357 * @return bool
e501603b 358 */
c3fc2621 359 public function getLog() {
e501603b
TO
360 return self::$_log;
361 }
c3fc2621 362
e501603b
TO
363 /**
364 * Returns the list of fields that can be imported
365 *
366 * @param bool $prefix
367 *
368 * @return array
369 */
c3fc2621
CW
370 public static function &import($prefix = FALSE) {
371 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dashboard', $prefix, []);
60808919 372 return $r;
e501603b 373 }
c3fc2621 374
e501603b
TO
375 /**
376 * Returns the list of fields that can be exported
377 *
378 * @param bool $prefix
379 *
380 * @return array
381 */
c3fc2621
CW
382 public static function &export($prefix = FALSE) {
383 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dashboard', $prefix, []);
60808919 384 return $r;
e501603b 385 }
c3fc2621 386
e7a6b91a
AS
387 /**
388 * Returns the list of indices
c3fc2621
CW
389 *
390 * @param bool $localize
391 *
392 * @return array
e7a6b91a
AS
393 */
394 public static function indices($localize = TRUE) {
c3fc2621 395 $indices = [];
e7a6b91a
AS
396 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
397 }
c3fc2621 398
e501603b 399}