31603 progress bar update not clearing widget cache
[com.zyxware.civiwci.git] / CRM / Wci / DAO / ProgressBar.php
CommitLineData
1720f579
M
1<?php
2/*
bccdda02
J
3 +--------------------------------------------------------------------+
4 | CiviCRM Widget Creation Interface (WCI) Version 1.0 |
5 +--------------------------------------------------------------------+
6 | Copyright Zyxware Technologies (c) 2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM WCI. |
9 | |
10 | CiviCRM WCI is free software; you can copy, modify, and distribute |
11 | it under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007. |
13 | |
14 | CiviCRM WCI is distributed in the hope that it will be useful, |
15 | but 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 along with this program; if not, contact Zyxware |
21 | Technologies at info[AT]zyxware[DOT]com. |
22 +--------------------------------------------------------------------+
1720f579 23*/
bccdda02 24
1720f579
M
25/**
26 *
27 * @package CRM
28 * @copyright CiviCRM LLC (c) 2004-2013
29 */
e364fc74 30class CRM_Wci_DAO_ProgressBar extends CRM_Core_DAO
1720f579
M
31{
32 /**
33 * static instance to hold the table name
34 *
35 * @var string
36 * @static
37 */
38 static $_tableName = 'civicrm_wci_progress_bar';
39 /**
40 * static instance to hold the field values
41 *
42 * @var array
43 * @static
44 */
45 static $_fields = null;
46 /**
47 * static instance to hold the keys used in $_fields for each field.
48 *
49 * @var array
50 * @static
51 */
52 static $_fieldKeys = null;
53 /**
54 * static instance to hold the FK relationships
55 *
56 * @var string
57 * @static
58 */
59 static $_links = null;
60 /**
61 * static instance to hold the values that can
62 * be imported
63 *
64 * @var array
65 * @static
66 */
67 static $_import = null;
68 /**
69 * static instance to hold the values that can
70 * be exported
71 *
72 * @var array
73 * @static
74 */
75 static $_export = null;
76 /**
77 * static value to see if we should log any modifications to
78 * this table in the civicrm_log table
79 *
80 * @var boolean
81 * @static
82 */
83 static $_log = true;
84 /**
85 * Progress bar Id
86 *
87 * @var int unsigned
88 */
89 public $id;
90 /**
91 * Name of progress bar
92 *
93 * @var string
94 */
95 public $name;
96 /**
97 * Arbitrary starting amount
98 *
99 * @var float
100 */
101 public $starting_amount;
102 function __construct()
103 {
104 $this->__table = 'civicrm_wci_progress_bar';
105 parent::__construct();
106 }
107 /**
108 * return foreign keys and entity references
109 *
110 * @static
111 * @access public
112 * @return array of CRM_Core_EntityReference
113 */
114 static function getReferenceColumns()
115 {
116 return self::$_links;
117 }
118 /**
119 * returns all the column names of this table
120 *
121 * @access public
122 * @return array
123 */
124 static function &fields()
125 {
126 if (!(self::$_fields)) {
127 self::$_fields = array(
128 'progress_bar_id' => array(
129 'name' => 'id',
130 'type' => CRM_Utils_Type::T_INT,
131 'title' => ts('WCI Progress Bar Id', array('domain' => 'org.civicrm.wci')) ,
132 'required' => true,
133 ) ,
134 'name' => array(
135 'name' => 'name',
136 'type' => CRM_Utils_Type::T_STRING,
137 'title' => ts('Progress Bar Name', array('domain' => 'org.civicrm.wci')) ,
138 'required' => true,
139 'maxlength' => 64,
140 ) ,
141 'starting_amount' => array(
142 'name' => 'starting_amount',
143 'type' => CRM_Utils_Type::T_FLOAT,
144 'required' => false,
145 ) ,
82ba21f9
J
146 'goal_amount' => array(
147 'name' => 'goal_amount',
148 'type' => CRM_Utils_Type::T_FLOAT,
149 'required' => false,
150 ) ,
1720f579
M
151 );
152 }
153 return self::$_fields;
154 }
155 /**
156 * Returns an array containing, for each field, the arary key used for that
157 * field in self::$_fields.
158 *
159 * @access public
160 * @return array
161 */
162 static function &fieldKeys()
163 {
164 if (!(self::$_fieldKeys)) {
165 self::$_fieldKeys = array(
166 'id' => 'progress_bar_id',
167 'name' => 'name',
168 'starting_amount' => 'starting_amount',
82ba21f9 169 'goal_amount' => 'goal_amount',
1720f579
M
170 );
171 }
172 return self::$_fieldKeys;
173 }
174 /**
175 * returns the names of this table
176 *
177 * @access public
178 * @static
179 * @return string
180 */
181 static function getTableName()
182 {
183 return self::$_tableName;
184 }
185 /**
186 * returns if this table needs to be logged
187 *
188 * @access public
189 * @return boolean
190 */
191 function getLog()
192 {
193 return self::$_log;
194 }
195 /**
196 * returns the list of fields that can be imported
197 *
198 * @access public
199 * return array
200 * @static
201 */
202 static function &import($prefix = false)
203 {
204 if (!(self::$_import)) {
205 self::$_import = array();
206 $fields = self::fields();
207 foreach($fields as $name => $field) {
208 if (CRM_Utils_Array::value('import', $field)) {
209 if ($prefix) {
210 self::$_import['wci_progress_bar'] = & $fields[$name];
211 } else {
212 self::$_import[$name] = & $fields[$name];
213 }
214 }
215 }
216 }
217 return self::$_import;
218 }
219 /**
220 * returns the list of fields that can be exported
221 *
222 * @access public
223 * return array
224 * @static
225 */
226 static function &export($prefix = false)
227 {
228 if (!(self::$_export)) {
229 self::$_export = array();
230 $fields = self::fields();
231 foreach($fields as $name => $field) {
232 if (CRM_Utils_Array::value('export', $field)) {
233 if ($prefix) {
234 self::$_export['wci_progress_bar'] = & $fields[$name];
235 } else {
236 self::$_export[$name] = & $fields[$name];
237 }
238 }
239 }
240 }
241 return self::$_export;
242 }
243}