Code

Fixed si function
[gosa.git] / gosa-core / include / class_gosaSupportDaemon.inc
index dbdd47a7591a33f362159a4f9b2953edf38fbee7..7d8a4f494c94a1a8a041f0909cff547805d6fbcf 100644 (file)
@@ -136,8 +136,15 @@ class gosaSupportDaemon
 
   public function FAI_get_kernels($release)
   {
-    $xml_msg = "<xml><header>gosa_get_available_kernel</header><source>GOSA</source><target>GOSA</target><release>halut</release></xml>";
+    $xml_msg = 
+      "<xml>".
+      "<header>gosa_get_available_kernel</header>".
+      "<source>GOSA</source>".
+      "<target>GOSA</target>".
+      "<release>".$release."</release>".
+      "</xml>";
 
+    $ret = array();
     if($this->connect()){
       $this->o_sock->write($xml_msg);
       $str = trim($this->o_sock->read());
@@ -162,12 +169,12 @@ class gosaSupportDaemon
           }
 
           /* Unset header tags */
-          foreach(array("HEADER","SOURCE","TARGET","SESSION_ID") as $type){
-            if(isset($entries['XML'][$type])){
-              unset($entries['XML'][$type]);
+          $ret = $entries['XML'];
+          foreach($ret as $key => $entry){
+            if(!preg_match("/^answer/i",$key)){
+              unset($ret[$key]);
             }
           }
-          $ret = $entries['XML'];
         }
       }
     }
@@ -413,21 +420,21 @@ class gosaSupportDaemon
     }
 
     $xml_msg = 
-"<xml>
+      "<xml>
       <header>gosa_query_jobdb</header>
       <target>GOSA</target>
       <source>GOSA</source>
       ".$tags."
 
       <orderby>".$sort."</orderby>";
-if($from != -1 && $to != -1){
-$xml_msg.= "
-      <limit>
-       <from>".$from."</from>
-       <to>".$to."</to>
-      </limit>";
-}
-$xml_msg.= "
+    if($from != -1 && $to != -1){
+      $xml_msg.= "
+        <limit>
+        <from>".$from."</from>
+        <to>".$to."</to>
+        </limit>";
+    }
+    $xml_msg.= "
       </xml>";
 
     if($this->connect()){
@@ -911,8 +918,29 @@ $xml_msg.= "
   /*! \brief  Returns the number of currently queued objects.
       @return Integer  
    */
-  public function number_of_queued_entries()
+  public function number_of_queued_entries($event_types)
   {
+    $tags = "";
+    foreach($event_types as $type){
+      $tags .= "<phrase><headertag>".$type."</headertag></phrase>";
+    }
+    if(count($event_types) > 1){
+      $tags = "<connector>or</connector>".$tags;
+    }
+    if(count($event_types)){
+      $tags = "<where><clause>".$tags."</clause></where>";
+    }
+
+
+    $xml_msg =
+      "<xml>".
+      "<header>gosa_query_jobdb</header>".
+      "<target>GOSA</target>".
+      "<source>GOSA</source>".
+      "<select> count ID</select>".
+      $tags.
+      "</xml>";
+
     $xml_msg ="<xml><header>gosa_count_jobdb</header><target>GOSA</target><source>GOSA</source></xml>";
     $this->connect();
     if($this->connect()){