CRM-19130 - xml/templates/dao.tpl - Fire events for fields() and links()
[civicrm-core.git] / CRM / Contribute / DAO / Premium.php
CommitLineData
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/Contribute/Premium.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
437fafcf 33 * (GenCodeChecksum:c84ce7b79339fc7842fe872fe75eccc1)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class CRM_Contribute_DAO_Premium extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_premiums';
44 /**
45 * static instance to hold the field values
46 *
47 * @var array
48 */
49 static $_fields = null;
e501603b
TO
50 /**
51 * static instance to hold the FK relationships
52 *
53 * @var string
54 */
55 static $_links = null;
e501603b
TO
56 /**
57 * static value to see if we should log any modifications to
58 * this table in the civicrm_log table
59 *
60 * @var boolean
61 */
62 static $_log = true;
63 /**
64 *
65 * @var int unsigned
66 */
67 public $id;
68 /**
69 * Joins these premium settings to another object. Always civicrm_contribution_page for now.
70 *
71 * @var string
72 */
73 public $entity_table;
74 /**
75 *
76 * @var int unsigned
77 */
78 public $entity_id;
79 /**
80 * Is the Premiums feature enabled for this page?
81 *
82 * @var boolean
83 */
84 public $premiums_active;
85 /**
86 * Title for Premiums section.
87 *
88 * @var string
89 */
90 public $premiums_intro_title;
91 /**
92 * Displayed in <div> at top of Premiums section of page. Text and HTML allowed.
93 *
94 * @var text
95 */
96 public $premiums_intro_text;
97 /**
98 * This email address is included in receipts if it is populated and a premium has been selected.
99 *
100 * @var string
101 */
102 public $premiums_contact_email;
103 /**
104 * This phone number is included in receipts if it is populated and a premium has been selected.
105 *
106 * @var string
107 */
108 public $premiums_contact_phone;
109 /**
110 * Boolean. Should we automatically display minimum contribution amount text after the premium descriptions.
111 *
112 * @var boolean
113 */
114 public $premiums_display_min_contribution;
115 /**
116 * Label displayed for No Thank-you option in premiums block (e.g. No thank you)
117 *
118 * @var string
119 */
120 public $premiums_nothankyou_label;
121 /**
122 *
123 * @var int unsigned
124 */
125 public $premiums_nothankyou_position;
126 /**
127 * class constructor
128 *
129 * @return civicrm_premiums
130 */
131 function __construct() {
132 $this->__table = 'civicrm_premiums';
133 parent::__construct();
134 }
135 /**
136 * Returns foreign keys and entity references
137 *
138 * @return array
139 * [CRM_Core_Reference_Interface]
140 */
141 static function getReferenceColumns() {
142 if (!self::$_links) {
143 self::$_links = static ::createReferenceColumns(__CLASS__);
144 self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table');
145 }
146 return self::$_links;
147 }
148 /**
149 * Returns all the column names of this table
150 *
151 * @return array
152 */
153 static function &fields() {
154 if (!(self::$_fields)) {
155 self::$_fields = array(
156 'id' => array(
157 'name' => 'id',
158 'type' => CRM_Utils_Type::T_INT,
159 'title' => ts('Premium ID') ,
160 'required' => true,
161 ) ,
162 'entity_table' => array(
163 'name' => 'entity_table',
164 'type' => CRM_Utils_Type::T_STRING,
165 'title' => ts('Premium Entity') ,
166 'description' => 'Joins these premium settings to another object. Always civicrm_contribution_page for now.',
167 'required' => true,
168 'maxlength' => 64,
169 'size' => CRM_Utils_Type::BIG,
170 ) ,
171 'entity_id' => array(
172 'name' => 'entity_id',
173 'type' => CRM_Utils_Type::T_INT,
174 'title' => ts('Premium entity ID') ,
175 'required' => true,
176 ) ,
177 'premiums_active' => array(
178 'name' => 'premiums_active',
179 'type' => CRM_Utils_Type::T_BOOLEAN,
180 'title' => ts('Is Premium Active?') ,
181 'description' => 'Is the Premiums feature enabled for this page?',
182 'required' => true,
183 ) ,
184 'premiums_intro_title' => array(
185 'name' => 'premiums_intro_title',
186 'type' => CRM_Utils_Type::T_STRING,
187 'title' => ts('Title for Premiums section') ,
188 'description' => 'Title for Premiums section.',
189 'maxlength' => 255,
190 'size' => CRM_Utils_Type::HUGE,
191 ) ,
192 'premiums_intro_text' => array(
193 'name' => 'premiums_intro_text',
194 'type' => CRM_Utils_Type::T_TEXT,
195 'title' => ts('Premium Introductory Text') ,
196 'description' => 'Displayed in <div> at top of Premiums section of page. Text and HTML allowed.',
197 ) ,
198 'premiums_contact_email' => array(
199 'name' => 'premiums_contact_email',
200 'type' => CRM_Utils_Type::T_STRING,
201 'title' => ts('Premium Contact Email') ,
202 'description' => 'This email address is included in receipts if it is populated and a premium has been selected.',
203 'maxlength' => 100,
204 'size' => CRM_Utils_Type::HUGE,
205 ) ,
206 'premiums_contact_phone' => array(
207 'name' => 'premiums_contact_phone',
208 'type' => CRM_Utils_Type::T_STRING,
209 'title' => ts('Premiums Contact Phone') ,
210 'description' => 'This phone number is included in receipts if it is populated and a premium has been selected.',
211 'maxlength' => 50,
212 'size' => CRM_Utils_Type::BIG,
213 ) ,
214 'premiums_display_min_contribution' => array(
215 'name' => 'premiums_display_min_contribution',
216 'type' => CRM_Utils_Type::T_BOOLEAN,
217 'title' => ts('Display Minimum Contribution?') ,
218 'description' => 'Boolean. Should we automatically display minimum contribution amount text after the premium descriptions.',
219 'required' => true,
220 ) ,
221 'premiums_nothankyou_label' => array(
222 'name' => 'premiums_nothankyou_label',
223 'type' => CRM_Utils_Type::T_STRING,
224 'title' => ts('No Thank-you Text') ,
225 'description' => 'Label displayed for No Thank-you option in premiums block (e.g. No thank you)',
226 'maxlength' => 255,
227 'size' => CRM_Utils_Type::HUGE,
228 ) ,
229 'premiums_nothankyou_position' => array(
230 'name' => 'premiums_nothankyou_position',
231 'type' => CRM_Utils_Type::T_INT,
232 'title' => ts('No Thank-you Position') ,
233 'default' => '1',
234 ) ,
235 );
236 }
237 return self::$_fields;
238 }
239 /**
bd8e0b14 240 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
241 *
242 * @return array
bd8e0b14 243 * Array(string $name => string $uniqueName).
e501603b
TO
244 */
245 static function &fieldKeys() {
bd8e0b14
TO
246 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
247 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 248 }
bd8e0b14 249 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
250 }
251 /**
252 * Returns the names of this table
253 *
254 * @return string
255 */
256 static function getTableName() {
257 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
258 }
259 /**
260 * Returns if this table needs to be logged
261 *
262 * @return boolean
263 */
264 function getLog() {
265 return self::$_log;
266 }
267 /**
268 * Returns the list of fields that can be imported
269 *
270 * @param bool $prefix
271 *
272 * @return array
273 */
274 static function &import($prefix = false) {
60808919
TO
275 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'premiums', $prefix, array());
276 return $r;
e501603b
TO
277 }
278 /**
279 * Returns the list of fields that can be exported
280 *
281 * @param bool $prefix
282 *
283 * @return array
284 */
285 static function &export($prefix = false) {
60808919
TO
286 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'premiums', $prefix, array());
287 return $r;
e501603b
TO
288 }
289}