Referal overview completed, thanks to monakoianar for useful hints. :-)
authorRoland Häder <roland@mxchange.org>
Sun, 12 Oct 2008 00:26:15 +0000 (00:26 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 12 Oct 2008 00:26:15 +0000 (00:26 +0000)
13 files changed:
.gitattributes
inc/databases.php
inc/functions.php
inc/language/de.php
inc/language/refback_de.php
inc/modules/admin/what-list_yoomedia_tm.php
inc/modules/guest/what-sponsor_infos.php
inc/modules/member/what-reflist.php
inc/mysql-manager.php
templates/de/html/member/member_ref_list.tpl [new file with mode: 0644]
templates/de/html/member/member_ref_list_level.tpl [new file with mode: 0644]
templates/de/html/member/member_ref_list_row.tpl [new file with mode: 0644]
templates/de/html/member/member_refback_list_level.tpl

index 733707e..601a343 100644 (file)
@@ -1350,6 +1350,9 @@ templates/de/html/member/member_primera_mode_list.tpl -text
 templates/de/html/member/member_primera_mode_list_row.tpl -text
 templates/de/html/member/member_primera_mode_pay.tpl -text
 templates/de/html/member/member_receive_table.tpl -text
+templates/de/html/member/member_ref_list.tpl -text
+templates/de/html/member/member_ref_list_level.tpl -text
+templates/de/html/member/member_ref_list_row.tpl -text
 templates/de/html/member/member_refback_edit.tpl -text
 templates/de/html/member/member_refback_list.tpl -text
 templates/de/html/member/member_refback_list_level.tpl -text
index 95ca170..54cff4d 100644 (file)
@@ -113,7 +113,7 @@ define('USAGE_BASE', "usage");
 define('SERVER_URL', "http://www.mxchange.org");
 
 // This current patch level
-define('CURR_SVN_REVISION', "492");
+define('CURR_SVN_REVISION', "493");
 
 // Take a prime number which is long (if you know a longer one please try it out!)
 define('_PRIME', 591623);
index e9eb668..291d865 100644 (file)
@@ -569,13 +569,18 @@ function MAKE_DATETIME ($time, $mode="0")
 }
 
 // Translates the american decimal dot into a german comma
-function TRANSLATE_COMMA ($dotted, $cut=true) {
+function TRANSLATE_COMMA ($dotted, $cut=true, $max=0) {
        global $_CONFIG;
 
        // Default is 3 you can change this in admin area "Misc -> Misc Options"
        if (empty($_CONFIG['max_comma'])) $_CONFIG['max_comma'] = "3";
+
+       // Use from config is default
        $maxComma = $_CONFIG['max_comma'];
 
+       // Use from parameter?
+       if ($max > 0) $maxComma = $max;
+
        // Cut zeros off?
        if ($cut) {
                // Test for commata if in cut-mode
index 4479845..cab9bc3 100644 (file)
@@ -1196,5 +1196,20 @@ define('EMAIL_STATUS_NEW', "Wartet auf Versand");
 define('EMAIL_STATUS_QUEUE', "Wird versendet");
 define('EMAIL_STATUS_TEMP', "Wird gerade gebucht");
 
+// Member activity
+define('MEMBER_ACTIVITY_ACTIVE', "Aktiv");
+define('MEMBER_ACTIVITY_INACTIVE', "Inaktiv");
+
+// Member reflist
+define('MEMBER_REFLIST_LIST_TITLE_1', "Ihre Referals in Ebene <u>");
+define('MEMBER_REFLIST_LIST_TITLE_2', "</u> (<u>");
+define('MEMBER_REFLIST_LIST_TITLE_3', "&#37;</u> Ref-Verg&uuml;tung)");
+define('MEMBER_REFLIST_TITLE', "Referal-&Uuml;bersicht");
+define('MEMBER_REFLIST_POINTS', "Verdienst des Mitgliedes");
+define('MEMBER_REFLIST_ACTIVITY', "Mitglied aktiv?");
+define('MEMBER_REFLIST_COUNTER_1', "In dieser Ebene haben Sie <u>");
+define('MEMBER_REFLIST_COUNTER_2', "</u> Mitglieder geworben.");
+
+
 //
 ?>
index 35348a0..fece0bb 100644 (file)
@@ -48,14 +48,12 @@ define('ADMIN_CONFIG_REFBACK_MAX_PERCENTS', "Maximum erlaubte Refback-Prozente:"
 // Member language strings
 define('MEMBER_REFBACK_LIST_TITLE_1', "Ref-Back &Uuml;bersicht f&uuml;r Referal-Ebene <u>");
 define('MEMBER_REFBACK_LIST_TITLE_2', "</u> (<u>");
-define('MEMBER_REFBACK_LIST_TITLE_3', "</u>% Ref-Verg&uuml;tung)");
+define('MEMBER_REFBACK_LIST_TITLE_3', "&#37;</u> Ref-Verg&uuml;tung)");
 define('MEMBER_REFBACK_TITLE', "Ref-Back und Referal-&Uuml;bersicht");
 define('MEMBER_REFBACK_NOTE', "Hier k&ouml;nnen Sie in jeder Referal-Ebene jedem von Ihnen geworbenen Mitglied Ref-Back einstellen. Sollte Ihr Referal {!POINTS!} verdienen und diese ihm/ihr nicht direkt gutgeschrieben werden, so erh&auml;lt Ihr Referal die eingestellten Prozente von Ihrem Referalverdienst aufgebuch. Ihnen wird daf&uuml;r sein Anteil (=eingestellte Prozente) von dem Refverdienst abgezogen. Unter <strong>{--MEMBER_REFBACK_POINTS--}</strong> sind die {!POINTS!}-Gutschriften durch Ref-Back an das jeweilige Mitglied zu verstehen.");
 define('MEMBER_REFBACK_EXAMPLE', "Ein Rechenbeispiel: Ihr Ref <strong>X</strong> verdient 1000 {!POINTS!}, es sind 10&#37; in Ref-Ebene 1 eingestellt. Sie erhalten somit 100 {!POINTS!} in Ref-Ebene 1 gutgeschrieben. Nun haben Sie einen Refback von 90&#37; dem Ref gegeben. Ihrem Ref werden somit 90 und Ihnen die restlichen 10 {!POINTS!} gutgeschrieben.");
 define('MEMBER_REFBACK_NO_ENTRIES', "Es gibt technische Probleme mit der Refback-Tabelle. Bitte Support benachrichtigen.");
 define('MEMBER_REFBACK_EDIT_SUBMIT', "Refback einstellen");
-define('MEMBER_REFBACK_COUNTER_1', "In dieser Ebene haben Sie <u>");
-define('MEMBER_REFBACK_COUNTER_2', "</u> Mitglieder geworben.");
 define('MEMBER_REFBACK_REFID', "User-ID (Nickname)");
 define('MEMBER_REFBACK_STATUS', "Referal-Status");
 define('MEMBER_REFBACK_PERCENTS', "Ref-Back Prozente");
index 91150db..252bd0d 100644 (file)
@@ -90,14 +90,11 @@ if ((!is_array($result)) || (count($result) == 0) || (!isset($result[0]['id'])))
        return false;
 }
 
-// Temporary set max comma
-$_CONFIG['max_comma'] = 5;
-
 // Prepare all entries
 $OUT = ""; $SW = 2;
 foreach ($result as $entry) {
        // Translate some data
-       $entry['pay']    = TRANSLATE_COMMA($entry['pay']);
+       $entry['pay']    = TRANSLATE_COMMA($entry['pay'], true, 5);
        $entry['remain'] = TRANSLATE_COMMA($entry['remain']);
        $entry['sw']     = $SW;
 
index 5096a76..886cbcc 100644 (file)
@@ -85,15 +85,9 @@ if ($num_act > 0)
                                'rate'  => TRANSLATE_COMMA($rate),
                                'min'   => $min,
                                'curr'  => $curr,
-                               'price' => $min,
+                               'price' => TRANSLATE_COMMA($min),
                        );
 
-                       if (!ereg(",", $content['price']))
-                       {
-                               // Add missing zeros
-                               $content['price'] .= ",".str_repeat("0", $_CONFIG['max_comma']);
-                       }
-
                        // Load row template and switch color
                        $OUT_PAY .= LOAD_TEMPLATE("guest_sponsor_pay_row", true, $content);
                        $SW = 3 - $SW;
index ee458bf..e0d6552 100644 (file)
@@ -44,14 +44,6 @@ if (!defined('__SECURITY')) {
        return;
 }
 
-// Is the reflist system enabled?
-if ($_CONFIG['reflist_enabled'] == "N") {
-       // Output message
-       LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_REFBACK_DISABLED);
-       // Abort here
-       return false;
-} // END - if
-
 // Add description as navigation point
 ADD_DESCR("member", __FILE__);
 
@@ -73,24 +65,17 @@ if (SQL_NUMROWS($result) > 0) {
                $SW = 2;
 
                // Check for users ref in this level
-               foreach (GET_USER_REFS($GLOBALS['userid'], $content['level']) as $refRow) {
-                       // Not-deleted account is default
-                       $deleted = false;
-                       if (is_null($refRow['status'])) $deleted = true;
-
+               foreach (GET_USER_REF_POINTS($GLOBALS['userid'], $content['level']) as $refRow) {
                        // Add/"translate" more content
-                       $refRow['sw']      = $SW;
-                       $refRow['points']  = TRANSLATE_COMMA($refRow['points']);
-                       $refRow['reflist'] = TRANSLATE_COMMA($refRow['reflist']);
-                       $refRow['status']  = TRANSLATE_STATUS($refRow['status']);
+                       $refRow['sw']          = $SW;
+                       $refRow['points']      = TRANSLATE_COMMA($refRow['points']);
+                       $refRow['status']      = TRANSLATE_STATUS($refRow['status']);
+                       $refRow['unconfirmed'] = TRANSLATE_COMMA($refRow['unconfirmed']);
+                       $refRow['clickrate']   = TRANSLATE_COMMA($refRow['clickrate'], true, 1);
                        if (empty($refRow['nickname'])) $refRow['nickname'] = "---";
 
                        // Load row template
-                       if ($deleted) {
-                               $rows .= LOAD_TEMPLATE("member_reflist_list_row_deleted", true, $refRow);
-                       } else {
-                               $rows .= LOAD_TEMPLATE("member_reflist_list_row", true, $refRow);
-                       }
+                       $rows .= LOAD_TEMPLATE("member_ref_list_row", true, $refRow);
 
                        // Count this ref and switch color
                        $counter++;
@@ -103,11 +88,11 @@ if (SQL_NUMROWS($result) > 0) {
                $content['rows']     = $rows;
 
                // Load level template
-               $OUT .= LOAD_TEMPLATE("member_reflist_list_level", true, $content);
+               $OUT .= LOAD_TEMPLATE("member_ref_list_level", true, $content);
        } // END - while
 
        // Load main template
-       LOAD_TEMPLATE("member_reflist_list", false, $OUT);
+       LOAD_TEMPLATE("member_ref_list", false, $OUT);
 } else {
        // No entries
        LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_REFBACK_NO_ENTRIES);
index 2d187f0..1561819 100644 (file)
@@ -2202,5 +2202,70 @@ function USER_STATS_INSERT_RECORD ($uid, $type, $data) {
        }
 }
 
+// "Getter" for array for user refs and points in given level
+function GET_USER_REF_POINTS ($uid, $level) {
+       global $_CONFIG;
+
+       //* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
+       // Default is no refs and no nickname
+       $ADD = "";
+       $refs = array();
+
+       // Do we have nickname extension installed?
+       if (EXT_IS_ACTIVE("nickname")) {
+               $ADD = ", ud.nickname";
+       } // END - if
+
+       // Get refs from database
+       $result = SQL_QUERY_ESC("SELECT ur.id, ur.refid, ud.status, ud.last_online, ud.mails_confirmed, ud.emails_received".$ADD."
+FROM "._MYSQL_PREFIX."_user_refs AS ur
+LEFT JOIN "._MYSQL_PREFIX."_user_points AS up
+ON ur.refid=up.userid AND ur.level=0
+LEFT JOIN "._MYSQL_PREFIX."_user_data AS ud
+ON ur.refid=ud.userid
+WHERE ur.userid=%s AND ur.level=%s
+ORDER BY ur.refid ASC",
+               array(bigintval($uid), bigintval($level)), __FILE__, __LINE__);
+
+       // Are there some entries?
+       if (SQL_NUMROWS($result) > 0) {
+               // Fetch all entries
+               while ($row = SQL_FETCHARRAY($result)) {
+                       // Get total points of this user
+                       $row['points'] = GET_TOTAL_DATA($row['refid'], "user_points", "points") - GET_TOTAL_DATA($row['refid'], "user_data", "used_points");
+
+                       // Get unconfirmed mails
+                       $row['unconfirmed']  = GET_TOTAL_DATA($row['refid'], "user_links", "id", "userid", true);
+
+                       // Calculate clickrate
+                       $row['clickrate'] = ($row['mails_confirmed'] / $row['emails_received'] * 100);
+
+                       // Activity is "active" by default because if autopurge is not installed
+                       $row['activity'] = MEMBER_ACTIVITY_ACTIVE;
+
+                       // Is autopurge installed and the user inactive?
+                       if ((EXT_IS_ACTIVE("autopurge")) && ((time() - $_CONFIG['ap_inactive_since']) >= $row['last_online']))  {
+                               // Inactive user!
+                               $row['activity'] = MEMBER_ACTIVITY_INACTIVE;
+                       } // END - if
+
+                       // Remove some entries
+                       unset($row['mails_confirmed']);
+                       unset($row['emails_received']);
+                       unset($row['last_online']);
+
+                       // Add row
+                       $refs[$row['id']] = $row;
+               } // END - while
+       } // END - if
+
+       // Free result
+       SQL_FREERESULT($result);
+
+       // Return result
+       //* DEBUG: */ print "</li></ul>----------------------- <font color=\"#aa0000\">".__FUNCTION__." - EXIT</font> ------------------------<br />\n";
+       return $refs;
+}
+
 //
 ?>
diff --git a/templates/de/html/member/member_ref_list.tpl b/templates/de/html/member/member_ref_list.tpl
new file mode 100644 (file)
index 0000000..649daae
--- /dev/null
@@ -0,0 +1,10 @@
+<table border="0" cellspacing="0" cellpadding="0" class="member_table dashed" width="740">
+<tr>
+       <td align="center" class="member_header bottom2">
+               <strong>{--MEMBER_REFLIST_TITLE--}</strong>
+       </td>
+</tr>
+<tr><td class="seperator" height="5">&nbsp;</td></tr>
+$content
+<tr><td class="seperator">&nbsp;</td></tr>
+</table>
diff --git a/templates/de/html/member/member_ref_list_level.tpl b/templates/de/html/member/member_ref_list_level.tpl
new file mode 100644 (file)
index 0000000..64b55ae
--- /dev/null
@@ -0,0 +1,38 @@
+<tr>
+       <td align="center">
+<table border="0" cellspacing="0" cellpadding="0" class="member_table dashed" width="730">
+<tr>
+       <td align="center" class="member_header" colspan="6">
+               <strong>{--MEMBER_REFLIST_LIST_TITLE_1--}$content[level]{--MEMBER_REFLIST_LIST_TITLE_2--}$content[percents]{--MEMBER_REFLIST_LIST_TITLE_3--}</strong>
+       </td>
+</tr>
+<tr>
+       <td align="center" class="member_title2 bottom2 right2">
+               <strong>{--_UID--}</strong>
+       </td>
+       <td align="center" class="member_title2 bottom2 right2">
+               <strong>{--ACCOUNT_STATUS--}</strong>
+       </td>
+       <td align="center" class="member_title2 bottom2 right2">
+               <strong>{--MEMBER_REFLIST_POINTS--}</strong>
+       </td>
+       <td align="center" class="member_title2 bottom2 right2">
+               <strong>{--UNCONFIRMED_LINKS--}</strong>
+       </td>
+       <td align="center" class="member_title2 bottom2 right2">
+               <strong>{--EMAIL_PERCENT--}</strong>
+       </td>
+       <td align="center" class="member_title2 bottom2">
+               <strong>{--MEMBER_REFLIST_ACTIVITY--}</strong>
+       </td>
+</tr>
+$content[rows]
+<tr>
+       <td align="center" class="member_footer" colspan="6">
+               <span class="member_note">{--MEMBER_REFLIST_COUNTER_1--}$content[counter]{--MEMBER_REFLIST_COUNTER_2--}</span>
+       </td>
+</tr>
+</table>
+       </td>
+</tr>
+<tr><td class="seperator" height="5">&nbsp;</td></tr>
diff --git a/templates/de/html/member/member_ref_list_row.tpl b/templates/de/html/member/member_ref_list_row.tpl
new file mode 100644 (file)
index 0000000..f7b6bc7
--- /dev/null
@@ -0,0 +1,20 @@
+<tr>
+       <td align="center" class="switch_sw$content[sw] bottom2 right2">
+               $content[refid] ($content[nickname])
+       </td>
+       <td align="center" class="switch_sw$content[sw] bottom2 right2">
+               $content[status]
+       </td>
+       <td align="center" class="switch_sw$content[sw] bottom2 right2">
+               $content[points] {!POINTS!}
+       </td>
+       <td align="center" class="switch_sw$content[sw] bottom2 right2">
+               $content[unconfirmed]
+       </td>
+       <td align="center" class="switch_sw$content[sw] bottom2 right2">
+               $content[clickrate]&#37;
+       </td>
+       <td align="center" class="switch_sw$content[sw] bottom2 right2">
+               $content[activity]
+       </td>
+</tr>
index 45e03f9..8251570 100644 (file)
@@ -26,7 +26,7 @@
 $content[rows]
 <tr>
        <td align="center" class="member_footer" colspan="5">
-               <span class="member_note">{--MEMBER_REFBACK_COUNTER_1--}$content[counter]{--MEMBER_REFBACK_COUNTER_2--}</span>
+               <span class="member_note">{--MEMBER_REFLIST_COUNTER_1--}$content[counter]{--MEMBER_REFLIST_COUNTER_2--}</span>
        </td>
 </tr>
 </table>