2682437ba85811e5f526dfeeebd66851f9be3ef4
[civicrm-core.git] / CRM / Core / DAO / StatusPreference.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/StatusPreference.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:ec99239ddba33ac2d8a514b5e94b0b24)
10 */
11
12 /**
13 * Database access object for the StatusPreference entity.
14 */
15 class CRM_Core_DAO_StatusPreference extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '4.7';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_status_pref';
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 * Unique Status Preference ID
35 *
36 * @var int
37 */
38 public $id;
39
40 /**
41 * Which Domain is this Status Preference for
42 *
43 * @var int
44 */
45 public $domain_id;
46
47 /**
48 * Name of the status check this preference references.
49 *
50 * @var string
51 */
52 public $name;
53
54 /**
55 * expires ignore_severity. NULL never hushes.
56 *
57 * @var date
58 */
59 public $hush_until;
60
61 /**
62 * Hush messages up to and including this severity.
63 *
64 * @var int
65 */
66 public $ignore_severity;
67
68 /**
69 * These settings are per-check, and can't be compared across checks.
70 *
71 * @var string
72 */
73 public $prefs;
74
75 /**
76 * These values are per-check, and can't be compared across checks.
77 *
78 * @var string
79 */
80 public $check_info;
81
82 /**
83 * Is this status check active?
84 *
85 * @var bool
86 */
87 public $is_active;
88
89 /**
90 * Class constructor.
91 */
92 public function __construct() {
93 $this->__table = 'civicrm_status_pref';
94 parent::__construct();
95 }
96
97 /**
98 * Returns localized title of this entity.
99 *
100 * @param bool $plural
101 * Whether to return the plural version of the title.
102 */
103 public static function getEntityTitle($plural = FALSE) {
104 return $plural ? ts('Status Preferences') : ts('Status Preference');
105 }
106
107 /**
108 * Returns foreign keys and entity references.
109 *
110 * @return array
111 * [CRM_Core_Reference_Interface]
112 */
113 public static function getReferenceColumns() {
114 if (!isset(Civi::$statics[__CLASS__]['links'])) {
115 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
116 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
117 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
118 }
119 return Civi::$statics[__CLASS__]['links'];
120 }
121
122 /**
123 * Returns all the column names of this table
124 *
125 * @return array
126 */
127 public static function &fields() {
128 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
129 Civi::$statics[__CLASS__]['fields'] = [
130 'id' => [
131 'name' => 'id',
132 'type' => CRM_Utils_Type::T_INT,
133 'title' => ts('Status Preference ID'),
134 'description' => ts('Unique Status Preference ID'),
135 'required' => TRUE,
136 'where' => 'civicrm_status_pref.id',
137 'table_name' => 'civicrm_status_pref',
138 'entity' => 'StatusPreference',
139 'bao' => 'CRM_Core_BAO_StatusPreference',
140 'localizable' => 0,
141 'html' => [
142 'type' => 'Number',
143 ],
144 'add' => '4.7',
145 ],
146 'domain_id' => [
147 'name' => 'domain_id',
148 'type' => CRM_Utils_Type::T_INT,
149 'title' => ts('Domain ID'),
150 'description' => ts('Which Domain is this Status Preference for'),
151 'required' => TRUE,
152 'where' => 'civicrm_status_pref.domain_id',
153 'table_name' => 'civicrm_status_pref',
154 'entity' => 'StatusPreference',
155 'bao' => 'CRM_Core_BAO_StatusPreference',
156 'localizable' => 0,
157 'FKClassName' => 'CRM_Core_DAO_Domain',
158 'html' => [
159 'label' => ts("Domain"),
160 ],
161 'pseudoconstant' => [
162 'table' => 'civicrm_domain',
163 'keyColumn' => 'id',
164 'labelColumn' => 'name',
165 ],
166 'add' => '4.7',
167 ],
168 'name' => [
169 'name' => 'name',
170 'type' => CRM_Utils_Type::T_STRING,
171 'title' => ts('Status Check Name'),
172 'description' => ts('Name of the status check this preference references.'),
173 'required' => TRUE,
174 'maxlength' => 255,
175 'size' => CRM_Utils_Type::HUGE,
176 'import' => TRUE,
177 'where' => 'civicrm_status_pref.name',
178 'export' => TRUE,
179 'table_name' => 'civicrm_status_pref',
180 'entity' => 'StatusPreference',
181 'bao' => 'CRM_Core_BAO_StatusPreference',
182 'localizable' => 0,
183 'add' => '4.7',
184 ],
185 'hush_until' => [
186 'name' => 'hush_until',
187 'type' => CRM_Utils_Type::T_DATE,
188 'title' => ts('Snooze Status Notifications Until'),
189 'description' => ts('expires ignore_severity. NULL never hushes.'),
190 'import' => TRUE,
191 'where' => 'civicrm_status_pref.hush_until',
192 'export' => TRUE,
193 'default' => 'NULL',
194 'table_name' => 'civicrm_status_pref',
195 'entity' => 'StatusPreference',
196 'bao' => 'CRM_Core_BAO_StatusPreference',
197 'localizable' => 0,
198 'add' => '4.7',
199 ],
200 'ignore_severity' => [
201 'name' => 'ignore_severity',
202 'type' => CRM_Utils_Type::T_INT,
203 'title' => ts('Ignore Severity'),
204 'description' => ts('Hush messages up to and including this severity.'),
205 'import' => TRUE,
206 'where' => 'civicrm_status_pref.ignore_severity',
207 'export' => TRUE,
208 'default' => '1',
209 'table_name' => 'civicrm_status_pref',
210 'entity' => 'StatusPreference',
211 'bao' => 'CRM_Core_BAO_StatusPreference',
212 'localizable' => 0,
213 'pseudoconstant' => [
214 'callback' => 'CRM_Utils_Check::getSeverityList',
215 ],
216 'add' => '4.7',
217 ],
218 'prefs' => [
219 'name' => 'prefs',
220 'type' => CRM_Utils_Type::T_STRING,
221 'title' => ts('Status Preferences'),
222 'description' => ts('These settings are per-check, and can\'t be compared across checks.'),
223 'maxlength' => 255,
224 'size' => CRM_Utils_Type::HUGE,
225 'where' => 'civicrm_status_pref.prefs',
226 'table_name' => 'civicrm_status_pref',
227 'entity' => 'StatusPreference',
228 'bao' => 'CRM_Core_BAO_StatusPreference',
229 'localizable' => 0,
230 'add' => '4.7',
231 ],
232 'check_info' => [
233 'name' => 'check_info',
234 'type' => CRM_Utils_Type::T_STRING,
235 'title' => ts('Check Info'),
236 'description' => ts('These values are per-check, and can\'t be compared across checks.'),
237 'maxlength' => 255,
238 'size' => CRM_Utils_Type::HUGE,
239 'where' => 'civicrm_status_pref.check_info',
240 'table_name' => 'civicrm_status_pref',
241 'entity' => 'StatusPreference',
242 'bao' => 'CRM_Core_BAO_StatusPreference',
243 'localizable' => 0,
244 'add' => '4.7',
245 ],
246 'is_active' => [
247 'name' => 'is_active',
248 'type' => CRM_Utils_Type::T_BOOLEAN,
249 'title' => ts('Check Is Active'),
250 'description' => ts('Is this status check active?'),
251 'where' => 'civicrm_status_pref.is_active',
252 'default' => '1',
253 'table_name' => 'civicrm_status_pref',
254 'entity' => 'StatusPreference',
255 'bao' => 'CRM_Core_BAO_StatusPreference',
256 'localizable' => 0,
257 'add' => '5.19',
258 ],
259 ];
260 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
261 }
262 return Civi::$statics[__CLASS__]['fields'];
263 }
264
265 /**
266 * Return a mapping from field-name to the corresponding key (as used in fields()).
267 *
268 * @return array
269 * Array(string $name => string $uniqueName).
270 */
271 public static function &fieldKeys() {
272 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
273 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
274 }
275 return Civi::$statics[__CLASS__]['fieldKeys'];
276 }
277
278 /**
279 * Returns the names of this table
280 *
281 * @return string
282 */
283 public static function getTableName() {
284 return self::$_tableName;
285 }
286
287 /**
288 * Returns if this table needs to be logged
289 *
290 * @return bool
291 */
292 public function getLog() {
293 return self::$_log;
294 }
295
296 /**
297 * Returns the list of fields that can be imported
298 *
299 * @param bool $prefix
300 *
301 * @return array
302 */
303 public static function &import($prefix = FALSE) {
304 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'status_pref', $prefix, []);
305 return $r;
306 }
307
308 /**
309 * Returns the list of fields that can be exported
310 *
311 * @param bool $prefix
312 *
313 * @return array
314 */
315 public static function &export($prefix = FALSE) {
316 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'status_pref', $prefix, []);
317 return $r;
318 }
319
320 /**
321 * Returns the list of indices
322 *
323 * @param bool $localize
324 *
325 * @return array
326 */
327 public static function indices($localize = TRUE) {
328 $indices = [
329 'UI_status_pref_name' => [
330 'name' => 'UI_status_pref_name',
331 'field' => [
332 0 => 'name',
333 ],
334 'localizable' => FALSE,
335 'sig' => 'civicrm_status_pref::0::name',
336 ],
337 ];
338 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
339 }
340
341 }