Beispiel #1
0
 public function handleAction()
 {
     $sReturn = '';
     if ($this->offersAction($this->sAction)) {
         switch ($this->sAction) {
             case 'getMapProperties':
                 $MAPCFG = new GlobalMapCfg($this->name);
                 $MAPCFG->readMapConfig(ONLY_GLOBAL);
                 $sReturn = json_encode($MAPCFG->getMapProperties());
                 break;
             case 'getMapObjects':
                 $sReturn = $this->getMapObjects();
                 break;
             case 'getObjectStates':
                 $sReturn = $this->getObjectStates();
                 break;
             case 'manage':
                 $VIEW = new ViewManageMaps();
                 $sReturn = json_encode(array('code' => $VIEW->parse()));
                 break;
             case 'modifyObject':
                 $sReturn = $this->handleResponse('handleResponseModifyObject', 'doModifyObject', null, l('The object could not be modified.'));
                 break;
             case 'deleteObject':
                 $aReturn = $this->handleResponseDeleteObject();
                 if ($aReturn !== false) {
                     if ($this->doDeleteObject($aReturn)) {
                         $sReturn = json_encode(array('status' => 'OK', 'message' => ''));
                     } else {
                         throw new NagVisException(l('The object could not be deleted.'));
                     }
                 } else {
                     throw new NagVisException(l('You entered invalid information.'));
                 }
                 break;
             case 'addModify':
                 $VIEW = new ViewMapAddModify();
                 $sReturn = json_encode(array('code' => $VIEW->parse()));
                 break;
             case 'manageTmpl':
                 $VIEW = new ViewMapManageTmpl();
                 $sReturn = json_encode(array('code' => $VIEW->parse()));
                 break;
             case 'doExportMap':
                 $this->doExportMap($this->name);
                 exit(0);
                 //header('Location:'.$_SERVER['HTTP_REFERER']);
                 break;
             case 'toStaticMap':
                 $VIEW = new ViewToStaticMap();
                 $sReturn = json_encode(array('code' => $VIEW->parse($this->name)));
                 break;
             case 'viewToNewMap':
                 $VIEW = new ViewToNewMap();
                 $sReturn = json_encode(array('code' => $VIEW->parse($this->name)));
                 break;
             case 'getWorldmapBounds':
                 $sReturn = $this->getWorldmapBounds();
                 break;
         }
     }
     return $sReturn;
 }