Commit 3ec3ea9ceecf2b3c6dedf82d835d11fba7e96828

Authored by Elena.Budnik
1 parent 2ac8da6c

add spectra

Showing 1 changed file with 27 additions and 1 deletions   Show diff stats
php/classes/UserWsTransfer.php
... ... @@ -7,7 +7,7 @@ class UserWsTransfer {
7 7  
8 8 private $oldWs, $newWs, $Mgr;
9 9 private $oldWsDir, $newWsDir;
10   - private $ws_deleted, $wsd_deleted, $pairs;
  10 + private $ws_deleted, $wsd_deleted, $pairs, $specParams;
11 11  
12 12 function __construct($user)
13 13 {
... ... @@ -29,6 +29,7 @@ class UserWsTransfer {
29 29 $this->ws_deleted = array();
30 30 $this->wsd_deleted = array();
31 31 $this->getModified();
  32 + $this->getSpectra();
32 33 }
33 34  
34 35 private function getObsolete() {
... ... @@ -125,6 +126,20 @@ class UserWsTransfer {
125 126 $this->pairs = $pairs;
126 127 }
127 128  
  129 + private function getSpectra()
  130 + {
  131 + $convertXML = new DomDocument("1.0");
  132 + $modifiedFile = CONVERSIONDIR.'SpectraModifs.xml';
  133 +
  134 + if (!$convertXML->load($modifiedFile))
  135 + error_log('ERROR loading '.$modifiedFile,1,email);
  136 + $convertedNodes = $convertXML->getElementsByTagName('deleted');
  137 +
  138 + foreach ($convertedNodes as $item) {
  139 + $this->specParams[] = $item->getAttribute('xml:id');
  140 + }
  141 + }
  142 +
128 143 private function updateParams($expression)
129 144 {
130 145 $newExp = strtr($expression, $this->pairs);
... ... @@ -255,6 +270,12 @@ class UserWsTransfer {
255 270 continue;
256 271 }
257 272  
  273 + if ($this->deleteParam($expression,$this->spectraParams)) {
  274 + $msg .= '<li><i>'.$name.'</i> : too much difference <br/> '.$expression.'<br/>';
  275 + $this->ws_deleted[] = $name;
  276 + continue;
  277 + }
  278 +
258 279 $expressionUpdated = $this->updateParams($expression);
259 280 $wsParamNode->appendChild($this->newWs->importNode($param));
260 281  
... ... @@ -390,6 +411,11 @@ class UserWsTransfer {
390 411 continue;
391 412 }
392 413  
  414 + if ($this->deleteParam($expression,$this->specParams)) {
  415 + $msg .= '<li><i>'.$name.'</i> : too much difference <br/> '.$expression.'<br/>';
  416 + $cond_deleted[] = $name;
  417 + continue;
  418 + }
393 419 $expressionUpdated = $this->updateParams($expression);
394 420 $condObj->expression = $expressionUpdated;
395 421 file_put_contents(NEWUSERPATH.TRANSFERUSER."/REQ/".$id, json_encode($condObj));
... ...