CRM-14885 - Import DAO's
[civicrm-core.git] / CRM / Contribute / DAO / Widget.php
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/Contribute/Widget.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:7414818b41b32e4c0d5a919be3f5f1e5)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Contribute_DAO_Widget extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_contribution_widget';
44 /**
45 * static instance to hold the field values
46 *
47 * @var array
48 */
49 static $_fields = null;
50 /**
51 * static instance to hold the keys used in $_fields for each field.
52 *
53 * @var array
54 */
55 static $_fieldKeys = null;
56 /**
57 * static instance to hold the FK relationships
58 *
59 * @var string
60 */
61 static $_links = null;
62 /**
63 * static instance to hold the values that can
64 * be imported
65 *
66 * @var array
67 */
68 static $_import = null;
69 /**
70 * static instance to hold the values that can
71 * be exported
72 *
73 * @var array
74 */
75 static $_export = null;
76 /**
77 * static value to see if we should log any modifications to
78 * this table in the civicrm_log table
79 *
80 * @var boolean
81 */
82 static $_log = true;
83 /**
84 * Contribution Id
85 *
86 * @var int unsigned
87 */
88 public $id;
89 /**
90 * The Contribution Page which triggered this contribution
91 *
92 * @var int unsigned
93 */
94 public $contribution_page_id;
95 /**
96 * Is this property active?
97 *
98 * @var boolean
99 */
100 public $is_active;
101 /**
102 * Widget title.
103 *
104 * @var string
105 */
106 public $title;
107 /**
108 * URL to Widget logo
109 *
110 * @var string
111 */
112 public $url_logo;
113 /**
114 * Button title.
115 *
116 * @var string
117 */
118 public $button_title;
119 /**
120 * About description.
121 *
122 * @var text
123 */
124 public $about;
125 /**
126 * URL to Homepage.
127 *
128 * @var string
129 */
130 public $url_homepage;
131 /**
132 *
133 * @var string
134 */
135 public $color_title;
136 /**
137 *
138 * @var string
139 */
140 public $color_button;
141 /**
142 *
143 * @var string
144 */
145 public $color_bar;
146 /**
147 *
148 * @var string
149 */
150 public $color_main_text;
151 /**
152 *
153 * @var string
154 */
155 public $color_main;
156 /**
157 *
158 * @var string
159 */
160 public $color_main_bg;
161 /**
162 *
163 * @var string
164 */
165 public $color_bg;
166 /**
167 *
168 * @var string
169 */
170 public $color_about_link;
171 /**
172 *
173 * @var string
174 */
175 public $color_homepage_link;
176 /**
177 * class constructor
178 *
179 * @return civicrm_contribution_widget
180 */
181 function __construct() {
182 $this->__table = 'civicrm_contribution_widget';
183 parent::__construct();
184 }
185 /**
186 * Returns foreign keys and entity references
187 *
188 * @return array
189 * [CRM_Core_Reference_Interface]
190 */
191 static function getReferenceColumns() {
192 if (!self::$_links) {
193 self::$_links = static ::createReferenceColumns(__CLASS__);
194 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_page_id', 'civicrm_contribution_page', 'id');
195 }
196 return self::$_links;
197 }
198 /**
199 * Returns all the column names of this table
200 *
201 * @return array
202 */
203 static function &fields() {
204 if (!(self::$_fields)) {
205 self::$_fields = array(
206 'id' => array(
207 'name' => 'id',
208 'type' => CRM_Utils_Type::T_INT,
209 'title' => ts('Widget ID') ,
210 'description' => 'Contribution Id',
211 'required' => true,
212 ) ,
213 'contribution_page_id' => array(
214 'name' => 'contribution_page_id',
215 'type' => CRM_Utils_Type::T_INT,
216 'title' => ts('Contribution Page') ,
217 'description' => 'The Contribution Page which triggered this contribution',
218 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage',
219 ) ,
220 'is_active' => array(
221 'name' => 'is_active',
222 'type' => CRM_Utils_Type::T_BOOLEAN,
223 'title' => ts('Enabled?') ,
224 'description' => 'Is this property active?',
225 ) ,
226 'title' => array(
227 'name' => 'title',
228 'type' => CRM_Utils_Type::T_STRING,
229 'title' => ts('Widget Title') ,
230 'description' => 'Widget title.',
231 'maxlength' => 255,
232 'size' => CRM_Utils_Type::HUGE,
233 ) ,
234 'url_logo' => array(
235 'name' => 'url_logo',
236 'type' => CRM_Utils_Type::T_STRING,
237 'title' => ts('Widget Image Url') ,
238 'description' => 'URL to Widget logo',
239 'maxlength' => 255,
240 'size' => CRM_Utils_Type::HUGE,
241 ) ,
242 'button_title' => array(
243 'name' => 'button_title',
244 'type' => CRM_Utils_Type::T_STRING,
245 'title' => ts('Button Title') ,
246 'description' => 'Button title.',
247 'maxlength' => 255,
248 'size' => CRM_Utils_Type::HUGE,
249 ) ,
250 'about' => array(
251 'name' => 'about',
252 'type' => CRM_Utils_Type::T_TEXT,
253 'title' => ts('Description') ,
254 'description' => 'About description.',
255 ) ,
256 'url_homepage' => array(
257 'name' => 'url_homepage',
258 'type' => CRM_Utils_Type::T_STRING,
259 'title' => ts('Homepage Url') ,
260 'description' => 'URL to Homepage.',
261 'maxlength' => 255,
262 'size' => CRM_Utils_Type::HUGE,
263 ) ,
264 'color_title' => array(
265 'name' => 'color_title',
266 'type' => CRM_Utils_Type::T_STRING,
267 'title' => ts('Title Color') ,
268 'maxlength' => 10,
269 'size' => CRM_Utils_Type::TWELVE,
270 ) ,
271 'color_button' => array(
272 'name' => 'color_button',
273 'type' => CRM_Utils_Type::T_STRING,
274 'title' => ts('Button Colour') ,
275 'maxlength' => 10,
276 'size' => CRM_Utils_Type::TWELVE,
277 ) ,
278 'color_bar' => array(
279 'name' => 'color_bar',
280 'type' => CRM_Utils_Type::T_STRING,
281 'title' => ts('Bar Color') ,
282 'maxlength' => 10,
283 'size' => CRM_Utils_Type::TWELVE,
284 ) ,
285 'color_main_text' => array(
286 'name' => 'color_main_text',
287 'type' => CRM_Utils_Type::T_STRING,
288 'title' => ts('Main Text Color') ,
289 'maxlength' => 10,
290 'size' => CRM_Utils_Type::TWELVE,
291 ) ,
292 'color_main' => array(
293 'name' => 'color_main',
294 'type' => CRM_Utils_Type::T_STRING,
295 'title' => ts('Main Colour') ,
296 'maxlength' => 10,
297 'size' => CRM_Utils_Type::TWELVE,
298 ) ,
299 'color_main_bg' => array(
300 'name' => 'color_main_bg',
301 'type' => CRM_Utils_Type::T_STRING,
302 'title' => ts('Backgroup Color') ,
303 'maxlength' => 10,
304 'size' => CRM_Utils_Type::TWELVE,
305 ) ,
306 'color_bg' => array(
307 'name' => 'color_bg',
308 'type' => CRM_Utils_Type::T_STRING,
309 'title' => ts('Other Backgroun Colour') ,
310 'maxlength' => 10,
311 'size' => CRM_Utils_Type::TWELVE,
312 ) ,
313 'color_about_link' => array(
314 'name' => 'color_about_link',
315 'type' => CRM_Utils_Type::T_STRING,
316 'title' => ts('About Link Colour') ,
317 'maxlength' => 10,
318 'size' => CRM_Utils_Type::TWELVE,
319 ) ,
320 'color_homepage_link' => array(
321 'name' => 'color_homepage_link',
322 'type' => CRM_Utils_Type::T_STRING,
323 'title' => ts('Homepage Link Colour') ,
324 'maxlength' => 10,
325 'size' => CRM_Utils_Type::TWELVE,
326 ) ,
327 );
328 }
329 return self::$_fields;
330 }
331 /**
332 * Returns an array containing, for each field, the arary key used for that
333 * field in self::$_fields.
334 *
335 * @return array
336 */
337 static function &fieldKeys() {
338 if (!(self::$_fieldKeys)) {
339 self::$_fieldKeys = array(
340 'id' => 'id',
341 'contribution_page_id' => 'contribution_page_id',
342 'is_active' => 'is_active',
343 'title' => 'title',
344 'url_logo' => 'url_logo',
345 'button_title' => 'button_title',
346 'about' => 'about',
347 'url_homepage' => 'url_homepage',
348 'color_title' => 'color_title',
349 'color_button' => 'color_button',
350 'color_bar' => 'color_bar',
351 'color_main_text' => 'color_main_text',
352 'color_main' => 'color_main',
353 'color_main_bg' => 'color_main_bg',
354 'color_bg' => 'color_bg',
355 'color_about_link' => 'color_about_link',
356 'color_homepage_link' => 'color_homepage_link',
357 );
358 }
359 return self::$_fieldKeys;
360 }
361 /**
362 * Returns the names of this table
363 *
364 * @return string
365 */
366 static function getTableName() {
367 return self::$_tableName;
368 }
369 /**
370 * Returns if this table needs to be logged
371 *
372 * @return boolean
373 */
374 function getLog() {
375 return self::$_log;
376 }
377 /**
378 * Returns the list of fields that can be imported
379 *
380 * @param bool $prefix
381 *
382 * @return array
383 */
384 static function &import($prefix = false) {
385 if (!(self::$_import)) {
386 self::$_import = array();
387 $fields = self::fields();
388 foreach($fields as $name => $field) {
389 if (CRM_Utils_Array::value('import', $field)) {
390 if ($prefix) {
391 self::$_import['contribution_widget'] = & $fields[$name];
392 } else {
393 self::$_import[$name] = & $fields[$name];
394 }
395 }
396 }
397 }
398 return self::$_import;
399 }
400 /**
401 * Returns the list of fields that can be exported
402 *
403 * @param bool $prefix
404 *
405 * @return array
406 */
407 static function &export($prefix = false) {
408 if (!(self::$_export)) {
409 self::$_export = array();
410 $fields = self::fields();
411 foreach($fields as $name => $field) {
412 if (CRM_Utils_Array::value('export', $field)) {
413 if ($prefix) {
414 self::$_export['contribution_widget'] = & $fields[$name];
415 } else {
416 self::$_export[$name] = & $fields[$name];
417 }
418 }
419 }
420 }
421 return self::$_export;
422 }
423 }