Module: nagvis
Branch: master
Commit: e1639b718a91c4fb848408b2acbc7ab9b7e3d1ce
URL:    
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=e1639b718a91c4fb848408b2acbc7ab9b7e3d1ce

Author: LaMi <[email protected]>
Date:   Thu Apr  1 01:10:14 2010 +0200

Code fomating

---

 share/server/core/classes/objects/NagVisObject.php |   39 +++++++++++++-------
 .../core/classes/objects/NagVisStatefulObject.php  |    2 +-
 2 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/share/server/core/classes/objects/NagVisObject.php 
b/share/server/core/classes/objects/NagVisObject.php
index 65df365..79e81d1 100644
--- a/share/server/core/classes/objects/NagVisObject.php
+++ b/share/server/core/classes/objects/NagVisObject.php
@@ -200,6 +200,28 @@ class NagVisObject {
                        $this->{$key} = $val;
                }
        }
+
+       /**
+        * PUBLIC fetchObjectAsChild()
+        *
+        * Is called when an object should only be displayed as child
+        * e.g. in hover menus. There are much less macros needed for this.
+        *
+        * @author      Lars Michelsen <[email protected]>
+        */
+       public function fetchObjectAsChild() {
+               $aChild = Array('type' => $this->getType(),
+                                                                               
'name' => $this->getName(),
+                                                                               
'summary_state' => $this->getSummaryState(),
+                                                                               
'summary_in_downtime' => $this->getSummaryInDowntime(),
+                                                                               
'summary_problem_has_been_acknowledged' => $this->getSummaryAcknowledgement(),
+                                                                               
'summary_output' => strtr($this->getSummaryOutput(), Array("\r" => '<br />', 
"\n" => '<br />', '"' => '&quot;', '\'' => '&#145;')));
+               
+               if($this->type == 'service') {
+                       $aChild['service_description'] = 
$this->getServiceDescription();
+               }
+    return $aChild;  
+       }
        
        /**
         * PUBLIC getObjectInformation()
@@ -216,19 +238,8 @@ class NagVisObject {
                // itselfs. So much less information are needed. Progress them 
here
     // If someone wants more information in hover menu children, this is
                // the place to change.
-               if(!$bFetchChilds) {
-      $aChild = Array('type' => $this->getType(),
-                      'name' => $this->getName(),
-                      'summary_state' => $this->getSummaryState(),
-                      'summary_in_downtime' => $this->getSummaryInDowntime(),
-                      'summary_problem_has_been_acknowledged' => 
$this->getSummaryAcknowledgement(),
-                      'summary_output' => strtr($this->getSummaryOutput(), 
Array("\r" => '<br />', "\n" => '<br />', '"' => '&quot;', '\'' => '&#145;')));
-      if($this->type == 'service') {
-        $aChild['service_description'] = $this->getServiceDescription();
-      }
-      
-      return $aChild;
-               }
+               if(!$bFetchChilds)
+      return $this->fetchObjectAsChild();
                
                // Need to remove some options which are not relevant
                $arrDenyKeys = Array('CORE' => '', 'BACKEND' => '', 'MAPCFG' => 
'',
@@ -363,7 +374,7 @@ class NagVisObject {
                if(isset($arr['num_members']) && $arr['num_members'] > 0) {
                        $arr['members'] = Array();
                        foreach($this->getSortedObjectMembers() AS $OBJ) {
-                               $arr['members'][] = 
$OBJ->getObjectInformation(!GET_CHILDS);
+                               $arr['members'][] = $OBJ->fetchObjectAsChild();
                        }
                }
                
diff --git a/share/server/core/classes/objects/NagVisStatefulObject.php 
b/share/server/core/classes/objects/NagVisStatefulObject.php
index c23c02c..caca961 100644
--- a/share/server/core/classes/objects/NagVisStatefulObject.php
+++ b/share/server/core/classes/objects/NagVisStatefulObject.php
@@ -478,7 +478,7 @@ class NagVisStatefulObject extends NagVisObject {
                if($bFetchChilds && $this->hasMembers()) {
                        $arr['members'] = Array();
                        foreach($this->getSortedObjectMembers() AS $OBJ) {
-                               $arr['members'][] = 
$OBJ->getObjectInformation(!GET_CHILDS);
+                               $arr['members'][] = $OBJ->fetchObjectAsChild();
                        }
                }
                


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to