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

Author: LaMi <[email protected]>
Date:   Wed Nov  4 17:44:20 2009 +0100

Removed many calls of method_exists function

---

 share/server/core/classes/objects/NagVisMapObj.php |    7 +++++--
 share/server/core/classes/objects/NagVisObject.php |   16 ++++++----------
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/share/server/core/classes/objects/NagVisMapObj.php 
b/share/server/core/classes/objects/NagVisMapObj.php
index 0a752e3..0f0cc14 100644
--- a/share/server/core/classes/objects/NagVisMapObj.php
+++ b/share/server/core/classes/objects/NagVisMapObj.php
@@ -307,7 +307,9 @@ class NagVisMapObj extends NagVisStatefulObject {
                        $arrStates = Array('UNREACHABLE' => 0, 'CRITICAL' => 
0,'DOWN' => 0,'WARNING' => 0,'UNKNOWN' => 0,'UP' => 0,'OK' => 0,'ERROR' => 
0,'ACK' => 0,'PENDING' => 0);
                        
                        foreach($this->getStateRelevantMembers() AS $OBJ) {
-                               if(method_exists($OBJ,'getSummaryState')) {
+                               
+                               // Do not get summary information for some 
object types
+                               if($OBJ->getType() != 'shape' && 
$OBJ->getType() != 'textbox') {
                                        $sState = $OBJ->getSummaryState();
                                        if(isset($arrStates[$sState])) {
                                                $arrStates[$sState]++;
@@ -449,7 +451,8 @@ class NagVisMapObj extends NagVisStatefulObject {
                if($this->hasObjects() && $this->hasStatefulObjects()) {
                        // Get summary state member objects
                        foreach($this->getStateRelevantMembers() AS $OBJ) {
-                               if(method_exists($OBJ,'getSummaryState')) {
+                               // Do not get summary information for some 
object types
+                               if($OBJ->getType() != 'shape' && 
$OBJ->getType() != 'textbox') {
                                        $this->wrapChildState($OBJ);
                                }
                        }
diff --git a/share/server/core/classes/objects/NagVisObject.php 
b/share/server/core/classes/objects/NagVisObject.php
index 2a13c45..2131a97 100644
--- a/share/server/core/classes/objects/NagVisObject.php
+++ b/share/server/core/classes/objects/NagVisObject.php
@@ -482,19 +482,15 @@ class NagVisObject {
         * @author      Lars Michelsen <[email protected]>
         */
        private static function sortObjectsByState($OBJ1, $OBJ2) {
-               // Textboxes and shapes do not have getSummaryState method, 
exclude them here
-               if(method_exists($OBJ1, 'getSummaryState') && 
method_exists($OBJ2, 'getSummaryState')) {
-                       $state1 = $OBJ1->getSummaryState();
-                       $state2 = $OBJ2->getSummaryState();
-
-                       if($state1 == '' || $state2 == '') {
-                               return 0;
-                       }
-               } else {
+               // Do not sort shapes and textboxes
+               if($OBJ1->getType() == 'shape' || $OBJ1->getType() == 'textbox' 
|| $OBJ1->getType() == 'line' || $OBJ2->getType() == 'shape' || 
$OBJ2->getType() == 'textbox' || $OBJ2->getType() == 'line') {
                        return 0;
                }
+               
+               $state1 = $OBJ1->getSummaryState();
+               $state2 = $OBJ2->getSummaryState();
 
-               // Break when nothing to compare
+               // Quit when nothing to compare
                if($state1 == '' || $state2 == '') {
                        return 0;
                }


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to