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