root/trunk/wifidog-auth/wifidog/classes/StatisticReport.php @ 1013

Revision 1013, 4.7 KB (checked in by benoitg, 7 years ago)

* dump_initial_data_postgres.sh: Add the
content_available_display_pages table to the dump, can someone
re-generate the initial data from a working install
* Remove the ?> tags from all the classes.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?php
2
3/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
4
5// +-------------------------------------------------------------------+
6// | WiFiDog Authentication Server                                     |
7// | =============================                                     |
8// |                                                                   |
9// | The WiFiDog Authentication Server is part of the WiFiDog captive  |
10// | portal suite.                                                     |
11// +-------------------------------------------------------------------+
12// | PHP version 5 required.                                           |
13// +-------------------------------------------------------------------+
14// | Homepage:     http://www.wifidog.org/                             |
15// | Source Forge: http://sourceforge.net/projects/wifidog/            |
16// +-------------------------------------------------------------------+
17// | This program is free software; you can redistribute it and/or     |
18// | modify it under the terms of the GNU General Public License as    |
19// | published by the Free Software Foundation; either version 2 of    |
20// | the License, or (at your option) any later version.               |
21// |                                                                   |
22// | This program is distributed in the hope that it will be useful,   |
23// | but WITHOUT ANY WARRANTY; without even the implied warranty of    |
24// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     |
25// | GNU General Public License for more details.                      |
26// |                                                                   |
27// | You should have received a copy of the GNU General Public License |
28// | along with this program; if not, contact:                         |
29// |                                                                   |
30// | Free Software Foundation           Voice:  +1-617-542-5942        |
31// | 59 Temple Place - Suite 330        Fax:    +1-617-542-2652        |
32// | Boston, MA  02111-1307,  USA       gnu@gnu.org                    |
33// |                                                                   |
34// +-------------------------------------------------------------------+
35
36/**
37 * @package    WiFiDogAuthServer
38 * @subpackage Statistics
39 * @author     Benoit Gregoire <bock@step.polymtl.ca>
40 * @copyright  2005-2006 Benoit Gregoire, Technologies Coeus inc.
41 * @version    Subversion $Id$
42 * @link       http://www.wifidog.org/
43 */
44
45/**
46 * Load required classes
47 */
48require_once('classes/StatisticGraph.php');
49
50/**
51 * An abstract class.  All statistics must inherit from this class
52 *
53 * @package    WiFiDogAuthServer
54 * @subpackage Statistics
55 * @author     Benoit Gregoire <bock@step.polymtl.ca>
56 * @copyright  2005-2006 Benoit Gregoire, Technologies Coeus inc.
57 */
58abstract class StatisticReport
59{
60    protected $stats; /**< The Statistics object passed to the constructor */
61    /** Get the report's name.  Must be overriden by the report class
62     * @return a localised string */
63    abstract public static function getReportName();
64
65    /** Get the report object.
66     * @param $statistics_object Mandatory to give the report it's context
67     * @return a localised string */
68    final public static function getObject($classname, Statistics $statistics_object)
69    {
70        return new $classname ($statistics_object);
71    }
72
73    /** Is the report available.  (Are all dependencies available,
74     * are all preconditions in the statistics calss available, etc.)
75     * Always returns true unless overriden by the child class
76     * @param $statistics_object Mandatory to give the report it's context
77     * @param &$errormsg Optionnal error message returned by the class
78     * @return true or false */
79    public static function isAvailable(Statistics $statistics_object, & $errormsg = null)
80    {
81        return true;
82    }
83
84    /** Constructor, must be called by subclasses
85         * @param $statistics_object Mandatory to give the report it's context */
86    protected function __construct(Statistics $statistics_object)
87    {
88        $this->stats = $statistics_object;
89    }
90
91    /** Get the actual report.
92     * Classes must override this, but must call the parent's method with what
93     * would otherwise be their return value and return that instead.
94     * @param $child_html The child method's return value
95     * @return A html fragment
96     */
97    public function getReportUI($child_html)
98    {
99        $html = '';
100        $html .= "<fieldset class='pretty_fieldset'>";
101        $html .= "<legend>".$this->getReportName()."</legend>";
102        $html .= $child_html;
103        $html .= "</fieldset>";
104        return $html;
105    }
106
107}
108
109/*
110 * Local variables:
111 * tab-width: 4
112 * c-basic-offset: 4
113 * c-hanging-comment-ender-p: nil
114 * End:
115 */
116
117
Note: See TracBrowser for help on using the browser.