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'; | |
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; | |
102 | /** | |
103 | * Date and time that tag was created. | |
104 | * | |
105 | * @var datetime | |
106 | */ | |
107 | public $created_date; | |
108 | /** | |
109 | * class constructor | |
110 | * | |
111 | * @return civicrm_tag | |
112 | */ | |
113 | function __construct() { | |
114 | $this->__table = 'civicrm_tag'; | |
115 | parent::__construct(); | |
116 | } | |
117 | /** | |
118 | * Returns foreign keys and entity references | |
119 | * | |
120 | * @return array | |
121 | * [CRM_Core_Reference_Interface] | |
122 | */ | |
123 | static function getReferenceColumns() { | |
346aaaba TO |
124 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
125 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
126 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_id', 'civicrm_tag', 'id'); | |
127 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); | |
128 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); | |
e501603b | 129 | } |
346aaaba | 130 | return Civi::$statics[__CLASS__]['links']; |
e501603b TO |
131 | } |
132 | /** | |
133 | * Returns all the column names of this table | |
134 | * | |
135 | * @return array | |
136 | */ | |
137 | static function &fields() { | |
346aaaba TO |
138 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
139 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
140 | 'id' => array( |
141 | 'name' => 'id', | |
142 | 'type' => CRM_Utils_Type::T_INT, | |
143 | 'title' => ts('Tag ID') , | |
144 | 'description' => 'Tag ID', | |
145 | 'required' => true, | |
146 | ) , | |
147 | 'name' => array( | |
148 | 'name' => 'name', | |
149 | 'type' => CRM_Utils_Type::T_STRING, | |
150 | 'title' => ts('Tag Name') , | |
151 | 'description' => 'Name of Tag.', | |
152 | 'required' => true, | |
153 | 'maxlength' => 64, | |
154 | 'size' => CRM_Utils_Type::BIG, | |
155 | ) , | |
156 | 'description' => array( | |
157 | 'name' => 'description', | |
158 | 'type' => CRM_Utils_Type::T_STRING, | |
159 | 'title' => ts('Description') , | |
160 | 'description' => 'Optional verbose description of the tag.', | |
161 | 'maxlength' => 255, | |
162 | 'size' => CRM_Utils_Type::HUGE, | |
163 | ) , | |
164 | 'parent_id' => array( | |
165 | 'name' => 'parent_id', | |
166 | 'type' => CRM_Utils_Type::T_INT, | |
167 | 'title' => ts('Parent Tag') , | |
168 | 'description' => 'Optional parent id for this tag.', | |
169 | 'default' => 'NULL', | |
170 | 'FKClassName' => 'CRM_Core_DAO_Tag', | |
171 | ) , | |
172 | 'is_selectable' => array( | |
173 | 'name' => 'is_selectable', | |
174 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
175 | 'title' => ts('Display Tag?') , | |
176 | 'description' => 'Is this tag selectable / displayed', | |
177 | 'default' => '1', | |
178 | ) , | |
179 | 'is_reserved' => array( | |
180 | 'name' => 'is_reserved', | |
181 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
182 | 'title' => ts('Reserved') , | |
183 | ) , | |
184 | 'is_tagset' => array( | |
185 | 'name' => 'is_tagset', | |
186 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
187 | 'title' => ts('Tagset') , | |
188 | ) , | |
189 | 'used_for' => array( | |
190 | 'name' => 'used_for', | |
191 | 'type' => CRM_Utils_Type::T_STRING, | |
192 | 'title' => ts('Used For') , | |
193 | 'maxlength' => 64, | |
194 | 'size' => CRM_Utils_Type::BIG, | |
195 | 'default' => 'NULL', | |
196 | 'html' => array( | |
197 | 'type' => 'Select', | |
198 | ) , | |
199 | 'pseudoconstant' => array( | |
200 | 'optionGroupName' => 'tag_used_for', | |
201 | 'optionEditPath' => 'civicrm/admin/options/tag_used_for', | |
202 | ) | |
203 | ) , | |
204 | 'created_id' => array( | |
205 | 'name' => 'created_id', | |
206 | 'type' => CRM_Utils_Type::T_INT, | |
207 | 'title' => ts('Tag Created By') , | |
208 | 'description' => 'FK to civicrm_contact, who created this tag', | |
209 | 'FKClassName' => 'CRM_Contact_DAO_Contact', | |
210 | ) , | |
211 | 'created_date' => array( | |
212 | 'name' => 'created_date', | |
213 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
214 | 'title' => ts('Tag Created Date') , | |
215 | 'description' => 'Date and time that tag was created.', | |
216 | ) , | |
217 | ); | |
346aaaba | 218 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 219 | } |
346aaaba | 220 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
221 | } |
222 | /** | |
bd8e0b14 | 223 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
224 | * |
225 | * @return array | |
bd8e0b14 | 226 | * Array(string $name => string $uniqueName). |
e501603b TO |
227 | */ |
228 | static function &fieldKeys() { | |
bd8e0b14 TO |
229 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
230 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 231 | } |
bd8e0b14 | 232 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
233 | } |
234 | /** | |
235 | * Returns the names of this table | |
236 | * | |
237 | * @return string | |
238 | */ | |
239 | static function getTableName() { | |
240 | return self::$_tableName; | |
241 | } | |
242 | /** | |
243 | * Returns if this table needs to be logged | |
244 | * | |
245 | * @return boolean | |
246 | */ | |
247 | function getLog() { | |
248 | return self::$_log; | |
249 | } | |
250 | /** | |
251 | * Returns the list of fields that can be imported | |
252 | * | |
253 | * @param bool $prefix | |
254 | * | |
255 | * @return array | |
256 | */ | |
257 | static function &import($prefix = false) { | |
60808919 TO |
258 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'tag', $prefix, array()); |
259 | return $r; | |
e501603b TO |
260 | } |
261 | /** | |
262 | * Returns the list of fields that can be exported | |
263 | * | |
264 | * @param bool $prefix | |
265 | * | |
266 | * @return array | |
267 | */ | |
268 | static function &export($prefix = false) { | |
60808919 TO |
269 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'tag', $prefix, array()); |
270 | return $r; | |
e501603b TO |
271 | } |
272 | } |