Changeset 718 for branches/0.4/web/addons/job_monarch/image.php
- Timestamp:
- 03/21/13 21:44:55 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.4/web/addons/job_monarch/image.php
r714 r718 31 31 function checkSessionData() { 32 32 33 33 global $_SESSION; 34 34 35 35 session_start(); 36 36 37 38 $myxml_data= &$_SESSION["data"];39 40 $myxml_data= 0;41 37 if( isset( $_SESSION["data"] ) ) { 38 $myxml_data = &$_SESSION["data"]; 39 } else { 40 $myxml_data = 0; 41 } 42 42 43 44 45 43 if( !$myxml_data ) { 44 $ds = new DataSource(); 45 $myxml_data = $ds->getData(); 46 46 47 48 47 } 48 return $myxml_data; 49 49 } 50 50 … … 61 61 function drawHostImage() { 62 62 63 63 global $clustername, $hostname, $data_gatherer; 64 64 65 66 65 $ds = new DataSource(); 66 $myxml_data = $ds->getData(); 67 67 68 $data_gatherer= new DataGatherer( $clustername );68 $data_gatherer = new DataGatherer( $clustername ); 69 69 70 70 $data_gatherer->parseXML( $myxml_data ); 71 71 72 73 74 75 72 if( $data_gatherer->isJobmonRunning() ) 73 $ic = new HostImage( $data_gatherer, $clustername, $hostname ); 74 else 75 $ic = new EmptyImage(); 76 76 77 77 $ic->draw(); 78 78 } 79 79 80 80 function drawSmallClusterImage() { 81 81 82 82 global $clustername, $data_gatherer; 83 83 84 85 84 $ds = new DataSource(); 85 $myxml_data = $ds->getData(); 86 86 87 $data_gatherer= new DataGatherer( $clustername );87 $data_gatherer = new DataGatherer( $clustername ); 88 88 89 89 $data_gatherer->parseXML( $myxml_data ); 90 90 91 92 93 94 95 96 91 if( $data_gatherer->isJobmonRunning() ) { 92 $ic = new ClusterImage( $myxml_data, $clustername ); 93 $ic->setSmall(); 94 } else { 95 $ic = new EmptyImage(); 96 } 97 97 98 98 $ic->draw(); 99 99 } 100 100 101 101 function drawBigClusterImage() { 102 102 103 103 global $filter, $clustername; 104 104 105 $myxml_data= checkSessionData();105 $myxml_data = checkSessionData(); 106 106 107 108 107 $ic = new ClusterImage( $myxml_data, $clustername ); 108 $ic->setBig(); 109 109 110 111 112 110 if( isset( $filter ) ) { 111 foreach( $filter as $filtername=>$filtervalue ) { 112 switch( $filtername ) { 113 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 114 case "id": 115 $ic->setFilter( 'jobid', $filtervalue ); 116 break; 117 case "owner": 118 $ic->setFilter( 'owner', $filtervalue); 119 break; 120 case "queue": 121 $ic->setFilter( 'queue', $filtervalue); 122 break; 123 case "state": 124 $ic->setFilter( 'status', $filtervalue); 125 break; 126 default: 127 break; 128 } 129 } 130 } 131 $ic->draw(); 132 132 } 133 133 134 134 switch( $view ) { 135 135 136 136 case "small-clusterimage": 137 137 138 139 140 138 drawSmallClusterImage(); 139 140 break; 141 141 142 142 case "big-clusterimage": 143 143 144 145 146 144 drawBigClusterImage(); 145 146 break; 147 147 148 148 case "hostimage": 149 149 150 151 152 150 drawHostImage(); 151 152 break; 153 153 154 154 default: 155 155 156 156 break; 157 157 } 158 158
Note: See TracChangeset
for help on using the changeset viewer.