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