-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadder3.php
More file actions
112 lines (77 loc) · 3.05 KB
/
Copy pathadder3.php
File metadata and controls
112 lines (77 loc) · 3.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
require_once 'globalVariables.php';
require_once 'HTTP/Request2.php'; //uses PEAR
$id = $_POST['id'];
//var_dump($pmui);
//print "<br /><br />";
$atname = "tool-id";
$tname = "translation";
$atorder = "order";
$torder = "1";
$placeInArr = "1";
//GET THE DOCUMENT LOAD IT PREPARE TO WRITE ON IT
$doc = new DOMDocument();
$doc->load( $localFolder .$id .'.xlf' );
$xpath = new DOMXPath($doc);
//PHASE STUFF FROM NAOTO
$phasegroups = $doc->getElementsByTagName('phase-group');
$toolid='WFR';
$phasename='WF-Custom-Workflow-Detected';
foreach($phasegroups as $phasegroup)
{
$root_child=$doc->createElement('phase');
$phasegroup ->appendChild($root_child);
$root_attr1 = $doc->createAttribute('phase-name');
$root_child->appendChild($root_attr1);
$root_text = $doc->createTextNode($phasename);
$root_attr1 ->appendChild($root_text);
$root_attr2 = $doc->createAttribute('company-name');
$root_child->appendChild($root_attr2);
$root_text = $doc->createTextNode('SomeCompany');
$root_attr2 ->appendChild($root_text);
$root_attr3 = $doc->createAttribute('process-name');
$root_child->appendChild($root_attr3);
$root_text = $doc->createTextNode('WF-Recommender');
$root_attr3 ->appendChild($root_text);
$root_attr4 = $doc->createAttribute('contact-name');
$root_child->appendChild($root_attr4);
$root_text = $doc->createTextNode('Aram');
$root_attr4 ->appendChild($root_text);
$root_attr5 = $doc->createAttribute('contact-email');
$root_child->appendChild($root_attr5);
$root_text = $doc->createTextNode('aram.morera-mesa@ul.ie');
$root_attr5 ->appendChild($root_text);
$root_attr6 = $doc->createAttribute('tool-id');
$root_child->appendChild($root_attr6);
$root_text = $doc->createTextNode($toolid);
$root_attr6 ->appendChild($root_text);
$date=date("r", time());
$root_attr7 = $doc->createAttribute('date');
$root_child->appendChild($root_attr7);
$root_text = $doc->createTextNode($date);
$root_attr7 ->appendChild($root_text);
}
// END OF PHASE STUFF FROM NAOTO
//var_dump($pmui);
$doc->save($localFolder . $id .'.xlf');
//}
//print "yo ";
$msg = "The workflow recommender found a custom workflow and did not add any additional workflow information: " ;
$request = new HTTP_Request2($this_url.'feedbacker.php', HTTP_Request2::METHOD_GET);
$url = $request->getUrl();
$url->setQueryVariable('id', $id); // set job id here
$url->setQueryVariable('msg', $msg); // set status id here
$result = $request->send();
if($result->getStatus() != 200) {
print "ERROR: send failed - ".$result->getStatus().": ".$result->getReasonPhrase();
}
$request = new HTTP_Request2($this_url.'outputer.php', HTTP_Request2::METHOD_GET);
$url = $request->getUrl();
$url->setQueryVariable('id', $id); // set job id here
$result=$request->send();
if($result->getStatus() == 200) {
print $result->getBody();
} else {
print "ERROR: Send failed - ".$result->getStatus().": ".$result->getReasonPhrase();
}
?>