commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-old / civicrm / CRM / Core / DAO / Tag.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
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-2015
30 *
31 * Generated from xml/schema/CRM/Core/Tag.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 */
34 require_once 'CRM/Core/DAO.php';
35 require_once 'CRM/Utils/Type.php';
36 class CRM_Core_DAO_Tag extends CRM_Core_DAO {
37 /**
38 * static instance to hold the table name
39 *
40 * @var string
41 */
42 static $_tableName = 'civicrm_tag';
43 /**
44 * static instance to hold the field values
45 *
46 * @var array
47 */
48 static $_fields = null;
49 /**
50 * static instance to hold the keys used in $_fields for each field.
51 *
52 * @var array
53 */
54 static $_fieldKeys = null;
55 /**
56 * static instance to hold the FK relationships
57 *
58 * @var string
59 */
60 static $_links = null;
61 /**
62 * static instance to hold the values that can
63 * be imported
64 *
65 * @var array
66 */
67 static $_import = null;
68 /**
69 * static instance to hold the values that can
70 * be exported
71 *
72 * @var array
73 */
74 static $_export = null;
75 /**
76 * static value to see if we should log any modifications to
77 * this table in the civicrm_log table
78 *
79 * @var boolean
80 */
81 static $_log = true;
82 /**
83 * Tag ID
84 *
85 * @var int unsigned
86 */
87 public $id;
88 /**
89 * Name of Tag.
90 *
91 * @var string
92 */
93 public $name;
94 /**
95 * Optional verbose description of the tag.
96 *
97 * @var string
98 */
99 public $description;
100 /**
101 * Optional parent id for this tag.
102 *
103 * @var int unsigned
104 */
105 public $parent_id;
106 /**
107 * Is this tag selectable / displayed
108 *
109 * @var boolean
110 */
111 public $is_selectable;
112 /**
113 *
114 * @var boolean
115 */
116 public $is_reserved;
117 /**
118 *
119 * @var boolean
120 */
121 public $is_tagset;
122 /**
123 *
124 * @var string
125 */
126 public $used_for;
127 /**
128 * FK to civicrm_contact, who created this tag
129 *
130 * @var int unsigned
131 */
132 public $created_id;
133 /**
134 * Date and time that tag was created.
135 *
136 * @var datetime
137 */
138 public $created_date;
139 /**
140 * class constructor
141 *
142 * @return civicrm_tag
143 */
144 function __construct() {
145 $this->__table = 'civicrm_tag';
146 parent::__construct();
147 }
148 /**
149 * Returns foreign keys and entity references
150 *
151 * @return array
152 * [CRM_Core_Reference_Interface]
153 */
154 static function getReferenceColumns() {
155 if (!self::$_links) {
156 self::$_links = static ::createReferenceColumns(__CLASS__);
157 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_id', 'civicrm_tag', 'id');
158 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id');
159 }
160 return self::$_links;
161 }
162 /**
163 * Returns all the column names of this table
164 *
165 * @return array
166 */
167 static function &fields() {
168 if (!(self::$_fields)) {
169 self::$_fields = array(
170 'id' => array(
171 'name' => 'id',
172 'type' => CRM_Utils_Type::T_INT,
173 'title' => ts('Tag ID') ,
174 'description' => 'Tag ID',
175 'required' => true,
176 ) ,
177 'name' => array(
178 'name' => 'name',
179 'type' => CRM_Utils_Type::T_STRING,
180 'title' => ts('Tag Name') ,
181 'description' => 'Name of Tag.',
182 'required' => true,
183 'maxlength' => 64,
184 'size' => CRM_Utils_Type::BIG,
185 ) ,
186 'description' => array(
187 'name' => 'description',
188 'type' => CRM_Utils_Type::T_STRING,
189 'title' => ts('Description') ,
190 'description' => 'Optional verbose description of the tag.',
191 'maxlength' => 255,
192 'size' => CRM_Utils_Type::HUGE,
193 ) ,
194 'parent_id' => array(
195 'name' => 'parent_id',
196 'type' => CRM_Utils_Type::T_INT,
197 'title' => ts('Parent Tag') ,
198 'description' => 'Optional parent id for this tag.',
199 'default' => 'NULL',
200 'FKClassName' => 'CRM_Core_DAO_Tag',
201 ) ,
202 'is_selectable' => array(
203 'name' => 'is_selectable',
204 'type' => CRM_Utils_Type::T_BOOLEAN,
205 'title' => ts('Display Tag?') ,
206 'description' => 'Is this tag selectable / displayed',
207 'default' => '1',
208 ) ,
209 'is_reserved' => array(
210 'name' => 'is_reserved',
211 'type' => CRM_Utils_Type::T_BOOLEAN,
212 'title' => ts('Reserved') ,
213 ) ,
214 'is_tagset' => array(
215 'name' => 'is_tagset',
216 'type' => CRM_Utils_Type::T_BOOLEAN,
217 'title' => ts('Tagset') ,
218 ) ,
219 'used_for' => array(
220 'name' => 'used_for',
221 'type' => CRM_Utils_Type::T_STRING,
222 'title' => ts('Used For') ,
223 'maxlength' => 64,
224 'size' => CRM_Utils_Type::BIG,
225 'default' => 'NULL',
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',
239 'FKClassName' => 'CRM_Contact_DAO_Contact',
240 ) ,
241 'created_date' => array(
242 'name' => 'created_date',
243 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
244 'title' => ts('Tag Created Date') ,
245 'description' => 'Date and time that tag was created.',
246 ) ,
247 );
248 }
249 return self::$_fields;
250 }
251 /**
252 * Returns an array containing, for each field, the arary key used for that
253 * field in self::$_fields.
254 *
255 * @return array
256 */
257 static function &fieldKeys() {
258 if (!(self::$_fieldKeys)) {
259 self::$_fieldKeys = array(
260 'id' => 'id',
261 'name' => 'name',
262 'description' => 'description',
263 'parent_id' => 'parent_id',
264 'is_selectable' => 'is_selectable',
265 'is_reserved' => 'is_reserved',
266 'is_tagset' => 'is_tagset',
267 'used_for' => 'used_for',
268 'created_id' => 'created_id',
269 'created_date' => 'created_date',
270 );
271 }
272 return self::$_fieldKeys;
273 }
274 /**
275 * Returns the names of this table
276 *
277 * @return string
278 */
279 static function getTableName() {
280 return self::$_tableName;
281 }
282 /**
283 * Returns if this table needs to be logged
284 *
285 * @return boolean
286 */
287 function getLog() {
288 return self::$_log;
289 }
290 /**
291 * Returns the list of fields that can be imported
292 *
293 * @param bool $prefix
294 *
295 * @return array
296 */
297 static function &import($prefix = false) {
298 if (!(self::$_import)) {
299 self::$_import = array();
300 $fields = self::fields();
301 foreach($fields as $name => $field) {
302 if (CRM_Utils_Array::value('import', $field)) {
303 if ($prefix) {
304 self::$_import['tag'] = & $fields[$name];
305 } else {
306 self::$_import[$name] = & $fields[$name];
307 }
308 }
309 }
310 }
311 return self::$_import;
312 }
313 /**
314 * Returns the list of fields that can be exported
315 *
316 * @param bool $prefix
317 *
318 * @return array
319 */
320 static function &export($prefix = false) {
321 if (!(self::$_export)) {
322 self::$_export = array();
323 $fields = self::fields();
324 foreach($fields as $name => $field) {
325 if (CRM_Utils_Array::value('export', $field)) {
326 if ($prefix) {
327 self::$_export['tag'] = & $fields[$name];
328 } else {
329 self::$_export[$name] = & $fields[$name];
330 }
331 }
332 }
333 }
334 return self::$_export;
335 }
336 }