3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.4 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
30 * @copyright CiviCRM LLC (c) 2004-2013
32 class CRM_Wci_DAO_Widget
extends CRM_Core_DAO
35 * static instance to hold the table name
40 static $_tableName = 'civicrm_wci_widget';
42 * static instance to hold the field values
47 static $_fields = null;
49 * static instance to hold the keys used in $_fields for each field.
54 static $_fieldKeys = null;
56 * static instance to hold the FK relationships
61 static $_links = null;
63 * static instance to hold the values that can
69 static $_import = null;
71 * static instance to hold the values that can
77 static $_export = null;
79 * static value to see if we should log any modifications to
80 * this table in the civicrm_log table
111 * Widget contribute/donate button title
115 public $button_title;
117 * Contribution/donate page reference id
121 public $button_link_to;
123 * WCI Progress bar reference id
127 public $progress_bar_id;
135 * Newsletter signup group reference id
139 public $email_signup_group_id;
141 * Widget size (Thin/Normal/Wide)
145 public $size_variant;
153 * Widget title background color
157 public $color_title_bg;
159 * Widget progress bar color
163 public $color_progress_bar;
165 * Widget progress bar background color
169 public $color_progress_bar_bg;
172 * Widget background color
176 public $color_widget_bg;
178 * Widget description color
182 public $color_description;
184 * Widget border color
188 public $color_border;
190 * Widget button color
194 public $color_button;
196 * Widget button background color
200 public $color_button_bg;
202 * Additional custom style rules
208 * Flag to override default widget template
220 * Flag to Hide widget border
226 * Flag to Hide pb caption
236 public $custom_template;
239 * Newsletter Button text color
243 public $color_btn_newsletter;
246 * Newsletter Button color
250 public $color_btn_newsletter_bg;
257 public $newsletter_text;
260 * Newsletter msg text color
264 public $color_newsletter_text;
266 function __construct()
268 $this->__table
= 'civicrm_wci_widget';
269 parent
::__construct();
272 * return foreign keys and entity references
276 * @return array of CRM_Core_EntityReference
278 static function getReferenceColumns()
280 if (!self
::$_links) {
281 self
::$_links = array(
282 new CRM_Core_EntityReference(self
::getTableName() , 'button_link_to', 'civicrm_contribution_page', 'id') ,
283 new CRM_Core_EntityReference(self
::getTableName() , 'progress_bar_id', 'civicrm_wci_progress_bar', 'id') ,
284 new CRM_Core_EntityReference(self
::getTableName() , 'email_signup_group_id', 'civicrm_group', 'id') ,
287 return self
::$_links;
290 * returns all the column names of this table
295 static function &fields()
297 if (!(self
::$_fields)) {
298 self
::$_fields = array(
299 'widget_id' => array(
301 'type' => CRM_Utils_Type
::T_INT
,
302 'title' => ts('WCI Widget Id', array('domain' => 'org.civicrm.wci')) ,
307 'type' => CRM_Utils_Type
::T_STRING
,
308 'title' => ts('Widget title', array('domain' => 'org.civicrm.wci')) ,
312 'logo_image' => array(
313 'name' => 'logo_image',
314 'type' => CRM_Utils_Type
::T_STRING
,
315 'title' => ts('Image url of widget logo image', array('domain' => 'org.civicrm.wci')) ,
321 'type' => CRM_Utils_Type
::T_STRING
,
322 'title' => ts('Url of widget image', array('domain' => 'org.civicrm.wci')) ,
326 'button_title' => array(
327 'name' => 'button_title',
328 'type' => CRM_Utils_Type
::T_STRING
,
329 'title' => ts('Contribute/Donate button title', array('domain' => 'org.civicrm.wci')) ,
333 'button_link_to' => array(
334 'name' => 'button_link_to',
335 'type' => CRM_Utils_Type
::T_INT
,
336 'title' => ts('Contribution/Donation page reference', array('domain' => 'org.civicrm.wci')) ,
339 'progress_bar_id' => array(
341 'type' => CRM_Utils_Type
::T_INT
,
342 'title' => ts('WCI Progress Bar Reference Id', array('domain' => 'org.civicrm.wci')) ,
345 'description' => array(
346 'name' => 'description',
347 'type' => CRM_Utils_Type
::T_TEXT
,
348 'title' => ts('Widget description', array('domain' => 'org.civicrm.wci')) ,
351 'email_signup_group_id' => array(
352 'name' => 'email_signup_group_id',
353 'type' => CRM_Utils_Type
::T_INT
,
354 'title' => ts('Group reference for email newsletter signup', array('domain' => 'org.civicrm.wci')) ,
357 'size_variant' => array(
359 'type' => CRM_Utils_Type
::T_STRING
,
360 'title' => ts('Widget size variant', array('domain' => 'org.civicrm.wci')) ,
364 'color_title' => array(
365 'name' => 'color_title',
366 'type' => CRM_Utils_Type
::T_STRING
,
367 'title' => ts('Widget title color', array('domain' => 'org.civicrm.wci')) ,
371 'color_title_bg' => array(
372 'name' => 'color_title_bg',
373 'type' => CRM_Utils_Type
::T_STRING
,
374 'title' => ts('Widget title background color', array('domain' => 'org.civicrm.wci')) ,
378 'color_progress_bar' => array(
379 'name' => 'color_progress_bar',
380 'type' => CRM_Utils_Type
::T_STRING
,
381 'title' => ts('Progress bar color', array('domain' => 'org.civicrm.wci')) ,
385 'color_progress_bar_bg' => array(
386 'name' => 'color_progress_bar_bg',
387 'type' => CRM_Utils_Type
::T_STRING
,
388 'title' => ts('Progress bar background color', array('domain' => 'org.civicrm.wci')) ,
392 'color_widget_bg' => array(
393 'name' => 'color_widget_bg',
394 'type' => CRM_Utils_Type
::T_STRING
,
395 'title' => ts('Widget background color', array('domain' => 'org.civicrm.wci')) ,
399 'color_description' => array(
400 'name' => 'color_description',
401 'type' => CRM_Utils_Type
::T_STRING
,
402 'title' => ts('Widget description color', array('domain' => 'org.civicrm.wci')) ,
406 'color_border' => array(
407 'name' => 'color_border',
408 'type' => CRM_Utils_Type
::T_STRING
,
409 'title' => ts('Widget border color', array('domain' => 'org.civicrm.wci')) ,
413 'color_button' => array(
414 'name' => 'color_button',
415 'type' => CRM_Utils_Type
::T_STRING
,
416 'title' => ts('Widget button text color', array('domain' => 'org.civicrm.wci')) ,
420 'color_button_bg' => array(
421 'name' => 'color_button_bg',
422 'type' => CRM_Utils_Type
::T_STRING
,
423 'title' => ts('Widget button background color', array('domain' => 'org.civicrm.wci')) ,
427 'style_rules' => array(
428 'name' => 'style_rules',
429 'type' => CRM_Utils_Type
::T_TEXT
,
430 'title' => ts('Additional style rules', array('domain' => 'org.civicrm.wci')) ,
434 'name' => 'override',
435 'type' => CRM_Utils_Type
::T_BOOLEAN
,
436 'title' => ts('Override default template', array('domain' => 'org.civicrm.wci')) ,
439 'hide_title' => array(
440 'name' => 'hide_title',
441 'type' => CRM_Utils_Type
::T_BOOLEAN
,
442 'title' => ts('Hide title, if 1.', array('domain' => 'org.civicrm.wci')) ,
445 'hide_border' => array(
446 'name' => 'hide_border',
447 'type' => CRM_Utils_Type
::T_BOOLEAN
,
448 'title' => ts('Hide widget border, if 1.', array('domain' => 'org.civicrm.wci')) ,
451 'hide_pbcap' => array(
452 'name' => 'hide_pbcap',
453 'type' => CRM_Utils_Type
::T_BOOLEAN
,
454 'title' => ts('Hide pb caption, if 1.', array('domain' => 'org.civicrm.wci')) ,
457 'custom_template' => array(
458 'name' => 'custom_template',
459 'type' => CRM_Utils_Type
::T_TEXT
,
460 'title' => ts('Widget custom template', array('domain' => 'org.civicrm.wci')) ,
464 'color_btn_newsletter' => array(
465 'name' => 'color_btn_newsletter',
466 'type' => CRM_Utils_Type
::T_STRING
,
467 'title' => ts('Newsletter Button text color', array('domain' => 'org.civicrm.wci')) ,
471 'color_btn_newsletter_bg' => array(
472 'name' => 'color_btn_newsletter_bg',
473 'type' => CRM_Utils_Type
::T_STRING
,
474 'title' => ts('Newsletter Button color', array('domain' => 'org.civicrm.wci')) ,
478 'newsletter_text' => array(
479 'name' => 'newsletter_text',
480 'type' => CRM_Utils_Type
::T_STRING
,
481 'title' => ts('Newsletter text', array('domain' => 'org.civicrm.wci')) ,
485 'color_newsletter_text' => array(
486 'name' => 'color_newsletter_text',
487 'type' => CRM_Utils_Type
::T_STRING
,
488 'title' => ts('Newsletter text color', array('domain' => 'org.civicrm.wci')) ,
494 return self
::$_fields;
497 * Returns an array containing, for each field, the arary key used for that
498 * field in self::$_fields.
503 static function &fieldKeys()
505 if (!(self
::$_fieldKeys)) {
506 self
::$_fieldKeys = array(
509 'logo_image' => 'logo_image',
511 'button_title' => 'button_title',
512 'button_link_to' => 'button_link_to',
513 'progress_bar_id' => 'progress_bar_id',
514 'description' => 'description',
515 'email_signup_group_id' => 'email_signup_group_id',
516 'size_variant' => 'size_variant',
517 'color_title' => 'color_title',
518 'color_title_bg' => 'color_title_bg',
519 'color_progress_bar' => 'color_progress_bar',
520 'color_progress_bar_bg' => 'color_progress_bar_bg',
521 'color_widget_bg' => 'color_widget_bg',
522 'color_description' => 'color_description',
523 'color_border' => 'color_border',
524 'color_button' => 'color_button',
525 'color_button_bg' => 'color_button_bg',
526 'style_rules' => 'style_rules',
527 'override' => 'override',
528 'hide_title' => 'hide_title',
529 'hide_border' => 'hide_border',
530 'hide_pbcap' => 'hide_pbcap',
531 'custom_template' => 'custom_template',
534 return self
::$_fieldKeys;
537 * returns the names of this table
543 static function getTableName()
545 return self
::$_tableName;
548 * returns if this table needs to be logged
558 * returns the list of fields that can be imported
564 static function &import($prefix = false)
566 if (!(self
::$_import)) {
567 self
::$_import = array();
568 $fields = self
::fields();
569 foreach($fields as $name => $field) {
570 if (CRM_Utils_Array
::value('import', $field)) {
572 self
::$_import['wci_widget'] = & $fields[$name];
574 self
::$_import[$name] = & $fields[$name];
579 return self
::$_import;
582 * returns the list of fields that can be exported
588 static function &export($prefix = false)
590 if (!(self
::$_export)) {
591 self
::$_export = array();
592 $fields = self
::fields();
593 foreach($fields as $name => $field) {
594 if (CRM_Utils_Array
::value('export', $field)) {
596 self
::$_export['wci_widget'] = & $fields[$name];
598 self
::$_export[$name] = & $fields[$name];
603 return self
::$_export;