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