Logo Search packages:      
Sourcecode: nagvis version File versions  Download package

NagVisFrontend::getNextRotationUrl (  ) 

Gets the Next map to rotate to, if enabled If Next map is in [ ], it will be an absolute url

Returns:
String URL to rotate to
Author:
Lars Michelsen <lars@vertical-visions.de>

Definition at line 313 of file NagVisFrontend.php.

                                    {
            if (DEBUG&&DEBUGLEVEL&1) debug('Start method NagVisFrontend::getNextRotate()');
            if(isset($_GET['rotation']) && $_GET['rotation'] != '') {
                  if($maps = $this->MAINCFG->getValue('rotation_'.$_GET['rotation'], 'maps')) {
                        $maps = explode(',', str_replace('"','',$maps));
                        
                        if(isset($_GET['url']) && $_GET['url'] != '') {
                              $currentMap = '['.$_GET['url'].']';
                        } else {
                              $currentMap = $this->MAPCFG->getName();
                        }
                  
                        // get position of actual map in the array
                        $index = array_search($currentMap,$maps);
                        if(($index + 1) >= sizeof($maps)) {
                              // if end of array reached, go to the beginning...
                              $index = 0;
                        } else {
                              $index++;
                        }
                              
                        $nextMap = $maps[$index];
                        
                        
                        if(preg_match("/^\[(.+)\]$/",$nextMap,$arrRet)) {
                              if (DEBUG&&DEBUGLEVEL&1) debug('End method NagVisFrontend::getNextRotate(): URL=index.php?rotation='.$_GET['rotation'].'&url='.$arrRet[1]);
                              return 'index.php?rotation='.$_GET['rotation'].'&url='.$arrRet[1];
                        } else {
                              if (DEBUG&&DEBUGLEVEL&1) debug('End method NagVisFrontend::getNextRotate(): URL=index.php?rotation='.$_GET['rotation'].'&map='.$nextMap);
                              return 'index.php?rotation='.$_GET['rotation'].'&map='.$nextMap;
                        }
                  } else {
                        // Error Message (Map rotation pool does not exist)
                        $FRONTEND = new GlobalPage($this->MAINCFG,Array('languageRoot'=>'nagvis:global'));
                        $FRONTEND->messageToUser('ERROR','mapRotationPoolNotExists','ROTATION~'.$_GET['rotation']);
                        
                        if (DEBUG&&DEBUGLEVEL&1) debug('End method NagVisFrontend::getNextRotate(): ');
                        return '';
                  }
            } else {
                  if (DEBUG&&DEBUGLEVEL&1) debug('End method NagVisFrontend::getNextRotate(): ');
                  return '';
            }
      }


Generated by  Doxygen 1.6.0   Back to index