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/Core/Tag.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
022785d8 | 33 | * (GenCodeChecksum:44541277221c451f8aa93c6170180c44) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
f41f0342 | 37 | /** |
38 | * CRM_Core_DAO_Tag constructor. | |
39 | */ | |
e501603b TO |
40 | class CRM_Core_DAO_Tag 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_tag'; | |
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 | * Tag ID | |
55 | * | |
56 | * @var int unsigned | |
57 | */ | |
58 | public $id; | |
59 | /** | |
60 | * Name of Tag. | |
61 | * | |
62 | * @var string | |
63 | */ | |
64 | public $name; | |
65 | /** | |
66 | * Optional verbose description of the tag. | |
67 | * | |
68 | * @var string | |
69 | */ | |
70 | public $description; | |
71 | /** | |
72 | * Optional parent id for this tag. | |
73 | * | |
74 | * @var int unsigned | |
75 | */ | |
76 | public $parent_id; | |
77 | /** | |
78 | * Is this tag selectable / displayed | |
79 | * | |
80 | * @var boolean | |
81 | */ | |
82 | public $is_selectable; | |
83 | /** | |
84 | * | |
85 | * @var boolean | |
86 | */ | |
87 | public $is_reserved; | |
88 | /** | |
89 | * | |
90 | * @var boolean | |
91 | */ | |
92 | public $is_tagset; | |
93 | /** | |
94 | * | |
95 | * @var string | |
96 | */ | |
97 | public $used_for; | |
98 | /** | |
99 | * FK to civicrm_contact, who created this tag | |
100 | * | |
101 | * @var int unsigned | |
102 | */ | |
103 | public $created_id; | |
d73974ac CW |
104 | /** |
105 | * Hex color value e.g. #ffffff | |
106 | * | |
107 | * @var string | |
108 | */ | |
109 | public $color; | |
e501603b TO |
110 | /** |
111 | * Date and time that tag was created. | |
112 | * | |
113 | * @var datetime | |
114 | */ | |
115 | public $created_date; | |
116 | /** | |
f41f0342 | 117 | * Class constructor. |
e501603b TO |
118 | */ |
119 | function __construct() { | |
120 | $this->__table = 'civicrm_tag'; | |
121 | parent::__construct(); | |
122 | } | |
123 | /** | |
f41f0342 | 124 | * Returns foreign keys and entity references. |
e501603b TO |
125 | * |
126 | * @return array | |
127 | * [CRM_Core_Reference_Interface] | |
128 | */ | |
129 | static function getReferenceColumns() { | |
346aaaba TO |
130 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
131 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
132 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_id', 'civicrm_tag', 'id'); | |
133 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); | |
134 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); | |
e501603b | 135 | } |
346aaaba | 136 | return Civi::$statics[__CLASS__]['links']; |
e501603b TO |
137 | } |
138 | /** | |
139 | * Returns all the column names of this table | |
140 | * | |
141 | * @return array | |
142 | */ | |
143 | static function &fields() { | |
346aaaba TO |
144 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
145 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
146 | 'id' => array( |
147 | 'name' => 'id', | |
148 | 'type' => CRM_Utils_Type::T_INT, | |
149 | 'title' => ts('Tag ID') , | |
150 | 'description' => 'Tag ID', | |
151 | 'required' => true, | |
522a26c9 | 152 | 'table_name' => 'civicrm_tag', |
153 | 'entity' => 'Tag', | |
154 | 'bao' => 'CRM_Core_BAO_Tag', | |
e501603b TO |
155 | ) , |
156 | 'name' => array( | |
157 | 'name' => 'name', | |
158 | 'type' => CRM_Utils_Type::T_STRING, | |
159 | 'title' => ts('Tag Name') , | |
160 | 'description' => 'Name of Tag.', | |
161 | 'required' => true, | |
162 | 'maxlength' => 64, | |
163 | 'size' => CRM_Utils_Type::BIG, | |
522a26c9 | 164 | 'table_name' => 'civicrm_tag', |
165 | 'entity' => 'Tag', | |
166 | 'bao' => 'CRM_Core_BAO_Tag', | |
e501603b TO |
167 | ) , |
168 | 'description' => array( | |
169 | 'name' => 'description', | |
170 | 'type' => CRM_Utils_Type::T_STRING, | |
171 | 'title' => ts('Description') , | |
172 | 'description' => 'Optional verbose description of the tag.', | |
173 | 'maxlength' => 255, | |
174 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 175 | 'table_name' => 'civicrm_tag', |
176 | 'entity' => 'Tag', | |
177 | 'bao' => 'CRM_Core_BAO_Tag', | |
e501603b TO |
178 | ) , |
179 | 'parent_id' => array( | |
180 | 'name' => 'parent_id', | |
181 | 'type' => CRM_Utils_Type::T_INT, | |
182 | 'title' => ts('Parent Tag') , | |
183 | 'description' => 'Optional parent id for this tag.', | |
184 | 'default' => 'NULL', | |
522a26c9 | 185 | 'table_name' => 'civicrm_tag', |
186 | 'entity' => 'Tag', | |
187 | 'bao' => 'CRM_Core_BAO_Tag', | |
e501603b TO |
188 | 'FKClassName' => 'CRM_Core_DAO_Tag', |
189 | ) , | |
190 | 'is_selectable' => array( | |
191 | 'name' => 'is_selectable', | |
192 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
193 | 'title' => ts('Display Tag?') , | |
194 | 'description' => 'Is this tag selectable / displayed', | |
195 | 'default' => '1', | |
522a26c9 | 196 | 'table_name' => 'civicrm_tag', |
197 | 'entity' => 'Tag', | |
198 | 'bao' => 'CRM_Core_BAO_Tag', | |
e501603b TO |
199 | ) , |
200 | 'is_reserved' => array( | |
201 | 'name' => 'is_reserved', | |
202 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
203 | 'title' => ts('Reserved') , | |
522a26c9 | 204 | 'table_name' => 'civicrm_tag', |
205 | 'entity' => 'Tag', | |
206 | 'bao' => 'CRM_Core_BAO_Tag', | |
e501603b TO |
207 | ) , |
208 | 'is_tagset' => array( | |
209 | 'name' => 'is_tagset', | |
210 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
211 | 'title' => ts('Tagset') , | |
522a26c9 | 212 | 'table_name' => 'civicrm_tag', |
213 | 'entity' => 'Tag', | |
214 | 'bao' => 'CRM_Core_BAO_Tag', | |
e501603b TO |
215 | ) , |
216 | 'used_for' => array( | |
217 | 'name' => 'used_for', | |
218 | 'type' => CRM_Utils_Type::T_STRING, | |
219 | 'title' => ts('Used For') , | |
220 | 'maxlength' => 64, | |
221 | 'size' => CRM_Utils_Type::BIG, | |
222 | 'default' => 'NULL', | |
522a26c9 | 223 | 'table_name' => 'civicrm_tag', |
224 | 'entity' => 'Tag', | |
225 | 'bao' => 'CRM_Core_BAO_Tag', | |
e501603b TO |
226 | 'html' => array( |
227 | 'type' => 'Select', | |
228 | ) , | |
229 | 'pseudoconstant' => array( | |
230 | 'optionGroupName' => 'tag_used_for', | |
231 | 'optionEditPath' => 'civicrm/admin/options/tag_used_for', | |
232 | ) | |
233 | ) , | |
234 | 'created_id' => array( | |
235 | 'name' => 'created_id', | |
236 | 'type' => CRM_Utils_Type::T_INT, | |
237 | 'title' => ts('Tag Created By') , | |
238 | 'description' => 'FK to civicrm_contact, who created this tag', | |
522a26c9 | 239 | 'table_name' => 'civicrm_tag', |
240 | 'entity' => 'Tag', | |
241 | 'bao' => 'CRM_Core_BAO_Tag', | |
e501603b TO |
242 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
243 | ) , | |
d73974ac CW |
244 | 'color' => array( |
245 | 'name' => 'color', | |
246 | 'type' => CRM_Utils_Type::T_STRING, | |
247 | 'title' => ts('Color') , | |
248 | 'description' => 'Hex color value e.g. #ffffff', | |
249 | 'maxlength' => 255, | |
250 | 'size' => CRM_Utils_Type::HUGE, | |
251 | 'default' => 'NULL', | |
522a26c9 | 252 | 'table_name' => 'civicrm_tag', |
253 | 'entity' => 'Tag', | |
254 | 'bao' => 'CRM_Core_BAO_Tag', | |
d73974ac | 255 | ) , |
e501603b TO |
256 | 'created_date' => array( |
257 | 'name' => 'created_date', | |
258 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
259 | 'title' => ts('Tag Created Date') , | |
260 | 'description' => 'Date and time that tag was created.', | |
522a26c9 | 261 | 'table_name' => 'civicrm_tag', |
262 | 'entity' => 'Tag', | |
263 | 'bao' => 'CRM_Core_BAO_Tag', | |
e501603b TO |
264 | ) , |
265 | ); | |
346aaaba | 266 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 267 | } |
346aaaba | 268 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
269 | } |
270 | /** | |
bd8e0b14 | 271 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
272 | * |
273 | * @return array | |
bd8e0b14 | 274 | * Array(string $name => string $uniqueName). |
e501603b TO |
275 | */ |
276 | static function &fieldKeys() { | |
bd8e0b14 TO |
277 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
278 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 279 | } |
bd8e0b14 | 280 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
281 | } |
282 | /** | |
283 | * Returns the names of this table | |
284 | * | |
285 | * @return string | |
286 | */ | |
287 | static function getTableName() { | |
288 | return self::$_tableName; | |
289 | } | |
290 | /** | |
291 | * Returns if this table needs to be logged | |
292 | * | |
293 | * @return boolean | |
294 | */ | |
295 | function getLog() { | |
296 | return self::$_log; | |
297 | } | |
298 | /** | |
299 | * Returns the list of fields that can be imported | |
300 | * | |
301 | * @param bool $prefix | |
302 | * | |
303 | * @return array | |
304 | */ | |
305 | static function &import($prefix = false) { | |
60808919 TO |
306 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'tag', $prefix, array()); |
307 | return $r; | |
e501603b TO |
308 | } |
309 | /** | |
310 | * Returns the list of fields that can be exported | |
311 | * | |
312 | * @param bool $prefix | |
313 | * | |
314 | * @return array | |
315 | */ | |
316 | static function &export($prefix = false) { | |
60808919 TO |
317 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'tag', $prefix, array()); |
318 | return $r; | |
e501603b TO |
319 | } |
320 | } |