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

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

web/addons/job_monarch/overview.php,
web/addons/job_monarch/index.php,
web/addons/job_monarch/libtoga.php,
web/addons/job_monarch/image.php:

  • fixes for latest php4, is more strict with foreach loop
  • Property svn:keywords set to Id
File size: 2.3 KB
Line 
1<?php
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 *
22 * SVN $Id: image.php 300 2007-04-12 13:01:26Z bastiaans $
23 */
24
25include_once "./libtoga.php";
26
27if ( !empty( $_GET ) ) {
28        extract( $_GET );
29}
30
31$httpvars = new HTTPVariables( $HTTP_GET_VARS, $_GET );
32$view = $httpvars->getHttpVar( "view" );
33$clustername = $httpvars->getClusterName();
34
35//printf("clustername = %s\n", $clustername );
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;
40
41function drawSmallClusterImage() {
42
43        global $clustername;
44
45        $data_gatherer = new DataGatherer( $clustername );
46        $data_gatherer->parseXML();
47
48        if( $data_gatherer->isJobmonRunning() )
49                $ic = new ClusterImage( $clustername );
50        else
51                $ic = new EmptyImage();
52
53        $ic->draw();
54}
55
56function drawBigClusterImage() {
57
58        global $filter, $clustername;
59
60        $ic = new ClusterImage( $clustername );
61
62        if( isset( $filter ) ) {
63                foreach( $filter as $filtername=>$filtervalue ) {
64                        //printf("filter %s,%s\n", $filtername, $filtervalue);
65                        switch( $filtername ) {
66
67                                case "id":
68                                        $ic->setFilter( 'jobid', $filtervalue );
69                                        break;
70                                case "user":
71                                        $ic->setFilter( 'owner', $filtervalue);
72                                        break;
73                                case "queue":
74                                        $ic->setFilter( 'queue', $filtervalue);
75                                        break;
76                                case "state":
77                                        $ic->setFilter( 'status', $filtervalue);
78                                        break;
79                                default:
80                                        break;
81                        }
82                }
83        }
84        $ic->draw();
85}
86
87switch( $view ) {
88
89        case "small-clusterimage":
90
91                drawSmallClusterImage();
92               
93                break;
94
95        case "big-clusterimage":
96
97                drawBigClusterImage();
98       
99                break;
100
101        default:
102
103                break;
104}
105
106?>
Note: See TracBrowser for help on using the repository browser.