htdocs/index.php
changeset 52 a8f0e99883d1
parent 46 186507f67064
--- a/htdocs/index.php	Tue Jan 20 22:08:07 2009 -0500
+++ b/htdocs/index.php	Tue Jan 20 22:08:17 2009 -0500
@@ -1,6 +1,6 @@
 <?php
-require('../stats-fe.php');
-require('../timezone.php');
+require_once('../stats-fe.php');
+require_once('../timezone.php');
 
 $channel_list = stats_channel_list();
 $first_channel = $channel_list[0];
@@ -9,6 +9,7 @@
 $title = "$nick - Statistics";
 require("./themes/$webtheme/header.php");
 ?>
+    <script type="text/javascript" src="ajax-update.js"></script>
     <div style="float: right;">
       <p>
         <?php
@@ -32,51 +33,21 @@
           }
         ?>
       </p>
+      <p>Update every <input id="update_ivl" size="3" value="..." style="text-align: center;" /> seconds<br />
+         <small>(Javascript required, min. 5 secs, default 30)</small><br />
+         </p>
     </div>
-    <h1>Active members</h1>
-    <p>For the last 1, 5, and 15 minutes:
-        <?php echo count(stats_activity_percent($channel, 1)) . ', ' .
-                   count(stats_activity_percent($channel, 5)) . ', ' .
-                   count(stats_activity_percent($channel, 15)) . ' (respectively)';
-        ?>
-        </p>
-    <h1>Currently active members:</h1>
-    <p>These people have posted in the last 3 minutes:</p>
-    <ul>
+    <div id="active-members">
       <?php
-      $datum = stats_activity_percent($channel, 3);
-      $count = stats_message_count($channel, 3);
-      if ( empty($datum) )
-        echo '<li>No recent posts.</li>';
-      foreach ( $datum as $usernick => $pct )
-      {
-        $total = round($pct * $count);
-        $pct = round(100 * $pct, 1);
-        echo "<li>$usernick - $pct% ($total)</li>\n";
-      }
+      require('ajax-active.php');
       ?>
-    </ul>
-    <p>Last 20 minutes:</p>
-    <ul>
-      <?php
-      $datum = stats_activity_percent($channel, 20);
-      $count = stats_message_count($channel, 20);
-      if ( empty($datum) )
-        echo '<li>No recent posts.</li>';
-      foreach ( $datum as $usernick => $pct )
-      {
-        $total = round($pct * $count);
-        $pct = round(100 * $pct, 1);
-        echo "<li>$usernick - $pct% ($total)</li>\n";
-      }
-      ?>
-    </ul>
+    </div>
     <h1>Last 60 minutes</h1>
-    <img alt="Graph image" src="graph.php?mode=lasthour&amp;channel=<?php echo urlencode($channel); ?>" />
+    <img class="graph" alt="Graph image" src="graph.php?mode=lasthour&amp;channel=<?php echo urlencode($channel); ?>" />
     <h1>Last 24 hours</h1>
-    <img alt="Graph image" src="graph.php?mode=lastday&amp;channel=<?php echo urlencode($channel); ?>" />
+    <img class="graph" alt="Graph image" src="graph.php?mode=lastday&amp;channel=<?php echo urlencode($channel); ?>" />
     <h1>Last 2 weeks</h1>
-    <img alt="Graph image" src="graph.php?mode=lastweek&amp;channel=<?php echo urlencode($channel); ?>" />
+    <img class="graph" alt="Graph image" src="graph.php?mode=lastweek&amp;channel=<?php echo urlencode($channel); ?>" />
 <?php
 require("./themes/$webtheme/footer.php");