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