htdocs/index.php
author Dan
Tue, 20 Jan 2009 22:08:17 -0500
changeset 52 a8f0e99883d1
parent 46 186507f67064
permissions -rw-r--r--
Web interface can now update with AJAX
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     1
<?php
52
a8f0e99883d1 Web interface can now update with AJAX
Dan
parents: 46
diff changeset
     2
require_once('../stats-fe.php');
a8f0e99883d1 Web interface can now update with AJAX
Dan
parents: 46
diff changeset
     3
require_once('../timezone.php');
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     4
20
e2f6e3af9959 Stats now uses MySQL backend
Dan
parents: 15
diff changeset
     5
$channel_list = stats_channel_list();
e2f6e3af9959 Stats now uses MySQL backend
Dan
parents: 15
diff changeset
     6
$first_channel = $channel_list[0];
e2f6e3af9959 Stats now uses MySQL backend
Dan
parents: 15
diff changeset
     7
$channel = ( isset($_REQUEST['channel']) && in_array($_REQUEST['channel'], $channel_list) ) ? $_REQUEST['channel'] : $first_channel;
44
73f74d395f95 Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents: 34
diff changeset
     8
73f74d395f95 Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents: 34
diff changeset
     9
$title = "$nick - Statistics";
73f74d395f95 Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents: 34
diff changeset
    10
require("./themes/$webtheme/header.php");
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    11
?>
52
a8f0e99883d1 Web interface can now update with AJAX
Dan
parents: 46
diff changeset
    12
    <script type="text/javascript" src="ajax-update.js"></script>
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    13
    <div style="float: right;">
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    14
      <p>
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    15
        <?php
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    16
        $tz_display = str_replace('_', ' ', str_replace('/', ': ', $tz));
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    17
        echo 'Time zone: ' . $tz_display . ' [<a href="changetz.php">change</a>]<br />';
20
e2f6e3af9959 Stats now uses MySQL backend
Dan
parents: 15
diff changeset
    18
        echo '<small>The time now is ' . date('H:i:s') . '.<br />Statistics now updated constantly (see <a href="news.php">news</a>)</small>';
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    19
        ?>
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    20
      </p>
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    21
      <p>
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    22
        <big><b>Channels:</b></big><br />
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    23
        <?php
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    24
          foreach ( $channels as $i => $c )
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    25
          {
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    26
            $bold = ( $c == $channel );
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    27
            echo $bold ? '<b>' : '';
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    28
            echo $bold ? '' : '<a href="index.php?channel=' . urlencode($c) . '">';
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    29
            echo $c;
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    30
            echo $bold ? '' : '</a>';
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    31
            echo $bold ? '</b>' : '';
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    32
            echo $i == count($channels) - 1 ? '' : ' | ';
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    33
          }
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    34
        ?>
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    35
      </p>
52
a8f0e99883d1 Web interface can now update with AJAX
Dan
parents: 46
diff changeset
    36
      <p>Update every <input id="update_ivl" size="3" value="..." style="text-align: center;" /> seconds<br />
a8f0e99883d1 Web interface can now update with AJAX
Dan
parents: 46
diff changeset
    37
         <small>(Javascript required, min. 5 secs, default 30)</small><br />
a8f0e99883d1 Web interface can now update with AJAX
Dan
parents: 46
diff changeset
    38
         </p>
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    39
    </div>
52
a8f0e99883d1 Web interface can now update with AJAX
Dan
parents: 46
diff changeset
    40
    <div id="active-members">
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    41
      <?php
52
a8f0e99883d1 Web interface can now update with AJAX
Dan
parents: 46
diff changeset
    42
      require('ajax-active.php');
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    43
      ?>
52
a8f0e99883d1 Web interface can now update with AJAX
Dan
parents: 46
diff changeset
    44
    </div>
45
53a50ba4d690 Added last 60 minutes graph to index.php
Dan
parents: 34
diff changeset
    45
    <h1>Last 60 minutes</h1>
52
a8f0e99883d1 Web interface can now update with AJAX
Dan
parents: 46
diff changeset
    46
    <img class="graph" alt="Graph image" src="graph.php?mode=lasthour&amp;channel=<?php echo urlencode($channel); ?>" />
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    47
    <h1>Last 24 hours</h1>
52
a8f0e99883d1 Web interface can now update with AJAX
Dan
parents: 46
diff changeset
    48
    <img class="graph" alt="Graph image" src="graph.php?mode=lastday&amp;channel=<?php echo urlencode($channel); ?>" />
34
a8daa2016cf1 Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents: 20
diff changeset
    49
    <h1>Last 2 weeks</h1>
52
a8f0e99883d1 Web interface can now update with AJAX
Dan
parents: 46
diff changeset
    50
    <img class="graph" alt="Graph image" src="graph.php?mode=lastweek&amp;channel=<?php echo urlencode($channel); ?>" />
44
73f74d395f95 Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents: 34
diff changeset
    51
<?php
73f74d395f95 Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents: 34
diff changeset
    52
require("./themes/$webtheme/footer.php");
73f74d395f95 Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents: 34
diff changeset
    53