xml/templates/dao.tpl - Simplify fieldKeys()
[civicrm-core.git] / CRM / Core / DAO / StatusPreference.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
6| Copyright CiviCRM LLC (c) 2004-2016 |
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
10| CiviCRM is free software; you can copy, modify, and distribute it |
11| under the terms of the GNU Affero General Public License |
12| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13| |
14| CiviCRM is distributed in the hope that it will be useful, but |
15| WITHOUT ANY WARRANTY; without even the implied warranty of |
16| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17| See the GNU Affero General Public License for more details. |
18| |
19| You should have received a copy of the GNU Affero General Public |
20| License and the CiviCRM Licensing Exception along |
21| with this program; if not, contact CiviCRM LLC |
22| at info[AT]civicrm[DOT]org. If you have questions about the |
23| GNU Affero General Public License or the licensing of CiviCRM, |
24| see the CiviCRM license FAQ at http://civicrm.org/licensing |
25+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
29 * @copyright CiviCRM LLC (c) 2004-2016
30 *
31 * Generated from xml/schema/CRM/Core/StatusPreference.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
437fafcf 33 * (GenCodeChecksum:a4010608f5b37f8e703fd4ae4b63bb35)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class CRM_Core_DAO_StatusPreference extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_status_pref';
44 /**
45 * static instance to hold the field values
46 *
47 * @var array
48 */
49 static $_fields = null;
50 /**
51 * static instance to hold the keys used in $_fields for each field.
52 *
53 * @var array
54 */
55 static $_fieldKeys = null;
56 /**
57 * static instance to hold the FK relationships
58 *
59 * @var string
60 */
61 static $_links = null;
e501603b
TO
62 /**
63 * static value to see if we should log any modifications to
64 * this table in the civicrm_log table
65 *
66 * @var boolean
67 */
68 static $_log = false;
69 /**
70 * Unique Status Preference ID
71 *
72 * @var int unsigned
73 */
74 public $id;
75 /**
76 * Which Domain is this Status Preference for
77 *
78 * @var int unsigned
79 */
80 public $domain_id;
81 /**
82 * Name of the status check this preference references.
83 *
84 * @var string
85 */
86 public $name;
87 /**
88 * expires ignore_severity. NULL never hushes.
89 *
90 * @var date
91 */
92 public $hush_until;
93 /**
94 * Hush messages up to and including this severity.
95 *
96 * @var int unsigned
97 */
98 public $ignore_severity;
99 /**
100 * These settings are per-check, and can't be compared across checks.
101 *
102 * @var string
103 */
104 public $prefs;
105 /**
106 * These values are per-check, and can't be compared across checks.
107 *
108 * @var string
109 */
110 public $check_info;
111 /**
112 * class constructor
113 *
114 * @return civicrm_status_pref
115 */
116 function __construct() {
117 $this->__table = 'civicrm_status_pref';
118 parent::__construct();
119 }
120 /**
121 * Returns foreign keys and entity references
122 *
123 * @return array
124 * [CRM_Core_Reference_Interface]
125 */
126 static function getReferenceColumns() {
127 if (!self::$_links) {
128 self::$_links = static ::createReferenceColumns(__CLASS__);
129 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id');
130 }
131 return self::$_links;
132 }
133 /**
134 * Returns all the column names of this table
135 *
136 * @return array
137 */
138 static function &fields() {
139 if (!(self::$_fields)) {
140 self::$_fields = array(
141 'id' => array(
142 'name' => 'id',
143 'type' => CRM_Utils_Type::T_INT,
144 'title' => ts('Status Preference ID') ,
145 'description' => 'Unique Status Preference ID',
146 'required' => true,
147 ) ,
148 'domain_id' => array(
149 'name' => 'domain_id',
150 'type' => CRM_Utils_Type::T_INT,
151 'title' => ts('Setting Domain') ,
152 'description' => 'Which Domain is this Status Preference for',
153 'required' => true,
154 'FKClassName' => 'CRM_Core_DAO_Domain',
155 'pseudoconstant' => array(
156 'table' => 'civicrm_domain',
157 'keyColumn' => 'id',
158 'labelColumn' => 'name',
159 )
160 ) ,
161 'name' => array(
162 'name' => 'name',
163 'type' => CRM_Utils_Type::T_STRING,
164 'title' => ts('Status Check Name') ,
165 'description' => 'Name of the status check this preference references.',
166 'required' => true,
167 'maxlength' => 255,
168 'size' => CRM_Utils_Type::HUGE,
169 'import' => true,
170 'where' => 'civicrm_status_pref.name',
171 'headerPattern' => '',
172 'dataPattern' => '',
173 'export' => true,
174 ) ,
175 'hush_until' => array(
176 'name' => 'hush_until',
177 'type' => CRM_Utils_Type::T_DATE,
178 'title' => ts('Snooze Status Notifications Until') ,
179 'description' => 'expires ignore_severity. NULL never hushes.',
180 'import' => true,
181 'where' => 'civicrm_status_pref.hush_until',
182 'headerPattern' => '',
183 'dataPattern' => '',
184 'export' => true,
185 'default' => 'NULL',
186 ) ,
187 'ignore_severity' => array(
188 'name' => 'ignore_severity',
189 'type' => CRM_Utils_Type::T_INT,
190 'title' => ts('Ignore Severity') ,
191 'description' => 'Hush messages up to and including this severity.',
192 'import' => true,
193 'where' => 'civicrm_status_pref.ignore_severity',
194 'headerPattern' => '',
195 'dataPattern' => '',
196 'export' => true,
197 'default' => '1',
198 'pseudoconstant' => array(
199 'callback' => 'CRM_Utils_Check::getSeverityList',
200 )
201 ) ,
202 'prefs' => array(
203 'name' => 'prefs',
204 'type' => CRM_Utils_Type::T_STRING,
205 'title' => ts('Status Preferences') ,
206 'description' => 'These settings are per-check, and can\'t be compared across checks.',
207 'maxlength' => 255,
208 'size' => CRM_Utils_Type::HUGE,
209 ) ,
210 'check_info' => array(
211 'name' => 'check_info',
212 'type' => CRM_Utils_Type::T_STRING,
213 'title' => ts('Check Info') ,
214 'description' => 'These values are per-check, and can\'t be compared across checks.',
215 'maxlength' => 255,
216 'size' => CRM_Utils_Type::HUGE,
217 ) ,
218 );
219 }
220 return self::$_fields;
221 }
222 /**
223 * Returns an array containing, for each field, the arary key used for that
224 * field in self::$_fields.
225 *
226 * @return array
227 */
228 static function &fieldKeys() {
229 if (!(self::$_fieldKeys)) {
230 self::$_fieldKeys = array(
231 'id' => 'id',
232 'domain_id' => 'domain_id',
233 'name' => 'name',
234 'hush_until' => 'hush_until',
235 'ignore_severity' => 'ignore_severity',
236 'prefs' => 'prefs',
237 'check_info' => 'check_info',
238 );
239 }
240 return self::$_fieldKeys;
241 }
242 /**
243 * Returns the names of this table
244 *
245 * @return string
246 */
247 static function getTableName() {
248 return self::$_tableName;
249 }
250 /**
251 * Returns if this table needs to be logged
252 *
253 * @return boolean
254 */
255 function getLog() {
256 return self::$_log;
257 }
258 /**
259 * Returns the list of fields that can be imported
260 *
261 * @param bool $prefix
262 *
263 * @return array
264 */
265 static function &import($prefix = false) {
60808919
TO
266 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'status_pref', $prefix, array());
267 return $r;
e501603b
TO
268 }
269 /**
270 * Returns the list of fields that can be exported
271 *
272 * @param bool $prefix
273 *
274 * @return array
275 */
276 static function &export($prefix = false) {
60808919
TO
277 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'status_pref', $prefix, array());
278 return $r;
e501603b
TO
279 }
280}