| 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 Grégoire <bock@step.polymtl.ca> |
|---|
| 40 | * @copyright 2005-2006 Benoit Grégoire, Technologies Coeus inc. |
|---|
| 41 | * @version Subversion $Id$ |
|---|
| 42 | * @link http://www.wifidog.org/ |
|---|
| 43 | */ |
|---|
| 44 | |
|---|
| 45 | /** |
|---|
| 46 | * Load required classes |
|---|
| 47 | */ |
|---|
| 48 | require_once('classes/StatisticReport.php'); |
|---|
| 49 | |
|---|
| 50 | /** |
|---|
| 51 | * General report about a node |
|---|
| 52 | * |
|---|
| 53 | * @package WiFiDogAuthServer |
|---|
| 54 | * @subpackage Statistics |
|---|
| 55 | * @author Benoit Grégoire |
|---|
| 56 | * @copyright 2005-2006 Benoit Grégoire, Technologies Coeus inc. |
|---|
| 57 | */ |
|---|
| 58 | class NetworkStatus extends StatisticReport |
|---|
| 59 | { |
|---|
| 60 | /** Get the report's name. Must be overriden by the report class |
|---|
| 61 | * @return a localised string */ |
|---|
| 62 | public static function getReportName() |
|---|
| 63 | { |
|---|
| 64 | return _("Network status information"); |
|---|
| 65 | } |
|---|
| 66 | |
|---|
| 67 | /** Constructor |
|---|
| 68 | * @param $statistics_object Mandatory to give the report it's context */ |
|---|
| 69 | protected function __construct(Statistics $statistics_object) |
|---|
| 70 | { |
|---|
| 71 | parent :: __construct($statistics_object); |
|---|
| 72 | } |
|---|
| 73 | |
|---|
| 74 | /** Get the actual report. |
|---|
| 75 | * Classes must override this, but must call the parent's method with what |
|---|
| 76 | * would otherwise be their return value and return that instead. |
|---|
| 77 | * @param $child_html The child method's return value |
|---|
| 78 | * @return A html fragment |
|---|
| 79 | */ |
|---|
| 80 | public function getReportUI($child_html = null) |
|---|
| 81 | { |
|---|
| 82 | global $db; |
|---|
| 83 | $html = ''; |
|---|
| 84 | $selected_network = $this->stats->getSelectedNetworks(); |
|---|
| 85 | if (count($selected_network) == 0) |
|---|
| 86 | { |
|---|
| 87 | $html .= _("Sorry, this report requires you to select individual networks"); |
|---|
| 88 | } |
|---|
| 89 | else |
|---|
| 90 | { |
|---|
| 91 | //pretty_print_r($this->stats->getSelectedNodes ()); |
|---|
| 92 | foreach ($selected_network as $network_id => $networkObject) |
|---|
| 93 | { |
|---|
| 94 | $html .= "<fieldset>"; |
|---|
| 95 | $html .= "<legend>".$networkObject->getName()."</legend>"; |
|---|
| 96 | $html .= "<table>"; |
|---|
| 97 | |
|---|
| 98 | $html .= "<tr>"; |
|---|
| 99 | $html .= " <th>"._("Name")."</th>"; |
|---|
| 100 | $html .= " <td>".$networkObject->getName()."</td>"; |
|---|
| 101 | $html .= "</tr>"; |
|---|
| 102 | |
|---|
| 103 | $html .= "<tr class='odd'>"; |
|---|
| 104 | $html .= " <th>"._("Creation date")."</th>"; |
|---|
| 105 | $html .= " <td>".$networkObject->getCreationDate()."</td>"; |
|---|
| 106 | $html .= "</tr>"; |
|---|
| 107 | |
|---|
| 108 | $html .= "<tr>"; |
|---|
| 109 | $html .= " <th>"._("Homepage")."</th>"; |
|---|
| 110 | $html .= " <td>".$networkObject->getHomepageURL()."</td>"; |
|---|
| 111 | $html .= "</tr>"; |
|---|
| 112 | |
|---|
| 113 | $html .= "<tr class='odd'>"; |
|---|
| 114 | $html .= " <th>"._("Tech support email")."</th>"; |
|---|
| 115 | $html .= " <td>".$networkObject->getTechSupportEmail()."</td>"; |
|---|
| 116 | $html .= "</tr>"; |
|---|
| 117 | |
|---|
| 118 | $html .= "<tr>"; |
|---|
| 119 | $html .= " <th>"._("Validation grace time")."</th>"; |
|---|
| 120 | $html .= " <td>".Utils :: convertSecondsToWords($networkObject->getValidationGraceTime())."</td>"; |
|---|
| 121 | $html .= "</tr>"; |
|---|
| 122 | |
|---|
| 123 | $html .= "<tr class='odd'>"; |
|---|
| 124 | $html .= " <th>"._("Validation email")."</th>"; |
|---|
| 125 | $html .= " <td>".$networkObject->getValidationEmailFromAddress()."</td>"; |
|---|
| 126 | $html .= "</tr>"; |
|---|
| 127 | |
|---|
| 128 | $html .= "<tr>"; |
|---|
| 129 | $html .= " <th>"._("Allows multiple login")."?</th>"; |
|---|
| 130 | $html .= " <td>". ($networkObject->getMultipleLoginAllowed() ? 'yes' : 'no')."</td>"; |
|---|
| 131 | $html .= "</tr>"; |
|---|
| 132 | |
|---|
| 133 | $html .= "<tr class='odd'>"; |
|---|
| 134 | $html .= " <th>"._("Splash only nodes allowed")."?</th>"; |
|---|
| 135 | $html .= " <td>". ($networkObject->getSplashOnlyNodesAllowed() ? 'yes' : 'no')."</td>"; |
|---|
| 136 | $html .= "</tr>"; |
|---|
| 137 | |
|---|
| 138 | $html .= "<tr>"; |
|---|
| 139 | $html .= " <th>"._("Custom portal redirect nodes allowed")."?</th>"; |
|---|
| 140 | $html .= " <td>". ($networkObject->getCustomPortalRedirectAllowed() ? 'yes' : 'no')."</td>"; |
|---|
| 141 | $html .= "</tr>"; |
|---|
| 142 | |
|---|
| 143 | $html .= "<tr class='odd'>"; |
|---|
| 144 | $html .= " <th>"._("Number of users").":</th>"; |
|---|
| 145 | $html .= " <td>".$networkObject->getNumUsers()."</td>"; |
|---|
| 146 | $html .= "</tr>"; |
|---|
| 147 | |
|---|
| 148 | $html .= "<tr>"; |
|---|
| 149 | $html .= " <th>"._("Number of validated users").":</th>"; |
|---|
| 150 | $html .= " <td>".$networkObject->getNumValidUsers()."</td>"; |
|---|
| 151 | $html .= "</tr>"; |
|---|
| 152 | |
|---|
| 153 | $html .= "<tr class='odd'>"; |
|---|
| 154 | $html .= " <th>"._("Number of users currently online").":</th>"; |
|---|
| 155 | $html .= " <td>".$networkObject->getNumOnlineUsers()."</td>"; |
|---|
| 156 | $html .= "</tr>"; |
|---|
| 157 | $html .= "</table>"; |
|---|
| 158 | $html .= "</fieldset>"; |
|---|
| 159 | } //End foreach |
|---|
| 160 | } //End else |
|---|
| 161 | return parent :: getReportUI($html); |
|---|
| 162 | } |
|---|
| 163 | |
|---|
| 164 | } |
|---|
| 165 | |
|---|
| 166 | /* |
|---|
| 167 | * Local variables: |
|---|
| 168 | * tab-width: 4 |
|---|
| 169 | * c-basic-offset: 4 |
|---|
| 170 | * c-hanging-comment-ender-p: nil |
|---|
| 171 | * End: |
|---|
| 172 | */ |
|---|
| 173 | |
|---|
| 174 | |
|---|