if (SQL_NUMROWS($result) > 0) {
// Load list
$OUT = "<select name=\"to_uid\" size=\"1\" class=\"member_select\">
- <option value=\"0\">".SELECT_NONE."</option>\n";
+ <option value=\"0\">{--SELECT_NONE--}</option>\n";
+ // @TODO Try to rewrite his to $content = SQL_FETCHARRAY(), see some lines above for two different queries
while (list($uid, $nick) = SQL_FETCHROW($result)) {
- $OUT .= "<option value=\"".$uid."\"";
+ $OUT .= " <option value=\"".$uid."\"";
if ((REQUEST_ISSET_POST(('to_uid'))) && (REQUEST_POST('to_uid') == $uid)) $OUT .= " selected=\"selected\"";
$OUT .= ">";
if (($nick != $uid) && (!empty($nick))) {
{
case "list_in":
$sql = "SELECT trans_id, from_uid, points, reason, time_trans FROM `{!_MYSQL_PREFIX!}_user_transfers_in` WHERE userid=%s ORDER BY time_trans DESC LIMIT ".getConfig('transfer_max');
+ // @TODO Rewrite these constants
$NOTHING = getMessage('TRANSFER_NO_INCOMING_TRANSFERS');
define('__TRANSFER_SUM', getMessage('TRANSFER_TOTAL_INCOMING'));
define('__TRANSFER_TITLE', getMessage('TRANSFER_LIST_INCOMING'));
case "list_out":
$sql = "SELECT trans_id, to_uid, points, reason, time_trans FROM `{!_MYSQL_PREFIX!}_user_transfers_out` WHERE userid=%s ORDER BY time_trans DESC LIMIT ".getConfig('transfer_max');
+ // @TODO Rewrite these constants
$NOTHING = getMessage('TRANSFER_NO_OUTGOING_TRANSFERS');
define('__TRANSFER_SUM', getMessage('TRANSFER_TOTAL_OUTGOING'));
define('__TRANSFER_TITLE', getMessage('TRANSFER_LIST_OUTGOING'));
$result = SQL_QUERY_ESC($sql, array($GLOBALS['userid']), __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
$OUT = ""; $SW = 2;
+ // @TODO This should be somehow rewritten to $content = SQL_FETCHARRAY(), see switch() block above for SQL queries
while (list($tid, $uid, $points, $reason, $stamp) = SQL_FETCHROW($result)) {
- if ($type == "OUT") $points = "$points-";
- $OUT .= "<tr>
- <td class=\"transfer_row1 switch_sw".$SW." bottom2 right2\">
- <div class=\"transfer_row1\">".$tid."</div>
- </td>
- <td class=\"transfer_row2 switch_sw".$SW." bottom2 right2\">
- <div class=\"transfer_row2\">".MAKE_DATETIME($stamp, "3")."</div>
- </td>
- <td class=\"transfer_row3 switch_sw".$SW." bottom2 right2\">
- <div class=\"transfer_row3\">".$uid."</div>
- </td>
- <td class=\"transfer_row4 switch_sw".$SW." bottom2 right2\">
- <div class=\"transfer_row4\">".$reason."</div>
- </td>
- <td class=\"transfer_row5 switch_sw".$SW." bottom2\">
- <div class=\"transfer_row5\">".$points."</div>
- </td>
-</tr>\n";
+ // Rewrite points
+ if ($type == "OUT") $points = $points."-";
+
+ // Prepare content for template
+ $content = array(
+ 'sw' => $SW,
+ 'tid' => $id,
+ 'stamp' => MAKE_DATETIME($stamp, "3"),
+ 'uid' => $uid,
+ 'reason' => $reason,
+ 'points' => TRANSLATE_COMMA($points)
+ );
+
+ // Load row template
+ $OUT .= LOAD_TEMPLATE("member_transfer_row2", true, $content);
+
+ // Add points and switch color
$total += $points;
$SW = 3 - $SW;
}
}
// ... and add them to a constant for the template
+ // @TODO Rewrite these constants
define('__TRANSFER_ROWS', $OUT);
// Remeber total amount
$total = 0;
if (SQL_NUMROWS($result) > 0) {
+ // Search for entries
+ $result = SQL_QUERY("SELECT party_uid, trans_id, points, reason, time_trans, trans_type FROM `{!_MYSQL_PREFIX!}_transfers_tmp` ORDER BY time_trans DESC",
+ __FILE__, __LINE__);
+
// Output rows
$OUT = ""; $SW = 2;
- $result = SQL_QUERY("SELECT party_uid, trans_id, points, reason, time_trans, trans_type FROM `{!_MYSQL_PREFIX!}_transfers_tmp` ORDER BY time_trans DESC", __FILE__, __LINE__);
- while (list($uid, $idx, $points, $reason, $stamp, $type) = SQL_FETCHROW($result)) {
- if ($type == "OUT") $points = "-$points";
- $OUT .= "<tr>
- <td class=\"transfer_row1 switch_sw".$SW." bottom2 right2\">
- <div class=\"transfer_row1\">".$idx."</div>
- </td>
- <td class=\"transfer_row2 switch_sw".$SW." bottom2 right2\">
- <div class=\"transfer_row2\">".MAKE_DATETIME($stamp, "3")."</div>
- </td>
- <td class=\"transfer_row3 switch_sw".$SW." bottom2 right2\">
- <div class=\"transfer_row3\">".$uid."</div>
- </td>
- <td class=\"transfer_row4 switch_sw".$SW." bottom2 right2\">
- <div class=\"transfer_row4\">".$reason."</div>
- </td>
- <td class=\"transfer_row5 switch_sw".$SW." bottom2\">
- <div class=\"transfer_row5\">".$points."</div>
- </td>
-</tr>\n";
- $total += $points;
+ while ($content = SQL_FETCHARRAY($result)) {
+ // Rewrite points
+ if ($content['trans_type'] == "OUT") $content['points'] = "-".$content['points']."";
+
+ // Prepare content for template
+ $content['sw'] = $SW;
+ $content['time'] = MAKE_DATETIME($content['time_trans'], "3");
+ $content['points'] = TRANSLATE_COMMA($content['points']);
+
+ // Load row template
+ $OUT .= LOAD_TEMPLATE("member_transfer_row", true, $content);
+
+ // Add points and switch color
+ $total += $content['points'];
$SW = 3 - $SW;
}
}
// ... and add them to a constant for the template
+ // @TODO Rewrite all these constants
define('__TRANSFER_ROWS', $OUT);
// Remeber total amount