summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4455a0e)
raw | patch | inline | side by side (parent: 4455a0e)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 22 Aug 2008 13:58:23 +0000 (13:58 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 22 Aug 2008 13:58:23 +0000 (13:58 +0000) |
-Implemented a new xml parse method which is more reliable
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12262 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12262 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/opsi/admin/opsi/class_opsi.inc | patch | blob | history |
diff --git a/gosa-plugins/opsi/admin/opsi/class_opsi.inc b/gosa-plugins/opsi/admin/opsi/class_opsi.inc
index 2e42a3abe74c0fd2087ff47ef8ba97983f7ab553..727314ee25faacd7cd0939a448568d1bd50d1bf1 100644 (file)
class opsi extends gosaSupportDaemon
{
private $config = NULL;
+ protected $use_alternative_xml_parse_method = TRUE;
/*! \brief Create opsi object.
@param
$data = array();
foreach($res as $entry){
- if(!isset($entry['MAC'])) $entry['MAC'] = "";;
+ if(!isset($entry['MAC'][0]['VALUE'])) $entry['MAC'][0]['VALUE'] = "";
$data[] = array(
- "dn" => "opsi:=".$entry['NAME'].",".get_ou("winstations").$this->config->current['BASE'],
+ "dn" => "opsi:=".$entry['NAME'][0]['VALUE'].",".get_ou("winstations").$this->config->current['BASE'],
"objectClass" => array("gosa_opsi_client"),
- "cn" => array(0 => $entry['NAME']),
- "description" => array(0 => $entry['DESCRIPTION']),
- "macAddress" => array(0 => $entry['MAC']),
- "opsi_notes" => array(0 => $entry['NOTES']));
+ "cn" => array(0 => $entry['NAME'][0]['VALUE']),
+ "description" => array(0 => $entry['DESCRIPTION'][0]['VALUE']),
+ "macAddress" => array(0 => $entry['MAC'][0]['VALUE']),
+ "opsi_notes" => array(0 => $entry['NOTES'][0]['VALUE']));
}
}
+ private function xml_to_array($xml,$alternative_method = FALSE)
+ {
+ echo "asd";
+ return(gosaSupportDaemon::xml_to_array($xml,TRUE));
+ }
+
/******************
SI Communication functions
******************/
$res = $this->send_data("gosa_opsi_get_netboot_products",$this->target,$data,TRUE);
$items = array();
- if(isset($res['XML']['ITEM']['PRODUCTID'])){
- if(!is_array($res['XML']['ITEM']['PRODUCTID'])){
- $items[$res['XML']['ITEM']['PRODUCTID']]['NAME'] = $res['XML']['ITEM']['PRODUCTID'];
- $items[$res['XML']['ITEM']['PRODUCTID']]['DESC'] = $res['XML']['ITEM']['DESCRIPTION'];
+ if(isset($res['XML'][0]['ITEM']['PRODUCTID'])){
+ if(!is_array($res['XML'][0]['ITEM']['PRODUCTID'])){
+ $items[$res['XML'][0]['ITEM']['PRODUCTID']]['NAME'] = $res['XML'][0]['ITEM']['PRODUCTID'];
+ $items[$res['XML'][0]['ITEM']['PRODUCTID']]['DESC'] = $res['XML'][0]['ITEM']['DESCRIPTION'];
}else{
- foreach($res['XML']['ITEM']['PRODUCTID'] as $id => $name){
+ foreach($res['XML'][0]['ITEM']['PRODUCTID'] as $id => $name){
$items[$name]['NAME'] = $name;
- $items[$name]['DESC'] = $res['XML']['ITEM']['DESCRIPTION'][$id];
+ $items[$name]['DESC'] = $res['XML'][0]['ITEM']['DESCRIPTION'][$id];
}
}
}
$res = $this->send_data("gosa_opsi_get_local_products",$this->target,$data,TRUE);
$items = array();
- if(isset($res['XML']['ITEM']['PRODUCTID'])){
- if(!is_array($res['XML']['ITEM']['PRODUCTID'])){
- $items[$res['XML']['ITEM']['PRODUCTID']]['NAME'] = $res['XML']['ITEM']['PRODUCTID'];
- $items[$res['XML']['ITEM']['PRODUCTID']]['DESC'] = $res['XML']['ITEM']['DESCRIPTION'];
+ if(isset($res['XML'][0]['ITEM']['PRODUCTID'])){
+ if(!is_array($res['XML'][0]['ITEM']['PRODUCTID'])){
+ $items[$res['XML'][0]['ITEM']['PRODUCTID']]['NAME'] = $res['XML'][0]['ITEM']['PRODUCTID'];
+ $items[$res['XML'][0]['ITEM']['PRODUCTID']]['DESC'] = $res['XML'][0]['ITEM']['DESCRIPTION'];
}else{
- foreach($res['XML']['ITEM']['PRODUCTID'] as $id => $name){
+ foreach($res['XML'][0]['ITEM']['PRODUCTID'] as $id => $name){
$items[$name]['NAME'] = $name;
- $items[$name]['DESC'] = $res['XML']['ITEM']['DESCRIPTION'][$id];
+ $items[$name]['DESC'] = $res['XML'][0]['ITEM']['DESCRIPTION'][$id];
}
}
}
/* Query SI server */
$res = $this->send_data("gosa_opsi_get_product_properties",$this->target,$data,TRUE);
- if(isset($res['XML']['ITEM'])){
- return($res['XML']['ITEM']);
+ if(isset($res['XML'][0]['ITEM'])){
+ return($res['XML'][0]['ITEM']);
}
return(array());
}
/* Query SI server */
$res = $this->send_data("gosa_opsi_get_client_hardware",$this->target,$data,TRUE);
- if(isset($res['XML']['ITEM'])){
- #print_a($res['XML']['ITEM']);
- }
+ print_a($res);
}
$data = array();
$res = $this->send_data("gosa_opsi_list_clients",$this->target,$data,TRUE);
$items = array();
- if(isset($res['XML']['ITEM'])){
- if(!is_array($res['XML']['ITEM']['NAME'])){
- $obj = $res['XML']['ITEM'];
- $items[$obj['NAME']] = $obj;
- }else{
- foreach($res['XML']['ITEM'] as $type => $val){
- foreach($val as $key => $value){
- $items[$key][$type] = $value;
- }
- }
- }
+ if(isset($res['XML'][0]['ITEM'])){
+ $items = $res['XML'][0]['ITEM'];
}
return($items);
}