a4f45c5d20d6c246fce430494efd27dfd154184d
[civicrm-core.git] / CRM / Core / DAO / StatusPreference.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
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-2017
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 /**
38 * CRM_Core_DAO_StatusPreference constructor.
39 */
40 class CRM_Core_DAO_StatusPreference extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_status_pref';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
49 *
50 * @var boolean
51 */
52 static $_log = false;
53 /**
54 * Unique Status Preference ID
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * Which Domain is this Status Preference for
61 *
62 * @var int unsigned
63 */
64 public $domain_id;
65 /**
66 * Name of the status check this preference references.
67 *
68 * @var string
69 */
70 public $name;
71 /**
72 * expires ignore_severity. NULL never hushes.
73 *
74 * @var date
75 */
76 public $hush_until;
77 /**
78 * Hush messages up to and including this severity.
79 *
80 * @var int unsigned
81 */
82 public $ignore_severity;
83 /**
84 * These settings are per-check, and can't be compared across checks.
85 *
86 * @var string
87 */
88 public $prefs;
89 /**
90 * These values are per-check, and can't be compared across checks.
91 *
92 * @var string
93 */
94 public $check_info;
95 /**
96 * Class constructor.
97 */
98 function __construct() {
99 $this->__table = 'civicrm_status_pref';
100 parent::__construct();
101 }
102 /**
103 * Returns foreign keys and entity references.
104 *
105 * @return array
106 * [CRM_Core_Reference_Interface]
107 */
108 static function getReferenceColumns() {
109 if (!isset(Civi::$statics[__CLASS__]['links'])) {
110 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
111 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id');
112 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
113 }
114 return Civi::$statics[__CLASS__]['links'];
115 }
116 /**
117 * Returns all the column names of this table
118 *
119 * @return array
120 */
121 static function &fields() {
122 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
123 Civi::$statics[__CLASS__]['fields'] = array(
124 'id' => array(
125 'name' => 'id',
126 'type' => CRM_Utils_Type::T_INT,
127 'title' => ts('Status Preference ID') ,
128 'description' => 'Unique Status Preference ID',
129 'required' => true,
130 ) ,
131 'domain_id' => array(
132 'name' => 'domain_id',
133 'type' => CRM_Utils_Type::T_INT,
134 'title' => ts('Setting Domain') ,
135 'description' => 'Which Domain is this Status Preference for',
136 'required' => true,
137 'FKClassName' => 'CRM_Core_DAO_Domain',
138 'pseudoconstant' => array(
139 'table' => 'civicrm_domain',
140 'keyColumn' => 'id',
141 'labelColumn' => 'name',
142 )
143 ) ,
144 'name' => array(
145 'name' => 'name',
146 'type' => CRM_Utils_Type::T_STRING,
147 'title' => ts('Status Check Name') ,
148 'description' => 'Name of the status check this preference references.',
149 'required' => true,
150 'maxlength' => 255,
151 'size' => CRM_Utils_Type::HUGE,
152 'import' => true,
153 'where' => 'civicrm_status_pref.name',
154 'headerPattern' => '',
155 'dataPattern' => '',
156 'export' => true,
157 ) ,
158 'hush_until' => array(
159 'name' => 'hush_until',
160 'type' => CRM_Utils_Type::T_DATE,
161 'title' => ts('Snooze Status Notifications Until') ,
162 'description' => 'expires ignore_severity. NULL never hushes.',
163 'import' => true,
164 'where' => 'civicrm_status_pref.hush_until',
165 'headerPattern' => '',
166 'dataPattern' => '',
167 'export' => true,
168 'default' => 'NULL',
169 ) ,
170 'ignore_severity' => array(
171 'name' => 'ignore_severity',
172 'type' => CRM_Utils_Type::T_INT,
173 'title' => ts('Ignore Severity') ,
174 'description' => 'Hush messages up to and including this severity.',
175 'import' => true,
176 'where' => 'civicrm_status_pref.ignore_severity',
177 'headerPattern' => '',
178 'dataPattern' => '',
179 'export' => true,
180 'default' => '1',
181 'pseudoconstant' => array(
182 'callback' => 'CRM_Utils_Check::getSeverityList',
183 )
184 ) ,
185 'prefs' => array(
186 'name' => 'prefs',
187 'type' => CRM_Utils_Type::T_STRING,
188 'title' => ts('Status Preferences') ,
189 'description' => 'These settings are per-check, and can\'t be compared across checks.',
190 'maxlength' => 255,
191 'size' => CRM_Utils_Type::HUGE,
192 ) ,
193 'check_info' => array(
194 'name' => 'check_info',
195 'type' => CRM_Utils_Type::T_STRING,
196 'title' => ts('Check Info') ,
197 'description' => 'These values are per-check, and can\'t be compared across checks.',
198 'maxlength' => 255,
199 'size' => CRM_Utils_Type::HUGE,
200 ) ,
201 );
202 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
203 }
204 return Civi::$statics[__CLASS__]['fields'];
205 }
206 /**
207 * Return a mapping from field-name to the corresponding key (as used in fields()).
208 *
209 * @return array
210 * Array(string $name => string $uniqueName).
211 */
212 static function &fieldKeys() {
213 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
214 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
215 }
216 return Civi::$statics[__CLASS__]['fieldKeys'];
217 }
218 /**
219 * Returns the names of this table
220 *
221 * @return string
222 */
223 static function getTableName() {
224 return self::$_tableName;
225 }
226 /**
227 * Returns if this table needs to be logged
228 *
229 * @return boolean
230 */
231 function getLog() {
232 return self::$_log;
233 }
234 /**
235 * Returns the list of fields that can be imported
236 *
237 * @param bool $prefix
238 *
239 * @return array
240 */
241 static function &import($prefix = false) {
242 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'status_pref', $prefix, array());
243 return $r;
244 }
245 /**
246 * Returns the list of fields that can be exported
247 *
248 * @param bool $prefix
249 *
250 * @return array
251 */
252 static function &export($prefix = false) {
253 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'status_pref', $prefix, array());
254 return $r;
255 }
256 }