fixup CRM-14885 - Import DAOs
[civicrm-core.git] / CRM / Core / DAO / StatusPreference.php
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
33 * (GenCodeChecksum:a4010608f5b37f8e703fd4ae4b63bb35)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class 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;
62 /**
63 * static instance to hold the values that can
64 * be imported
65 *
66 * @var array
67 */
68 static $_import = null;
69 /**
70 * static instance to hold the values that can
71 * be exported
72 *
73 * @var array
74 */
75 static $_export = null;
76 /**
77 * static value to see if we should log any modifications to
78 * this table in the civicrm_log table
79 *
80 * @var boolean
81 */
82 static $_log = false;
83 /**
84 * Unique Status Preference ID
85 *
86 * @var int unsigned
87 */
88 public $id;
89 /**
90 * Which Domain is this Status Preference for
91 *
92 * @var int unsigned
93 */
94 public $domain_id;
95 /**
96 * Name of the status check this preference references.
97 *
98 * @var string
99 */
100 public $name;
101 /**
102 * expires ignore_severity. NULL never hushes.
103 *
104 * @var date
105 */
106 public $hush_until;
107 /**
108 * Hush messages up to and including this severity.
109 *
110 * @var int unsigned
111 */
112 public $ignore_severity;
113 /**
114 * These settings are per-check, and can't be compared across checks.
115 *
116 * @var string
117 */
118 public $prefs;
119 /**
120 * These values are per-check, and can't be compared across checks.
121 *
122 * @var string
123 */
124 public $check_info;
125 /**
126 * class constructor
127 *
128 * @return civicrm_status_pref
129 */
130 function __construct() {
131 $this->__table = 'civicrm_status_pref';
132 parent::__construct();
133 }
134 /**
135 * Returns foreign keys and entity references
136 *
137 * @return array
138 * [CRM_Core_Reference_Interface]
139 */
140 static function getReferenceColumns() {
141 if (!self::$_links) {
142 self::$_links = static ::createReferenceColumns(__CLASS__);
143 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id');
144 }
145 return self::$_links;
146 }
147 /**
148 * Returns all the column names of this table
149 *
150 * @return array
151 */
152 static function &fields() {
153 if (!(self::$_fields)) {
154 self::$_fields = array(
155 'id' => array(
156 'name' => 'id',
157 'type' => CRM_Utils_Type::T_INT,
158 'title' => ts('Status Preference ID') ,
159 'description' => 'Unique Status Preference ID',
160 'required' => true,
161 ) ,
162 'domain_id' => array(
163 'name' => 'domain_id',
164 'type' => CRM_Utils_Type::T_INT,
165 'title' => ts('Setting Domain') ,
166 'description' => 'Which Domain is this Status Preference for',
167 'required' => true,
168 'FKClassName' => 'CRM_Core_DAO_Domain',
169 'pseudoconstant' => array(
170 'table' => 'civicrm_domain',
171 'keyColumn' => 'id',
172 'labelColumn' => 'name',
173 )
174 ) ,
175 'name' => array(
176 'name' => 'name',
177 'type' => CRM_Utils_Type::T_STRING,
178 'title' => ts('Status Check Name') ,
179 'description' => 'Name of the status check this preference references.',
180 'required' => true,
181 'maxlength' => 255,
182 'size' => CRM_Utils_Type::HUGE,
183 'import' => true,
184 'where' => 'civicrm_status_pref.name',
185 'headerPattern' => '',
186 'dataPattern' => '',
187 'export' => true,
188 ) ,
189 'hush_until' => array(
190 'name' => 'hush_until',
191 'type' => CRM_Utils_Type::T_DATE,
192 'title' => ts('Snooze Status Notifications Until') ,
193 'description' => 'expires ignore_severity. NULL never hushes.',
194 'import' => true,
195 'where' => 'civicrm_status_pref.hush_until',
196 'headerPattern' => '',
197 'dataPattern' => '',
198 'export' => true,
199 'default' => 'NULL',
200 ) ,
201 'ignore_severity' => array(
202 'name' => 'ignore_severity',
203 'type' => CRM_Utils_Type::T_INT,
204 'title' => ts('Ignore Severity') ,
205 'description' => 'Hush messages up to and including this severity.',
206 'import' => true,
207 'where' => 'civicrm_status_pref.ignore_severity',
208 'headerPattern' => '',
209 'dataPattern' => '',
210 'export' => true,
211 'default' => '1',
212 'pseudoconstant' => array(
213 'callback' => 'CRM_Utils_Check::getSeverityList',
214 )
215 ) ,
216 'prefs' => array(
217 'name' => 'prefs',
218 'type' => CRM_Utils_Type::T_STRING,
219 'title' => ts('Status Preferences') ,
220 'description' => 'These settings are per-check, and can\'t be compared across checks.',
221 'maxlength' => 255,
222 'size' => CRM_Utils_Type::HUGE,
223 ) ,
224 'check_info' => array(
225 'name' => 'check_info',
226 'type' => CRM_Utils_Type::T_STRING,
227 'title' => ts('Check Info') ,
228 'description' => 'These values are per-check, and can\'t be compared across checks.',
229 'maxlength' => 255,
230 'size' => CRM_Utils_Type::HUGE,
231 ) ,
232 );
233 }
234 return self::$_fields;
235 }
236 /**
237 * Returns an array containing, for each field, the arary key used for that
238 * field in self::$_fields.
239 *
240 * @return array
241 */
242 static function &fieldKeys() {
243 if (!(self::$_fieldKeys)) {
244 self::$_fieldKeys = array(
245 'id' => 'id',
246 'domain_id' => 'domain_id',
247 'name' => 'name',
248 'hush_until' => 'hush_until',
249 'ignore_severity' => 'ignore_severity',
250 'prefs' => 'prefs',
251 'check_info' => 'check_info',
252 );
253 }
254 return self::$_fieldKeys;
255 }
256 /**
257 * Returns the names of this table
258 *
259 * @return string
260 */
261 static function getTableName() {
262 return self::$_tableName;
263 }
264 /**
265 * Returns if this table needs to be logged
266 *
267 * @return boolean
268 */
269 function getLog() {
270 return self::$_log;
271 }
272 /**
273 * Returns the list of fields that can be imported
274 *
275 * @param bool $prefix
276 *
277 * @return array
278 */
279 static function &import($prefix = false) {
280 if (!(self::$_import)) {
281 self::$_import = array();
282 $fields = self::fields();
283 foreach($fields as $name => $field) {
284 if (CRM_Utils_Array::value('import', $field)) {
285 if ($prefix) {
286 self::$_import['status_pref'] = & $fields[$name];
287 } else {
288 self::$_import[$name] = & $fields[$name];
289 }
290 }
291 }
292 }
293 return self::$_import;
294 }
295 /**
296 * Returns the list of fields that can be exported
297 *
298 * @param bool $prefix
299 *
300 * @return array
301 */
302 static function &export($prefix = false) {
303 if (!(self::$_export)) {
304 self::$_export = array();
305 $fields = self::fields();
306 foreach($fields as $name => $field) {
307 if (CRM_Utils_Array::value('export', $field)) {
308 if ($prefix) {
309 self::$_export['status_pref'] = & $fields[$name];
310 } else {
311 self::$_export[$name] = & $fields[$name];
312 }
313 }
314 }
315 }
316 return self::$_export;
317 }
318 }