ws_deleted = array(); } public function setVI($vi) { $this->vi = $vi; $this->dataset = strtolower($vi); } public function deleteDerived() { $msg = 'WS (Derived) Params:
'; // derived parameters $this->Mgr = new DerivedParamMgr('derivedParam'); // get params $wsParams = $this->Mgr->contentDom->getElementsByTagName('param'); if ($wsParams->length == 0) { return array('success' => true, 'msg' => 'No parameters'); } foreach ($wsParams as $param) { $id = $param->getAttribute('xml:id'); $name = $param->getAttribute('name'); $expression = $param->getAttribute('buildchain'); if (strpos(strtolower($expression), $this->dataset)) { $msg .= 'deleted name:'.$name.'; expression: '.$expression.'
'; $obj = new stdClass(); $obj->leaf = true; $obj->id = $id; $this->Mgr->deleteObject($obj); // error_log( 'For INFO : DELETED '.$expression,1,email); $this->ws_deleted[] = $name; } } $msg .= ' ok
'; return array('success' => true, 'msg' => $msg); } public function deleteConditions() { $msg = 'Conditions:
'; // conditons $this->Mgr = new RequestMgr('condition'); $conditions = $this->Mgr->contentDom->getElementsByTagName('condition'); if ($conditions->length == 0) { return array('success' => true, 'msg' => 'No conditions'); } foreach ($conditions as $item) { $id = $item->getAttribute('xml:id'); $name = $item->getAttribute('name'); $expression = strtolower($this->Mgr->getObject($id)->expression); if (strpos($expression, $this->dataset)) { $obj = new stdClass(); $obj->leaf = true; $obj->id = $id; $this->Mgr->deleteObject($obj); $msg .= 'deleted name:'.$obj->name.'; expression:'.$expression.'
'; } } $msg .= ' ok
'; return array('success' => true, 'msg' => $msg); } public function deleteRequests() { $msg = 'Requests:
'; // requests $this->Mgr = new RequestMgr('request'); $requests = $this->Mgr->contentDom->getElementsByTagName('request'); if (count($requests) == 0) { return array('success' => true, 'msg' => 'No requests'); } foreach ($requests as $item) { $id = $item->getAttribute('xml:id'); $name = $item->getAttribute('name'); $objplot = $this->Mgr->getObject($id); $obj = new stdClass(); $obj->leaf = true; $obj->id = $id; foreach ($objplot->children as $panel) { foreach ($panel->children as $param) { $parID = strtolower($param->name); if ($this->ws_deleted && substr($parId,0,3) == "ws_") { if (array_search($this->ws_deleted, $parId)) { $this->Mgr->deleteObject($obj); $msg .= 'request deleted '.$name.'
'; continue 3; } } if (strpos($parID, $this->dataset)) { $this->Mgr->deleteObject($obj); $msg .= 'request deleted '.$name.'
'; continue 3; } } } } $msg .= ' ok
'; return array('success' => true, 'msg' => $msg); } public function deleteAliases() { $msg = 'Aliases:
'; $this->Mgr = new AliasMgr(); $aliases = $this->Mgr->contentDom->getElementsByTagName('alias'); foreach ($aliases as $alias) { $id = $alias->getAttribute('xml:id'); $name = $alias->getAttribute('name'); if (strpos(strtolower($id), $this->dataset)) { $obj = new stdClass(); $obj->leaf = true; $obj->id = $id; $this->Mgr->deleteObject($obj); $msg .= 'alias deleted '.$name.'
'; } } return array('success' => true, 'msg' => $msg); } public function deleteInTree() { $msg = 'Dataset in RemoteParams:
'; $this->Mgr = new ParamMgr(); $xp = new domxpath($this->Mgr->xmlDom); $nodeToDelete = $xp->query("//dataset[@name='".$this->vi."']"); if ($nodeToDelete->length > 0) { $instrNode = $nodeToDelete->item(0)->parentNode; $instrNode->removeChild($nodeToDelete->item(0)); if (!$instrNode->hasChildNodes()) { $missionNode = $instrNode->parentNode; $missionNode->removeChild($instrNode); if (!$missionNode->hasChildNodes()) { $datacenterNode = $missionNode->parentNode; $datacenterNode->removeChild($missionNode); } } $this->Mgr->xmlDom->save($this->Mgr->xmlName); $msg .= 'dataset deleted '.$this->vi.'
'; } return array('success' => true, 'msg' => $msg); } } ?>