Commit | Line | Data |
---|---|---|
1720f579 M |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.4 | | |
5 | +--------------------------------------------------------------------+ | |
6 | | Copyright CiviCRM LLC (c) 2004-2013 | | |
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 | * | |
29 | * @package CRM | |
30 | * @copyright CiviCRM LLC (c) 2004-2013 | |
31 | */ | |
e364fc74 | 32 | class CRM_Wci_DAO_ProgressBarFormula extends CRM_Core_DAO |
1720f579 M |
33 | { |
34 | /** | |
35 | * static instance to hold the table name | |
36 | * | |
37 | * @var string | |
38 | * @static | |
39 | */ | |
40 | static $_tableName = 'civicrm_wci_progress_bar_formula'; | |
41 | /** | |
42 | * static instance to hold the field values | |
43 | * | |
44 | * @var array | |
45 | * @static | |
46 | */ | |
47 | static $_fields = null; | |
48 | /** | |
49 | * static instance to hold the keys used in $_fields for each field. | |
50 | * | |
51 | * @var array | |
52 | * @static | |
53 | */ | |
54 | static $_fieldKeys = null; | |
55 | /** | |
56 | * static instance to hold the FK relationships | |
57 | * | |
58 | * @var string | |
59 | * @static | |
60 | */ | |
61 | static $_links = null; | |
62 | /** | |
63 | * static instance to hold the values that can | |
64 | * be imported | |
65 | * | |
66 | * @var array | |
67 | * @static | |
68 | */ | |
69 | static $_import = null; | |
70 | /** | |
71 | * static instance to hold the values that can | |
72 | * be exported | |
73 | * | |
74 | * @var array | |
75 | * @static | |
76 | */ | |
77 | static $_export = null; | |
78 | /** | |
79 | * static value to see if we should log any modifications to | |
80 | * this table in the civicrm_log table | |
81 | * | |
82 | * @var boolean | |
83 | * @static | |
84 | */ | |
85 | static $_log = true; | |
86 | /** | |
87 | * Formula entry id | |
88 | * | |
89 | * @var int unsigned | |
90 | */ | |
91 | public $id; | |
92 | /** | |
93 | * Contribution page reference id | |
94 | * | |
95 | * @var int unsigned | |
96 | */ | |
97 | public $contribution_page_id; | |
98 | /** | |
99 | * Progress bar reference id | |
100 | * | |
101 | * @var int unsigned | |
102 | */ | |
103 | public $progress_bar_id; | |
104 | /** | |
105 | * Percentage amount | |
106 | * | |
107 | * @var float | |
108 | */ | |
109 | public $percentage; | |
110 | function __construct() | |
111 | { | |
112 | $this->__table = 'civicrm_wci_progress_bar_formula'; | |
113 | parent::__construct(); | |
114 | } | |
115 | /** | |
116 | * return foreign keys and entity references | |
117 | * | |
118 | * @static | |
119 | * @access public | |
120 | * @return array of CRM_Core_EntityReference | |
121 | */ | |
122 | static function getReferenceColumns() | |
123 | { | |
10119db1 | 124 | if (!self::$_links) { |
1720f579 M |
125 | self::$_links = array( |
126 | new CRM_Core_EntityReference(self::getTableName() , 'progress_bar_id', 'civicrm_wci_progress_bar', 'id') , | |
127 | new CRM_Core_EntityReference(self::getTableName() , 'contribution_page_id', 'civicrm_contribution_page', 'id') , | |
128 | ); | |
10119db1 | 129 | } |
1720f579 M |
130 | return self::$_links; |
131 | } | |
132 | /** | |
133 | * returns all the column names of this table | |
134 | * | |
135 | * @access public | |
136 | * @return array | |
137 | */ | |
138 | static function &fields() | |
139 | { | |
140 | if (!(self::$_fields)) { | |
141 | self::$_fields = array( | |
142 | 'progress_bar_formula_id' => array( | |
143 | 'name' => 'id', | |
144 | 'type' => CRM_Utils_Type::T_INT, | |
145 | 'title' => ts('WCI Progress Bar Formula Entry Id', array('domain' => 'org.civicrm.wci')) , | |
146 | 'required' => true, | |
147 | ) , | |
148 | 'contribution_page_id' => array( | |
149 | 'name' => 'contribution_page_id', | |
150 | 'type' => CRM_Utils_Type::T_INT, | |
151 | 'title' => ts('Contribution Page Reference Id', array('domain' => 'org.civicrm.wci')) , | |
152 | 'required' => true, | |
153 | ) , | |
154 | 'progress_bar_id' => array( | |
155 | 'name' => 'progress_bar_id', | |
156 | 'type' => CRM_Utils_Type::T_INT, | |
157 | 'title' => ts('Progress Bar Reference Id', array('domain' => 'org.civicrm.wci')) , | |
158 | 'required' => true, | |
159 | ) , | |
160 | 'percentage' => array( | |
161 | 'name' => 'percentage', | |
162 | 'type' => CRM_Utils_Type::T_FLOAT, | |
163 | 'title' => ts('Percentage Amount', array('domain' => 'org.civicrm.wci')) , | |
164 | 'required' => true, | |
165 | ) , | |
166 | ); | |
167 | } | |
168 | return self::$_fields; | |
169 | } | |
170 | /** | |
171 | * Returns an array containing, for each field, the arary key used for that | |
172 | * field in self::$_fields. | |
173 | * | |
174 | * @access public | |
175 | * @return array | |
176 | */ | |
177 | static function &fieldKeys() | |
178 | { | |
179 | if (!(self::$_fieldKeys)) { | |
180 | self::$_fieldKeys = array( | |
181 | 'id' => 'progress_bar_formula_id', | |
182 | 'contribution_page_id' => 'contribution_page_id', | |
183 | 'progress_bar_id' => 'progress_bar_id', | |
184 | 'percentage' => 'percentage', | |
185 | ); | |
186 | } | |
187 | return self::$_fieldKeys; | |
188 | } | |
189 | /** | |
190 | * returns the names of this table | |
191 | * | |
192 | * @access public | |
193 | * @static | |
194 | * @return string | |
195 | */ | |
196 | static function getTableName() | |
197 | { | |
198 | return self::$_tableName; | |
199 | } | |
200 | /** | |
201 | * returns if this table needs to be logged | |
202 | * | |
203 | * @access public | |
204 | * @return boolean | |
205 | */ | |
206 | function getLog() | |
207 | { | |
208 | return self::$_log; | |
209 | } | |
210 | /** | |
211 | * returns the list of fields that can be imported | |
212 | * | |
213 | * @access public | |
214 | * return array | |
215 | * @static | |
216 | */ | |
217 | static function &import($prefix = false) | |
218 | { | |
219 | if (!(self::$_import)) { | |
220 | self::$_import = array(); | |
221 | $fields = self::fields(); | |
222 | foreach($fields as $name => $field) { | |
223 | if (CRM_Utils_Array::value('import', $field)) { | |
224 | if ($prefix) { | |
225 | self::$_import['wci_progress_bar_formula'] = & $fields[$name]; | |
10119db1 J |
226 | } |
227 | else { | |
1720f579 M |
228 | self::$_import[$name] = & $fields[$name]; |
229 | } | |
230 | } | |
231 | } | |
232 | } | |
233 | return self::$_import; | |
234 | } | |
235 | /** | |
236 | * returns the list of fields that can be exported | |
237 | * | |
238 | * @access public | |
239 | * return array | |
240 | * @static | |
241 | */ | |
242 | static function &export($prefix = false) | |
243 | { | |
244 | if (!(self::$_export)) { | |
245 | self::$_export = array(); | |
246 | $fields = self::fields(); | |
247 | foreach($fields as $name => $field) { | |
248 | if (CRM_Utils_Array::value('export', $field)) { | |
249 | if ($prefix) { | |
250 | self::$_export['wci_progress_bar_formula'] = & $fields[$name]; | |
10119db1 J |
251 | } |
252 | else { | |
1720f579 M |
253 | self::$_export[$name] = & $fields[$name]; |
254 | } | |
255 | } | |
256 | } | |
257 | } | |
258 | return self::$_export; | |
259 | } | |
260 | } |