DAOs with singular/plural options for entity titles
[civicrm-core.git] / CRM / Contribute / DAO / Widget.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Contribute/Widget.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
7b66c3b5 9 * (GenCodeChecksum:bb99920b9b2c2a8b7419ecd94dcbf577)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the Widget entity.
f41f0342 14 */
e501603b 15class CRM_Contribute_DAO_Widget extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '2.0';
c3fc2621 18
e501603b 19 /**
f41f0342 20 * Static instance to hold the table name.
e501603b
TO
21 *
22 * @var string
23 */
fa45b5b9 24 public static $_tableName = 'civicrm_contribution_widget';
c3fc2621 25
e501603b 26 /**
f41f0342 27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 28 *
c3fc2621 29 * @var bool
e501603b 30 */
fa45b5b9 31 public static $_log = TRUE;
c3fc2621 32
e501603b
TO
33 /**
34 * Contribution Id
35 *
e6ca0a57 36 * @var int
e501603b
TO
37 */
38 public $id;
c3fc2621 39
e501603b
TO
40 /**
41 * The Contribution Page which triggered this contribution
42 *
e6ca0a57 43 * @var int
e501603b
TO
44 */
45 public $contribution_page_id;
c3fc2621 46
e501603b
TO
47 /**
48 * Is this property active?
49 *
e6ca0a57 50 * @var bool
e501603b
TO
51 */
52 public $is_active;
c3fc2621 53
e501603b
TO
54 /**
55 * Widget title.
56 *
57 * @var string
58 */
59 public $title;
c3fc2621 60
e501603b
TO
61 /**
62 * URL to Widget logo
63 *
64 * @var string
65 */
66 public $url_logo;
c3fc2621 67
e501603b
TO
68 /**
69 * Button title.
70 *
71 * @var string
72 */
73 public $button_title;
c3fc2621 74
e501603b
TO
75 /**
76 * About description.
77 *
78 * @var text
79 */
80 public $about;
c3fc2621 81
e501603b
TO
82 /**
83 * URL to Homepage.
84 *
85 * @var string
86 */
87 public $url_homepage;
c3fc2621 88
e501603b 89 /**
e501603b
TO
90 * @var string
91 */
92 public $color_title;
c3fc2621 93
e501603b 94 /**
e501603b
TO
95 * @var string
96 */
97 public $color_button;
c3fc2621 98
e501603b 99 /**
e501603b
TO
100 * @var string
101 */
102 public $color_bar;
c3fc2621 103
e501603b 104 /**
e501603b
TO
105 * @var string
106 */
107 public $color_main_text;
c3fc2621 108
e501603b 109 /**
e501603b
TO
110 * @var string
111 */
112 public $color_main;
c3fc2621 113
e501603b 114 /**
e501603b
TO
115 * @var string
116 */
117 public $color_main_bg;
c3fc2621 118
e501603b 119 /**
e501603b
TO
120 * @var string
121 */
122 public $color_bg;
c3fc2621 123
e501603b 124 /**
e501603b
TO
125 * @var string
126 */
127 public $color_about_link;
c3fc2621 128
e501603b 129 /**
e501603b
TO
130 * @var string
131 */
132 public $color_homepage_link;
c3fc2621 133
e501603b 134 /**
f41f0342 135 * Class constructor.
e501603b 136 */
c3fc2621 137 public function __construct() {
e501603b
TO
138 $this->__table = 'civicrm_contribution_widget';
139 parent::__construct();
140 }
c3fc2621 141
449c4e6b
CW
142 /**
143 * Returns localized title of this entity.
7b66c3b5
AH
144 *
145 * @param bool $plural
146 * Whether to return the plural version of the title.
449c4e6b 147 */
7b66c3b5
AH
148 public static function getEntityTitle($plural = FALSE) {
149 return $plural ? ts('Widgets') : ts('Widget');
449c4e6b
CW
150 }
151
e501603b 152 /**
f41f0342 153 * Returns foreign keys and entity references.
e501603b
TO
154 *
155 * @return array
156 * [CRM_Core_Reference_Interface]
157 */
c3fc2621 158 public static function getReferenceColumns() {
346aaaba 159 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 160 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621 161 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_page_id', 'civicrm_contribution_page', 'id');
346aaaba 162 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 163 }
346aaaba 164 return Civi::$statics[__CLASS__]['links'];
e501603b 165 }
c3fc2621 166
e501603b
TO
167 /**
168 * Returns all the column names of this table
169 *
170 * @return array
171 */
c3fc2621 172 public static function &fields() {
346aaaba 173 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
174 Civi::$statics[__CLASS__]['fields'] = [
175 'id' => [
e501603b
TO
176 'name' => 'id',
177 'type' => CRM_Utils_Type::T_INT,
c3fc2621 178 'title' => ts('Widget ID'),
215b423e 179 'description' => ts('Contribution Id'),
c3fc2621 180 'required' => TRUE,
a36434b9 181 'where' => 'civicrm_contribution_widget.id',
522a26c9 182 'table_name' => 'civicrm_contribution_widget',
183 'entity' => 'Widget',
184 'bao' => 'CRM_Contribute_BAO_Widget',
6a7e5e5d 185 'localizable' => 0,
a9d0587b 186 'add' => '2.0',
c3fc2621
CW
187 ],
188 'contribution_page_id' => [
e501603b
TO
189 'name' => 'contribution_page_id',
190 'type' => CRM_Utils_Type::T_INT,
c3fc2621 191 'title' => ts('Contribution Page'),
215b423e 192 'description' => ts('The Contribution Page which triggered this contribution'),
a36434b9 193 'where' => 'civicrm_contribution_widget.contribution_page_id',
522a26c9 194 'table_name' => 'civicrm_contribution_widget',
195 'entity' => 'Widget',
196 'bao' => 'CRM_Contribute_BAO_Widget',
6a7e5e5d 197 'localizable' => 0,
e501603b 198 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage',
a9d0587b 199 'add' => '1.5',
c3fc2621
CW
200 ],
201 'is_active' => [
e501603b
TO
202 'name' => 'is_active',
203 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 204 'title' => ts('Enabled?'),
215b423e 205 'description' => ts('Is this property active?'),
a36434b9 206 'where' => 'civicrm_contribution_widget.is_active',
522a26c9 207 'table_name' => 'civicrm_contribution_widget',
208 'entity' => 'Widget',
209 'bao' => 'CRM_Contribute_BAO_Widget',
6a7e5e5d 210 'localizable' => 0,
a9d0587b 211 'add' => '2.0',
c3fc2621
CW
212 ],
213 'title' => [
e501603b
TO
214 'name' => 'title',
215 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 216 'title' => ts('Widget Title'),
215b423e 217 'description' => ts('Widget title.'),
e501603b
TO
218 'maxlength' => 255,
219 'size' => CRM_Utils_Type::HUGE,
a36434b9 220 'where' => 'civicrm_contribution_widget.title',
522a26c9 221 'table_name' => 'civicrm_contribution_widget',
222 'entity' => 'Widget',
223 'bao' => 'CRM_Contribute_BAO_Widget',
6a7e5e5d 224 'localizable' => 0,
a9d0587b 225 'add' => '2.0',
c3fc2621
CW
226 ],
227 'url_logo' => [
e501603b
TO
228 'name' => 'url_logo',
229 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 230 'title' => ts('Widget Image Url'),
215b423e 231 'description' => ts('URL to Widget logo'),
e501603b
TO
232 'maxlength' => 255,
233 'size' => CRM_Utils_Type::HUGE,
a36434b9 234 'where' => 'civicrm_contribution_widget.url_logo',
522a26c9 235 'table_name' => 'civicrm_contribution_widget',
236 'entity' => 'Widget',
237 'bao' => 'CRM_Contribute_BAO_Widget',
6a7e5e5d 238 'localizable' => 0,
a9d0587b 239 'add' => '2.0',
c3fc2621
CW
240 ],
241 'button_title' => [
e501603b
TO
242 'name' => 'button_title',
243 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 244 'title' => ts('Button Title'),
215b423e 245 'description' => ts('Button title.'),
e501603b
TO
246 'maxlength' => 255,
247 'size' => CRM_Utils_Type::HUGE,
a36434b9 248 'where' => 'civicrm_contribution_widget.button_title',
522a26c9 249 'table_name' => 'civicrm_contribution_widget',
250 'entity' => 'Widget',
251 'bao' => 'CRM_Contribute_BAO_Widget',
6a7e5e5d 252 'localizable' => 0,
a9d0587b 253 'add' => '2.0',
c3fc2621
CW
254 ],
255 'about' => [
e501603b
TO
256 'name' => 'about',
257 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 258 'title' => ts('Description'),
215b423e 259 'description' => ts('About description.'),
a36434b9 260 'where' => 'civicrm_contribution_widget.about',
522a26c9 261 'table_name' => 'civicrm_contribution_widget',
262 'entity' => 'Widget',
263 'bao' => 'CRM_Contribute_BAO_Widget',
6a7e5e5d 264 'localizable' => 0,
a9d0587b 265 'add' => '2.0',
c3fc2621
CW
266 ],
267 'url_homepage' => [
e501603b
TO
268 'name' => 'url_homepage',
269 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 270 'title' => ts('Homepage Url'),
215b423e 271 'description' => ts('URL to Homepage.'),
e501603b
TO
272 'maxlength' => 255,
273 'size' => CRM_Utils_Type::HUGE,
a36434b9 274 'where' => 'civicrm_contribution_widget.url_homepage',
522a26c9 275 'table_name' => 'civicrm_contribution_widget',
276 'entity' => 'Widget',
277 'bao' => 'CRM_Contribute_BAO_Widget',
6a7e5e5d 278 'localizable' => 0,
a9d0587b 279 'add' => '2.0',
c3fc2621
CW
280 ],
281 'color_title' => [
e501603b
TO
282 'name' => 'color_title',
283 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 284 'title' => ts('Title Color'),
e501603b
TO
285 'maxlength' => 10,
286 'size' => CRM_Utils_Type::TWELVE,
a36434b9 287 'where' => 'civicrm_contribution_widget.color_title',
522a26c9 288 'table_name' => 'civicrm_contribution_widget',
289 'entity' => 'Widget',
290 'bao' => 'CRM_Contribute_BAO_Widget',
6a7e5e5d 291 'localizable' => 0,
a9d0587b 292 'add' => '2.0',
c3fc2621
CW
293 ],
294 'color_button' => [
e501603b
TO
295 'name' => 'color_button',
296 'type' => CRM_Utils_Type::T_STRING,
d63dedfa 297 'title' => ts('Button Color'),
e501603b
TO
298 'maxlength' => 10,
299 'size' => CRM_Utils_Type::TWELVE,
a36434b9 300 'where' => 'civicrm_contribution_widget.color_button',
522a26c9 301 'table_name' => 'civicrm_contribution_widget',
302 'entity' => 'Widget',
303 'bao' => 'CRM_Contribute_BAO_Widget',
6a7e5e5d 304 'localizable' => 0,
a9d0587b 305 'add' => '2.0',
c3fc2621
CW
306 ],
307 'color_bar' => [
e501603b
TO
308 'name' => 'color_bar',
309 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 310 'title' => ts('Bar Color'),
e501603b
TO
311 'maxlength' => 10,
312 'size' => CRM_Utils_Type::TWELVE,
a36434b9 313 'where' => 'civicrm_contribution_widget.color_bar',
522a26c9 314 'table_name' => 'civicrm_contribution_widget',
315 'entity' => 'Widget',
316 'bao' => 'CRM_Contribute_BAO_Widget',
6a7e5e5d 317 'localizable' => 0,
a9d0587b 318 'add' => '2.0',
c3fc2621
CW
319 ],
320 'color_main_text' => [
e501603b
TO
321 'name' => 'color_main_text',
322 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 323 'title' => ts('Main Text Color'),
e501603b
TO
324 'maxlength' => 10,
325 'size' => CRM_Utils_Type::TWELVE,
a36434b9 326 'where' => 'civicrm_contribution_widget.color_main_text',
522a26c9 327 'table_name' => 'civicrm_contribution_widget',
328 'entity' => 'Widget',
329 'bao' => 'CRM_Contribute_BAO_Widget',
6a7e5e5d 330 'localizable' => 0,
a9d0587b 331 'add' => '2.0',
c3fc2621
CW
332 ],
333 'color_main' => [
e501603b
TO
334 'name' => 'color_main',
335 'type' => CRM_Utils_Type::T_STRING,
d63dedfa 336 'title' => ts('Main Color'),
e501603b
TO
337 'maxlength' => 10,
338 'size' => CRM_Utils_Type::TWELVE,
a36434b9 339 'where' => 'civicrm_contribution_widget.color_main',
522a26c9 340 'table_name' => 'civicrm_contribution_widget',
341 'entity' => 'Widget',
342 'bao' => 'CRM_Contribute_BAO_Widget',
6a7e5e5d 343 'localizable' => 0,
a9d0587b 344 'add' => '2.0',
c3fc2621
CW
345 ],
346 'color_main_bg' => [
e501603b
TO
347 'name' => 'color_main_bg',
348 'type' => CRM_Utils_Type::T_STRING,
d63dedfa 349 'title' => ts('Background Color'),
e501603b
TO
350 'maxlength' => 10,
351 'size' => CRM_Utils_Type::TWELVE,
a36434b9 352 'where' => 'civicrm_contribution_widget.color_main_bg',
522a26c9 353 'table_name' => 'civicrm_contribution_widget',
354 'entity' => 'Widget',
355 'bao' => 'CRM_Contribute_BAO_Widget',
6a7e5e5d 356 'localizable' => 0,
a9d0587b 357 'add' => '2.0',
c3fc2621
CW
358 ],
359 'color_bg' => [
e501603b
TO
360 'name' => 'color_bg',
361 'type' => CRM_Utils_Type::T_STRING,
d63dedfa 362 'title' => ts('Other Background Color'),
e501603b
TO
363 'maxlength' => 10,
364 'size' => CRM_Utils_Type::TWELVE,
a36434b9 365 'where' => 'civicrm_contribution_widget.color_bg',
522a26c9 366 'table_name' => 'civicrm_contribution_widget',
367 'entity' => 'Widget',
368 'bao' => 'CRM_Contribute_BAO_Widget',
6a7e5e5d 369 'localizable' => 0,
a9d0587b 370 'add' => '2.0',
c3fc2621
CW
371 ],
372 'color_about_link' => [
e501603b
TO
373 'name' => 'color_about_link',
374 'type' => CRM_Utils_Type::T_STRING,
d63dedfa 375 'title' => ts('About Link Color'),
e501603b
TO
376 'maxlength' => 10,
377 'size' => CRM_Utils_Type::TWELVE,
a36434b9 378 'where' => 'civicrm_contribution_widget.color_about_link',
522a26c9 379 'table_name' => 'civicrm_contribution_widget',
380 'entity' => 'Widget',
381 'bao' => 'CRM_Contribute_BAO_Widget',
6a7e5e5d 382 'localizable' => 0,
a9d0587b 383 'add' => '2.0',
c3fc2621
CW
384 ],
385 'color_homepage_link' => [
e501603b
TO
386 'name' => 'color_homepage_link',
387 'type' => CRM_Utils_Type::T_STRING,
d63dedfa 388 'title' => ts('Homepage Link Color'),
e501603b
TO
389 'maxlength' => 10,
390 'size' => CRM_Utils_Type::TWELVE,
a36434b9 391 'where' => 'civicrm_contribution_widget.color_homepage_link',
522a26c9 392 'table_name' => 'civicrm_contribution_widget',
393 'entity' => 'Widget',
394 'bao' => 'CRM_Contribute_BAO_Widget',
6a7e5e5d 395 'localizable' => 0,
a9d0587b 396 'add' => '2.0',
c3fc2621
CW
397 ],
398 ];
346aaaba 399 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 400 }
346aaaba 401 return Civi::$statics[__CLASS__]['fields'];
e501603b 402 }
c3fc2621 403
e501603b 404 /**
bd8e0b14 405 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
406 *
407 * @return array
bd8e0b14 408 * Array(string $name => string $uniqueName).
e501603b 409 */
c3fc2621 410 public static function &fieldKeys() {
bd8e0b14
TO
411 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
412 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 413 }
bd8e0b14 414 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 415 }
c3fc2621 416
e501603b
TO
417 /**
418 * Returns the names of this table
419 *
420 * @return string
421 */
c3fc2621 422 public static function getTableName() {
e501603b
TO
423 return self::$_tableName;
424 }
c3fc2621 425
e501603b
TO
426 /**
427 * Returns if this table needs to be logged
428 *
c3fc2621 429 * @return bool
e501603b 430 */
c3fc2621 431 public function getLog() {
e501603b
TO
432 return self::$_log;
433 }
c3fc2621 434
e501603b
TO
435 /**
436 * Returns the list of fields that can be imported
437 *
438 * @param bool $prefix
439 *
440 * @return array
441 */
c3fc2621
CW
442 public static function &import($prefix = FALSE) {
443 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution_widget', $prefix, []);
60808919 444 return $r;
e501603b 445 }
c3fc2621 446
e501603b
TO
447 /**
448 * Returns the list of fields that can be exported
449 *
450 * @param bool $prefix
451 *
452 * @return array
453 */
c3fc2621
CW
454 public static function &export($prefix = FALSE) {
455 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution_widget', $prefix, []);
60808919 456 return $r;
e501603b 457 }
c3fc2621 458
e7a6b91a
AS
459 /**
460 * Returns the list of indices
c3fc2621
CW
461 *
462 * @param bool $localize
463 *
464 * @return array
e7a6b91a
AS
465 */
466 public static function indices($localize = TRUE) {
c3fc2621 467 $indices = [];
e7a6b91a
AS
468 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
469 }
c3fc2621 470
e501603b 471}