Blame view

php/classes/AmdaAction.php 43.6 KB
16035364   Benjamin Renard   First commit
1
2
3
<?php
/**
 * @class AmdaAction
aa94fd24   elena   Merge with last svn
4
 * @version $Id: AmdaAction.php 2976 2015-07-01 15:05:40Z benjamin $
16035364   Benjamin Renard   First commit
5
6
7
8
9
10
 *
 */


class AmdaAction {

f740e66b   Nathanael Jourdane   Improve the VOTab...
11
    private $xmlFiles  = array('localParam' => 'LocalParams.xml', 'remoteParam' => 'RemoteParams.xml',
16035364   Benjamin Renard   First commit
12
                                'remoteSimuParam' => 'RemoteParams.xml', 'derivedParam' => 'WsParams.xml', 'myDataParam' => 'WsParams.xml',
f740e66b   Nathanael Jourdane   Improve the VOTab...
13
14
                                'timeTable' => 'Tt.xml', 'catalog' => 'Tt.xml', 'alias' => 'Alias.xml',
                                'myData' => 'Files.xml',
16035364   Benjamin Renard   First commit
15
16
17
18
                                'request' => 'Request.xml', 'condition' => 'Request.xml',
                                'bkgWorks' => 'jobs.xml');

    private $user, $amdaStat;
aa94fd24   elena   Merge with last svn
19

f740e66b   Nathanael Jourdane   Improve the VOTab...
20
21
    public function __construct()
    {
aa94fd24   elena   Merge with last svn
22
23
24
25
        $dd = new UserMgr();
        $this->user = $dd->user;
        if (!defined('NEWKERNEL_DEBUG') || !NEWKERNEL_DEBUG)
                 $this->amdaStat = new AmdaStats($dd->user);
16035364   Benjamin Renard   First commit
26
27
28
29
30
    }

    private function getUrlDirs($url) {
        //TODO replace by ftp php class methods: ftp_nlist() etc
        require_once "simple_html_dom.php";
f740e66b   Nathanael Jourdane   Improve the VOTab...
31
32

        $url = html_entity_decode($url);
16035364   Benjamin Renard   First commit
33
34
        $trimmed_url = trim($url);
        if (strrpos($trimmed_url, "/") == strlen($trimmed_url) - 1) {
f740e66b   Nathanael Jourdane   Improve the VOTab...
35
            if (file_exists("temp.html")) unlink("temp.html");
16035364   Benjamin Renard   First commit
36
            exec("wget -O temp.html ".$url);
f740e66b   Nathanael Jourdane   Improve the VOTab...
37

16035364   Benjamin Renard   First commit
38
39
40
41
42
43
            $html = file_get_html('temp.html');
            $dirs = $html->find('a[href]');
            foreach ($dirs as $dir) {
                $name =  $dir->innertext; //$dir->href;
                $isLeaf = strrpos($name, "/") !== strlen($name) - 1;
                $childrenToReturn[] = array('text' => $name, 'id' => $trimmed_url.$name,
f740e66b   Nathanael Jourdane   Improve the VOTab...
44
                                    'nodeType' => 'url', 'leaf' => $isLeaf);
16035364   Benjamin Renard   First commit
45
            }
f740e66b   Nathanael Jourdane   Improve the VOTab...
46

16035364   Benjamin Renard   First commit
47
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
48
      return $childrenToReturn;
16035364   Benjamin Renard   First commit
49
    }
f740e66b   Nathanael Jourdane   Improve the VOTab...
50

16035364   Benjamin Renard   First commit
51
52
/*****************************************************************
*                           PUBLIC FUNCTIONS
f740e66b   Nathanael Jourdane   Improve the VOTab...
53
54
*****************************************************************/

16035364   Benjamin Renard   First commit
55
56
57
58
    /*
    *   $obj = { id: node.id,  nodeType: node.nodeType }
    */
    public function getTree($obj) {
f740e66b   Nathanael Jourdane   Improve the VOTab...
59

16035364   Benjamin Renard   First commit
60
       $node = $obj->node;
f740e66b   Nathanael Jourdane   Improve the VOTab...
61
62

    // to correct 'restricted' parameters
16035364   Benjamin Renard   First commit
63
64
65
66
67
68
69
70
        if (strpos($node, restricted) !== false) {
            $node = str_replace(restricted,"",$node);
        }

       $nodeType = $obj->nodeType;
       $remoteBase = false;
       $isRemoteDataSet = false;

f740e66b   Nathanael Jourdane   Improve the VOTab...
71
        if ($nodeType == 'url')
16035364   Benjamin Renard   First commit
72
        {
f740e66b   Nathanael Jourdane   Improve the VOTab...
73
            $url = $node == 'root' ? $obj->baseId : $node;
16035364   Benjamin Renard   First commit
74
75
76
77
78
79
80
            return  $this->getUrlDirs($url);
        }

        if ($obj->baseId) $remoteBase = true;

        if ($node == 'root' && $remoteBase)  $node = $obj->baseId;

f740e66b   Nathanael Jourdane   Improve the VOTab...
81
82
        if ($node == 'root' && !$remoteBase)
        {
16035364   Benjamin Renard   First commit
83
            $json_o = json_decode(file_get_contents(DATAPATH.$nodeType.'.json'));
f740e66b   Nathanael Jourdane   Improve the VOTab...
84
85
86
            $childrenToReturn = $json_o->nodes;
        }
        else
16035364   Benjamin Renard   First commit
87
88
89
        {
            $Dom = new DomDocument("1.0");

f740e66b   Nathanael Jourdane   Improve the VOTab...
90
            switch ($nodeType)
16035364   Benjamin Renard   First commit
91
92
            {
                case 'sharedtimeTable':
169f14d2   Benjamin Renard   Add shared object...
93
94
95
                case 'sharedcatalog':
                		$xmlName = SHAREDPATH.'/SharedObjectTree.xml';
                           break;
f740e66b   Nathanael Jourdane   Improve the VOTab...
96
                case 'bkgWorks':
16035364   Benjamin Renard   First commit
97
98
99
                        $xmlName = USERJOBDIR.$this->xmlFiles[$nodeType];
                        break;
                case 'source':
f740e66b   Nathanael Jourdane   Improve the VOTab...
100
101
102
103
                        $xmlName = DATAPATH.'RemoteData/'.$obj->baseId.'/base.xml';
                        break;
                case 'destination':
                        $xmlName = USERWSDIR.'RemoteParams.xml';
16035364   Benjamin Renard   First commit
104
                        break;
16035364   Benjamin Renard   First commit
105
106
107
108
                default:
                        $xmlName = USERWSDIR.$this->xmlFiles[$nodeType];
            }

f740e66b   Nathanael Jourdane   Improve the VOTab...
109
110
	    if ($remoteBase)
            {
16035364   Benjamin Renard   First commit
111
                 $nodeType = 'remoteParam';
f740e66b   Nathanael Jourdane   Improve the VOTab...
112
113
	    }

16035364   Benjamin Renard   First commit
114
	    $Dom->load($xmlName);
f740e66b   Nathanael Jourdane   Improve the VOTab...
115
116

	    if ($node == "myRemoteSimuData-treeRootNode")
169f14d2   Benjamin Renard   Add shared object...
117
			$node = "myRemoteData-treeRootNode";
f740e66b   Nathanael Jourdane   Improve the VOTab...
118

16035364   Benjamin Renard   First commit
119
120
121
	    $nodeToOpen = $Dom->getElementById($node);
	    $children = $nodeToOpen->childNodes;

f740e66b   Nathanael Jourdane   Improve the VOTab...
122
	    foreach ($children as $child)
16035364   Benjamin Renard   First commit
123
124
	      if ($child->nodeType == XML_ELEMENT_NODE) {
		  $isLeaf = true;
f740e66b   Nathanael Jourdane   Improve the VOTab...
125

16035364   Benjamin Renard   First commit
126
                if ($child->hasChildNodes())
f740e66b   Nathanael Jourdane   Improve the VOTab...
127
                    foreach ($child->childNodes as $grandChild)
16035364   Benjamin Renard   First commit
128
129
130
131
                    if ($grandChild -> nodeType == XML_ELEMENT_NODE)  {
                            $isLeaf = false;
                            break;
                        }
16035364   Benjamin Renard   First commit
132
133
                if ($child->tagName == 'folder')  $isLeaf = false;

f740e66b   Nathanael Jourdane   Improve the VOTab...
134
135
                //TODO MAKE PROPERLY  as function of nodetype !!!!
                $info = '';
16035364   Benjamin Renard   First commit
136
                $id =  $child->getAttribute('xml:id');
f740e66b   Nathanael Jourdane   Improve the VOTab...
137
                $name = $child->getAttribute('name');
16035364   Benjamin Renard   First commit
138
139
140
141
142
143
                $help = $child->getAttribute('att');
                if ($child->hasAttribute('dataStart')) $dataStart = $child->getAttribute('dataStart');
                if ($child->hasAttribute('dataStop')) $dataStop = $child->getAttribute('dataStop');

                $specialNode = false;
                $isParameter = false;
57bf8841   Elena.Budnik   correct mydataPar...
144
                $isAddable =  false;
16035364   Benjamin Renard   First commit
145
146
147
                $isSimulation = false;
                $rank = null;

f740e66b   Nathanael Jourdane   Improve the VOTab...
148
                switch ($nodeType)
16035364   Benjamin Renard   First commit
149
                {
f740e66b   Nathanael Jourdane   Improve the VOTab...
150
		    case 'bkgWorks':
16035364   Benjamin Renard   First commit
151
152
			$specialNode = true;
			$status = $child->getAttribute('status');
f740e66b   Nathanael Jourdane   Improve the VOTab...
153
		    //     if ($status == 'done') continue;
16035364   Benjamin Renard   First commit
154
			$childrenToReturn[] = array('text' => $name, 'id' => $id,'nodeType' => $nodeType, 'leaf' => $isLeaf,
f740e66b   Nathanael Jourdane   Improve the VOTab...
155
					  'pid' => $child->getAttribute('pid'), 'status' => $status,
16035364   Benjamin Renard   First commit
156
157
158
159
160
					  'jobType' => $child->getAttribute('jobType'), 'info' => $child->getAttribute('info'));
		    break;

		    case 'condition':
			$objectMgr = new RequestMgr();
f740e66b   Nathanael Jourdane   Improve the VOTab...
161
162
			$info = $objectMgr->getObject($id)->expression;
		    break;
16035364   Benjamin Renard   First commit
163
164

		    case 'request':
f740e66b   Nathanael Jourdane   Improve the VOTab...
165

16035364   Benjamin Renard   First commit
166
		 	$objectMgr = new RequestMgr();
f740e66b   Nathanael Jourdane   Improve the VOTab...
167
168
		 	$objplot = $objectMgr->getObject($id);
		 	for ($i=0; $i < count($objplot->children); $i++) {
16035364   Benjamin Renard   First commit
169
170
171
172
		 	    for ($j=0; $j < count($objplot->children[$i]->children); $j++) {
		 			$info = $info.' '.$objplot->children[$i]->children[$j]->name;
		 		}
		 	}
16035364   Benjamin Renard   First commit
173

f740e66b   Nathanael Jourdane   Improve the VOTab...
174
175
176
		    break;

		    case 'alias':
16035364   Benjamin Renard   First commit
177
178
			$info = $id;
			$id = 'alias_'.$id;
f740e66b   Nathanael Jourdane   Improve the VOTab...
179
                        if ($isLeaf) $isParameter = true;
16035364   Benjamin Renard   First commit
180
181
182
		    break;

                    case 'timeTable':
f740e66b   Nathanael Jourdane   Improve the VOTab...
183
                    case 'catalog':
16035364   Benjamin Renard   First commit
184
185
                        if ($isLeaf) $info = $child->getAttribute('intervals').' intervals';
                    break;
169f14d2   Benjamin Renard   Add shared object...
186
187
188
189
190
191
192
193
                    case 'sharedtimeTable':
                    case 'sharedcatalog':
                    	if ($isLeaf) {
                    		$info = '<b>Nb intervals:</b> '.$child->getAttribute('nbIntervals').'<br/>';
                    		$info .= '<b>Shared by:</b> '.$child->getAttribute('sharedBy').' ('.$child->getAttribute('sharedDate').')<br/>';
                    		$info .= '<b>Description:</b> '.$child->getAttribute('description');
                    	}
                    	break;
16035364   Benjamin Renard   First commit
194
195
196
197
198
199
200
201
202
203
204
205
206
                    case 'derivedParam':
                            $info = $child->getAttribute('buildchain');
                            if ($isLeaf) $isParameter = true;
                    break;

                    case 'localParam':

                        $globalStart = null;
                        $globalStop = null;
                        $timeRestriction = false;
                        $specialNode = true;
                        $isParameter = false;
                        $needsArgs = false;
f740e66b   Nathanael Jourdane   Improve the VOTab...
207
                        $isSpectra = false;
16035364   Benjamin Renard   First commit
208
209
                        $isStack = false;

3197b3e2   Elena.Budnik   globalStart, Glob...
210
                        if ($child->hasAttribute('desc')) {
f740e66b   Nathanael Jourdane   Improve the VOTab...
211

3197b3e2   Elena.Budnik   globalStart, Glob...
212
				$info = $child->getAttribute('desc');
f740e66b   Nathanael Jourdane   Improve the VOTab...
213
214
215

				if ($child->hasAttribute('dataStart') && $child->hasAttribute('dataStop')) {
					$info .= "<br/>Time Range: ".$child->getAttribute('dataStart')."-".$child->getAttribute('dataStop');
3197b3e2   Elena.Budnik   globalStart, Glob...
216
				}
f740e66b   Nathanael Jourdane   Improve the VOTab...
217

3197b3e2   Elena.Budnik   globalStart, Glob...
218
219
				if ($child->getAttribute('dataStart') == 'depending on mission'){
					$info .= "<br/>Time Range: ".$child->getAttribute('dataStart');
f740e66b   Nathanael Jourdane   Improve the VOTab...
220
221
				}

3197b3e2   Elena.Budnik   globalStart, Glob...
222
223
224
225
226
				if ($child->getAttribute('restriction') > 1) {
					$restricted  = $child->getAttribute('restriction');
					$info .= "<br/><b>Time Restriction</b>: -$restricted days";
				}
			   }
f740e66b   Nathanael Jourdane   Improve the VOTab...
227
228


16035364   Benjamin Renard   First commit
229
230
                        if ($child->hasAttribute('units')) $info = $child->getAttribute('units');

f740e66b   Nathanael Jourdane   Improve the VOTab...
231
                        if ($child->tagName == 'parameter')
16035364   Benjamin Renard   First commit
232
233
234
235
236
237
238
                        {
                                $isParameter = true;
                                $isScatter = true;

                                if ($child->parentNode->hasAttribute('dataStart'))
                                {
                                    $globalStart = $child->parentNode->getAttribute('dataStart');
f740e66b   Nathanael Jourdane   Improve the VOTab...
239
                                    $globalStop = $child->parentNode->getAttribute('dataStop');
16035364   Benjamin Renard   First commit
240
241
                                }

0f5fecfc   Elena.Budnik   only "restriction...
242
                                if ($child->parentNode->getAttribute('restriction') > 1 )
16035364   Benjamin Renard   First commit
243
244
                                {
                                    $timeRestriction = true;
f740e66b   Nathanael Jourdane   Improve the VOTab...
245

aec5ba13   Elena.Budnik   not tested param ...
246
                                }
f740e66b   Nathanael Jourdane   Improve the VOTab...
247
248
249

                                /*------------------- to show not tested parameters ------*/

aec5ba13   Elena.Budnik   not tested param ...
250
251
                                 if ($child->getAttribute('tbd'))
                                            $info .= "<br/><b>Not tested yet</b>";
f740e66b   Nathanael Jourdane   Improve the VOTab...
252
253
254

				    /*------------------- --------------------------------------*/

16035364   Benjamin Renard   First commit
255
                        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
256

16035364   Benjamin Renard   First commit
257

63ac7745   Benjamin Renard   Support component...
258
                        $component_info = array();
16035364   Benjamin Renard   First commit
259
260
261
262
263
264
265
266
                        if ($child->tagName == 'component')
                        {
                                $isParameter = true;
                                $isScatter = true;

                                if ($child->parentNode->parentNode->hasAttribute('dataStart'))
                                {
                                    $globalStart = $child->parentNode->parentNode->getAttribute('dataStart');
f740e66b   Nathanael Jourdane   Improve the VOTab...
267
268
                                    $globalStop = $child->parentNode->parentNode->getAttribute('dataStop');
                                }
16035364   Benjamin Renard   First commit
269

0f5fecfc   Elena.Budnik   only "restriction...
270
                                if ($child->parentNode->parentNode->getAttribute('restriction') > 1)
16035364   Benjamin Renard   First commit
271
272
                                {
                                    $timeRestriction = true;
f740e66b   Nathanael Jourdane   Improve the VOTab...
273
274

                                }
63ac7745   Benjamin Renard   Support component...
275
276
277
278
279

                                if ($child->hasAttribute("index1"))
                                	$component_info["index1"] = $child->getAttribute('index1');
                                if ($child->hasAttribute("index2"))
                                	$component_info["index2"] = $child->getAttribute('index2');
f740e66b   Nathanael Jourdane   Improve the VOTab...
280

63ac7745   Benjamin Renard   Support component...
281
                                $component_info["parentId"] = $child->parentNode->getAttribute('xml:id');
16035364   Benjamin Renard   First commit
282
                        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
283

16035364   Benjamin Renard   First commit
284
                       if ($child->tagName == 'parameter' && $child->hasChildNodes()) $isScatter = false;
f740e66b   Nathanael Jourdane   Improve the VOTab...
285

16035364   Benjamin Renard   First commit
286
287
288
                        if ($child->tagName == 'parameter' && $child->hasAttribute('display_type')) {

                              if ($child->getAttribute('display_type') == 'spectrogram') {
f740e66b   Nathanael Jourdane   Improve the VOTab...
289
290
                                    $needsArgs = true;
                                    $isSpectra = true;
16035364   Benjamin Renard   First commit
291
292
                                    $isScatter = false;
                               }
f740e66b   Nathanael Jourdane   Improve the VOTab...
293
                               else if ($child->getAttribute('display_type') == 'stackplot') {
16035364   Benjamin Renard   First commit
294
295
296
                                     $isStack = true;
                                     $isScatter = false;
                               }
f740e66b   Nathanael Jourdane   Improve the VOTab...
297
298
299
                        }

                        if ($isParameter)
16035364   Benjamin Renard   First commit
300
301
                        {
                            if ($child->tagName == 'parameter' && $child->childNodes->length == 1)
f740e66b   Nathanael Jourdane   Improve the VOTab...
302
303
304
305
306
                            {
                                $needsArgs = true;
                            }
                             if (substr($id,0,4) == 'bt96' || substr($id,0,6) == 'ba2000'|| substr($id,0,5) == 'bcain' || substr($id,0,7) == 'bmorsch' )
                             {
16035364   Benjamin Renard   First commit
307
308
                                 $needsArgs = true;
                             }
16035364   Benjamin Renard   First commit
309
310
311

                            $objectMgr = new AliasMgr();
                            $alias = $objectMgr->getAlias($id);
f740e66b   Nathanael Jourdane   Improve the VOTab...
312
313

                            $childrenToReturn[] = array('text' => $name,'alias' => $alias,
63ac7745   Benjamin Renard   Support component...
314
                                'id' => $id,'nodeType' => $nodeType, 'info' => $info, "component_info" => $component_info,
16035364   Benjamin Renard   First commit
315
316
317
318
                                'globalStart' => $globalStart, 'globalStop' => $globalStop, 'timeRestriction' => $timeRestriction,
                                'leaf' => $isLeaf, 'isParameter' => $isParameter, 'isScatter' => $isScatter,
                                'isSpectra' => $isSpectra,'isStack' => $isStack, 'needsArgs' => $needsArgs, 'help' => $help, 'notyet' => $not_yet);
                        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
319
                        else
16035364   Benjamin Renard   First commit
320
                        {
f740e66b   Nathanael Jourdane   Improve the VOTab...
321
                            if ($child->tagName == 'mission')
16035364   Benjamin Renard   First commit
322
                            {
0f5fecfc   Elena.Budnik   only "restriction...
323
                                $disable = $child->hasAttribute('restriction');
16035364   Benjamin Renard   First commit
324
325
326
327
                                $rank = $child->getAttribute('rank');
                            }
                            else
                            {
0f5fecfc   Elena.Budnik   only "restriction...
328
                                $disable = $child->hasAttribute('restriction');
16035364   Benjamin Renard   First commit
329
                            }
f740e66b   Nathanael Jourdane   Improve the VOTab...
330

16035364   Benjamin Renard   First commit
331
332
333
334
335
                            if ($disable)
                            {
                                if ($disable == 1) {
                                    $info .=  "<br/><b>Restricted access</b>";
                                }
f740e66b   Nathanael Jourdane   Improve the VOTab...
336
337
                                else {
                                    $disable = false;
16035364   Benjamin Renard   First commit
338
339
340
                                }
                            }

f740e66b   Nathanael Jourdane   Improve the VOTab...
341
342
                            $childrenToReturn[] = array('text' => $name, 'id' => $id,'nodeType' => $nodeType,  'info' => $info,
                                'leaf' => false, 'help' => $help, 'disable' => $disable, 'rank' => $rank);
16035364   Benjamin Renard   First commit
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
                        }
                    break;

                    case 'remoteSimuParam' :

                        $isSimulation = true;
  			if ($id == 'spase://IMPEX/SimulationModel/FMI/GUMICS' ) {
                                        $isLeaf = false;
                                        $isAddable = true;
                        }
                        if ($child->tagName == 'dataCenter') {
                                if ($child->getAttribute('isSimulation')) break;
                                else {
                                    $skip = true;
                                    break;
                                }
                        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
360
                        if ($child->tagName == 'simulationRegion')
16035364   Benjamin Renard   First commit
361
362
363
364
                            {
                                 $rank = $child->getAttribute('rank');
                            }
 		    case 'remoteParam' :
f740e66b   Nathanael Jourdane   Improve the VOTab...
365

16035364   Benjamin Renard   First commit
366
367
368
369
370
371
                        if ($child->getAttribute('isSimulation') && $child->tagName == 'dataCenter') {
                                $skip = true;
                                break;
                        }

                        $isDeletable = $child->hasAttribute('isDeletable');
f740e66b   Nathanael Jourdane   Improve the VOTab...
372

0f5fecfc   Elena.Budnik   only "restriction...
373
			   $specialNode = true;
f740e66b   Nathanael Jourdane   Improve the VOTab...
374
375
376
377
378
			   $isParameter = false;
                        $isSpectra = false;

                        switch ($id)

16035364   Benjamin Renard   First commit
379
                        {
f740e66b   Nathanael Jourdane   Improve the VOTab...
380
381
                            case 'CDAWEB'  :
                            case 'OMNIWEB' :
16035364   Benjamin Renard   First commit
382
383
384
385
386
387
388
389
390
391
392
393
394
                                            $isLeaf = false;
                                            break;
                            case 'THEMIS' :
                                            $rank = 5;
                                            break;
                            case 'MAPSKP' :
                                            $rank = 9;
                                            break;
                            case 'VEXGRAZ' :
                                            $rank = 2;
                                            break;
                            default:
                        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
395

16035364   Benjamin Renard   First commit
396
397
                        $info = $child->getAttribute('desc');

f740e66b   Nathanael Jourdane   Improve the VOTab...
398
// 			if ($info && !$isSimulation) {
16035364   Benjamin Renard   First commit
399
400
401
			       $info = str_replace(';', "<br/>Time Range: ", $info);
// 			}
			if ($child->tagName == 'dataset') {
f740e66b   Nathanael Jourdane   Improve the VOTab...
402
403
			    /*if ($child->hasAttribute('dataStart') && $child->hasAttribute('dataStop'))
			      $info .= "Time Range: ".$child->getAttribute('dataStart')."-".$child->getAttribute('dataStop')."<br/>";  */
16035364   Benjamin Renard   First commit
404
405
406
407
// 			      $info .= "Time Range: ".$dataStart"-".$dataStop."<br/>";
                        }
			if (($child->tagName == 'parameter') || ($child->tagName == 'component')) {
				    $isParameter = true;
f740e66b   Nathanael Jourdane   Improve the VOTab...
408
				    $isScatter = true;
16035364   Benjamin Renard   First commit
409
			}
f740e66b   Nathanael Jourdane   Improve the VOTab...
410

16035364   Benjamin Renard   First commit
411
412
413
			$needsArgs =  $child->hasAttribute('needsArgs');

			if (($child->tagName == 'parameter' && $child->hasChildNodes()) || $needsArgs) $isScatter = false;
f740e66b   Nathanael Jourdane   Improve the VOTab...
414

16035364   Benjamin Renard   First commit
415
			if ($remoteBase) {
f740e66b   Nathanael Jourdane   Improve the VOTab...
416
			    if ($child->tagName == 'dataset') $isRemoteDataSet = true;
16035364   Benjamin Renard   First commit
417
418
419
			}

			if ($isParameter) {
f740e66b   Nathanael Jourdane   Improve the VOTab...
420
                            $disable = $child->parentNode->getAttribute('disabled');
16035364   Benjamin Renard   First commit
421
422
423
424
			    $objectMgr = new AliasMgr();
			    $alias = $objectMgr->getAlias($id);


f740e66b   Nathanael Jourdane   Improve the VOTab...
425
                            if ($child->hasAttribute('display_type')
16035364   Benjamin Renard   First commit
426
                            && $child->getAttribute('display_type') == 'spectrogram'){
f740e66b   Nathanael Jourdane   Improve the VOTab...
427
                                                $needsArgs = true;
16035364   Benjamin Renard   First commit
428
429
                                                $isScatter = false;
                                                $isSpectra = true;
f740e66b   Nathanael Jourdane   Improve the VOTab...
430
                        }
16035364   Benjamin Renard   First commit
431

f740e66b   Nathanael Jourdane   Improve the VOTab...
432
			    $childrenToReturn[] = array('text' => $name,'alias' => $alias,
16035364   Benjamin Renard   First commit
433
				      'id' => $id,'nodeType' => $nodeType,  'info' => $info, 'help' => $help,
f740e66b   Nathanael Jourdane   Improve the VOTab...
434
				      'leaf' => $isLeaf, 'disable' => $disable, 'isParameter' => $isParameter,
63ac7745   Benjamin Renard   Support component...
435
				      'isScatter' => $isScatter, 'isSpectra' => $isSpectra, 'needsArgs' => $needsArgs, "component_info" => $component_info);
16035364   Benjamin Renard   First commit
436
			  }
f740e66b   Nathanael Jourdane   Improve the VOTab...
437
438
439
			  else {
                            if ($child->tagName == 'dataCenter')
                                $restricted = ($child->getAttribute('available') != "1");
16035364   Benjamin Renard   First commit
440
441
                            else
                                $restricted = false;
f740e66b   Nathanael Jourdane   Improve the VOTab...
442
443

                            if ($id == 'CDAWEB' || $id == 'THEMIS'|| $id == 'MAPSKP' || $id == 'VEXGRAZ')
16035364   Benjamin Renard   First commit
444
445
                                                                                     $restricted = FALSE;
                            if ($restricted)
f740e66b   Nathanael Jourdane   Improve the VOTab...
446
447
                                $info .= "<br/><b>Open soon !</b>";

16035364   Benjamin Renard   First commit
448
449
450
451
                            if ($child->tagName == 'dataset')
                                $nonavailable = ($child->getAttribute('disabled'));
                            else
                                $nonavailable = false;
f740e66b   Nathanael Jourdane   Improve the VOTab...
452

16035364   Benjamin Renard   First commit
453
454
455
456
457
458
459
460
461
462
463
464
465
466
                            if ($nonavailable)
                                $info .= "<br/><b>Not available yet</b>";

                            if ($child->getAttribute('url'))
                                    $info .= "<br/>".$child->getAttribute('url');

                            if ($child->hasAttribute('obsolete')) {
                                $info = $child->getAttribute('desc');
                                $obsolete = true;
                            }
                            else
                                $obsolete = false;

                            $disable = $restricted || $nonavailable || $obsolete;
f740e66b   Nathanael Jourdane   Improve the VOTab...
467

57bf8841   Elena.Budnik   correct mydataPar...
468
				$childrenToReturn[] = array('text' => $name, 'id' => $id,'nodeType' => $nodeType,  'isAddable' => $isAddable,
f740e66b   Nathanael Jourdane   Improve the VOTab...
469
470
471
				'info' => $info, 'leaf' => false, 'isRemoteDataSet' => $isRemoteDataSet, 'disable' => $disable,
                            'isSimulation' => $isSimulation, 'rank' => $rank, 'isDeletable' => $isDeletable, 'help' => $help);

16035364   Benjamin Renard   First commit
472
			  }
f740e66b   Nathanael Jourdane   Improve the VOTab...
473

16035364   Benjamin Renard   First commit
474
		    break;
f740e66b   Nathanael Jourdane   Improve the VOTab...
475
476
477

		     case 'myData' :
			    $info = $child->hasAttribute('info') ? $child->getAttribute('info') : $child->nodeValue;
16035364   Benjamin Renard   First commit
478
479
480
481
482
483
484
485
486
487
488
489
			    break;

                    case 'myDataParam' :

                        $globalStart = null;
                        $globalStop = null;
                        $specialNode = true;
                        $size = $child->getAttribute('size');
                        $isScatter = $size == 1;
                        $mask = $child->getAttribute('mask');
                        $isSpectra = false;

f740e66b   Nathanael Jourdane   Improve the VOTab...
490

16035364   Benjamin Renard   First commit
491
492
493
494
495
496
497
                        if ($isLeaf) {
                            $isParameter = true;
                            $info = "Size: ".$size."<br/>".$child->getAttribute('desc')."<br/> Mask: ".$mask;
                            $isSpectra = $child->getAttribute('plottype') === 'Spectra';
                        }

                        if ($child->hasAttribute('desc')) {
57bf8841   Elena.Budnik   correct mydataPar...
498
499
                            $globalStart = substr($child->getAttribute('desc'), 0, 19);
                            $globalStop =  substr($child->getAttribute('desc'), 20);
16035364   Benjamin Renard   First commit
500
501
                        }

f740e66b   Nathanael Jourdane   Improve the VOTab...
502
                        $childrenToReturn[] = array('text' => $name, 'size' =>  $size, 'id' => $id,
16035364   Benjamin Renard   First commit
503
                        'globalStart' => $globalStart, 'globalStop' => $globalStop,
f740e66b   Nathanael Jourdane   Improve the VOTab...
504
                        'nodeType' => $nodeType, 'info' => $info, 'isScatter' => $isScatter, 'leaf' => $isLeaf,
16035364   Benjamin Renard   First commit
505
506
507
                        'isParameter' => $isParameter, 'linkedMask' => $mask, 'isSpectra' => $isSpectra);

                        break;
f740e66b   Nathanael Jourdane   Improve the VOTab...
508
                    default:
16035364   Benjamin Renard   First commit
509
		}
f740e66b   Nathanael Jourdane   Improve the VOTab...
510

16035364   Benjamin Renard   First commit
511
		if (!$specialNode && !$skip) {
f740e66b   Nathanael Jourdane   Improve the VOTab...
512
		       if ($child->hasAttribute('desc'))
16035364   Benjamin Renard   First commit
513
			    $info = $child->getAttribute('desc');
f740e66b   Nathanael Jourdane   Improve the VOTab...
514
			$childrenToReturn[] = array('text' => $name, 'id' => $id, 'nodeType' => $nodeType, 'info' => $info,
16035364   Benjamin Renard   First commit
515
516
517
518
                                                    'help' => $help, 'leaf' => $isLeaf, 'isParameter' => $isParameter);
		}
	      }
		// if $childrenToReturn we have to return []
f740e66b   Nathanael Jourdane   Improve the VOTab...
519
		 if ($childrenToReturn == null) {
16035364   Benjamin Renard   First commit
520
521
522
523
524
525
526
			$childrenToReturn = array('nodeType' => $nodeType, 'text' => null);
		 }
        }

      return  $childrenToReturn;
 }

f740e66b   Nathanael Jourdane   Improve the VOTab...
527
    public  function saveTree($obj)
16035364   Benjamin Renard   First commit
528
529
    {
            $paramMgr = new ParamMgr();
f740e66b   Nathanael Jourdane   Improve the VOTab...
530
            return $paramMgr->saveTree($obj);
16035364   Benjamin Renard   First commit
531
532
    }

f740e66b   Nathanael Jourdane   Improve the VOTab...
533
534
    public  function doNothing($obj)
    {
16035364   Benjamin Renard   First commit
535
        return array("res" => 'ok');
f740e66b   Nathanael Jourdane   Improve the VOTab...
536

16035364   Benjamin Renard   First commit
537
538
    }

f740e66b   Nathanael Jourdane   Improve the VOTab...
539
540
    public  function deleteFromTree($obj)
    {
16035364   Benjamin Renard   First commit
541
542
        $paramMgr = new ParamMgr();
        return $paramMgr->deleteFromTree($obj);
f740e66b   Nathanael Jourdane   Improve the VOTab...
543

16035364   Benjamin Renard   First commit
544
545
546
547
    }

/*
*  temporary object fromUpload
f740e66b   Nathanael Jourdane   Improve the VOTab...
548
*/
16035364   Benjamin Renard   First commit
549
    public  function getUploadedObject($name, $format, $nodeType)
f740e66b   Nathanael Jourdane   Improve the VOTab...
550
551
    {
            switch ($nodeType)
16035364   Benjamin Renard   First commit
552
            {
f740e66b   Nathanael Jourdane   Improve the VOTab...
553
554
                case 'timeTable' :
                        $objectMgr = new TimeTableMgr();
16035364   Benjamin Renard   First commit
555
                        break;
f740e66b   Nathanael Jourdane   Improve the VOTab...
556
557
                case 'myDataParam' :
                        $objectMgr = new FilesMgr();
16035364   Benjamin Renard   First commit
558
559
560
561
562
                        break;
                default:
                        return array("error" => $nodeType." NOT_IMPLEMENTED_YET");
            }
            return  $objectMgr -> getUploadedObject($name, $format, true);
aa94fd24   elena   Merge with last svn
563

f740e66b   Nathanael Jourdane   Improve the VOTab...
564
    }
16035364   Benjamin Renard   First commit
565
566

/*
f740e66b   Nathanael Jourdane   Improve the VOTab...
567
568
569
570
571
*  fill ascii file into grid
*/
    public  function getAsciiFile($obj)
    {
            $objectMgr = new FilesMgr();
16035364   Benjamin Renard   First commit
572
573
            return  $objectMgr -> getAsciiFile($obj->fileName);
    }
f740e66b   Nathanael Jourdane   Improve the VOTab...
574
575
576
577

    public  function getMyParamInfo($object)
    {
            $objectMgr = new FilesMgr();
16035364   Benjamin Renard   First commit
578
            return  $objectMgr -> getParamInfo($object);
f740e66b   Nathanael Jourdane   Improve the VOTab...
579
    }
16035364   Benjamin Renard   First commit
580
581

/*
f740e66b   Nathanael Jourdane   Improve the VOTab...
582
583
584
585
*  temporary object from Search
*/
    public  function getTmpObject($folderId, $name, $nodeType) {

aa94fd24   elena   Merge with last svn
586

16035364   Benjamin Renard   First commit
587
	    switch ($nodeType) {
f740e66b   Nathanael Jourdane   Improve the VOTab...
588
589
590
		  case 'timeTable' :
			   $objectMgr = new TimeTableMgr();
			   break;
d18b535d   elena   catalog draft + c...
591
		 case 'catalog' :
f740e66b   Nathanael Jourdane   Improve the VOTab...
592
593
			   $objectMgr = new CatalogMgr();
			   break;
16035364   Benjamin Renard   First commit
594
595
596
597
		  default:
			    return array("error" => $nodeType." NOT_IMPLEMENTED_YET");
              }
	      return  $objectMgr -> getTmpObject($folderId, $name, true);
aa94fd24   elena   Merge with last svn
598

16035364   Benjamin Renard   First commit
599
    }
16035364   Benjamin Renard   First commit
600

f740e66b   Nathanael Jourdane   Improve the VOTab...
601
602
603

    public  function getObject($id, $nodeType) {

16035364   Benjamin Renard   First commit
604
605
	    switch ($nodeType) {
		  case 'myDataParam':
f740e66b   Nathanael Jourdane   Improve the VOTab...
606
607
		  case 'derivedParam' :
			   $objectMgr = new DerivedParamMgr($nodeType);
16035364   Benjamin Renard   First commit
608
			   break;
f740e66b   Nathanael Jourdane   Improve the VOTab...
609
		  case 'timeTable' :
16035364   Benjamin Renard   First commit
610
		  case 'sharedtimeTable' :
f740e66b   Nathanael Jourdane   Improve the VOTab...
611
612
			   $objectMgr = new TimeTableMgr();
			   break;
048b4d77   elena   catalogs +
613
		  case 'catalog' :
169f14d2   Benjamin Renard   Add shared object...
614
          case 'sharedcatalog' :
f740e66b   Nathanael Jourdane   Improve the VOTab...
615
616
617
			   $objectMgr = new CatalogMgr();
			   break;
		  case 'condition' :
16035364   Benjamin Renard   First commit
618
		  case 'request' :
f740e66b   Nathanael Jourdane   Improve the VOTab...
619
620
			   $objectMgr = new RequestMgr($nodeType);
			   break;
16035364   Benjamin Renard   First commit
621
622
623
624
625
		  case 'bkgWorks' :
		  	require_once(INTEGRATION_SRC_DIR."RequestManager.php");
		  	return $this->executeRequest($id, FunctionTypeEnumClass::PROCESSGETINFO);
			   break;
		  case 'myData' :
f740e66b   Nathanael Jourdane   Improve the VOTab...
626
			   $objectMgr = new FilesMgr();
16035364   Benjamin Renard   First commit
627
628
629
630
631
632
633
634
635
636
			   break;
		  default:
			    return array("error" => $nodeType." NOT_IMPLEMENTED_YET");
              }

	    return  $objectMgr -> getObject($id, $nodeType);
    }
/*
*   $obj = { id: node.id, leaf: node.leaf, nodeType: node.nodeType }
*/
f740e66b   Nathanael Jourdane   Improve the VOTab...
637
638
639
640
641
642
643
    public  function deleteObject($obj) {

	    switch ($obj->nodeType) {

		  case 'myDataParam' :
		  case 'derivedParam' :
			   $objectMgr = new DerivedParamMgr($obj->nodeType);
16035364   Benjamin Renard   First commit
644
			   break;
f740e66b   Nathanael Jourdane   Improve the VOTab...
645
646
		  case 'timeTable' :
			   $objectMgr = new TimeTableMgr();
16035364   Benjamin Renard   First commit
647
			   break;
f740e66b   Nathanael Jourdane   Improve the VOTab...
648
649
650
651
		  case 'catalog' :
			   $objectMgr = new CatalogMgr();
			   break;
		  case 'condition' :
16035364   Benjamin Renard   First commit
652
		  case 'request' :
f740e66b   Nathanael Jourdane   Improve the VOTab...
653
			   $objectMgr = new RequestMgr($obj->nodeType);
16035364   Benjamin Renard   First commit
654
655
656
657
			   break;
		  case 'alias' :
		  	   $objectMgr = new AliasMgr();
		  	   $obj->id = substr($obj->id,strlen('alias_'));
f740e66b   Nathanael Jourdane   Improve the VOTab...
658
		  	   break;
16035364   Benjamin Renard   First commit
659
660
661
		  case 'bkgWorks' :
		  	   require_once(INTEGRATION_SRC_DIR."RequestManager.php");
		  	   return $this->executeRequest($obj, FunctionTypeEnumClass::PROCESSDELETE);
aa94fd24   elena   Merge with last svn
662

16035364   Benjamin Renard   First commit
663
664
665
666
667
668
669
670
671
672
673
674
675
		  case 'myData' :
				$objectMgr = new FilesMgr();
			   break;
		  default:
			    return array("error" => $obj->nodeType." NOT_IMPLEMENTED_YET");
              }

	    return  $objectMgr -> deleteObject($obj);
    }

/*
*   $obj = { id: node.id, old_name: node.text, name: value,  parent : node.parentNode.id, leaf: node.leaf, nodeType: node.nodeType }
*/
f740e66b   Nathanael Jourdane   Improve the VOTab...
676
677
    public  function renameObject($obj) {

16035364   Benjamin Renard   First commit
678
	    switch ($obj->nodeType) {
f740e66b   Nathanael Jourdane   Improve the VOTab...
679

16035364   Benjamin Renard   First commit
680
		  case 'myDataParam' :
f740e66b   Nathanael Jourdane   Improve the VOTab...
681
682
		  case 'derivedParam' :
			   $objectMgr = new DerivedParamMgr($obj->nodeType);
16035364   Benjamin Renard   First commit
683
			   break;
f740e66b   Nathanael Jourdane   Improve the VOTab...
684
685
		  case 'timeTable' :
			   $objectMgr = new TimeTableMgr();
d18b535d   elena   catalog draft + c...
686
			   break;
f740e66b   Nathanael Jourdane   Improve the VOTab...
687
688
689
690
691
692
		  case 'catalog' :
			   $objectMgr = new CatalogMgr();
			   break;
		  case 'condition' :
		  case 'request' :
			   $objectMgr = new RequestMgr($obj->nodeType);
16035364   Benjamin Renard   First commit
693
694
			   break;
		  case 'alias' :
f740e66b   Nathanael Jourdane   Improve the VOTab...
695
696
		  	   $objectMgr = new AliasMgr();
		  	   break;
16035364   Benjamin Renard   First commit
697
698
699
700
701
702
703
		  default:
			    return array("error" => $obj->nodeType." NOT_IMPLEMENTED_YET");
              }

	    return  $objectMgr -> renameObject($obj);
    }

f740e66b   Nathanael Jourdane   Improve the VOTab...
704
/*
16035364   Benjamin Renard   First commit
705
706
*   $obj = { name: obj.name, obj.nodeType, obj.leaf (??), OBJ DEPENDENT ATTRIBUTES }
*/
f740e66b   Nathanael Jourdane   Improve the VOTab...
707
708
    public  function createObject($obj, $folder) {

16035364   Benjamin Renard   First commit
709
710
	    switch ($obj->nodeType) {

f740e66b   Nathanael Jourdane   Improve the VOTab...
711
		  case 'myDataParam' :
16035364   Benjamin Renard   First commit
712
		  case 'derivedParam' :
f740e66b   Nathanael Jourdane   Improve the VOTab...
713
                        if ($obj->nodeType == 'derivedParam' &&  $this->amdaStat->success)
16035364   Benjamin Renard   First commit
714
715
                             $this->amdaStat->addTask('create', $this->user, null);

f740e66b   Nathanael Jourdane   Improve the VOTab...
716
717
718
719
720
721
722
                        $objectMgr = new DerivedParamMgr($obj->nodeType);
                        break;
		  case 'timeTable' :
                        $objectMgr = new TimeTableMgr();
			   break;
		  case 'catalog' :
                        $objectMgr = new CatalogMgr();
16035364   Benjamin Renard   First commit
723
724
			   break;
		  case 'condition' :
f740e66b   Nathanael Jourdane   Improve the VOTab...
725
726
727
		  case 'request' :
			   $objectMgr = new RequestMgr($obj->nodeType);
			   break;
16035364   Benjamin Renard   First commit
728
		  case 'alias' :
f740e66b   Nathanael Jourdane   Improve the VOTab...
729
730
			    $objectMgr = new AliasMgr();
			    break;
16035364   Benjamin Renard   First commit
731
732
733
734
735
736
737
		  default:
			    return array("error" => $obj->nodeType." NOT_IMPLEMENTED_YET");
              }

	    return  $objectMgr -> createObject($obj, $folder);
    }

f740e66b   Nathanael Jourdane   Improve the VOTab...
738
/*
16035364   Benjamin Renard   First commit
739
740
741
*   $obj = { id:obj.id, name: obj.name, obj.nodeType, obj.leaf (??), OBJ DEPENDENT ATTRIBUTES }
*/
    public  function modifyObject($obj) {
16035364   Benjamin Renard   First commit
742

f740e66b   Nathanael Jourdane   Improve the VOTab...
743
744
745
746
747
748
749
750
	    switch ($obj->nodeType) {

		  case 'myDataParam' :
		  case 'derivedParam' :
			   $objectMgr = new DerivedParamMgr($obj->nodeType);
			   break;
		  case 'timeTable' :
			   $objectMgr = new TimeTableMgr();
16035364   Benjamin Renard   First commit
751
			   break;
f740e66b   Nathanael Jourdane   Improve the VOTab...
752
753
		  case 'catalog' :
			   $objectMgr = new CatalogMgr();
d18b535d   elena   catalog draft + c...
754
			   break;
f740e66b   Nathanael Jourdane   Improve the VOTab...
755
		  case 'condition' :
16035364   Benjamin Renard   First commit
756
		  case 'request' :
f740e66b   Nathanael Jourdane   Improve the VOTab...
757
			   $objectMgr = new RequestMgr($obj->nodeType);
16035364   Benjamin Renard   First commit
758
759
760
761
762
763
			   break;
		  default:
			    return array("error" => $obj->nodeType." NOT_IMPLEMENTED_YET");
              }

	    return  $objectMgr -> modifyObject($obj);
f740e66b   Nathanael Jourdane   Improve the VOTab...
764
    }
16035364   Benjamin Renard   First commit
765
766
767
768
769
770
771
772
773
774
/*
 * {obj.name, obj.nodeType, obj.leaf}
 */
    public function validNameObject($obj) {
		switch ($obj->nodeType) {
			case 'myDataParam' :
			case 'derivedParam' :
				$objectMgr = new DerivedParamMgr($obj->nodeType);
				break;
			case 'timeTable' :
d18b535d   elena   catalog draft + c...
775
			case 'sharedtimeTable' :
16035364   Benjamin Renard   First commit
776
777
				$objectMgr = new TimeTableMgr();
				break;
d18b535d   elena   catalog draft + c...
778
			case 'catalog' :
169f14d2   Benjamin Renard   Add shared object...
779
			case 'sharedcatalog' :
d18b535d   elena   catalog draft + c...
780
781
				$objectMgr = new CatalogMgr();
				break;
16035364   Benjamin Renard   First commit
782
783
784
785
786
787
788
789
790
791
792
793
794
795
			case 'condition' :
			case 'request' :
				$objectMgr = new RequestMgr($obj->nodeType);
				break;
			default:
				return array("error" => $obj->nodeType." NOT_IMPLEMENTED_YET");
		}

		return  $objectMgr -> validNameObject($obj);
    }

/*
*   Get Jobs en cours
*/
aa94fd24   elena   Merge with last svn
796

16035364   Benjamin Renard   First commit
797
798
799
    public  function getJobs()
    {
    	require_once(INTEGRATION_SRC_DIR."RequestManager.php");
f740e66b   Nathanael Jourdane   Improve the VOTab...
800
    	return $this->executeRequest($obj, FunctionTypeEnumClass::PROCESSRUNNINGINFO);
16035364   Benjamin Renard   First commit
801
802
803
804
805
806
807
808
809
810
811
812
813
    }


	/* AKKA-KERNEL-INT
	Move user check from RequestMgr.php to AmdaAction.php
	*/
	private function checkUser($obj)
	{
		if (defined('NEWKERNEL_DEBUG') && NEWKERNEL_DEBUG)
		{
			$this->user = NEWKERNEL_DEBUG_USER;
			return array('success' => true);
		}
f740e66b   Nathanael Jourdane   Improve the VOTab...
814
815


16035364   Benjamin Renard   First commit
816
817
818
819
820
821
822
823
		if (isset($obj->username) && isset($obj->password) && isset($obj->sessionID))
        {
			//$dd = new WSUserMgr();
            //$dd->init($obj->username,$obj->password,$obj->sessionID);
			return array('success' => false, "message" => "AKKA-KERNEL-INT - WS support not implemented");
        }
        else
			$dd = new UserMgr();
f740e66b   Nathanael Jourdane   Improve the VOTab...
824
825

        //TODO error handling
16035364   Benjamin Renard   First commit
826
827
        if (($res = $dd -> ddCheckUser()) != 0)
		{
f740e66b   Nathanael Jourdane   Improve the VOTab...
828
			if ($res == 156)
16035364   Benjamin Renard   First commit
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
				return array('success' => false, 'message' => 'Your AMDA session is expired.<br/> Login please!');

            return array('success' => false, 'message' => 'ddLogin error: '.$res);
        }

        if ($dd->user == 'impex')
		{
			//if ($dd->getWsSize() > DISK_QUOTA * 100)
			//	error_log('Natacha! It is time to CLEAN UP IMPEX WS!',1,'nbourrel@irap.omp.eu');
			return array('success' => false, "message" => "AKKA-KERNEL-INT - WS support for IMPEx not implemented");
        }
        else
		{
			// check disk space
            if ($dd->getWsSize() > DISK_QUOTA)
				return array('success' => false, 'message' => 'Please clean up your workspace.<br/>No more space is available');
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
846

16035364   Benjamin Renard   First commit
847
        $this->user = $dd->user;
f740e66b   Nathanael Jourdane   Improve the VOTab...
848

16035364   Benjamin Renard   First commit
849
850
		return array('success' => true, 'userHost' => $dd -> getIPclient());
	}
f740e66b   Nathanael Jourdane   Improve the VOTab...
851

16035364   Benjamin Renard   First commit
852
853
854
	private function executeRequest($obj, $function)
	{
		$res = $this->checkUser($obj);
f740e66b   Nathanael Jourdane   Improve the VOTab...
855

16035364   Benjamin Renard   First commit
856
857
		if (!$res['success'])
			return $res;
f740e66b   Nathanael Jourdane   Improve the VOTab...
858

16035364   Benjamin Renard   First commit
859
		$requestManager = new RequestManagerClass();
f740e66b   Nathanael Jourdane   Improve the VOTab...
860

16035364   Benjamin Renard   First commit
861
862
863
864
865
		try {
			$res = $requestManager->runIHMRequest($this->user, $res['userHost'], $function, $obj);
		} catch (Exception $e) {
			return array('success' => false, 'message' => 'Exception detected : '.$e->getMessage());
		}
f740e66b   Nathanael Jourdane   Improve the VOTab...
866

16035364   Benjamin Renard   First commit
867
868
		return $res;
	}
f740e66b   Nathanael Jourdane   Improve the VOTab...
869
870
871

/*
*    Main EXECUTE PROCEDURE
16035364   Benjamin Renard   First commit
872
873
*/
    public  function execute($node, $obj)
f740e66b   Nathanael Jourdane   Improve the VOTab...
874
	{
16035364   Benjamin Renard   First commit
875
876
877
878
879
880
		require_once(INTEGRATION_SRC_DIR."RequestManager.php");
		if (isset($obj->action))
			return $this->executeRequest($obj, FunctionTypeEnumClass::ACTION);
		else
			return $this->executeRequest($obj, FunctionTypeEnumClass::PARAMS);
    }
f740e66b   Nathanael Jourdane   Improve the VOTab...
881

16035364   Benjamin Renard   First commit
882
/*
a0b3d64e   Benjamin Renard   Derived parameter...
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
 * Generate derived parameter compilation
 */
    public function compilParam($obj)
    {
    	require_once(INTEGRATION_SRC_DIR."RequestManager.php");
    	return $this->executeRequest($obj, FunctionTypeEnumClass::PARAMSGEN);
    }

/*
 * Delete derived parameter compilation
 */
   public function compilParamDelete($obj)
   {
		require_once(INTEGRATION_SRC_DIR."RequestManager.php");
		$res = $this->checkUser($obj);
f740e66b   Nathanael Jourdane   Improve the VOTab...
898

a0b3d64e   Benjamin Renard   Derived parameter...
899
900
		if (!$res['success'])
			return $res;
f740e66b   Nathanael Jourdane   Improve the VOTab...
901

a0b3d64e   Benjamin Renard   Derived parameter...
902
903
904
905
906
907
		IHMConfigClass::setUserName($this->user);
		$libParamPath = IHMConfigClass::getCompilationPath()."lib/".$obj->paramId.".so";
		if (file_exists($libParamPath))
			unlink($libParamPath);
    	return array("success" => true);
   }
f740e66b   Nathanael Jourdane   Improve the VOTab...
908

a0b3d64e   Benjamin Renard   Derived parameter...
909
/*
e6e5b259   Benjamin Renard   Add kill plot req...
910
 * kill plot process
16035364   Benjamin Renard   First commit
911
 */
f740e66b   Nathanael Jourdane   Improve the VOTab...
912

e6e5b259   Benjamin Renard   Add kill plot req...
913
    public function killPlotRequest()
f740e66b   Nathanael Jourdane   Improve the VOTab...
914
    {
e6e5b259   Benjamin Renard   Add kill plot req...
915
916
    	require_once(INTEGRATION_SRC_DIR."RequestManager.php");
    	return $this->executeRequest((object) array('nodeType' => 'killplot'), FunctionTypeEnumClass::PARAMS);
16035364   Benjamin Renard   First commit
917
918
919
920
921
922
923
924
925
    }

/*
 * merge time tables
 */
    public  function merge($obj)   {

        if ($this->amdaStat->success)
            $this->amdaStat->addTask('ttoper', $this->user, null);
f740e66b   Nathanael Jourdane   Improve the VOTab...
926

16035364   Benjamin Renard   First commit
927
928
929
930
931
932
        $objectMgr = new TimeTableMgr();

    return  $objectMgr -> merge($obj);

    }

f740e66b   Nathanael Jourdane   Improve the VOTab...
933

16035364   Benjamin Renard   First commit
934
935
936
937
938
939
940
941
942
943
944
945
946
/*
 * intersect time tables
 */
        public  function intersect($obj)   {

            if ($this->amdaStat->success)
                $this->amdaStat->addTask('ttoper', $this->user, null);

            $objectMgr = new TimeTableMgr();
            $result = $objectMgr -> intersect($obj);

            return  $result;
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
947

f9c8b272   elena   edit catalog
948
        public function initTTCache($isCatalog = false, $nparams)
16035364   Benjamin Renard   First commit
949
        {
048b4d77   elena   catalogs +
950
951
        	if (!$isCatalog) $cacheMgr = new TimeTableCacheMgr();
        	else              $cacheMgr = new CatalogCacheMgr();
f740e66b   Nathanael Jourdane   Improve the VOTab...
952

f9c8b272   elena   edit catalog
953
        	return $cacheMgr->initTTCache($nparams);
16035364   Benjamin Renard   First commit
954
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
955
956


16035364   Benjamin Renard   First commit
957
958
        public function initTTCacheFromTT($id, $type)
        {
169f14d2   Benjamin Renard   Add shared object...
959
        	if ($type == 'catalog' || $type == 'sharedcatalog') $cacheMgr = new CatalogCacheMgr();
048b4d77   elena   catalogs +
960
        	else $cacheMgr = new TimeTableCacheMgr();
f740e66b   Nathanael Jourdane   Improve the VOTab...
961

16035364   Benjamin Renard   First commit
962
963
        	return $cacheMgr->initFromTT($id, $type);
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
964

9d412dda   elena   catalog tmp and r...
965
        public function initForChart($id, $name, $isTmpObject, $type)
86263051   elena   visu second draft
966
        {
169f14d2   Benjamin Renard   Add shared object...
967
        	if ($type == 'catalog' || $type == 'sharedcatalog') $objMgr = new CatalogMgr();
f740e66b   Nathanael Jourdane   Improve the VOTab...
968

9d412dda   elena   catalog tmp and r...
969
        	return $objMgr->initForChart($id, $name, $isTmpObject, $type);
86263051   elena   visu second draft
970
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
971

d18b535d   elena   catalog draft + c...
972
        public function initTTCacheFromTmpObject($folderId, $name, $isCatalog = false)
16035364   Benjamin Renard   First commit
973
        {
d18b535d   elena   catalog draft + c...
974
			if (!$isCatalog) $cacheMgr = new TimeTableCacheMgr();
f740e66b   Nathanael Jourdane   Improve the VOTab...
975

d18b535d   elena   catalog draft + c...
976
			else              $cacheMgr = new CatalogCacheMgr();
f740e66b   Nathanael Jourdane   Improve the VOTab...
977
978
979



16035364   Benjamin Renard   First commit
980
981
        	return $cacheMgr->initFromTmpObject($folderId, $name);
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
982

16035364   Benjamin Renard   First commit
983
984
985
986
987
        public function initTTCacheFromUploadedFile($name, $format)
        {
        	$cacheMgr = new TimeTableCacheMgr();
        	return $cacheMgr->initFromUploadedFile($name, $format);
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
988

16035364   Benjamin Renard   First commit
989
990
        public function readTTCacheIntervals($o)
        {
169f14d2   Benjamin Renard   Add shared object...
991
        	if ($o->typeTT == 'catalog' || $type == 'sharedcatalog') $cacheMgr = new CatalogCacheMgr();
d18b535d   elena   catalog draft + c...
992
        	else $cacheMgr = new TimeTableCacheMgr();
f740e66b   Nathanael Jourdane   Improve the VOTab...
993

16035364   Benjamin Renard   First commit
994
995
        	return $cacheMgr->getIntervals($o->start,$o->limit,$o->sort,$o->filter);
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
996

86263051   elena   visu second draft
997
998
	 public function readIntervalsForChart($o)
        {
169f14d2   Benjamin Renard   Add shared object...
999
        	if ($o->typeTT == 'catalog' || $type == 'sharedcatalog') $objMgr = new CatalogMgr();
f740e66b   Nathanael Jourdane   Improve the VOTab...
1000
1001


9d412dda   elena   catalog tmp and r...
1002
        	return $objMgr->getIntervalsForChart($o->id, $o->name, $o->fromPlugin, $o->typeTT);
86263051   elena   visu second draft
1003
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1004

16035364   Benjamin Renard   First commit
1005
1006
1007
1008
1009
        public function saveTTCacheIntervalsInTT($o)
        {
        	$cacheMgr = new TimeTableCacheMgr();
            return $cacheMgr->saveInTT($o->ttId,$o->action,$o->cacheToken);
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1010

16035364   Benjamin Renard   First commit
1011
1012
        public function addTTCacheInterval($o)
        {
f9c8b272   elena   edit catalog
1013
1014
          	if ($o->isCatalog) $cacheMgr = new CatalogCacheMgr();
          	else $cacheMgr = new TimeTableCacheMgr();
f740e66b   Nathanael Jourdane   Improve the VOTab...
1015

16035364   Benjamin Renard   First commit
1016
1017
            return $cacheMgr->addInterval($o->index, $o->start, $o->stop);
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1018

70aabdee   elena   catalog draft
1019
        public function removeTTCacheIntervalFromId($id, $isCatalog = false)
16035364   Benjamin Renard   First commit
1020
        {
70aabdee   elena   catalog draft
1021
1022
        	if ($isCatalog) $cacheMgr = new CatalogCacheMgr();
        	else $cacheMgr = new TimeTableCacheMgr();
f740e66b   Nathanael Jourdane   Improve the VOTab...
1023

16035364   Benjamin Renard   First commit
1024
1025
        	return $cacheMgr->removeIntervalFromId($id);
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1026

16035364   Benjamin Renard   First commit
1027
1028
        public function modifyTTCacheInterval($o)
        {
f9c8b272   elena   edit catalog
1029
        	if ($o->isCatalog) {
f740e66b   Nathanael Jourdane   Improve the VOTab...
1030

f9c8b272   elena   edit catalog
1031
1032
			$cacheMgr = new CatalogCacheMgr();
		return $cacheMgr->modifyIntervalFromId($o);
f740e66b   Nathanael Jourdane   Improve the VOTab...
1033

f9c8b272   elena   edit catalog
1034
1035
		}
          	else $cacheMgr = new TimeTableCacheMgr();
f740e66b   Nathanael Jourdane   Improve the VOTab...
1036

16035364   Benjamin Renard   First commit
1037
1038
        	return $cacheMgr->modifyIntervalFromId($o->cacheId, $o->start, $o->stop);
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1039

16035364   Benjamin Renard   First commit
1040
1041
1042
1043
1044
        public function operationTTCacheIntervals($extendTime, $shiftTime)
        {
        	$cacheMgr = new TimeTableCacheMgr();
        	return $cacheMgr->operationIntervals($extendTime, $shiftTime);
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1045

16035364   Benjamin Renard   First commit
1046
1047
1048
1049
1050
        public function mergeTTCacheIntervals()
        {
        	$cacheMgr = new TimeTableCacheMgr();
        	return $cacheMgr->mergeIntervals();
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1051

16035364   Benjamin Renard   First commit
1052
1053
1054
1055
1056
        public function getTTCacheStatistics()
        {
        	$cacheMgr = new TimeTableCacheMgr();
        	return $cacheMgr->getStatistics();
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1057

16035364   Benjamin Renard   First commit
1058
1059
1060
1061
1062
        public function getTTCacheStatus()
        {
        	$cacheMgr = new TimeTableCacheMgr();
        	return $cacheMgr->getStatus();
        }
aa94fd24   elena   Merge with last svn
1063

16035364   Benjamin Renard   First commit
1064
1065
/*
 * Send a feedback
f740e66b   Nathanael Jourdane   Improve the VOTab...
1066
 *
16035364   Benjamin Renard   First commit
1067
1068
1069
1070
1071
1072
 */
        public function sendFeedback($feed)
        {
            $feedMgr = new FeedbackMgr();
            return $feedMgr->addFeedback($feed->user, $feed->interface, $feed->subject, $feed->userText, $feed->userAgent, $feed->attach);
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1073

16035364   Benjamin Renard   First commit
1074
1075
/*
 * Save state
f740e66b   Nathanael Jourdane   Improve the VOTab...
1076
 *
16035364   Benjamin Renard   First commit
1077
1078
1079
1080
1081
1082
 */
        public function saveState($datas)
        {
            $myStateMgr = new StateMgr();
            return $myStateMgr->saveState($datas);
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1083

16035364   Benjamin Renard   First commit
1084
1085
/*
 * Load state
f740e66b   Nathanael Jourdane   Improve the VOTab...
1086
1087
 *
 */
16035364   Benjamin Renard   First commit
1088
        public function loadState($o)
f740e66b   Nathanael Jourdane   Improve the VOTab...
1089
        {
16035364   Benjamin Renard   First commit
1090
1091
1092
                $myStateMgr = new StateMgr();
                return $myStateMgr->loadState();
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1093
1094

/*
16035364   Benjamin Renard   First commit
1095
1096
1097
 * SAMP
 */
        public function sendToSAMP($o)
f740e66b   Nathanael Jourdane   Improve the VOTab...
1098
        {
16035364   Benjamin Renard   First commit
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
                if ($this->amdaStat->success)
                    $this->amdaStat->addTask('samp', $this->user, null);

                $objectMgr = new RequestMgr();
                $res = $objectMgr->generateVOTableFromDownloadResult($o->folderId, $o->downId,true,true);
                if ($res['success'])
                {
                    foreach ($res['files'] as $key => $value)
                    $res['files'][$key] = str_replace(BASE_PATH,"",$value);
                }
                return $res;
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1111

16035364   Benjamin Renard   First commit
1112
1113
1114
1115
1116
1117
1118
/*
 * HST Images
 */
        public function getHstImagesUrl($o)
        {
                if ($this->amdaStat->success)
                    $this->amdaStat->addTask('images', $this->user, null);
f740e66b   Nathanael Jourdane   Improve the VOTab...
1119

16035364   Benjamin Renard   First commit
1120
1121
1122
1123
1124
1125
                $myHstMgr = new HstMgr();
                $res = $myHstMgr->getImagesUrl($o->startTime, $o->stopTime, $o->planet);
                //if ($domRes->length <= 0)
                //	return array('success' => false, 'message' => 'Cannot find HST Images for this request.');
                return array('success' => true, 'result' => $res);
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1126

16035364   Benjamin Renard   First commit
1127
1128
        public function getAPISImagesUrl($o)
        {
f740e66b   Nathanael Jourdane   Improve the VOTab...
1129
                if ($this->amdaStat->success)
16035364   Benjamin Renard   First commit
1130
                    $this->amdaStat->addTask('images', $this->user, null);
f740e66b   Nathanael Jourdane   Improve the VOTab...
1131

16035364   Benjamin Renard   First commit
1132
                $apisMgr = new APISMgr();
b7796276   Benjamin Renard   Migration to supp...
1133
                $res = $apisMgr->get($o->target, $o->startTime, $o->stopTime, $o->datasets);
16035364   Benjamin Renard   First commit
1134
1135

                return $res;
f740e66b   Nathanael Jourdane   Improve the VOTab...
1136
        }
16035364   Benjamin Renard   First commit
1137
1138
1139
1140
1141
/*
 * Filters
 */
        public function loadFilterList($o)
        {
f740e66b   Nathanael Jourdane   Improve the VOTab...
1142
                $filtersMgr = new FiltersMgr();
16035364   Benjamin Renard   First commit
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
                $res = $filtersMgr->loadList();
                return $res;
        }

        public function loadFilters($o)
        {
                $filtersMgr = new FiltersMgr();
                if (isset($o->id))
                    $res = $filtersMgr->loadFilter($o->id);
                else
                    $res = $filtersMgr->loadAll();
                return $res;
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1156

16035364   Benjamin Renard   First commit
1157
1158
        public function saveFilter($o)
        {
f740e66b   Nathanael Jourdane   Improve the VOTab...
1159
                $filtersMgr = new FiltersMgr();
16035364   Benjamin Renard   First commit
1160
1161
                return $filtersMgr->save($o);
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1162

16035364   Benjamin Renard   First commit
1163
1164
        public function createFilter($o)
        {
f740e66b   Nathanael Jourdane   Improve the VOTab...
1165
                $filtersMgr = new FiltersMgr();
16035364   Benjamin Renard   First commit
1166
1167
                return $filtersMgr->create($o);
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1168

16035364   Benjamin Renard   First commit
1169
1170
1171
1172
1173
1174
        public function destroyFilter($o)
        {
                $filtersMgr = new FiltersMgr();
                $res = $filtersMgr->delete($o);
                return;
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1175

16035364   Benjamin Renard   First commit
1176
1177
1178
1179
1180
1181
        public function getCrtFilterId()
        {
                $filtersMgr = new FiltersMgr();
                $res = $filtersMgr->getCrtId();
                return $res;
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1182

16035364   Benjamin Renard   First commit
1183
1184
        public function getCrtFilterResult()
        {
f740e66b   Nathanael Jourdane   Improve the VOTab...
1185
                $filtersMgr = new FiltersMgr();
16035364   Benjamin Renard   First commit
1186
1187
                return $filtersMgr->getCrtResult();
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1188

16035364   Benjamin Renard   First commit
1189
1190
        public function setCrtFilterId($o)
        {
f740e66b   Nathanael Jourdane   Improve the VOTab...
1191
                $filtersMgr = new FiltersMgr();
16035364   Benjamin Renard   First commit
1192
1193
                return $filtersMgr->setCrtId($o->id);
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1194

16035364   Benjamin Renard   First commit
1195
1196
1197
1198
1199
1200
        public function resetFilter()
        {
                $filtersMgr = new FiltersMgr();
                $res = $filtersMgr->reset();
                return $res;
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1201

16035364   Benjamin Renard   First commit
1202
1203
1204
1205
1206
1207
1208
1209
	public function logout($isGuest)
	{
                if ($isGuest) {
                    $guestMgr = new Guest($this->user);
                    $guestMgr->deleteGuest();
                }
                else {
                    $myBaseMgr = new BaseManager();
f740e66b   Nathanael Jourdane   Improve the VOTab...
1210
1211
1212
                    $myBaseMgr->delSimuFiles('mysimudata');
		    $myBaseMgr->delSimuFiles('mywsrdata');

18d4a11e   Benjamin Renard   Save and load plo...
1213
                    $this->cleanUserWS();
f740e66b   Nathanael Jourdane   Improve the VOTab...
1214
                 }
16035364   Benjamin Renard   First commit
1215
		return;
f740e66b   Nathanael Jourdane   Improve the VOTab...
1216
	}
16035364   Benjamin Renard   First commit
1217
1218
1219

        public function getInfo($obj)
        {
f740e66b   Nathanael Jourdane   Improve the VOTab...
1220
                if (file_exists(HELPPATH.$obj->name))
16035364   Benjamin Renard   First commit
1221
                {
f740e66b   Nathanael Jourdane   Improve the VOTab...
1222
                        $content = file_get_contents(HELPPATH.$obj->name);
16035364   Benjamin Renard   First commit
1223
1224
1225
                        return  array('success' => true, 'result' => $content);
                }
                return array('success' => false);
f740e66b   Nathanael Jourdane   Improve the VOTab...
1226
1227
1228

        }

16035364   Benjamin Renard   First commit
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
        public function getUserInfo()
        {
                    $dd = new UserMgr();
                    return $dd->getUserInfo();
        }

        public function convertWS()
        {
                 $dd = new UserMgr();
                 return $dd->convertWS();
        }

// $obj ={"Object":"Earth","RunCount":"2",
// "SW_Density_value":"10","SW_Density_weight":"1","SW_Density_scale":"7","SW_Temperature_value":"100", ....}
        public function getRun($obj)
        {

            $myBestRunsMgr = new BestRunsMgr();
            $res = $myBestRunsMgr->getRun($obj);
f740e66b   Nathanael Jourdane   Improve the VOTab...
1248
1249

            return  $res;
16035364   Benjamin Renard   First commit
1250
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1251
1252

    //$obj = array of IDs
16035364   Benjamin Renard   First commit
1253
1254
1255
1256
1257
1258
1259
1260
        public function addRun($obj)
        {
            $myBestRunsMgr = new BestRunsMgr();
            $myBestRunsMgr->init();
            $myBestRunsMgr->addRuns($obj);

            $res =  array('success' => true,'addedRuns' => $obj);
        return $res;
f740e66b   Nathanael Jourdane   Improve the VOTab...
1261
        }
16035364   Benjamin Renard   First commit
1262
1263
1264
        //AKKA - New action to clean user WS
        public function cleanUserWS()
        {
70aabdee   elena   catalog draft
1265
          	require_once(INTEGRATION_SRC_DIR."RequestManager.php");
e82af71b   elena   catalog draft
1266
         	return $this->executeRequest($obj, FunctionTypeEnumClass::PROCESSCLEAN);
16035364   Benjamin Renard   First commit
1267
1268
1269
1270
        }

        public function deleteSpecialInfo($name)
        {
f740e66b   Nathanael Jourdane   Improve the VOTab...
1271
             if (file_exists(USERDIR.$name))
16035364   Benjamin Renard   First commit
1272
1273
1274
                                    unlink(USERDIR.$name);
             return array('success' => true);
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1275

488b1401   Benjamin Renard   Interactive multi...
1276
        public function interactivePlot($obj, $multiPlotState)
9f08f4eb   Benjamin Renard   Zoom in interacti...
1277
1278
        {
        	require_once(INTEGRATION_SRC_DIR."RequestManager.php");
488b1401   Benjamin Renard   Interactive multi...
1279
1280
1281
1282
1283
        	$inputobj = (Object)array(
        		'action' => $obj,
        		'multiPlotState' => $multiPlotState
        	);
        	return $this->executeRequest($inputobj, FunctionTypeEnumClass::ACTION);
9f08f4eb   Benjamin Renard   Zoom in interacti...
1284
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1285

ced82260   Benjamin Renard   Get initial plot ...
1286
1287
1288
1289
1290
1291
1292
1293
1294
        public function getParamPlotInit($obj)
        {
        	require_once(INTEGRATION_SRC_DIR."RequestManager.php");
        	$inputobj = (Object)array(
        			'paramId' => $obj->paramId,
        			'type' => 'plot_init'
        	);
        	return $this->executeRequest($inputobj, FunctionTypeEnumClass::PARAMINFO);
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1295

7ac3ce50   Benjamin Renard   First implementat...
1296
1297
1298
1299
1300
1301
1302
1303
1304
        public function getParamInfo($obj)
        {
        	require_once(INTEGRATION_SRC_DIR."RequestManager.php");
        	$inputobj = (Object)array(
        			'paramId' => $obj->paramId,
        			'type' => 'param_info'
        	);
        	return $this->executeRequest($inputobj, FunctionTypeEnumClass::PARAMINFO);
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1305

169f14d2   Benjamin Renard   Add shared object...
1306
1307
1308
1309
1310
1311
        public function getSharedObjectFolders($obj)
        {
        	$mgr = new SharedObjectsMgr();
        	$folders = $mgr->getFolders($obj->type);
        	return array('success' => true, 'folders' => $folders);
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1312

169f14d2   Benjamin Renard   Add shared object...
1313
1314
1315
1316
1317
1318
1319
1320
        public function shareObjects($obj)
        {
        	$mgr = new SharedObjectsMgr();
        	switch ($obj->type) {
        		case 'timeTable' :
        		case 'catalog' :
        			$src_object_path = USERTTDIR.$obj->object->id.".xml";
        			break;
f740e66b   Nathanael Jourdane   Improve the VOTab...
1321

169f14d2   Benjamin Renard   Add shared object...
1322
1323
1324
        		default:
        			return array('success' => false, 'message' => 'Unknown object type');
        	}
f740e66b   Nathanael Jourdane   Improve the VOTab...
1325

169f14d2   Benjamin Renard   Add shared object...
1326
1327
1328
        	$result = $mgr->add($obj->type, $obj->name, $obj->folder, $src_object_path, $obj->description, $this->user);
        	if (!$result['success'])
        		return $result;
f740e66b   Nathanael Jourdane   Improve the VOTab...
1329

169f14d2   Benjamin Renard   Add shared object...
1330
1331
1332
        	$mgr->updateTree();
        	return $result;
        }
f740e66b   Nathanael Jourdane   Improve the VOTab...
1333

169f14d2   Benjamin Renard   Add shared object...
1334
1335
1336
1337
1338
1339
        public function isSharedObjectNameAlreadyUsed($obj)
        {
        	$mgr = new SharedObjectsMgr();
        	$alreadyUsed = $mgr->isNameAlreadyUsed($obj->type, $obj->name);
        	return array('success' => true, 'alreadyUsed' => $alreadyUsed);
        }
a79b0198   Nathanael Jourdane   Add EPN-TAP modul...
1340

4e39b17b   Nathanael Jourdane   Add a function to...
1341
1342
1343
1344
1345
1346
		public function epnTapGetGranules($table_name, $access_url, $filter, $select, $limit, $offset) {
			return (new EpnTapMgr)->getGranules($table_name, $access_url, $filter, $select, $limit, $offset);
		}

		public function epnTapGetNbRows($table_name, $access_url, $filter) {
			return (new EpnTapMgr)->getNbRows($table_name, $access_url, $filter);
a79b0198   Nathanael Jourdane   Add EPN-TAP modul...
1347
		}
16035364   Benjamin Renard   First commit
1348
1349
}
?>