sumstats.php 23.8 KB
Newer Older
Leigh Stoller's avatar
Leigh Stoller committed
1 2
<?php
#
3
# Copyright (c) 2000-2018 University of Utah and the Flux Group.
Leigh Stoller's avatar
Leigh Stoller committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
# 
# {{{EMULAB-LICENSE
# 
# This file is part of the Emulab network testbed software.
# 
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
# 
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
# License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
# 
# }}}
#
chdir("..");
include("defs.php3");
include_once("geni_defs.php");
chdir("apt");
include("quickvm_sup.php");
29
include_once("instance_defs.php");
Leigh Stoller's avatar
Leigh Stoller committed
30 31 32 33 34
$page_title = "Summary Stats";

#
# Verify page arguments.
#
35 36 37
$optargs = OptionalPageArguments("showby",   PAGEARG_STRING,
                                 "min",      PAGEARG_INTEGER,
                                 "max",      PAGEARG_INTEGER);
Leigh Stoller's avatar
Leigh Stoller committed
38 39 40 41 42 43 44 45 46 47
if (!isset($showby)) {
    $showby = "user";
}

#
# Get current user.
#
RedirectSecure();
$this_user = CheckLoginOrRedirect();

48
if (! (ISADMIN() || ISFOREIGN_ADMIN())) {
Leigh Stoller's avatar
Leigh Stoller committed
49 50 51 52 53 54
    SPITUSERERROR("You do not have permission to view summary stats");
}
SPITHEADER(1);

echo "<link rel='stylesheet'
            href='css/tablesorter.css'>\n";
55 56
echo "<link rel='stylesheet'
            href='css/jQRangeSlider.css'>\n";
Leigh Stoller's avatar
Leigh Stoller committed
57 58 59

function ShowByCreator()
{
60 61 62
    global $urn_mapping, $TBBASE, $min, $max;
    $whereclause = "";

63
    if (isset($min)) {
64
        $whereclause = "where UNIX_TIMESTAMP(started) > $min ";
65
        if (isset($max)) {
66
            $whereclause .= "and UNIX_TIMESTAMP(started) < $max ";
67
        }
68
    }
Leigh Stoller's avatar
Leigh Stoller committed
69 70
    
    $query_result =
71
        DBQueryFatal("(select creator,aggregate_urn,count(creator) as ecount, ".
Leigh Stoller's avatar
Leigh Stoller committed
72 73 74
                     "   sum(physnode_count) as pcount, ".
                     "   truncate(sum(physnode_count * ".
                     "     ((UNIX_TIMESTAMP(destroyed) - ".
75
                     "       UNIX_TIMESTAMP(started)) / 3600.0)),2) as phours ".
76 77 78 79 80 81 82 83
                     " from apt_instance_history ".
                       $whereclause .
                     " group by creator,aggregate_urn) ".
                     "union ".
                     "(select creator,aggregate_urn,count(creator) as ecount,".
                     "   sum(physnode_count) as pcount, ".
                     "   truncate(sum(physnode_count * ".
                     "     ((UNIX_TIMESTAMP(now()) - ".
84
                     "       UNIX_TIMESTAMP(started)) / 3600.0)),2) as phours ".
85 86 87
                     " from apt_instances ".
                       $whereclause .
                     " group by creator,aggregate_urn)");
Leigh Stoller's avatar
Leigh Stoller committed
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
    #
    # Aggregate the per aggregate rows into a single row per user.
    #
    $uid_array = array();

    while ($row = mysql_fetch_array($query_result)) {
        $uid    = $row["creator"];
        $urn    = $row["aggregate_urn"];
        $cluster= $urn_mapping[$urn];
        $ecount = $row["ecount"];
        $pcount = $row["pcount"];
        $phours = $row["phours"];
    
        if (!array_key_exists($uid, $uid_array)) {
            $uid_array[$uid] = array("ecount" => 0,
103
                                     "pcount" => 0,
Leigh Stoller's avatar
Leigh Stoller committed
104 105 106 107 108 109 110 111 112 113 114
                                     "phours" => 0,
                                     "Utah"   => array("ecount" => 0,
                                                       "pcount" => 0,
                                                       "phours" => 0),
                                     "Wisc"   => array("ecount" => 0,
                                                       "pcount" => 0,
                                                       "phours" => 0),
                                     "Clem"   => array("ecount" => 0,
                                                       "pcount" => 0,
                                                       "phours" => 0),
                                     "APT"    => array("ecount" => 0,
115 116 117 118 119 120
                                                       "pcount" => 0,
                                                       "phours" => 0),
                                     "DDC"    => array("ecount" => 0,
                                                       "pcount" => 0,
                                                       "phours" => 0),
                                     "Emulab" => array("ecount" => 0,
Leigh Stoller's avatar
Leigh Stoller committed
121 122 123 124 125 126
                                                       "pcount" => 0,
                                                       "phours" => 0));
        }
        $uid_array[$uid]["ecount"] += $ecount;
        $uid_array[$uid]["pcount"] += $pcount;
        $uid_array[$uid]["phours"] += $phours;
127 128 129
        $uid_array[$uid][$cluster]["ecount"] += $ecount;
        $uid_array[$uid][$cluster]["pcount"] += $pcount;
        $uid_array[$uid][$cluster]["phours"] += $phours;
Leigh Stoller's avatar
Leigh Stoller committed
130
    }
131
    echo "<div id='output_dropdown'></div>\n";
Leigh Stoller's avatar
Leigh Stoller committed
132
    echo "<input class='form-control search' type='search' data-column='0'
133 134
             id='search_sumstats' placeholder='Search'>\n";
    echo "  <table class='tablesorter' id='tablesorter_sumstats'>
Leigh Stoller's avatar
Leigh Stoller committed
135 136
         <thead>
          <tr>
137
           <th rowspan=1>UID</th>
Leigh Stoller's avatar
Leigh Stoller committed
138 139 140 141 142
           <th colspan=3>Totals</th>
           <th colspan=3>APT</th>
           <th colspan=3>Utah</th>
           <th colspan=3>Wisc</th>
           <th colspan=3>Clem</th>
143 144
           <th colspan=3>Emulab</th>
           <th colspan=3>DDC</th>
Leigh Stoller's avatar
Leigh Stoller committed
145 146
          </tr>
          <tr>
147 148
           <th class='filter-false sorter-false'
               style='padding-left:1px; text-align:left'>Total</th>
Leigh Stoller's avatar
Leigh Stoller committed
149
           <th>Expt</th>
150
           <th>PCs</th>
Leigh Stoller's avatar
Leigh Stoller committed
151 152
           <th>PHours</th>
           <th>Expt</th>
153
           <th>PCs</th>
Leigh Stoller's avatar
Leigh Stoller committed
154 155
           <th>PHours</th>
           <th>Expt</th>
156
           <th>PCs</th>
Leigh Stoller's avatar
Leigh Stoller committed
157 158
           <th>PHours</th>
           <th>Expt</th>
159
           <th>PCs</th>
Leigh Stoller's avatar
Leigh Stoller committed
160 161
           <th>PHours</th>
           <th>Expt</th>
162
           <th>PCs</th>
Leigh Stoller's avatar
Leigh Stoller committed
163
           <th>PHours</th>
164 165 166 167 168 169
           <th>Expt</th>
           <th>PCs</th>
           <th>PHours</th>
           <th>Expt</th>
           <th>PCs</th>
           <th>PHours</th>
Leigh Stoller's avatar
Leigh Stoller committed
170 171
          </tr>
          <tr>
172
           <th class='filter-false sorter-false' data-math='col-count'>0</th>
Leigh Stoller's avatar
Leigh Stoller committed
173 174 175
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
176
                  data-math='col-sum' data-math-mask='##0'>0</th>
Leigh Stoller's avatar
Leigh Stoller committed
177 178 179
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
180
                  data-math='col-sum' data-math-mask='##0'>0</th>
Leigh Stoller's avatar
Leigh Stoller committed
181 182 183
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
184
                  data-math='col-sum' data-math-mask='##0'>0</th>
Leigh Stoller's avatar
Leigh Stoller committed
185 186 187
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
188
                  data-math='col-sum' data-math-mask='##0'>0</th>
Leigh Stoller's avatar
Leigh Stoller committed
189 190 191
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
192
                  data-math='col-sum' data-math-mask='##0'>0</th>
193 194 195 196 197 198 199 200
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
                  data-math='col-sum' data-math-mask='##0'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
                  data-math='col-sum' data-math-mask='##0'>0</th>
Leigh Stoller's avatar
Leigh Stoller committed
201 202 203 204 205 206 207 208
          </tr>
         </thead>\n";
 echo"   <tfoot>
          <tr>
           <th class='filter-false sorter-false'>Totals</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
209
                  data-math='col-sum' data-math-mask='##0'>0</th>
Leigh Stoller's avatar
Leigh Stoller committed
210 211 212
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
213
                  data-math='col-sum' data-math-mask='##0'>0</th>
Leigh Stoller's avatar
Leigh Stoller committed
214 215 216
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
217
                  data-math='col-sum' data-math-mask='##0'>0</th>
Leigh Stoller's avatar
Leigh Stoller committed
218 219 220
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
221
                  data-math='col-sum' data-math-mask='##0'>0</th>
Leigh Stoller's avatar
Leigh Stoller committed
222 223 224
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
225
                  data-math='col-sum' data-math-mask='##0'>0</th>
226 227 228 229 230 231 232 233
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
                  data-math='col-sum' data-math-mask='##0'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
                  data-math='col-sum' data-math-mask='##0'>0</th>
Leigh Stoller's avatar
Leigh Stoller committed
234 235 236 237
          </tr>
         </tfoot>\n";

    foreach ($uid_array as $uid => $ref) {
238
        $uid = "<a href='activity.php?user=$uid'>$uid</a>";
Leigh Stoller's avatar
Leigh Stoller committed
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257
        
        echo
            "<tr>".
            "<td>$uid</td>".
            "<td>" . $ref["ecount"] . "</td> ".
            "<td>" . $ref["pcount"] . "</td> ".
            "<td>" . $ref["phours"] . "</td> ".
            "<td>" . $ref["APT"]["ecount"] . "</td> ".
            "<td>" . $ref["APT"]["pcount"] . "</td> ".
            "<td>" . $ref["APT"]["phours"] . "</td> ".
            "<td>" . $ref["Utah"]["ecount"] . "</td> ".
            "<td>" . $ref["Utah"]["pcount"] . "</td> ".
            "<td>" . $ref["Utah"]["phours"] . "</td> ".
            "<td>" . $ref["Wisc"]["ecount"] . "</td> ".
            "<td>" . $ref["Wisc"]["pcount"] . "</td> ".
            "<td>" . $ref["Wisc"]["phours"] . "</td> ".
            "<td>" . $ref["Clem"]["ecount"] . "</td> ".
            "<td>" . $ref["Clem"]["pcount"] . "</td> ".
            "<td>" . $ref["Clem"]["phours"] . "</td> ".
258 259 260 261 262 263
            "<td>" . $ref["Emulab"]["ecount"] . "</td> ".
            "<td>" . $ref["Emulab"]["pcount"] . "</td> ".
            "<td>" . $ref["Emulab"]["phours"] . "</td> ".
            "<td>" . $ref["DDC"]["ecount"] . "</td> ".
            "<td>" . $ref["DDC"]["pcount"] . "</td> ".
            "<td>" . $ref["DDC"]["phours"] . "</td> ".
Leigh Stoller's avatar
Leigh Stoller committed
264 265 266 267 268 269 270
            "</tr>\n";
    }
    echo "</table>";
}

function ShowByProject()
{
271 272 273
    global $urn_mapping, $TBBASE, $min, $max;
    $whereclause = "";

274
    if (isset($min)) {
275
        $whereclause = "where UNIX_TIMESTAMP(started) > $min ";
276
        if (isset($max)) {        
277
            $whereclause .= " and UNIX_TIMESTAMP(started) < $max ";
278
        }
279
    }
Leigh Stoller's avatar
Leigh Stoller committed
280 281
    
    $query_result =
282
        DBQueryFatal("(select pid,aggregate_urn,count(pid) as ecount, ".
Leigh Stoller's avatar
Leigh Stoller committed
283 284 285
                     "   sum(physnode_count) as pcount, ".
                     "   truncate(sum(physnode_count * ".
                     "     ((UNIX_TIMESTAMP(destroyed) - ".
286
                     "       UNIX_TIMESTAMP(started)) / 3600.0)),2) as phours ".
287 288 289 290 291 292 293 294
                     " from apt_instance_history ".
                       $whereclause .
                     " group by pid,aggregate_urn) ".
                     "union ".
                     "(select pid,aggregate_urn,count(pid) as ecount, ".
                     "   sum(physnode_count) as pcount, ".
                     "   truncate(sum(physnode_count * ".
                     "     ((UNIX_TIMESTAMP(now()) - ".
295
                     "       UNIX_TIMESTAMP(started)) / 3600.0)),2) as phours ".
296 297 298
                     " from apt_instances ".
                       $whereclause .
                     " group by pid,aggregate_urn)");
Leigh Stoller's avatar
Leigh Stoller committed
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317
    #
    # Aggregate the per aggregate rows into a single row per user.
    #
    $pid_array = array();

    while ($row = mysql_fetch_array($query_result)) {
        $pid    = $row["pid"];
        $urn    = $row["aggregate_urn"];
        $cluster= $urn_mapping[$urn];
        $ecount = $row["ecount"];
        $pcount = $row["pcount"];
        $phours = $row["phours"];

        if (!$pid) {
            $pid = "NONE";
        }
    
        if (!array_key_exists($pid, $pid_array)) {
            $pid_array[$pid] = array("ecount" => 0,
318
                                     "pcount" => 0,
Leigh Stoller's avatar
Leigh Stoller committed
319 320 321 322 323 324 325 326 327 328 329
                                     "phours" => 0,
                                     "Utah"   => array("ecount" => 0,
                                                       "pcount" => 0,
                                                       "phours" => 0),
                                     "Wisc"   => array("ecount" => 0,
                                                       "pcount" => 0,
                                                       "phours" => 0),
                                     "Clem"   => array("ecount" => 0,
                                                       "pcount" => 0,
                                                       "phours" => 0),
                                     "APT"    => array("ecount" => 0,
330 331 332 333 334 335
                                                       "pcount" => 0,
                                                       "phours" => 0),
                                     "Emulab" => array("ecount" => 0,
                                                       "pcount" => 0,
                                                       "phours" => 0),
                                     "DDC"    => array("ecount" => 0,
Leigh Stoller's avatar
Leigh Stoller committed
336 337 338 339 340 341
                                                       "pcount" => 0,
                                                       "phours" => 0));
        }
        $pid_array[$pid]["ecount"] += $ecount;
        $pid_array[$pid]["pcount"] += $pcount;
        $pid_array[$pid]["phours"] += $phours;
342 343 344
        $pid_array[$pid][$cluster]["ecount"] += $ecount;
        $pid_array[$pid][$cluster]["pcount"] += $pcount;
        $pid_array[$pid][$cluster]["phours"] += $phours;
Leigh Stoller's avatar
Leigh Stoller committed
345
    }
346
    echo "<div id='output_dropdown'></div>\n";
Leigh Stoller's avatar
Leigh Stoller committed
347
    echo "<input class='form-control search' type='search' data-column='0'
348 349
             id='search_sumstats' placeholder='Search'>\n";
    echo "  <table class='tablesorter' id='tablesorter_sumstats'>
Leigh Stoller's avatar
Leigh Stoller committed
350 351
         <thead>
          <tr>
352
           <th rowspan=1>PID</th>
Leigh Stoller's avatar
Leigh Stoller committed
353 354 355 356 357
           <th colspan=3>Totals</th>
           <th colspan=3>APT</th>
           <th colspan=3>Utah</th>
           <th colspan=3>Wisc</th>
           <th colspan=3>Clem</th>
358 359
           <th colspan=3>Emulab</th>
           <th colspan=3>DDC</th>
Leigh Stoller's avatar
Leigh Stoller committed
360 361
          </tr>
          <tr>
362 363
           <th class='filter-false sorter-false'
               style='padding-left:1px; text-align:left'>Total</th>
Leigh Stoller's avatar
Leigh Stoller committed
364
           <th>Expt</th>
365
           <th>PCs</th>
Leigh Stoller's avatar
Leigh Stoller committed
366 367
           <th>Phours</th>
           <th>Expt</th>
368
           <th>PCs</th>
Leigh Stoller's avatar
Leigh Stoller committed
369 370
           <th>Phours</th>
           <th>Expt</th>
371
           <th>PCs</th>
Leigh Stoller's avatar
Leigh Stoller committed
372 373
           <th>Phours</th>
           <th>Expt</th>
374
           <th>PCs</th>
Leigh Stoller's avatar
Leigh Stoller committed
375 376
           <th>Phours</th>
           <th>Expt</th>
377
           <th>PCs</th>
Leigh Stoller's avatar
Leigh Stoller committed
378
           <th>Phours</th>
379 380 381 382 383 384
           <th>Expt</th>
           <th>PCs</th>
           <th>Phours</th>
           <th>Expt</th>
           <th>PCs</th>
           <th>Phours</th>
Leigh Stoller's avatar
Leigh Stoller committed
385 386
          </tr>
          <tr>
387
           <th class='filter-false sorter-false' data-math='col-count'>0</th>
Leigh Stoller's avatar
Leigh Stoller committed
388 389 390
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
391
                  data-math='col-sum' data-math-mask='##0'>0</th>
Leigh Stoller's avatar
Leigh Stoller committed
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
                  data-math='col-sum' data-math-mask='##0.00'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
                  data-math='col-sum' data-math-mask='##0.00'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
                  data-math='col-sum' data-math-mask='##0.00'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
                  data-math='col-sum' data-math-mask='##0.00'>0</th>
408 409 410 411 412 413 414 415
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
                  data-math='col-sum' data-math-mask='##0.00'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
                  data-math='col-sum' data-math-mask='##0.00'>0</th>
Leigh Stoller's avatar
Leigh Stoller committed
416 417 418 419 420 421 422 423
          </tr>
         </thead>\n";
 echo"   <tfoot>
          <tr>
           <th class='filter-false sorter-false'>Totals</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
424
                  data-math='col-sum' data-math-mask='##0'>0</th>
Leigh Stoller's avatar
Leigh Stoller committed
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
                  data-math='col-sum' data-math-mask='##0.00'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
                  data-math='col-sum' data-math-mask='##0.00'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
                  data-math='col-sum' data-math-mask='##0.00'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
                  data-math='col-sum' data-math-mask='##0.00'>0</th>
441 442 443 444 445 446 447 448
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
                  data-math='col-sum' data-math-mask='##0.00'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' data-math='col-sum'>0</th>
           <th class='filter-false sorter-false' 
                  data-math='col-sum' data-math-mask='##0.00'>0</th>
Leigh Stoller's avatar
Leigh Stoller committed
449 450 451 452 453
          </tr>
         </tfoot>\n";

    foreach ($pid_array as $pid => $ref) {
        if ($pid != "NONE") {
454
            $pid = "<a href='activity.php?pid=$pid'>$pid</a>";
Leigh Stoller's avatar
Leigh Stoller committed
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473
        }
        echo
            "<tr>".
            "<td>$pid</td>".
            "<td>" . $ref["ecount"] . "</td> ".
            "<td>" . $ref["pcount"] . "</td> ".
            "<td>" . $ref["phours"] . "</td> ".
            "<td>" . $ref["APT"]["ecount"] . "</td> ".
            "<td>" . $ref["APT"]["pcount"] . "</td> ".
            "<td>" . $ref["APT"]["phours"] . "</td> ".
            "<td>" . $ref["Utah"]["ecount"] . "</td> ".
            "<td>" . $ref["Utah"]["pcount"] . "</td> ".
            "<td>" . $ref["Utah"]["phours"] . "</td> ".
            "<td>" . $ref["Wisc"]["ecount"] . "</td> ".
            "<td>" . $ref["Wisc"]["pcount"] . "</td> ".
            "<td>" . $ref["Wisc"]["phours"] . "</td> ".
            "<td>" . $ref["Clem"]["ecount"] . "</td> ".
            "<td>" . $ref["Clem"]["pcount"] . "</td> ".
            "<td>" . $ref["Clem"]["phours"] . "</td> ".
474 475 476 477 478 479
            "<td>" . $ref["Emulab"]["ecount"] . "</td> ".
            "<td>" . $ref["Emulab"]["pcount"] . "</td> ".
            "<td>" . $ref["Emulab"]["phours"] . "</td> ".
            "<td>" . $ref["DDC"]["ecount"] . "</td> ".
            "<td>" . $ref["DDC"]["pcount"] . "</td> ".
            "<td>" . $ref["DDC"]["phours"] . "</td> ".
Leigh Stoller's avatar
Leigh Stoller committed
480 481 482 483
            "</tr>\n";
    }
    echo "</table>";
}
484 485 486 487 488 489 490
$minmax = "";
if (isset($min)) {
    $minmax .= "&min=$min";
    if (isset($max)) {
        $minmax .= "&max=$max";
    }
}
491
if ($showby == "user") {
492
    echo "<a href='sumstats.php?showby=project$minmax'>".
493
        "Show project stats</a>,";
494 495
}
else {
496
    echo "<a href='sumstats.php?showby=user$minmax'>".
497
        "Show user stats</a>,"; 
498
}
499 500
echo "<a href='summary-graphs.php'> Summary Graphs</a><br>\n";

Leigh Stoller's avatar
Leigh Stoller committed
501
echo "<div class='row'>
502 503 504 505 506 507 508 509 510
        <div class='col-xs-10 col-xs-offset-1'>\n";
echo "    <div id='date-slider'></div>\n";
echo "  </div>\n";
echo "<button type='button' id='slider-go-button'
         class='btn btn-primary btn-xs'
         style='margin-left: 20px; margin-top: 40px;'>Go</button>\n";   
echo "</div><br>\n";
echo "<div class='row'>
        <div class='col-xs-12 col-xs-offset-0'>\n";
Leigh Stoller's avatar
Leigh Stoller committed
511 512 513 514 515 516 517 518 519
if ($showby == "user") {
    ShowByCreator();
}
else {
    ShowByProject();
}
echo " </div>
      </div>\n";

520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543
echo "<script type='text/javascript'>\n";
if (isset($min)) {
    echo "    window.MIN  = $min;\n";
}
else {
    echo "    window.MIN  = null;\n";
}
if (isset($max)) {
    echo "    window.MAX  = $max;\n";
}
else {
    echo "    window.MAX  = null;\n";
}
echo "</script>\n";
echo "<script src='js/lib/jquery-ui.js'></script>\n";
echo "<script src='js/lib/jQRangeSlider/jQRangeSliderMouseTouch.js'></script>\n";
echo "<script src='js/lib/jQRangeSlider/jQRangeSliderDraggable.js'></script>\n";
echo "<script src='js/lib/jQRangeSlider/jQRangeSliderHandle.js'></script>\n";
echo "<script src='js/lib/jQRangeSlider/jQRangeSliderBar.js'></script>\n";
echo "<script src='js/lib/jQRangeSlider/jQRangeSliderLabel.js'></script>\n";
echo "<script src='js/lib/jQRangeSlider/jQRangeSlider.js'></script>\n";
echo "<script src='js/lib/jQRangeSlider/jQDateRangeSliderHandle.js'></script>\n";
echo "<script src='js/lib/jQRangeSlider/jQDateRangeSlider.js'></script>\n";
echo "<script src='js/lib/jQRangeSlider/jQRuler.js'></script>\n";
Leigh Stoller's avatar
Leigh Stoller committed
544 545 546
echo "<script src='js/lib/jquery.tablesorter.min.js'></script>\n";
echo "<script src='js/lib/jquery.tablesorter.widgets.min.js'></script>\n";
echo "<script src='js/lib/jquery.tablesorter.widget-math.js'></script>\n";
547
echo "<script src='js/lib/jquery.tablesorter.widget-output.js'></script>\n";
Leigh Stoller's avatar
Leigh Stoller committed
548

549 550 551 552 553
REQUIRE_SUP();
REQUIRE_MOMENT();
SPITREQUIRE("js/sumstats.js");

AddTemplate("output-dropdown");
Leigh Stoller's avatar
Leigh Stoller committed
554 555
SPITFOOTER();
?>