TREPSAction.php
4.63 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?php
require_once("../Constants.php");
require_once(TREPS_PHP_DIR."RequestManager.php");
class TREPSAction {
function startNewOperation($arg)
{
$datatype = $arg->type;
$reqMgr = new RequestManager();
if ($datatype == 'local')
$location = TREPS_PHP_TMP_DIR.$arg->data;
else if ($datatype == 'url')
$location = $arg->data;
else if ($datatype == 'data')
{ // bug error execution : remove paramter NULL
$file_name = time()."_".$reqMgr->generateRandomString();
$pos = strpos($arg->data,"base64,");
if ($pos === false)
$file = $arg->data;
else
{
$file = substr($arg->data,$pos+7);
$file = base64_decode($file);
}
$location = TREPS_PHP_TMP_DIR.$file_name;
file_put_contents($location, $file);
$datatype = 'local';
}
$res = $reqMgr->run('new_op',array('type' => $datatype, 'location' => $location),OutputTypeEnum::OUTPUT_RESULTFILE);
if ($datatype == 'local')
if (file_exists($location))
unlink($location);
return $res;
}
function resetOperation($arg)
{
$reqMgr = new RequestManager();
$res = $reqMgr->run('reset_op',array('id' => $arg->id),OutputTypeEnum::OUTPUT_NONE);
return $res;
}
function getStatusOperation($arg)
{
$reqMgr = new RequestManager();
$res = $reqMgr->run('status_get',array('id' => $arg->id),OutputTypeEnum::OUTPUT_STRING);
return $res;
}
function runOperation($arg)
{
$reqMgr = new RequestManager();
$res = $reqMgr->run('run_op',array('id' => $arg->id, 'srcframe' => $arg->srcframe,'srccenter' => $arg->srccenter, 'dstframe' => $arg->dstframe, 'dstcenter' => $arg->dstcenter, 'starttime' => $arg->starttime, 'stoptime' => $arg->stoptime, 'vectors' => $arg->vectors, 'timefieldid' => $arg->timefieldid, 'timeformatid' => $arg->timeformatid, 'timepattern' => $arg->timepattern), OutputTypeEnum::OUTPUT_RESULTFILE);
return $res;
}
function exportOperation($arg)
{
$reqMgr = new RequestManager();
$res = $reqMgr->run('export_op',array('id' => $arg->id, 'format' => $arg->format, 'structure' => $arg->structure, 'timeformat' => $arg->timeformat, 'timepattern' => $arg->timepattern), OutputTypeEnum::OUTPUT_RESULTFILE);
return $res;
}
function getSourceInfo($arg)
{
$reqMgr = new RequestManager();
$res = $reqMgr->run('source_info',array('id' => $arg->id),OutputTypeEnum::OUTPUT_RESULTFILE);
return $res;
}
function getSourceData($arg)
{
$reqMgr = new RequestManager();
$res = $reqMgr->run('source_get',array('id' => $arg->id, 'start' => $arg->start, 'limit' => $arg->limit),OutputTypeEnum::OUTPUT_RESULTFILE);
return $res;
}
function getResultInfo($arg)
{
$reqMgr = new RequestManager();
$res = $reqMgr->run('result_info',array('id' => $arg->id),OutputTypeEnum::OUTPUT_RESULTFILE);
return $res;
}
function getResultData($arg)
{
$reqMgr = new RequestManager();
$res = $reqMgr->run('result_get',array('id' => $arg->id, 'start' => $arg->start, 'limit' => $arg->limit),OutputTypeEnum::OUTPUT_RESULTFILE);
return $res;
}
function getRunInfo($arg)
{
$reqMgr = new RequestManager();
$res = $reqMgr->run('run_info',array('id' => $arg->id),OutputTypeEnum::OUTPUT_RESULTFILE);
return $res;
}
function getBodiesList($arg)
{
$reqMgr = new RequestManager();
$res = $reqMgr->run('bodies_get',array('id' => $arg->id, 'issc' => $arg->issc, 'starttime' => $arg->starttime, 'stoptime' => $arg->stoptime),OutputTypeEnum::OUTPUT_XMLFILE);
return $res;
}
function getFramesList()
{
$reqMgr = new RequestManager();
$res = $reqMgr->run('frames_get',array(),OutputTypeEnum::OUTPUT_XMLFILE);
return $res;
}
function getTimesList()
{
$reqMgr = new RequestManager();
$res = $reqMgr->run('times_get',array(),OutputTypeEnum::OUTPUT_XMLFILE);
return $res;
}
function getUnitsList()
{
$reqMgr = new RequestManager();
$res = $reqMgr->run('units_get',array(),OutputTypeEnum::OUTPUT_XMLFILE);
return $res;
}
function getExportsList()
{
$reqMgr = new RequestManager();
$res = $reqMgr->run('exports_get',array(),OutputTypeEnum::OUTPUT_XMLFILE);
return $res;
}
function getFormatsList()
{
$reqMgr = new RequestManager();
$res = $reqMgr->run('formats_get',array(),OutputTypeEnum::OUTPUT_XMLFILE);
return $res;
}
function getStatus($arg)
{
$reqMgr = new RequestManager();
$res = $reqMgr->run('status_get',array('id' => $arg->id),OutputTypeEnum::OUTPUT_STRING);
return $res;
}
function getKernelVersion()
{
$reqMgr = new RequestManager();
$res = $reqMgr->run('version_get',array(),OutputTypeEnum::OUTPUT_STRING);
return $res;
}
}
?>