2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 10/24/2012 *
4 * =================== Last change: 10/24/2012 *
6 * -------------------------------------------------------------------- *
7 * File : what-list_user_amounts.php *
8 * -------------------------------------------------------------------- *
9 * Short description : *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2015 by Mailer Developer Team *
20 * For more information visit: http://mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if ((!defined('__SECURITY')) || (!isAdmin())) {
43 // Add description as navigation point
44 addYouAreHereLink('admin', __FILE__);
46 // Run through all "points columns"
48 foreach (runFilterChain('locked_points_columns_array', array('points')) as $column) {
49 // Add it with/-out locked
50 $sql .= '`p`.`' . $column . '` + `p`.`locked_' . $column . '` +';
54 $sql = substr($sql, 0, -1);
56 // Run the query to obtain all user's amounts (regardless of their status)
57 $result = sqlQuery('SELECT
64 `{?_MYSQL_PREFIX?}_user_points` AS `p`
66 `{?_MYSQL_PREFIX?}_user_data` AS `d`
68 `d`.`userid`=`p`.`userid`
72 `p`.`userid` ASC', __FILE__, __LINE__);
74 // Are there entries? (sorry, the XML functions cannot "produce" the above SQL statement)
75 if (!ifSqlHasZeroNumRows($result)) {
76 // Init amounts and points
81 while ($row = sqlFetchArray($result)) {
83 $amounts[$row['userid']] = $row;
84 $totalPoints += $row['points'];
90 'total' => $totalPoints
93 // ... and display all
94 foreach ($amounts as $userid => $row) {
95 // Calculate and add percentage to data array
96 $row['percents'] = calculatePercentageRate($row['points'], $totalPoints);
99 $out['rows'] .= loadTemplate('admin_list_user_amounts_row', TRUE, $row);
102 // Load main template
103 loadTemplate('admin_list_user_amounts', FALSE, $out);
106 displayMessage('{--ADMIN_LIST_USER_AMOUNTS_404--}');
110 sqlFreeResult($result);