Changeset 582 for trunk/web2/addons/job_monarch/libtoga.php
- Timestamp:
- 02/04/09 13:51:28 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/web2/addons/job_monarch/libtoga.php
r578 r582 1402 1402 $filtered_nodes = array(); 1403 1403 1404 $filter_checks = array(); 1405 1404 1406 foreach( $nodes as $node ) 1405 1407 { 1406 $hostname = $node->getHostname(); 1407 1408 $addhost = 1; 1409 1410 if( count( $this->filters ) > 0 ) 1411 { 1412 $mynjobs = $node->getJobs(); 1413 1414 if( $filtername == 'host' && $hostname == $filtervalue ) 1415 { 1416 $addhost = 1; 1417 $this->selected = $hostname; 1418 } 1419 else if( count( $mynjobs ) > 0 ) 1420 { 1421 foreach( $mynjobs as $myjob ) 1422 { 1423 foreach( $this->filters as $filtername => $filtervalue ) 1424 { 1425 if( $filtername!=null && $filtername!='' ) 1408 $hostname = $node->getHostname(); 1409 $mynjobs = $node->getJobs(); 1410 1411 foreach( $this->filters as $filtername => $filtervalue ) 1412 { 1413 $filter_checks[$filtername] = false; 1414 } 1415 1416 if( array_key_exists( 'host', $this->filters ) ) 1417 { 1418 if( $hostname == $this->filters['host'] ) 1419 { 1420 $this->selected = $hostname; 1421 $filtered_nodes[] = $hostname; 1422 //$filter_checks['host'] = true; 1423 } 1424 } 1425 1426 if( count( $mynjobs ) == 0 ) 1427 { 1428 continue; 1429 } 1430 1431 foreach( $mynjobs as $myjob ) 1432 { 1433 foreach( $this->filters as $filtername => $filtervalue ) 1434 { 1435 if( $filtername == 'jid' ) 1436 { 1437 if( $myjob == $filtervalue ) 1438 { 1439 $filter_checks['jid'] = true; 1440 } 1441 } 1442 if( $filtername == 'query' ) 1443 { 1444 foreach( $jobs[$myjob] as $myj_attr => $myj_val ) 1445 { 1446 if( is_array( $myj_val ) ) 1426 1447 { 1427 if( $filtername == 'jobid')1448 foreach( $myj_val as $myj_v ) 1428 1449 { 1429 if ( $myjob != $filtervalue )1450 if( strpos( $myj_v, $filtervalue ) !== false ) 1430 1451 { 1431 $addhost = 0; 1432 break; 1433 } 1434 else 1435 { 1436 $addhost = 1; 1437 break; 1438 } 1439 } 1440 else 1441 { 1442 if( $jobs[$myjob][$filtername] == $filtervalue ) 1443 { 1444 $addhost = 1; 1445 continue; 1446 } 1447 else if( $jobs[$myjob][$filtername] != $filtervalue ) 1448 { 1449 $addhost = 0; 1450 } 1451 if( $filtername == 'query' ) 1452 { 1453 foreach( $jobs[$myjob] as $myj_attr => $myj_val ) 1454 { 1455 if(!is_array( $myj_val ) ) 1456 { 1457 if( strpos( $myj_val, $filtervalue ) !== false ) 1458 { 1459 $addhost = 1; 1460 continue; 1461 } 1462 } 1463 else 1464 { 1465 foreach( $myj_val as $myj_v ) 1466 { 1467 if( strpos( $myj_v, $filtervalue ) !== false ) 1468 { 1469 $addhost = 1; 1470 continue; 1471 } 1472 } 1473 } 1474 if( strpos( $myjob, $filtervalue ) !== false ) 1475 { 1476 $addhost = 1; 1477 continue; 1478 } 1479 } 1452 $filter_checks['query'] = true; 1480 1453 } 1481 1454 } 1482 1455 } 1483 } 1484 } 1485 } 1486 else 1487 { 1488 $addhost = 0; 1489 } 1490 } 1491 1492 if( $addhost ) 1456 else 1457 { 1458 if( strpos( $myj_v, $filtervalue ) !== false ) 1459 { 1460 $filter_checks['query'] = true; 1461 } 1462 } 1463 } 1464 } 1465 if( $filtername != 'host' ) 1466 { 1467 if( $jobs[$myjob][$filtername] == $filtervalue ) 1468 { 1469 $filter_checks[$filtername] = true; 1470 } 1471 } 1472 } 1473 } 1474 1475 $addhost = true; 1476 1477 foreach( $filter_checks as $c_filtername => $c_filterfound ) 1478 { 1479 if( ! $c_filterfound ) 1480 { 1481 $addhost = false; 1482 } 1483 } 1484 1485 if( $addhost == true ) 1493 1486 { 1494 1487 $filtered_nodes[] = $hostname;
Note: See TracChangeset
for help on using the changeset viewer.