Index: trunk/extensions/ContributionReporting/ContributionReporting.php |
— | — | @@ -134,7 +134,7 @@ |
135 | 135 | ) + $commonModuleInfo; |
136 | 136 | |
137 | 137 | $wgResourceModules['ext.fundraiserstatistics'] = array( |
138 | | - 'scripts' => 'ext.fundraiserstatistics.edit.js', |
| 138 | + 'scripts' => 'ext.fundraiserstatistics.js', |
139 | 139 | 'styles' => 'ext.fundraiserstatistics.css', |
140 | 140 | ) + $commonModuleInfo; |
141 | 141 | |
— | — | @@ -145,17 +145,29 @@ |
146 | 146 | $wgHooks['ParserFirstCallInit'][] = 'efContributionReportingSetup'; |
147 | 147 | $wgHooks['LanguageGetMagic'][] = 'efContributionReportingTotal_Magic'; |
148 | 148 | |
| 149 | +/** |
| 150 | + * @param $parser Parser |
| 151 | + * @return bool |
| 152 | + */ |
149 | 153 | function efContributionReportingSetup( $parser ) { |
150 | 154 | $parser->setFunctionHook( 'contributiontotal', 'efContributionReportingTotal_Render' ); |
151 | 155 | return true; |
152 | 156 | } |
153 | 157 | |
| 158 | +/** |
| 159 | + * @param $magicWords array |
| 160 | + * @param $langCode string |
| 161 | + * @return bool |
| 162 | + */ |
154 | 163 | function efContributionReportingTotal_Magic( &$magicWords, $langCode ) { |
155 | 164 | $magicWords['contributiontotal'] = array( 0, 'contributiontotal' ); |
156 | 165 | return true; |
157 | 166 | } |
158 | 167 | |
159 | | -// Automatically use a local or special database connection |
| 168 | +/** |
| 169 | + * Automatically use a local or special database connection for reporting |
| 170 | + * @return DatabaseMysql |
| 171 | + */ |
160 | 172 | function efContributionReportingConnection() { |
161 | 173 | global $wgContributionReportingDBserver, $wgContributionReportingDBname; |
162 | 174 | global $wgContributionReportingDBuser, $wgContributionReportingDBpassword; |
— | — | @@ -174,6 +186,10 @@ |
175 | 187 | return $db; |
176 | 188 | } |
177 | 189 | |
| 190 | +/** |
| 191 | + * Automatically use a local or special database connection for tracking |
| 192 | + * @return DatabaseMysql |
| 193 | + */ |
178 | 194 | function efContributionTrackingConnection() { |
179 | 195 | global $wgContributionTrackingDBserver, $wgContributionTrackingDBname; |
180 | 196 | global $wgContributionTrackingDBuser, $wgContributionTrackingDBpassword; |
— | — | @@ -192,6 +208,12 @@ |
193 | 209 | return $db; |
194 | 210 | } |
195 | 211 | |
| 212 | +/** |
| 213 | + * Get the total amount of money raised since the start of the fundraiser |
| 214 | + * @param $start |
| 215 | + * @param $fudgeFactor |
| 216 | + * @return string |
| 217 | + */ |
196 | 218 | function efContributionReportingTotal( $start, $fudgeFactor ) { |
197 | 219 | $db = efContributionReportingConnection(); |
198 | 220 | |
— | — | @@ -213,6 +235,9 @@ |
214 | 236 | return $output; |
215 | 237 | } |
216 | 238 | |
| 239 | +/** |
| 240 | + * @return string |
| 241 | + */ |
217 | 242 | function efContributionReportingTotal_Render() { |
218 | 243 | $args = func_get_args(); |
219 | 244 | array_shift( $args ); |
Index: trunk/extensions/ContributionReporting/ContributionTrackingStatistics_body.php |
— | — | @@ -205,7 +205,12 @@ |
206 | 206 | |
207 | 207 | /* Query Functions */ |
208 | 208 | |
209 | | - // Totals for today |
| 209 | + /** |
| 210 | + * Totals for today |
| 211 | + * |
| 212 | + * @param $timestamp string |
| 213 | + * @return array |
| 214 | + */ |
210 | 215 | public function getDayTotals( $timestamp = 0 ) { |
211 | 216 | $range = array(); |
212 | 217 | $end_format = 'Ymd235959'; |
— | — | @@ -250,15 +255,21 @@ |
251 | 256 | |
252 | 257 | ); |
253 | 258 | |
| 259 | + $result = array(); |
254 | 260 | foreach ( $res as $row ) { |
255 | | - foreach( $row as $key => $value ) { |
| 261 | + foreach( $row as $value ) { |
256 | 262 | $result[] = $value; |
257 | 263 | } |
258 | 264 | } |
259 | 265 | return $result; |
260 | 266 | } |
261 | 267 | |
262 | | - // Given a day figure out what its week bounds are |
| 268 | + /** |
| 269 | + * Given a day figure out what its week bounds are |
| 270 | + * |
| 271 | + * @param $day |
| 272 | + * @return array |
| 273 | + */ |
263 | 274 | public function weekRange( $day ) { |
264 | 275 | $day = wfTimestamp( TS_UNIX, $day ); |
265 | 276 | $start = ( date( 'w', $day ) == 0) ? $day : strtotime('last sunday', $day ); // Use current Sunday |
Index: trunk/extensions/ContributionReporting/FundraiserStatistics_body.php |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | } |
17 | 17 | |
18 | 18 | public function execute( $sub ) { |
19 | | - global $wgRequest, $wgOut, $wgUser, $wgLang, $wgScriptPath, $egFundraiserStatisticsFundraisers; |
| 19 | + global $wgRequest, $wgOut, $wgLang, $wgScriptPath, $egFundraiserStatisticsFundraisers; |
20 | 20 | |
21 | 21 | $showYear = array(); |
22 | 22 | foreach ( $egFundraiserStatisticsFundraisers as $fundraiser ) { |
— | — | @@ -242,7 +242,7 @@ |
243 | 243 | Xml::tags( |
244 | 244 | 'table', |
245 | 245 | array( 'cellpadding' => 0, 'cellspacing' => 0, 'border' => 0 ), |
246 | | - Xml::tags( 'tr', null, implode( $chart['data'] ) ) |
| 246 | + Xml::tags( 'tr', null, implode( $chart['data'] ) ) // FIXME: Missing parameter to implode |
247 | 247 | ) |
248 | 248 | ); |
249 | 249 | $first = false; |
— | — | @@ -364,6 +364,10 @@ |
365 | 365 | return null; |
366 | 366 | } |
367 | 367 | |
| 368 | + /** |
| 369 | + * @param $values |
| 370 | + * @return string |
| 371 | + */ |
368 | 372 | private function dropDownList ( $values ) { |
369 | 373 | $dropDown = ''; |
370 | 374 | foreach ( $values as $value ) { |