Commit | Line | Data |
---|---|---|
e501603b TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.7 | | |
5 | +--------------------------------------------------------------------+ | |
0f03f337 | 6 | | Copyright CiviCRM LLC (c) 2004-2017 | |
e501603b TO |
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 | |
0f03f337 | 29 | * @copyright CiviCRM LLC (c) 2004-2017 |
e501603b TO |
30 | * |
31 | * Generated from xml/schema/CRM/Case/CaseType.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
e7a6b91a | 33 | * (GenCodeChecksum:a9a547708dfca9da8c4421dd5edac6ac) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
f41f0342 | 37 | /** |
38 | * CRM_Case_DAO_CaseType constructor. | |
39 | */ | |
e501603b TO |
40 | class CRM_Case_DAO_CaseType extends CRM_Core_DAO { |
41 | /** | |
f41f0342 | 42 | * Static instance to hold the table name. |
e501603b TO |
43 | * |
44 | * @var string | |
45 | */ | |
46 | static $_tableName = 'civicrm_case_type'; | |
e501603b | 47 | /** |
f41f0342 | 48 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b TO |
49 | * |
50 | * @var boolean | |
51 | */ | |
52 | static $_log = true; | |
53 | /** | |
54 | * Autoincremented type id | |
55 | * | |
56 | * @var int unsigned | |
57 | */ | |
58 | public $id; | |
59 | /** | |
60 | * Machine name for Case Type | |
61 | * | |
62 | * @var string | |
63 | */ | |
64 | public $name; | |
65 | /** | |
66 | * Natural language name for Case Type | |
67 | * | |
68 | * @var string | |
69 | */ | |
70 | public $title; | |
71 | /** | |
72 | * Description of the Case Type | |
73 | * | |
74 | * @var string | |
75 | */ | |
76 | public $description; | |
77 | /** | |
78 | * Is this entry active? | |
79 | * | |
80 | * @var boolean | |
81 | */ | |
82 | public $is_active; | |
83 | /** | |
84 | * Is this case type a predefined system type? | |
85 | * | |
86 | * @var boolean | |
87 | */ | |
88 | public $is_reserved; | |
89 | /** | |
90 | * Ordering of the case types | |
91 | * | |
92 | * @var int | |
93 | */ | |
94 | public $weight; | |
95 | /** | |
96 | * xml definition of case type | |
97 | * | |
98 | * @var blob | |
99 | */ | |
100 | public $definition; | |
101 | /** | |
f41f0342 | 102 | * Class constructor. |
e501603b TO |
103 | */ |
104 | function __construct() { | |
105 | $this->__table = 'civicrm_case_type'; | |
106 | parent::__construct(); | |
107 | } | |
108 | /** | |
109 | * Returns all the column names of this table | |
110 | * | |
111 | * @return array | |
112 | */ | |
113 | static function &fields() { | |
346aaaba TO |
114 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
115 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
116 | 'id' => array( |
117 | 'name' => 'id', | |
118 | 'type' => CRM_Utils_Type::T_INT, | |
119 | 'title' => ts('Case Type ID') , | |
120 | 'description' => 'Autoincremented type id', | |
121 | 'required' => true, | |
522a26c9 | 122 | 'table_name' => 'civicrm_case_type', |
123 | 'entity' => 'CaseType', | |
124 | 'bao' => 'CRM_Case_BAO_CaseType', | |
6a7e5e5d | 125 | 'localizable' => 0, |
e501603b TO |
126 | ) , |
127 | 'name' => array( | |
128 | 'name' => 'name', | |
129 | 'type' => CRM_Utils_Type::T_STRING, | |
130 | 'title' => ts('Case Type Name') , | |
131 | 'description' => 'Machine name for Case Type', | |
132 | 'required' => true, | |
133 | 'maxlength' => 64, | |
134 | 'size' => CRM_Utils_Type::BIG, | |
522a26c9 | 135 | 'table_name' => 'civicrm_case_type', |
136 | 'entity' => 'CaseType', | |
137 | 'bao' => 'CRM_Case_BAO_CaseType', | |
6a7e5e5d | 138 | 'localizable' => 0, |
e501603b TO |
139 | ) , |
140 | 'title' => array( | |
141 | 'name' => 'title', | |
142 | 'type' => CRM_Utils_Type::T_STRING, | |
143 | 'title' => ts('Case Type Title') , | |
144 | 'description' => 'Natural language name for Case Type', | |
145 | 'required' => true, | |
146 | 'maxlength' => 64, | |
147 | 'size' => CRM_Utils_Type::BIG, | |
522a26c9 | 148 | 'table_name' => 'civicrm_case_type', |
149 | 'entity' => 'CaseType', | |
150 | 'bao' => 'CRM_Case_BAO_CaseType', | |
6a7e5e5d | 151 | 'localizable' => 1, |
e501603b TO |
152 | ) , |
153 | 'description' => array( | |
154 | 'name' => 'description', | |
155 | 'type' => CRM_Utils_Type::T_STRING, | |
156 | 'title' => ts('Case Type Description') , | |
157 | 'description' => 'Description of the Case Type', | |
158 | 'maxlength' => 255, | |
159 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 160 | 'table_name' => 'civicrm_case_type', |
161 | 'entity' => 'CaseType', | |
162 | 'bao' => 'CRM_Case_BAO_CaseType', | |
6a7e5e5d | 163 | 'localizable' => 1, |
e501603b TO |
164 | ) , |
165 | 'is_active' => array( | |
166 | 'name' => 'is_active', | |
167 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
168 | 'title' => ts('Case Type Is Active') , | |
169 | 'description' => 'Is this entry active?', | |
522a26c9 | 170 | 'table_name' => 'civicrm_case_type', |
171 | 'entity' => 'CaseType', | |
172 | 'bao' => 'CRM_Case_BAO_CaseType', | |
6a7e5e5d | 173 | 'localizable' => 0, |
e501603b TO |
174 | ) , |
175 | 'is_reserved' => array( | |
176 | 'name' => 'is_reserved', | |
177 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
178 | 'title' => ts('Case Type Is Reserved') , | |
179 | 'description' => 'Is this case type a predefined system type?', | |
522a26c9 | 180 | 'table_name' => 'civicrm_case_type', |
181 | 'entity' => 'CaseType', | |
182 | 'bao' => 'CRM_Case_BAO_CaseType', | |
6a7e5e5d | 183 | 'localizable' => 0, |
e501603b TO |
184 | ) , |
185 | 'weight' => array( | |
186 | 'name' => 'weight', | |
187 | 'type' => CRM_Utils_Type::T_INT, | |
188 | 'title' => ts('Order') , | |
189 | 'description' => 'Ordering of the case types', | |
190 | 'required' => true, | |
191 | 'default' => '1', | |
522a26c9 | 192 | 'table_name' => 'civicrm_case_type', |
193 | 'entity' => 'CaseType', | |
194 | 'bao' => 'CRM_Case_BAO_CaseType', | |
6a7e5e5d | 195 | 'localizable' => 0, |
e501603b TO |
196 | ) , |
197 | 'definition' => array( | |
198 | 'name' => 'definition', | |
199 | 'type' => CRM_Utils_Type::T_BLOB, | |
200 | 'title' => ts('Case Type Definition') , | |
201 | 'description' => 'xml definition of case type', | |
522a26c9 | 202 | 'table_name' => 'civicrm_case_type', |
203 | 'entity' => 'CaseType', | |
204 | 'bao' => 'CRM_Case_BAO_CaseType', | |
6a7e5e5d | 205 | 'localizable' => 0, |
e501603b TO |
206 | ) , |
207 | ); | |
346aaaba | 208 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 209 | } |
346aaaba | 210 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
211 | } |
212 | /** | |
bd8e0b14 | 213 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
214 | * |
215 | * @return array | |
bd8e0b14 | 216 | * Array(string $name => string $uniqueName). |
e501603b TO |
217 | */ |
218 | static function &fieldKeys() { | |
bd8e0b14 TO |
219 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
220 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 221 | } |
bd8e0b14 | 222 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
223 | } |
224 | /** | |
225 | * Returns the names of this table | |
226 | * | |
227 | * @return string | |
228 | */ | |
229 | static function getTableName() { | |
230 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); | |
231 | } | |
232 | /** | |
233 | * Returns if this table needs to be logged | |
234 | * | |
235 | * @return boolean | |
236 | */ | |
237 | function getLog() { | |
238 | return self::$_log; | |
239 | } | |
240 | /** | |
241 | * Returns the list of fields that can be imported | |
242 | * | |
243 | * @param bool $prefix | |
244 | * | |
245 | * @return array | |
246 | */ | |
247 | static function &import($prefix = false) { | |
60808919 TO |
248 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'case_type', $prefix, array()); |
249 | return $r; | |
e501603b TO |
250 | } |
251 | /** | |
252 | * Returns the list of fields that can be exported | |
253 | * | |
254 | * @param bool $prefix | |
255 | * | |
256 | * @return array | |
257 | */ | |
258 | static function &export($prefix = false) { | |
60808919 TO |
259 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'case_type', $prefix, array()); |
260 | return $r; | |
e501603b | 261 | } |
e7a6b91a AS |
262 | /** |
263 | * Returns the list of indices | |
264 | */ | |
265 | public static function indices($localize = TRUE) { | |
266 | $indices = array( | |
267 | 'case_type_name' => array( | |
268 | 'name' => 'case_type_name', | |
269 | 'field' => array( | |
270 | 0 => 'name', | |
271 | ) , | |
272 | 'localizable' => false, | |
273 | 'unique' => true, | |
274 | 'sig' => 'civicrm_case_type::1::name', | |
275 | ) , | |
276 | ); | |
277 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; | |
278 | } | |
e501603b | 279 | } |