示例#1
0
 protected function doModifyObject($a)
 {
     $MAPCFG = new GlobalMapCfg($a['map']);
     try {
         $MAPCFG->readMapConfig();
     } catch (MapCfgInvalid $e) {
     }
     // Give the sources the chance to load the object
     $MAPCFG->handleSources('load_obj', $a['id']);
     if (!$MAPCFG->objExists($a['id'])) {
         throw new NagVisException(l('The object does not exist.'));
     }
     // set options in the array
     foreach ($a['opts'] as $key => $val) {
         $MAPCFG->setValue($a['id'], $key, $val);
     }
     // write element to file
     $MAPCFG->storeUpdateElement($a['id']);
     // delete map lock
     if (!$MAPCFG->deleteMapLock()) {
         throw new NagVisException(l('mapLockNotDeleted'));
     }
     return json_encode(array('status' => 'OK', 'message' => ''));
 }