Listing of coupons rewritten to more clear
authorRoland Häder <roland@mxchange.org>
Fri, 29 Jul 2011 04:40:38 +0000 (04:40 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 29 Jul 2011 04:40:38 +0000 (04:40 +0000)
15 files changed:
.gitattributes
inc/extensions/ext-nickname.php
inc/language/sponsor_de.php
inc/libs/sponsor_functions.php
inc/modules/admin/what-list_coupon.php
inc/modules/admin/what-list_nickname.php [new file with mode: 0644]
inc/modules/sponsor/account.php
inc/modules/sponsor/settings.php
templates/de/html/admin/admin_edit_rallyes.tpl
templates/de/html/admin/admin_list_coupon.tpl
templates/de/html/admin/admin_list_coupon_row.tpl
templates/de/html/admin/admin_list_coupon_usr.tpl [new file with mode: 0644]
templates/de/html/admin/admin_list_coupon_usr_row.tpl [new file with mode: 0644]
templates/de/html/admin/admin_list_sponsor_details.tpl
templates/de/html/admin/admin_list_sponsor_row.tpl

index 40a522f9cfdf4d8aa8693cbe72003705d5273703..3421fd6fafdd73ab809144184e94a542bef20a4d 100644 (file)
@@ -533,6 +533,7 @@ inc/modules/admin/what-list_network_api_translation.php svneol=native#text/plain
 inc/modules/admin/what-list_network_params.php svneol=native#text/plain
 inc/modules/admin/what-list_network_types.php svneol=native#text/plain
 inc/modules/admin/what-list_networks.php svneol=native#text/plain
+inc/modules/admin/what-list_nickname.php svneol=native#text/plain
 inc/modules/admin/what-list_notifications.php svneol=native#text/plain
 inc/modules/admin/what-list_payouts.php svneol=native#text/plain
 inc/modules/admin/what-list_point_accounts.php svneol=native#text/plain
@@ -1264,6 +1265,8 @@ templates/de/html/admin/admin_list_country_no_row.tpl svneol=native#text/plain
 templates/de/html/admin/admin_list_country_row.tpl svneol=native#text/plain
 templates/de/html/admin/admin_list_coupon.tpl svneol=native#text/plain
 templates/de/html/admin/admin_list_coupon_row.tpl svneol=native#text/plain
+templates/de/html/admin/admin_list_coupon_usr.tpl svneol=native#text/plain
+templates/de/html/admin/admin_list_coupon_usr_row.tpl svneol=native#text/plain
 templates/de/html/admin/admin_list_doubler_already.tpl svneol=native#text/plain
 templates/de/html/admin/admin_list_doubler_overview.tpl svneol=native#text/plain
 templates/de/html/admin/admin_list_doubler_waiting.tpl svneol=native#text/plain
index 473be774721575749a365e0cccff01e2285f3064..137d4f8f7b4bb0304f33468ef95edfd04948e46b 100644 (file)
@@ -49,15 +49,15 @@ setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0
 switch (getExtensionMode()) {
        case 'register': // Do stuff when installation is running
                // SQL commands to run
-               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD nickname VARCHAR(255) NOT NULL DEFAULT ''");
-               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD nick_userid ENUM ('nick','userid') NOT NULL DEFAULT 'userid'");
+               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `nickname` VARCHAR(255) NOT NULL DEFAULT ''");
+               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `nick_userid` ENUM ('nick','userid') NOT NULL DEFAULT 'userid'");
                addMemberMenuSql('main','nickname','Nicknamen',5);
                break;
 
        case 'remove': // Do stuff when removing extension
                // SQL commands to run
-               addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='nickname'");
-               addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN ('config_nickname','list_nickname')");
+               addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='nickname' LIMIT 1");
+               addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN ('config_nickname','list_nickname') LIMIT 2");
                addDropTableSql('nickname_history');
                break;
 
index 771283855647042778a4aee94bdeeb324df22364..65148a610b4ccda1dd7dcbc3deaa4574f1e351d6 100644 (file)
@@ -248,7 +248,7 @@ addMessages(array(
        'SPONSOR_EMAIL_404' => "Bei der Anmeldung ist uns ein Fehler unterlaufen: Ihr Sponsor-Account mit der EMail-Adresse <span class=\"data\">%s</span> wurde nicht gefunden.",
        'SPONSOR_ACCOUNT_PENDING_FAILED' => "Bei der Umschaltung Ihres Sponorenaccounts auf <em>Wartend</em> trat ein unerwarteter Fehler auf.",
        'SPONSOR_ACCOUNT_404' => "Das von Ihnen angegebene Sponsorenaccount <span class=\"data\">%s</span> konnte nicht gefunden werden.",
-       'SPONSOR_ACCOUNT_FAILED' => "Sponsorenaccount konnte nicht geladen werden: <span class=\"data\">%s</span>",
+       'SPONSOR_ACCOUNT_FAILED' => "Sponsorenaccount konnte nicht geladen werden: <span class=\"data\">{%%pipe,translateSponsorStatus=%s%%}</span>",
        'SPONSOR_ACCOUNT_EMAIL_FAILED' => "Konnten Sponsorenaccount nicht freigeben! Bitte benachrichtigen Sie den Support.",
 
 // Login form
index eb9aad248ebdc74551fe2ff141176c2e4bcd426f..77e0654db9a01aa8007b76ce3e31cadd3d3537a4 100644 (file)
@@ -217,7 +217,7 @@ function handleSponsorRequest ($postData, $update=false, $messageArray = array()
 }
 
 // Translate the account status
-function sponsorTranslateUserStatus ($status) {
+function translateSponsorStatus ($status) {
        // Construct constant name
        $constantName = sprintf("ACCOUNT_STATUS_%s", $status);
 
index 0069ce021df9fb501c67f84e2b3a127f2f126313..2f6f89c79a3c43f91710df52a6dbb862b2bae2db 100644 (file)
@@ -43,8 +43,9 @@ if ((!defined('__SECURITY')) || (!isAdmin())) {
 // Add description as navigation point
 addYouAreHereLink('admin', __FILE__);
 
-// Check if the user has cashed coupons
-$result = SQL_QUERY('SELECT
+if (isGetRequestParameterSet('coupon_id')) {
+       // List userids for given coupon
+       $result = SQL_QUERY_ESC('SELECT
        u.`coupon_id`,
        u.`userid`,
        UNIX_TIMESTAMP(u.`cashed_on`) AS `cashed_on`,
@@ -57,34 +58,79 @@ INNER JOIN
        `{?_MYSQL_PREFIX?}_coupon_data` AS d
 ON
        u.`coupon_id`=d.`id`
+WHERE
+       u.`coupon_id`=%s
 ORDER BY
-       u.`cashed_on` DESC', __FILE__, __LINE__);
+       u.`cashed_on` DESC',
+               array(
+                       bigintval(getRequestParameter('coupon_id'))
+               ), __FILE__, __LINE__);
 
-// Do we have entries?
-if (SQL_NUMROWS($result) > 0) {
-       // Init variable
-       $OUT = '';
+       // Do we have entries?
+       if (SQL_NUMROWS($result) > 0) {
+               // Init variable
+               $OUT = '';
 
-       // Load all rows
-       while ($content = SQL_FETCHARRAY($result)) {
-               // Translate all timestamps
-               $content['cashed_on']      = generateDateTime($content['cashed_on']     , '2');
-               $content['coupon_created'] = generateDateTime($content['coupon_created'], '2');
-               $content['coupon_expired'] = generateDateTime($content['coupon_expired'], '2');
+               // Load all rows
+               while ($content = SQL_FETCHARRAY($result)) {
+                       // Translate all timestamps
+                       $content['cashed_on']      = generateDateTime($content['cashed_on']     , '2');
+                       $content['coupon_created'] = generateDateTime($content['coupon_created'], '2');
+                       $content['coupon_expired'] = generateDateTime($content['coupon_expired'], '2');
 
-               // Add the row template
-               $OUT .= loadTemplate('admin_list_coupon_row', true, $content);
-       } // END - while
+                       // Add the row template
+                       $OUT .= loadTemplate('admin_list_coupon_usr_row', true, $content);
+               } // END - while
 
-       // Load main template
-       loadTemplate('admin_list_coupon', false, $OUT);
+               // Load main template
+               loadTemplate('admin_list_coupon_usr', false, $OUT);
+       } else {
+               // No cashed coupons found
+               displayMessage('{--ADMIN_LIST_COUPON_404--}');
+       }
+
+       // Free result
+       SQL_FREERESULT($result);
 } else {
-       // No cashed coupons found
-       displayMessage('{--ADMIN_LIST_COUPON_404--}');
-}
+       // Check if the user has cashed coupons
+       $result = SQL_QUERY('SELECT
+       d.`id` AS `coupon_id`,
+       UNIX_TIMESTAMP(d.`coupon_created`) AS `coupon_created`,
+       UNIX_TIMESTAMP(d.`coupon_expired`) AS `coupon_expired`,
+       d.`points`,
+       d.`total_created`,
+       d.`total_cashed`,
+       d.`coupon_description`
+FROM
+       `{?_MYSQL_PREFIX?}_coupon_data` AS d
+ORDER BY
+       d.`id` ASC', __FILE__, __LINE__);
+
+       // Do we have entries?
+       if (SQL_NUMROWS($result) > 0) {
+               // Init variable
+               $OUT = '';
+
+               // Load all rows
+               while ($content = SQL_FETCHARRAY($result)) {
+                       // Translate all timestamps
+                       $content['coupon_created'] = generateDateTime($content['coupon_created'], '2');
+                       $content['coupon_expired'] = generateDateTime($content['coupon_expired'], '2');
 
-// Free result
-SQL_FREERESULT($result);
+                       // Add the row template
+                       $OUT .= loadTemplate('admin_list_coupon_row', true, $content);
+               } // END - while
+
+               // Load main template
+               loadTemplate('admin_list_coupon', false, $OUT);
+       } else {
+               // No cashed coupons found
+               displayMessage('{--ADMIN_LIST_COUPON_404--}');
+       }
+
+       // Free result
+       SQL_FREERESULT($result);
+}
 
 // [EOF]
 ?>
diff --git a/inc/modules/admin/what-list_nickname.php b/inc/modules/admin/what-list_nickname.php
new file mode 100644 (file)
index 0000000..bc3e13d
--- /dev/null
@@ -0,0 +1,56 @@
+<?php
+/************************************************************************
+ * Mailer v0.2.1-FINAL                                Start: 07/29/2011 *
+ * ===================                          Last change: 07/29/2011 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : what-list_nickname.php                           *
+ * -------------------------------------------------------------------- *
+ * Short description : List per-user nickname history                   *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Nickname-Historie per Mitglied auflisten         *
+ * -------------------------------------------------------------------- *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author::                                                          $ *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
+ * For more information visit: http://www.mxchange.org                  *
+ *                                                                      *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or    *
+ * (at your option) any later version.                                  *
+ *                                                                      *
+ * This program is distributed in the hope that it will be useful,      *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
+ * GNU General Public License for more details.                         *
+ *                                                                      *
+ * You should have received a copy of the GNU General Public License    *
+ * along with this program; if not, write to the Free Software          *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
+ * MA  02110-1301  USA                                                  *
+ ************************************************************************/
+
+// Some security stuff...
+if ((!defined('__SECURITY')) || (!isAdmin())) {
+       die();
+} // END - if
+
+// Display only title when no form was submitted
+addYouAreHereLink('admin', __FILE__);
+
+// Check if 'userid' is set
+if (isGetRequestParameterSet('userid')) {
+       // List all entries per user
+       showEntriesByXmlCallback('admin_list_nickname_history');
+} else {
+       // Output selection form with all confirmed user accounts listed
+       addMemberSelectionBox();
+}
+
+// [EOF]
+?>
index 88e358cf2de065c111c5a50fead7ecd1cea22137..bfe20c20ce2c39cc7f9857db3d629f3b9047b3c8 100644 (file)
@@ -129,8 +129,7 @@ if (SQL_NUMROWS($result) == 1) {
                }
        } else {
                // Locked or so?
-               $STATUS = sponsorTranslateUserStatus($content['status']);
-               $GLOBALS['sponsor_output'] = displayMessage('{%message,SPONSOR_ACCOUNT_FAILED=' . $STATUS . '%}', true);
+               $GLOBALS['sponsor_output'] = displayMessage('{%message,SPONSOR_ACCOUNT_FAILED=' . $content['status'] . '%}', true);
        }
 } else {
        // Sponsor account not found
index f65f420153634e26212daa64e6b0d2ba325e3ea7..cee56805ac8464803531cf8fd26ef741e74e81a4 100644 (file)
@@ -115,8 +115,7 @@ if (SQL_NUMROWS($result) == 1) {
                }
        } else {
                // Locked or so?
-               $STATUS = sponsorTranslateUserStatus($content['status']);
-               $GLOBALS['sponsor_output'] = displayMessage('{%message,SPONSOR_ACCOUNT_FAILED=' . $STATUS . '%}', true);
+               $GLOBALS['sponsor_output'] = displayMessage('{%message,SPONSOR_ACCOUNT_FAILED=' . $content['status'] . '%}', true);
        }
 } else {
        // Sponsor account not found
index 2d18ef7c886f549c18c7305cf6b837f3bdfb6471..eb35f5b9f90b140fe7b8d737b60ef55d179bd542 100644 (file)
@@ -1,3 +1,4 @@
+<div align="center">
 <form accept-charset="UTF-8" action="{%url=modules.php?module=admin&amp;what=list_rallyes%}" method="post">
 <table border="0" cellspacing="0" cellpadding="0" class="table dashed">
        <tr>
@@ -13,3 +14,4 @@
        </tr>
 </table>
 </form>
+</div>
index f383293dd7733ed020e2e1982db01c56341ca9b9..c1e6868689dd7bd25c899161fe873936d3a5821f 100644 (file)
@@ -1,7 +1,7 @@
 <div align="center">
 <table border="0" cellspacing="0" cellpadding="0" class="table dashed">
 <tr>
-       <td colspan="9" class="table_header bottom" align="center">
+       <td colspan="7" class="table_header bottom" align="center">
                <strong>{--ADMIN_LIST_CASHED_COUPONS_TITLE--}</strong>
        </td>
 </tr>
@@ -9,15 +9,9 @@
        <td align="center" class="header_column bottom right">
                <strong>{--COUPON_ID--}</strong>
        </td>
-       <td align="center" class="header_column bottom right">
-               <strong>{--_USERID--}</strong>
-       </td>
        <td align="center" class="header_column bottom right">
                <strong>{?POINTS?}</strong>
        </td>
-       <td align="center" class="header_column bottom right">
-               <strong>{--COUPON_CASHED_ON--}</strong>
-       </td>
        <td align="center" class="header_column bottom right">
                <strong>{--COUPON_CREATED_ON--}</strong>
        </td>
@@ -36,7 +30,7 @@
 </tr>
 $content
 <tr>
-       <td colspan="9" class="table_footer" align="center">
+       <td colspan="7" class="table_footer" align="center">
                <div class="tiny notice">{--ADMIN_LIST_CASHED_COUPONS_NOTE--}</div>
        </td>
 </tr>
index 66b92ad8d51385dd268463df4172a9b38c882360..adb7fb08e55cbc2d1e87c589d7f456db8d7c251a 100644 (file)
@@ -1,16 +1,10 @@
 <tr>
        <td align="center" class="{%template,ColorSwitch%} bottom right">
-               $content[coupon_id]
-       </td>
-       <td align="center" class="{%template,ColorSwitch%} bottom right">
-               {%pipe,generateUserProfileLink=$content[userid]%}
+               [<a href="{%url=modules.php?module=admin&amp;what=list_coupon&amp;coupon_id=$content[coupon_id]%}">$content[coupon_id]</a>]
        </td>
        <td align="center" class="{%template,ColorSwitch%} bottom right">
                {%pipe,translateComma=$content[points]%}
        </td>
-       <td align="center" class="{%template,ColorSwitch%} bottom right">
-               $content[cashed_on]
-       </td>
        <td align="center" class="{%template,ColorSwitch%} bottom right">
                $content[coupon_created]
        </td>
diff --git a/templates/de/html/admin/admin_list_coupon_usr.tpl b/templates/de/html/admin/admin_list_coupon_usr.tpl
new file mode 100644 (file)
index 0000000..f383293
--- /dev/null
@@ -0,0 +1,44 @@
+<div align="center">
+<table border="0" cellspacing="0" cellpadding="0" class="table dashed">
+<tr>
+       <td colspan="9" class="table_header bottom" align="center">
+               <strong>{--ADMIN_LIST_CASHED_COUPONS_TITLE--}</strong>
+       </td>
+</tr>
+<tr>
+       <td align="center" class="header_column bottom right">
+               <strong>{--COUPON_ID--}</strong>
+       </td>
+       <td align="center" class="header_column bottom right">
+               <strong>{--_USERID--}</strong>
+       </td>
+       <td align="center" class="header_column bottom right">
+               <strong>{?POINTS?}</strong>
+       </td>
+       <td align="center" class="header_column bottom right">
+               <strong>{--COUPON_CASHED_ON--}</strong>
+       </td>
+       <td align="center" class="header_column bottom right">
+               <strong>{--COUPON_CREATED_ON--}</strong>
+       </td>
+       <td align="center" class="header_column bottom right">
+               <strong>{--COUPON_EXPIRED_ON--}</strong>
+       </td>
+       <td align="center" class="header_column bottom right">
+               <strong>{--COUPON_TOTAL_CREATED--}</strong>
+       </td>
+       <td align="center" class="header_column bottom right">
+               <strong>{--COUPON_TOTAL_CASHED--}</strong>
+       </td>
+       <td align="center" class="header_column bottom">
+               <strong>{--COUPON_DESCRIPTION--}</strong>
+       </td>
+</tr>
+$content
+<tr>
+       <td colspan="9" class="table_footer" align="center">
+               <div class="tiny notice">{--ADMIN_LIST_CASHED_COUPONS_NOTE--}</div>
+       </td>
+</tr>
+</table>
+</div>
diff --git a/templates/de/html/admin/admin_list_coupon_usr_row.tpl b/templates/de/html/admin/admin_list_coupon_usr_row.tpl
new file mode 100644 (file)
index 0000000..66b92ad
--- /dev/null
@@ -0,0 +1,29 @@
+<tr>
+       <td align="center" class="{%template,ColorSwitch%} bottom right">
+               $content[coupon_id]
+       </td>
+       <td align="center" class="{%template,ColorSwitch%} bottom right">
+               {%pipe,generateUserProfileLink=$content[userid]%}
+       </td>
+       <td align="center" class="{%template,ColorSwitch%} bottom right">
+               {%pipe,translateComma=$content[points]%}
+       </td>
+       <td align="center" class="{%template,ColorSwitch%} bottom right">
+               $content[cashed_on]
+       </td>
+       <td align="center" class="{%template,ColorSwitch%} bottom right">
+               $content[coupon_created]
+       </td>
+       <td align="center" class="{%template,ColorSwitch%} bottom right">
+               $content[coupon_expired]
+       </td>
+       <td align="center" class="{%template,ColorSwitch%} bottom right">
+               {%pipe,translateComma=$content[total_created]%}
+       </td>
+       <td align="center" class="{%template,ColorSwitch%} bottom right">
+               {%pipe,translateComma=$content[total_cashed]%}
+       </td>
+       <td align="center" class="{%template,ColorSwitch%} bottom">
+               $content[coupon_description]
+       </td>
+</tr>
index d0e736f2b67d76f384376fc38c5dea4a0e5050e4..27d3d0ba420879e0309b9f3f67dfd6f4fa69279a 100644 (file)
@@ -7,7 +7,7 @@
 </tr>
 <tr>
        <td align="right" class="bottom right" height="25">{--SPONSOR_ID--}:&nbsp;</td>
-       <td class="bottom">$content[id] [<strong><a href="{%url=modules.php?module=admin&amp;what=lock_sponsor&amp;id=$content[id]%}">{%pipe,sponsorTranslateUserStatus=$content[status]%}</a></strong>]</td>
+       <td class="bottom">$content[id] [<strong><a href="{%url=modules.php?module=admin&amp;what=lock_sponsor&amp;id=$content[id]%}">{%pipe,translateSponsorStatus=$content[status]%}</a></strong>]</td>
 </tr>
 <tr>
        <td colspan="2" align="center" class="table_header bottom">
index be611a320f3de1587573da6ed0996d2c03607224..e411602eb935536eab822fa1c58e21b22da3ccc1 100644 (file)
@@ -25,7 +25,7 @@
 </tr>
 <tr>
   <td align="center" class="{%template,ColorSwitch%} bottom right" width="100">
-    [<strong><a href="{%url=modules.php?module=admin&amp;what=lock_sponsor&amp;id=$content[id]%}">{%pipe,sponsorTranslateUserStatus=$content[status]%}</a></strong>]
+    [<strong><a href="{%url=modules.php?module=admin&amp;what=lock_sponsor&amp;id=$content[id]%}">{%pipe,translateSponsorStatus=$content[status]%}</a></strong>]
   </td>
   <td align="center" class="{%template,ColorSwitch%} bottom right" width="120">
     $content[sponsor_created]