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