Login   Register  
PHP Classes
elePHPant
Icontem

File: view.php3

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Pierre-henri Delaval  >  Counter  >  view.php3  >  Download  
File: view.php3
Role: ???
Content type: text/plain
Description: View the counters created
Class: Counter
Author: By
Last change:
Date: 2000-05-05 05:08
Size: 3,752 bytes
 

Contents

Class file image Download
<?
/******************* Configuration area *************************/

// Modify these path to fetch you configuration

include ('../../php-includes/metaclass/metabase_interface.php');
include ('../../php-includes/metaclass/metabase_database.php');

// modify the include file under to fecth the db you'll use
include ('../../php-includes/metaclass/metabase_ifx.php');

include ('../../php-includes/metaclass/dbaccess_class.php3');
include ('../../php-includes/counter/counter_class.php3');
?>

<html>
<head>
        <title>Counter</title>

        <style type="text/css">
        <!--
        a                                                 {text-decoration: none ;}
        a.bottom                                 {color: #ffffff ;text-weight: bold ;}
        a.archives                                 {color: #000000 ; text-weight: bold ;}
        a.archives:hover                {color: #808080 ; text-weight: bold ;}
        -->
        </style>
</head>

<body bgcolor="#ffffff" text="#336699" link="#ffffff" vlink="#ffffff" alink="#336699">

<table width="100%" cellpadding="1" cellspacing="1" border="0" bgcolor="#336699">
<tr><td><font face="verdana" size="4" color="#ffffff"><b>Counters</b></font></td></tr>
</table>

<p>
<center>

<?

// get min date fox the table

$Date_min = new Dbaccess ();
$Date_min->Query("select min(month) as min_date from counter");
$Date_min->NextRow();
$min_date = $Date_min->Get('min_date');
$Date_min->Close();

// get today month
$today_date = date("Ym");
settype($min_date,"integer");
settype($today_date,"integer");


$compteurs = new Dbaccess ();
$query = "select count(unique id_counter) as num_counters from counter";
$compteurs->Query($query);
$compteurs->NextRow();
$numrows = $compteurs->Get("num_counters");
$compteurs->Close();

$compteurs = new Dbaccess ();
$query = "select unique id_counter from counter";
$compteurs->Query($query);
settype($numrows,"integer");
$compteurs->SetMaxRow($numrows);

echo "<table cellpadding=\"1\" cellspacing=\"1\" border=\"0\"><tr>\n";
echo "<td bgcolor=\"#336699\" align=\"center\"><font face=\"verdana\" size=\"3\" color=\"#ffffff\"><b><i>Dates:</i></b></font></td>\n";



for ($month=$min_date;$month <= $today_date;$month++) {
	
	$rest = substr($month,0,4); // returns "bcdef"
	$rest = $rest . "/";
	$rest = $rest . substr($month, 4); // returns "bcd"
   echo "<td bgcolor=\"#336699\" align=\"center\"><font face=\"verdana\" size=\"3\" color=\"#ffffff\"><b><i>$rest</i></b></font></td>\n";
}

echo "</tr>";

if (isset($counter_id)) {
	        echo "<tr><td> Counter: " . $counter_id . "</td>";
	        for ($month=$min_date;$month <= $today_date;$month++) {
	                $values = new Dbaccess();
	                $query = "select *  from counter where id_counter = $counter_id and month = '$month'";
	                $values->Query($query);
	                $values->NextRow();
	                echo "<td align=\"right\">" . $values->Get('counts') . "</td>";
	        }
	        echo "</tr>\n";
}
else {
	while ($compteurs->NextRow()) {
	
	        $counter_id = $compteurs->Get("id_counter");
	        echo "<tr><td> Counter: " . $counter_id . "</td>";
	        for ($month=$min_date;$month <= $today_date;$month++) {
	                $values = new Dbaccess();
	                $query = "select *  from counter where id_counter = '$counter_id' and month = '$month'";
	                $values->Query($query);
	                $values->NextRow();
	                echo "<td align=\"right\">" . $values->Get('counts') . "</td>";
	        }
	        echo "</tr>\n";
	};
}

echo "</table>\n";

$compteurs->Close();
?>
</center>
</body>
</html>