source: trunk/web/addons/job_monarch/image.php @ 303

Last change on this file since 303 was 303, checked in by bastiaans, 17 years ago

web/addons/job_monarch/image.php:

web/addons/job_monarch/overview.php:

  • removed function makeTime -> moved to libtoga.php

web/addons/job_monarch/libtoga.php:

  • Property svn:keywords set to Id
File size: 2.7 KB
RevLine 
[110]1<?php
[225]2/*
3 *
4 * This file is part of Jobmonarch
5 *
6 * Copyright (C) 2006  Ramon Bastiaans
7 *
8 * Jobmonarch is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * Jobmonarch is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21 *
[231]22 * SVN $Id: image.php 303 2007-04-16 14:28:06Z bastiaans $
[225]23 */
24
[110]25include_once "./libtoga.php";
26
[122]27if ( !empty( $_GET ) ) {
28        extract( $_GET );
29}
30
[117]31$httpvars = new HTTPVariables( $HTTP_GET_VARS, $_GET );
[110]32$view = $httpvars->getHttpVar( "view" );
[111]33$clustername = $httpvars->getClusterName();
[110]34
[163]35//printf("clustername = %s\n", $clustername );
[124]36if( isset($id) && ($id!='')) $filter[id]=$id;
37if( isset($state) && ($state!='')) $filter[state]=$state;
38if( isset($user) && ($user!='')) $filter[user]=$user;
39if( isset($queue) && ($queue!='')) $filter[queue]=$queue;
[122]40
[303]41function drawHostImage() {
42
43        global $clustername, $hostname;
44
45        $data_gatherer = new DataGatherer( $clustername );
46        $data_gatherer->parseXML();
47
48        if( $data_gatherer->isJobmonRunning() )
49                $ic = new HostImage( $data_gatherer, $clustername, $hostname );
50        else
51                $ic = new EmptyImage();
52
53        $ic->draw();
54}
55
[110]56function drawSmallClusterImage() {
57
[164]58        global $clustername;
59
[298]60        $data_gatherer = new DataGatherer( $clustername );
61        $data_gatherer->parseXML();
62
63        if( $data_gatherer->isJobmonRunning() )
64                $ic = new ClusterImage( $clustername );
65        else
66                $ic = new EmptyImage();
67
[110]68        $ic->draw();
69}
70
71function drawBigClusterImage() {
72
[163]73        global $filter, $clustername;
[122]74
75        $ic = new ClusterImage( $clustername );
76
[300]77        if( isset( $filter ) ) {
78                foreach( $filter as $filtername=>$filtervalue ) {
79                        //printf("filter %s,%s\n", $filtername, $filtervalue);
80                        switch( $filtername ) {
81
82                                case "id":
83                                        $ic->setFilter( 'jobid', $filtervalue );
84                                        break;
85                                case "user":
86                                        $ic->setFilter( 'owner', $filtervalue);
87                                        break;
88                                case "queue":
89                                        $ic->setFilter( 'queue', $filtervalue);
90                                        break;
91                                case "state":
92                                        $ic->setFilter( 'status', $filtervalue);
93                                        break;
94                                default:
95                                        break;
96                        }
[124]97                }
[122]98        }
[114]99        $ic->draw();
[110]100}
101
102switch( $view ) {
103
104        case "small-clusterimage":
105
106                drawSmallClusterImage();
107               
108                break;
109
110        case "big-clusterimage":
111
112                drawBigClusterImage();
113       
114                break;
115
[303]116        case "hostimage":
117
118                drawHostImage();
119       
120                break;
121
[110]122        default:
123
124                break;
125}
126
127?>
Note: See TracBrowser for help on using the repository browser.