X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-list_refs.php;h=0be210ce71a89b2e810f27866edbed29a397eac6;hb=0176313718a3887a7d833d578142ae41d3a06a15;hp=83b1760ceda9d482c048b26ac55c90a120ee923f;hpb=dbe56bb043ba16ca1ec1e9efa9effdc1f0612261;p=mailer.git
diff --git a/inc/modules/admin/what-list_refs.php b/inc/modules/admin/what-list_refs.php
index 83b1760ced..0be210ce71 100644
--- a/inc/modules/admin/what-list_refs.php
+++ b/inc/modules/admin/what-list_refs.php
@@ -1,12 +1,12 @@
0
+ORDER BY
+ `level` ASC", __FILE__, __LINE__);
// Are there some levels (VERY BAD IF NONE!)
- if (SQL_NUMROWS($result_levels) > 0) {
- // List all ref levels
- $OUT = ""; $SW = 2;
+ if (!SQL_HASZERONUMS($result_levels)) {
+ // List all ref levels or entries if no refback is installed
+ $OUT = '';
while ($levels = SQL_FETCHARRAY($result_levels)) {
- // Insert more data
- $levels['sw'] = $SW;
- $levels['level'] = ($levels['level'] + 1);
+ // Is the refback still active? ;-)
+ if (isExtensionActive('refback')) {
+ // Load all refs of this user
+ $result_refs = SQL_QUERY_ESC("SELECT `refid` FROM `{?_MYSQL_PREFIX?}_user_refs` WHERE `userid`=%s AND `level`='%s' ORDER BY refid ASC",
+ array($userid, $levels['level']), __FILE__, __LINE__);
+ //* DEBUG: */ debugOutput($userid.'/'.$levels['level'].'/'.SQL_NUMROWS($result_refs));
+
+ // Do we have levels?
+ if (!SQL_HASZERONUMS($result_refs)) {
+ // Count entries
+ $menge = countSumTotalData($userid, 'user_data', 'userid', 'refid', true);
+ $menge_lck = countSumTotalData($userid, 'user_data', 'userid', 'refid', true, " AND `status` != 'CONFIRMED'");
+
+ // Output info message
+ $levels['info'] = sprintf(getMessage('ADMIN_USER_TOTAL_REFS'), generateUserProfileLink($userid), $menge, $menge_lck);
+
+ // Init variables
+ $OUT_REFS = '';
+
+ // Load all refs
+ while ($content = SQL_FETCHARRAY($result_refs)) {
+ // Is the data there?
+ if (fetchUserData($content['refid'])) {
+ // Check for referals
+ $refs_cnt = countSumTotalData(getUserData('userid'), 'user_refs', 'id', 'userid', true);
+
+ // Prepare data for the template
+ // @TODO Try to rewrite some to EL
+ $content = array(
+ 'userid' => getUserData('userid'),
+ 'gender' => getUserData('gender'),
+ 'refs_link' => 0,
+ 'surname' => getUserData('surname'),
+ 'family' => getUserData('family'),
+ 'email' => '[' . getUserData('email') . ']',
+ 'status' => getUserData('status'),
+ 'registered' => generateDateTime(getUserData('joined'), 3),
+ );
- // Load all refs of this user
- //$result_refs = SQL_QUERY_ESC("SELECT
- // Load level template
- $OUT .= LOAD_TEMPLATE("admin_list_refs_level", true, $levels);
+ // Check if referal count is larger 0 and update link
+ if ($refs_cnt > 0) {
+ $content['refs_link'] = generateUserProfileLink(getUserData('userid'), $refs_cnt, 'list_refs');
+ } // END - if
- // Switch colors
- $SW = 3 - $SW;
- } // END - if
+ // Load template for level one
+ $OUT_REFS .= loadTemplate('admin_list_refs_row', true, $content);
+ } else {
+ // No refs found
+ $OUT_REFS = loadTemplate('admin_list_refs_nodata', true, $content);
+ }
+
+ // Add content
+ $levels['rows'] = $OUT_REFS;
+ } // END - while
+ } else {
+ // Output info message
+ $levels['info'] = sprintf(getMessage('ADMIN_USER_TOTAL_REFS'), generateUserProfileLink($userid), 0, 0);
+
+ // No refs found
+ $levels['rows'] = loadTemplate('admin_list_refs_norefs', true, array('userid' => $userid));
+ }
+
+ // Free result
+ SQL_FREERESULT($result_refs);
+
+ // Load level template
+ $OUT .= loadTemplate('admin_list_refs_level', true, $levels);
+ } else {
+ // Check for referals
+ $refs_cnt = countSumTotalData($levels['userid'], 'user_data', 'userid', 'refid', true);
+
+ // Prepare data for the template
+ $content = array(
+ 'userid' => $levels['userid'],
+ 'gender' => $levels['gender'],
+ 'refs_link' => 0,
+ 'surname' => $levels['surname'],
+ 'family' => $levels['family'],
+ 'email' => '[' . $levels['email'] . ']',
+ 'status' => $levels['status'],
+ 'registered' => generateDateTime($levels['joined'], 3),
+ );
+
+ // Check if referal count is larger 0 and update link
+ if ($refs_cnt > 0) $content['refs_link'] = generateUserProfileLink($levels['userid'], $refs_cnt, 'list_refs');
+
+ // Load template for level one
+ $OUT .= loadTemplate('admin_list_refs_row', true, $content);
+ }
+ } // END - while
// Prepare content
$content = array(
- 'rows' => $OUT,
- 'uid' => ADMIN_USER_PROFILE_LINK($_GET['u_id'])
+ 'rows' => $OUT,
+ 'userid' => getRequestParameter('userid')
);
- // Load mein template
- LOAD_TEMPLATE("admin_list_refs", false, $content);
- } else {
+ // Load main template
+ if (isExtensionActive('refback')) {
+ loadTemplate('admin_list_refs2', false, $content);
+ } else {
+ loadTemplate('admin_list_refs', false, $content);
+ }
+ } elseif (isExtensionActive('refback')) {
// No levels found, very bad!
- LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_NO_REF_LEVELS);
+ displayMessage('{--ADMIN_NO_REFERAL_LEVELS--}');
+ } else {
+ // No refs made so far
+ displayMessage('{--USER_REFERAL_404--}');
}
// Free result
SQL_FREERESULT($result_levels);
} else {
// User not found
- LOAD_TEMPLATE("admin_settings_saved", false, sprintf(ADMIN_MEMBER_404, $_GET['u_id']));
+ displayMessage(getMaskedMessage('ADMIN_MEMBER_404', getRequestParameter('userid')));
}
-
- // Free memory
- SQL_FREERESULT($result);
} else {
// Output selection form with all confirmed user accounts listed
- ADD_MEMBER_SELECTION_BOX();
+ addMemberSelectionBox();
}
-//
+// [EOF]
?>