]> git.mxchange.org Git - mailer.git/commitdiff
Admin surfbar stats finished
authorRoland Häder <roland@mxchange.org>
Sun, 12 Oct 2008 19:03:18 +0000 (19:03 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 12 Oct 2008 19:03:18 +0000 (19:03 +0000)
.gitattributes
inc/databases.php
inc/language/surfbar_de.php
inc/libs/rallye_functions.php
inc/modules/admin/what-surfbar_stats.php
templates/de/html/admin/admin_surfbar_stats.tpl [new file with mode: 0644]
templates/de/html/admin/admin_surfbar_stats_row.tpl [new file with mode: 0644]
templates/de/html/admin/admin_surfbar_url_stats.tpl [new file with mode: 0644]
templates/de/html/admin/admin_surfbar_url_stats_row.tpl [new file with mode: 0644]

index 4d8da6f0231b11bf4e5a9738d345813cd94d9c1e..75e81371aab8658d45b46af6d6873e63e9b7cff8 100644 (file)
@@ -1102,6 +1102,10 @@ templates/de/html/admin/admin_settings_saved.tpl -text
 templates/de/html/admin/admin_sponsor_paytypes.tpl -text
 templates/de/html/admin/admin_sub_points.tpl -text
 templates/de/html/admin/admin_sub_points_all.tpl -text
+templates/de/html/admin/admin_surfbar_stats.tpl -text
+templates/de/html/admin/admin_surfbar_stats_row.tpl -text
+templates/de/html/admin/admin_surfbar_url_stats.tpl -text
+templates/de/html/admin/admin_surfbar_url_stats_row.tpl -text
 templates/de/html/admin/admin_task_holiday.tpl -text
 templates/de/html/admin/admin_theme_404.tpl -text
 templates/de/html/admin/admin_theme_edit.tpl -text
index 2bd89166f63c7daeac11b1331c9108bc58474afd..938ce9ee6fa57958393c61f9cab71a4b582f1d0c 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', "507");
+define('CURR_SVN_REVISION', "508");
 
 // Take a prime number which is long (if you know a longer one please try it out!)
 define('_PRIME', 591623);
index 294e2c016edcad15327b1e3dcad76a88448bfc6b..b31300bfb4153c2d4315045e3e28214bea89e7c0 100644 (file)
@@ -94,6 +94,13 @@ define('ADMIN_SURFBAR_URL_ADDED', "URL wurde der Surfbar hinzugef&uuml;gt.");
 define('ADMIN_SURFBAR_URL_NOT_ADDED', "URL wurde wegen Fehler nicht hinzugef&uuml;gt. Ist die URL bereits vorhanden?");
 define('ADMIN_SURFBAR_ADD_URL', "URL hinzuf&uuml;gen");
 define('ADMIN_BUILD_STATUS_HANDLER', "Status-Handler");
+define('ADMIN_SURFBAR_NO_STATS', "Keine Surfbar-Statistiken vorhanden!");
+define('ADMIN_SURFBAR_STATS_TITLE', "Mitglieder-Statistik der Surfbar");
+define('ADMIN_SURFBAR_VISITED_URLS', "Aufgerufene URLs");
+define('ADMIN_SURFBAR_TOTAL_VISITS', "Gesamtbesuche");
+define('ADMIN_SURFBAR_TOTALS', "Zusammenfassung");
+define('ADMIN_SURFBAR_LAST_ONLINE', "Letzter Aufruf der URL");
+define('ADMIN_SURFBAR_URL_STATS_TITLE', "URL-bezogene Statistik der Surfbar");
 
 // Admin titles
 define('ADMIN_SURFBAR_LIST_URLS_TITLE', "Surfbar - URLs aufisten");
index 3faa726f6c53f38199f5b64926c6b6843514b43f..700d0ca4d0d14d5cbed3be5f882266c9f615cb18 100644 (file)
@@ -740,6 +740,7 @@ function RALLYE_TEMPLATE_SELECTION($name="template", $default="")
 //
 function RALLYE_GET_REFCOUNT($uid, $old=0) {
        global $_CONFIG, $cacheArray;
+
        // Check current refs
        if (GET_EXT_VERSION("cache") >= "0.1.2") {
                // Get refs from cache
index c758fdb18fc857f28467125e65406754d782aab3..12f405332d3059cf8fb8dd6f9c7e5a66fd941f09 100644 (file)
@@ -40,5 +40,90 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
 // Add description as navigation point
 ADD_DESCR("admin", __FILE__);
 
+// Is the 'url_id' set?
+if (isset($_GET['url_id'])) {
+       // Generate general statistics
+       $result = SQL_QUERY_ESC("SELECT `userid`, `count` AS `total_visits`, UNIX_TIMESTAMP(`last_online`) AS `last_online`
+FROM `"._MYSQL_PREFIX."_surfbar_stats`
+WHERE `url_id`=%s
+ORDER BY `userid` ASC",
+               array(bigintval($_GET['url_id'])), __FILE__, __LINE__);
+
+       // Entries found?
+       if (SQL_NUMROWS($result) > 0) {
+               // Get all rows
+               $OUT = ""; $SW = 2; $cnt = 0; $visits = 0;
+               while ($content = SQL_FETCHARRAY($result)) {
+                       // Count totals
+                       $visits += $content['total_visits'];
+
+                       // "Translate" some data
+                       $content['userid']       = ADMIN_USER_PROFILE_LINK($content['userid']);
+                       $content['total_visits'] = TRANSLATE_COMMA($content['total_visits']);
+                       $content['last_online']  = MAKE_DATETIME($content['last_online'], "2");
+
+                       // Load row template
+                       $OUT .= LOAD_TEMPLATE("admin_surfbar_url_stats_row", true, $content);
+                       $cnt++;
+               } // END - while
+
+               // Prepare content
+               $content = array(
+                       'rows'    => $OUT,
+                       'userids' => $cnt,
+                       'visits'  => $visits
+               );
+
+
+               // Load main template
+               LOAD_TEMPLATE("admin_surfbar_url_stats", false, $content);
+       } else {
+               // No statistics so far
+               LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_SURFBAR_NO_URL_STATS);
+       }
+} else {
+       // Generate general statistics
+       $result = SQL_QUERY("SELECT `userid`, COUNT(`url_id`) AS `visited_urls`, SUM(`count`) AS `total_visits`
+FROM `"._MYSQL_PREFIX."_surfbar_stats`
+GROUP BY `userid`
+ORDER BY `userid` ASC", __FILE__, __LINE__);
+
+       // Entries found?
+       if (SQL_NUMROWS($result) > 0) {
+               // Get all rows
+               $OUT = ""; $SW = 2; $urls = 0; $visits = 0;
+               while ($content = SQL_FETCHARRAY($result)) {
+                       // Count totals
+                       $urls   += $content['visited_urls'];
+                       $visits += $content['total_visits'];
+
+                       // "Translate" some data
+                       $content['userid']       = ADMIN_USER_PROFILE_LINK($content['userid']);
+                       $content['visited_urls'] = TRANSLATE_COMMA($content['visited_urls']);
+                       $content['total_visits'] = TRANSLATE_COMMA($content['total_visits']);
+
+                       // Load row template
+                       $OUT .= LOAD_TEMPLATE("admin_surfbar_stats_row", true, $content);
+               } // END - while
+
+               // Prepare content
+               $content = array(
+                       'rows'   => $OUT,
+                       'urls'   => $urls,
+                       'visits' => $visits
+               );
+
+
+               // Load main template
+               LOAD_TEMPLATE("admin_surfbar_stats", false, $content);
+       } else {
+               // No statistics so far
+               LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_SURFBAR_NO_STATS);
+       }
+}
+
+// Free result
+SQL_FREERESULT($result);
+
 //
 ?>
diff --git a/templates/de/html/admin/admin_surfbar_stats.tpl b/templates/de/html/admin/admin_surfbar_stats.tpl
new file mode 100644 (file)
index 0000000..744fb51
--- /dev/null
@@ -0,0 +1,30 @@
+<table border="0" cellspacing="0" cellpadding="0" class="admin_table dashed" width="600">
+<tr>
+       <td colspan="3" align="center" class="admin_header bottom2" height="30">
+               <strong>{--ADMIN_SURFBAR_STATS_TITLE--}</strong>
+       </td>
+</tr>
+<tr>
+       <td align="center" width="33%" class="admin_title bottom2 right2">
+               <strong>{--_UID--}:</strong>
+       </td>
+       <td align="center" width="34%" class="admin_title bottom2 right2">
+               <strong>{--ADMIN_SURFBAR_VISITED_URLS--}:</strong>
+       </td>
+       <td align="center" width="33%" class="admin_title bottom2">
+               <strong>{--ADMIN_SURFBAR_TOTAL_VISITS--}:</strong>
+       </td>
+</tr>
+$content[rows]
+<tr>
+       <td class="admin_footer right2" align="right" style="padding-right:2px">
+               <strong>{--ADMIN_SURFBAR_TOTALS--}:</strong>
+       </td>
+       <td class="admin_footer right2">
+               <strong>$content[urls]</strong>
+       </td>
+       <td class="admin_footer">
+               <strong>$content[visits]</strong>
+       </td>
+</tr>
+</table>
diff --git a/templates/de/html/admin/admin_surfbar_stats_row.tpl b/templates/de/html/admin/admin_surfbar_stats_row.tpl
new file mode 100644 (file)
index 0000000..3bb5028
--- /dev/null
@@ -0,0 +1,5 @@
+<tr>
+       <td align="center" class="bottom2 right2">[<strong>$content[userid]</strong>]</td>
+       <td align="center" class="bottom2 right2">$content[visited_urls]</td>
+       <td align="center" class="bottom2">$content[total_visits]</td>
+</tr>
diff --git a/templates/de/html/admin/admin_surfbar_url_stats.tpl b/templates/de/html/admin/admin_surfbar_url_stats.tpl
new file mode 100644 (file)
index 0000000..5ab1bec
--- /dev/null
@@ -0,0 +1,30 @@
+<table border="0" cellspacing="0" cellpadding="0" class="admin_table dashed" width="600">
+<tr>
+       <td colspan="3" align="center" class="admin_header bottom2" height="30">
+               <strong>{--ADMIN_SURFBAR_URL_STATS_TITLE--}</strong>
+       </td>
+</tr>
+<tr>
+       <td align="center" width="33%" class="admin_title bottom2 right2">
+               <strong>{--_UID--}:</strong>
+       </td>
+       <td align="center" width="34%" class="admin_title bottom2 right2">
+               <strong>{--ADMIN_SURFBAR_TOTAL_VISITS--}:</strong>
+       </td>
+       <td align="center" width="33%" class="admin_title bottom2">
+               <strong>{--ADMIN_SURFBAR_LAST_ONLINE--}:</strong>
+       </td>
+</tr>
+$content[rows]
+<tr>
+       <td class="admin_footer right2" align="right" style="padding-right:2px">
+               <strong>{--ADMIN_SURFBAR_TOTALS--}:</strong>
+       </td>
+       <td class="admin_footer right2">
+               <strong>$content[visits]</strong>
+       </td>
+       <td class="admin_footer">
+               <strong>$content[userids]</strong>
+       </td>
+</tr>
+</table>
diff --git a/templates/de/html/admin/admin_surfbar_url_stats_row.tpl b/templates/de/html/admin/admin_surfbar_url_stats_row.tpl
new file mode 100644 (file)
index 0000000..925ee64
--- /dev/null
@@ -0,0 +1,5 @@
+<tr>
+       <td align="center" class="bottom2 right2">[<strong>$content[userid]</strong>]</td>
+       <td align="center" class="bottom2 right2">$content[total_visits]</td>
+       <td align="center" class="bottom2">$content[last_online]</td>
+</tr>