mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-30 19:02:27 +00:00 
			
		
		
		
	Changed cmd.php to handle xCAT response that is embedded in multiple layers. Worked on hmc inventory. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6832 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
		
			
				
	
	
		
			50 lines
		
	
	
		
			1017 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
		
			1017 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| /**
 | |
|  * Main xCAT page
 | |
|  */
 | |
| require_once "lib/functions.php";
 | |
| require_once "lib/ui.php";
 | |
| require_once "lib/jsonwrapper.php";
 | |
| 
 | |
| /* Load page */
 | |
| loadPage();
 | |
| 
 | |
| /* Login user */
 | |
| if (!isAuthenticated()) {
 | |
| 	login();
 | |
| } else {
 | |
| 	loadContent();
 | |
| }
 | |
| 
 | |
| /**
 | |
|  * Test lib/cmd.php
 | |
|  */
 | |
| function testCmdPhp() {
 | |
| 	$xml = docmd('rinv', 'ca4dsls08', array('all'));
 | |
| 	$rsp = array();
 | |
| 
 | |
| 	foreach ($xml->children() as $child) {
 | |
| 		// Get the 1st level child
 | |
| 		foreach ($child->children() as $level_one) {
 | |
| 			if ($level_one->children()) {
 | |
| 				// Get the 2nd level child
 | |
| 				foreach ($level_one->children() as $level_two) {
 | |
| 					if ($level_two->children()) {
 | |
| 						// Get the 3rd level child
 | |
| 						foreach ($level_two->children() as $level_three) {
 | |
| 							array_push($rsp, "$level_three");
 | |
| 						}
 | |
| 					} else {
 | |
| 						array_push($rsp, "$level_two");
 | |
| 					}
 | |
| 				}
 | |
| 			} else {
 | |
| 				array_push($rsp, "$level_one");
 | |
| 			}
 | |
| 		}
 | |
| 	}
 | |
|   	
 | |
| 	$rtn = array("rsp" => $rsp, "msg" => '');
 | |
| 	echo json_encode($rtn);
 | |
| }
 | |
| ?>
 |