Blame view

php/classes/AmdaAction.php 44.8 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 {

5de62950   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',
5de62950   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

5de62950   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";
5de62950   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) {
5de62950   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);
5de62950   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,
5de62950   Nathanael Jourdane   Improve the VOTab...
44
                                    'nodeType' => 'url', 'leaf' => $isLeaf);
16035364   Benjamin Renard   First commit
45
            }
5de62950   Nathanael Jourdane   Improve the VOTab...
46

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

16035364   Benjamin Renard   First commit
51
52
/*****************************************************************
*                           PUBLIC FUNCTIONS
5de62950   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) {
5de62950   Nathanael Jourdane   Improve the VOTab...
59

16035364   Benjamin Renard   First commit
60
       $node = $obj->node;
5de62950   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;

5de62950   Nathanael Jourdane   Improve the VOTab...
71
        if ($nodeType == 'url')
16035364   Benjamin Renard   First commit
72
        {
5de62950   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;

5de62950   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'));
5de62950   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");

5de62950   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;
5de62950   Nathanael Jourdane   Improve the VOTab...
96
                case 'bkgWorks':
16035364   Benjamin Renard   First commit
97
98
99
                        $xmlName = USERJOBDIR.$this->xmlFiles[$nodeType];
                        break;
                case 'source':
5de62950   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];
            }

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

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

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

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

5de62950   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;
5de62950   Nathanael Jourdane   Improve the VOTab...
125

16035364   Benjamin Renard   First commit
126
                if ($child->hasChildNodes())
5de62950   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;

5de62950   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');
5de62950   Nathanael Jourdane   Improve the VOTab...
137
                $name = $child->getAttribute('name');
16035364   Benjamin Renard   First commit
138
139
140
141
142
143
144
145
146
147
148
                $help = $child->getAttribute('att');
                if ($child->hasAttribute('dataStart')) $dataStart = $child->getAttribute('dataStart');
                if ($child->hasAttribute('dataStop')) $dataStop = $child->getAttribute('dataStop');

                $specialNode = false;
                $isParameter = false;
                $skip = false;
		$isAddable =  false;
                $isSimulation = false;
                $rank = null;

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

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

		    case 'request':
5de62950   Nathanael Jourdane   Improve the VOTab...
166

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

5de62950   Nathanael Jourdane   Improve the VOTab...
175
176
177
		    break;

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

                    case 'timeTable':
5de62950   Nathanael Jourdane   Improve the VOTab...
184
                    case 'catalog':
16035364   Benjamin Renard   First commit
185
186
                        if ($isLeaf) $info = $child->getAttribute('intervals').' intervals';
                    break;
169f14d2   Benjamin Renard   Add shared object...
187
188
189
190
191
192
193
194
                    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
195
196
197
198
199
200
201
202
203
204
205
206
207
                    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;
5de62950   Nathanael Jourdane   Improve the VOTab...
208
                        $isSpectra = false;
16035364   Benjamin Renard   First commit
209
210
211
212
                        $isStack = false;

                        if ($child->hasAttribute('desc')) $info = $child->getAttribute('desc');

5de62950   Nathanael Jourdane   Improve the VOTab...
213
                        if ($child->hasAttribute('sampling'))
16035364   Benjamin Renard   First commit
214
215
216
217
218
                        {
                            $info =  "Sampling: ".$child->getAttribute('sampling')."<br/>";
                            if ($child->getAttribute('dataStart') == 'depending on mission')
                            {
                                $info .= "Time Range: ".$child->getAttribute('dataStart')."<br/>";
5de62950   Nathanael Jourdane   Improve the VOTab...
219
220
221
222
223
224
                            }
                            else
                            {
                                $info .= "Time Range: ".$child->getAttribute('dataStart')."-".$child->getAttribute('dataStop')."<br/>";
                            }

16035364   Benjamin Renard   First commit
225
226
227
228
                            if ($child->getAttribute('restricted') > 1) {
                                $restricted  = $child->getAttribute('restricted');
                                $info .= "<b>Time Restriction</b>: -$restricted days<br/>";
                            }
5de62950   Nathanael Jourdane   Improve the VOTab...
229

16035364   Benjamin Renard   First commit
230
231
                            $info .= "Source: ".$child->getAttribute('dataSource');
                        }
5de62950   Nathanael Jourdane   Improve the VOTab...
232

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

5de62950   Nathanael Jourdane   Improve the VOTab...
235
                        if ($child->tagName == 'parameter')
16035364   Benjamin Renard   First commit
236
237
238
239
240
241
242
                        {
                                $isParameter = true;
                                $isScatter = true;

                                if ($child->parentNode->hasAttribute('dataStart'))
                                {
                                    $globalStart = $child->parentNode->getAttribute('dataStart');
5de62950   Nathanael Jourdane   Improve the VOTab...
243
                                    $globalStop = $child->parentNode->getAttribute('dataStop');
16035364   Benjamin Renard   First commit
244
245
246
247
248
                                }

                                if ($child->parentNode->getAttribute('restricted') > 1 )
                                {
                                    $timeRestriction = true;
5de62950   Nathanael Jourdane   Improve the VOTab...
249

aec5ba13   Elena.Budnik   not tested param ...
250
                                }
5de62950   Nathanael Jourdane   Improve the VOTab...
251
252
253

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

aec5ba13   Elena.Budnik   not tested param ...
254
255
                                 if ($child->getAttribute('tbd'))
                                            $info .= "<br/><b>Not tested yet</b>";
5de62950   Nathanael Jourdane   Improve the VOTab...
256
257
258

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

16035364   Benjamin Renard   First commit
259
                        }
5de62950   Nathanael Jourdane   Improve the VOTab...
260

16035364   Benjamin Renard   First commit
261

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

                                if ($child->parentNode->parentNode->hasAttribute('dataStart'))
                                {
                                    $globalStart = $child->parentNode->parentNode->getAttribute('dataStart');
5de62950   Nathanael Jourdane   Improve the VOTab...
271
272
                                    $globalStop = $child->parentNode->parentNode->getAttribute('dataStop');
                                }
16035364   Benjamin Renard   First commit
273
274
275
276

                                if ($child->parentNode->parentNode->getAttribute('restricted') > 1)
                                {
                                    $timeRestriction = true;
5de62950   Nathanael Jourdane   Improve the VOTab...
277
278

                                }
63ac7745   Benjamin Renard   Support component...
279
280
281
282
283

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

63ac7745   Benjamin Renard   Support component...
285
                                $component_info["parentId"] = $child->parentNode->getAttribute('xml:id');
16035364   Benjamin Renard   First commit
286
                        }
5de62950   Nathanael Jourdane   Improve the VOTab...
287

16035364   Benjamin Renard   First commit
288
                       if ($child->tagName == 'parameter' && $child->hasChildNodes()) $isScatter = false;
5de62950   Nathanael Jourdane   Improve the VOTab...
289

16035364   Benjamin Renard   First commit
290
291
292
                        if ($child->tagName == 'parameter' && $child->hasAttribute('display_type')) {

                              if ($child->getAttribute('display_type') == 'spectrogram') {
5de62950   Nathanael Jourdane   Improve the VOTab...
293
294
                                    $needsArgs = true;
                                    $isSpectra = true;
16035364   Benjamin Renard   First commit
295
296
                                    $isScatter = false;
                               }
5de62950   Nathanael Jourdane   Improve the VOTab...
297
                               else if ($child->getAttribute('display_type') == 'stackplot') {
16035364   Benjamin Renard   First commit
298
299
300
                                     $isStack = true;
                                     $isScatter = false;
                               }
5de62950   Nathanael Jourdane   Improve the VOTab...
301
302
303
                        }

                        if ($isParameter)
16035364   Benjamin Renard   First commit
304
305
                        {
                            if ($child->tagName == 'parameter' && $child->childNodes->length == 1)
5de62950   Nathanael Jourdane   Improve the VOTab...
306
307
308
309
310
                            {
                                $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
311
312
                                 $needsArgs = true;
                             }
5de62950   Nathanael Jourdane   Improve the VOTab...
313
314

                            if ($id == 'mex_n_sw' || $id == 'mex_v_sw')
16035364   Benjamin Renard   First commit
315
316
                             {
                                  $not_yet = true;
5de62950   Nathanael Jourdane   Improve the VOTab...
317

16035364   Benjamin Renard   First commit
318
319
                             }

aa94fd24   elena   Merge with last svn
320
                            //TODO proper conditions
5de62950   Nathanael Jourdane   Improve the VOTab...
321
                            if (substr($id,0,3) == 'ros')
16035364   Benjamin Renard   First commit
322
323
                             {
                                if ( !(strpos($id,'_r_') || strpos($id,'_xyz_') || strpos($id,'_cg_')
5de62950   Nathanael Jourdane   Improve the VOTab...
324
325
326
                                     || strpos($id,'_sc_') || strpos($id,'_aux_') || strpos($id,'_sw_')
                                     || strpos($id,'_tao_') ))
                                {
16035364   Benjamin Renard   First commit
327
                                   $not_yet = true;
5de62950   Nathanael Jourdane   Improve the VOTab...
328
                                }
16035364   Benjamin Renard   First commit
329
330
331
332
                             }

                            $objectMgr = new AliasMgr();
                            $alias = $objectMgr->getAlias($id);
5de62950   Nathanael Jourdane   Improve the VOTab...
333
334

                            $childrenToReturn[] = array('text' => $name,'alias' => $alias,
63ac7745   Benjamin Renard   Support component...
335
                                'id' => $id,'nodeType' => $nodeType, 'info' => $info, "component_info" => $component_info,
16035364   Benjamin Renard   First commit
336
337
338
339
                                'globalStart' => $globalStart, 'globalStop' => $globalStop, 'timeRestriction' => $timeRestriction,
                                'leaf' => $isLeaf, 'isParameter' => $isParameter, 'isScatter' => $isScatter,
                                'isSpectra' => $isSpectra,'isStack' => $isStack, 'needsArgs' => $needsArgs, 'help' => $help, 'notyet' => $not_yet);
                        }
5de62950   Nathanael Jourdane   Improve the VOTab...
340
                        else
16035364   Benjamin Renard   First commit
341
                        {
5de62950   Nathanael Jourdane   Improve the VOTab...
342
                            if ($child->tagName == 'mission')
16035364   Benjamin Renard   First commit
343
344
345
346
347
348
349
350
                            {
                                $disable = ($child->getAttribute('available') != "1");
                                $rank = $child->getAttribute('rank');
                            }
                            else
                            {
                                $disable = $child->getAttribute('restricted');
                            }
5de62950   Nathanael Jourdane   Improve the VOTab...
351

16035364   Benjamin Renard   First commit
352
353
354
355
356
                            if ($disable)
                            {
                                if ($disable == 1) {
                                    $info .=  "<br/><b>Restricted access</b>";
                                }
5de62950   Nathanael Jourdane   Improve the VOTab...
357
358
                                else {
                                    $disable = false;
16035364   Benjamin Renard   First commit
359
360
361
                                }
                            }

5de62950   Nathanael Jourdane   Improve the VOTab...
362
363
                            $childrenToReturn[] = array('text' => $name, 'id' => $id,'nodeType' => $nodeType,  'info' => $info,
                                'leaf' => false, 'help' => $help, 'disable' => $disable, 'rank' => $rank);
16035364   Benjamin Renard   First commit
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
                        }
                    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;
                                }
                        }
5de62950   Nathanael Jourdane   Improve the VOTab...
381
                        if ($child->tagName == 'simulationRegion')
16035364   Benjamin Renard   First commit
382
383
384
385
                            {
                                 $rank = $child->getAttribute('rank');
                            }
 		    case 'remoteParam' :
5de62950   Nathanael Jourdane   Improve the VOTab...
386

16035364   Benjamin Renard   First commit
387
388
389
390
391
392
393
                        if ($child->getAttribute('isSimulation') && $child->tagName == 'dataCenter') {
                                $skip = true;
                                break;
                        }

                        $isDeletable = $child->hasAttribute('isDeletable');
			$specialNode = true;
5de62950   Nathanael Jourdane   Improve the VOTab...
394
395
396
397
			$isParameter = false;
                        $isSpectra = false;

                        switch ($id)
16035364   Benjamin Renard   First commit
398
                        {
5de62950   Nathanael Jourdane   Improve the VOTab...
399
400
                            case 'CDAWEB'  :
                            case 'OMNIWEB' :
16035364   Benjamin Renard   First commit
401
402
403
404
405
406
407
408
409
410
411
412
413
                                            $isLeaf = false;
                                            break;
                            case 'THEMIS' :
                                            $rank = 5;
                                            break;
                            case 'MAPSKP' :
                                            $rank = 9;
                                            break;
                            case 'VEXGRAZ' :
                                            $rank = 2;
                                            break;
                            default:
                        }
5de62950   Nathanael Jourdane   Improve the VOTab...
414

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

5de62950   Nathanael Jourdane   Improve the VOTab...
417
// 			if ($info && !$isSimulation) {
16035364   Benjamin Renard   First commit
418
419
420
			       $info = str_replace(';', "<br/>Time Range: ", $info);
// 			}
			if ($child->tagName == 'dataset') {
5de62950   Nathanael Jourdane   Improve the VOTab...
421
422
			    /*if ($child->hasAttribute('dataStart') && $child->hasAttribute('dataStop'))
			      $info .= "Time Range: ".$child->getAttribute('dataStart')."-".$child->getAttribute('dataStop')."<br/>";  */
16035364   Benjamin Renard   First commit
423
424
425
426
// 			      $info .= "Time Range: ".$dataStart"-".$dataStop."<br/>";
                        }
			if (($child->tagName == 'parameter') || ($child->tagName == 'component')) {
				    $isParameter = true;
5de62950   Nathanael Jourdane   Improve the VOTab...
427
				    $isScatter = true;
16035364   Benjamin Renard   First commit
428
			}
5de62950   Nathanael Jourdane   Improve the VOTab...
429

16035364   Benjamin Renard   First commit
430
431
432
			$needsArgs =  $child->hasAttribute('needsArgs');

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

16035364   Benjamin Renard   First commit
434
			if ($remoteBase) {
5de62950   Nathanael Jourdane   Improve the VOTab...
435
			    if ($child->tagName == 'dataset') $isRemoteDataSet = true;
16035364   Benjamin Renard   First commit
436
437
438
			}

			if ($isParameter) {
5de62950   Nathanael Jourdane   Improve the VOTab...
439
                            $disable = $child->parentNode->getAttribute('disabled');
16035364   Benjamin Renard   First commit
440
441
442
443
			    $objectMgr = new AliasMgr();
			    $alias = $objectMgr->getAlias($id);


5de62950   Nathanael Jourdane   Improve the VOTab...
444
                            if ($child->hasAttribute('display_type')
16035364   Benjamin Renard   First commit
445
                            && $child->getAttribute('display_type') == 'spectrogram'){
5de62950   Nathanael Jourdane   Improve the VOTab...
446
                                                $needsArgs = true;
16035364   Benjamin Renard   First commit
447
448
                                                $isScatter = false;
                                                $isSpectra = true;
5de62950   Nathanael Jourdane   Improve the VOTab...
449
                        }
16035364   Benjamin Renard   First commit
450

5de62950   Nathanael Jourdane   Improve the VOTab...
451
			    $childrenToReturn[] = array('text' => $name,'alias' => $alias,
16035364   Benjamin Renard   First commit
452
				      'id' => $id,'nodeType' => $nodeType,  'info' => $info, 'help' => $help,
5de62950   Nathanael Jourdane   Improve the VOTab...
453
				      'leaf' => $isLeaf, 'disable' => $disable, 'isParameter' => $isParameter,
63ac7745   Benjamin Renard   Support component...
454
				      'isScatter' => $isScatter, 'isSpectra' => $isSpectra, 'needsArgs' => $needsArgs, "component_info" => $component_info);
16035364   Benjamin Renard   First commit
455
			  }
5de62950   Nathanael Jourdane   Improve the VOTab...
456
457
458
			  else {
                            if ($child->tagName == 'dataCenter')
                                $restricted = ($child->getAttribute('available') != "1");
16035364   Benjamin Renard   First commit
459
460
                            else
                                $restricted = false;
5de62950   Nathanael Jourdane   Improve the VOTab...
461
462

                            if ($id == 'CDAWEB' || $id == 'THEMIS'|| $id == 'MAPSKP' || $id == 'VEXGRAZ')
16035364   Benjamin Renard   First commit
463
464
                                                                                     $restricted = FALSE;
                            if ($restricted)
5de62950   Nathanael Jourdane   Improve the VOTab...
465
466
                                $info .= "<br/><b>Open soon !</b>";

16035364   Benjamin Renard   First commit
467
468
469
470
                            if ($child->tagName == 'dataset')
                                $nonavailable = ($child->getAttribute('disabled'));
                            else
                                $nonavailable = false;
5de62950   Nathanael Jourdane   Improve the VOTab...
471

16035364   Benjamin Renard   First commit
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
                            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;
			    $childrenToReturn[] = array('text' => $name, 'id' => $id,'nodeType' => $nodeType,  'isAddable' => $isAddable,
5de62950   Nathanael Jourdane   Improve the VOTab...
487
488
			    'info' => $info, 'leaf' => false, 'isRemoteDataSet' => $isRemoteDataSet, 'disable' => $disable,
                            'isSimulation' => $isSimulation, 'rank' => $rank, 'isDeletable' => $isDeletable, 'help' => $help);
16035364   Benjamin Renard   First commit
489
			  }
5de62950   Nathanael Jourdane   Improve the VOTab...
490

16035364   Benjamin Renard   First commit
491
		    break;
5de62950   Nathanael Jourdane   Improve the VOTab...
492
		     case 'myData' :
16035364   Benjamin Renard   First commit
493
494
495
496
497
498
499
500
501
502
503
504
505
506
			    $info = $child->hasAttribute('info') ? $child->getAttribute('info') : $child->nodeValue;
			  //  $info = str_replace("\n","<br/>",$info);
			    break;

                    case 'myDataParam' :

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

5de62950   Nathanael Jourdane   Improve the VOTab...
507

16035364   Benjamin Renard   First commit
508
509
510
511
512
513
514
515
516
517
518
                        if ($isLeaf) {
                            $isParameter = true;
                            $info = "Size: ".$size."<br/>".$child->getAttribute('desc')."<br/> Mask: ".$mask;
                            $isSpectra = $child->getAttribute('plottype') === 'Spectra';
                        }

                        if ($child->hasAttribute('desc')) {
                            $globalStart = substr(str_replace('-','/',$child->getAttribute('desc')), 0, 16);
                            $globalStop =  substr(str_replace( '-','/',$child->getAttribute('desc')), 17, 22);
                        }

5de62950   Nathanael Jourdane   Improve the VOTab...
519
                        $childrenToReturn[] = array('text' => $name, 'size' =>  $size, 'id' => $id,
16035364   Benjamin Renard   First commit
520
                        'globalStart' => $globalStart, 'globalStop' => $globalStop,
5de62950   Nathanael Jourdane   Improve the VOTab...
521
                        'nodeType' => $nodeType, 'info' => $info, 'isScatter' => $isScatter, 'leaf' => $isLeaf,
16035364   Benjamin Renard   First commit
522
523
524
                        'isParameter' => $isParameter, 'linkedMask' => $mask, 'isSpectra' => $isSpectra);

                        break;
5de62950   Nathanael Jourdane   Improve the VOTab...
525
                    default:
16035364   Benjamin Renard   First commit
526
		}
5de62950   Nathanael Jourdane   Improve the VOTab...
527

16035364   Benjamin Renard   First commit
528
		if (!$specialNode && !$skip) {
5de62950   Nathanael Jourdane   Improve the VOTab...
529
		       if ($child->hasAttribute('desc'))
16035364   Benjamin Renard   First commit
530
			    $info = $child->getAttribute('desc');
5de62950   Nathanael Jourdane   Improve the VOTab...
531
			$childrenToReturn[] = array('text' => $name, 'id' => $id, 'nodeType' => $nodeType, 'info' => $info,
16035364   Benjamin Renard   First commit
532
533
534
535
                                                    'help' => $help, 'leaf' => $isLeaf, 'isParameter' => $isParameter);
		}
	      }
		// if $childrenToReturn we have to return []
5de62950   Nathanael Jourdane   Improve the VOTab...
536
		 if ($childrenToReturn == null) {
16035364   Benjamin Renard   First commit
537
538
539
540
541
542
543
			$childrenToReturn = array('nodeType' => $nodeType, 'text' => null);
		 }
        }

      return  $childrenToReturn;
 }

5de62950   Nathanael Jourdane   Improve the VOTab...
544
    public  function saveTree($obj)
16035364   Benjamin Renard   First commit
545
546
    {
            $paramMgr = new ParamMgr();
5de62950   Nathanael Jourdane   Improve the VOTab...
547
            return $paramMgr->saveTree($obj);
16035364   Benjamin Renard   First commit
548
549
    }

5de62950   Nathanael Jourdane   Improve the VOTab...
550
551
    public  function doNothing($obj)
    {
16035364   Benjamin Renard   First commit
552
        return array("res" => 'ok');
5de62950   Nathanael Jourdane   Improve the VOTab...
553

16035364   Benjamin Renard   First commit
554
555
    }

5de62950   Nathanael Jourdane   Improve the VOTab...
556
557
    public  function deleteFromTree($obj)
    {
16035364   Benjamin Renard   First commit
558
559
        $paramMgr = new ParamMgr();
        return $paramMgr->deleteFromTree($obj);
5de62950   Nathanael Jourdane   Improve the VOTab...
560

16035364   Benjamin Renard   First commit
561
562
563
564
    }

/*
*  temporary object fromUpload
5de62950   Nathanael Jourdane   Improve the VOTab...
565
*/
16035364   Benjamin Renard   First commit
566
    public  function getUploadedObject($name, $format, $nodeType)
5de62950   Nathanael Jourdane   Improve the VOTab...
567
568
    {
            switch ($nodeType)
16035364   Benjamin Renard   First commit
569
            {
5de62950   Nathanael Jourdane   Improve the VOTab...
570
571
                case 'timeTable' :
                        $objectMgr = new TimeTableMgr();
16035364   Benjamin Renard   First commit
572
                        break;
5de62950   Nathanael Jourdane   Improve the VOTab...
573
574
                case 'myDataParam' :
                        $objectMgr = new FilesMgr();
16035364   Benjamin Renard   First commit
575
576
577
578
579
                        break;
                default:
                        return array("error" => $nodeType." NOT_IMPLEMENTED_YET");
            }
            return  $objectMgr -> getUploadedObject($name, $format, true);
aa94fd24   elena   Merge with last svn
580

5de62950   Nathanael Jourdane   Improve the VOTab...
581
    }
16035364   Benjamin Renard   First commit
582
583

/*
5de62950   Nathanael Jourdane   Improve the VOTab...
584
585
586
587
588
*  fill ascii file into grid
*/
    public  function getAsciiFile($obj)
    {
            $objectMgr = new FilesMgr();
16035364   Benjamin Renard   First commit
589
590
            return  $objectMgr -> getAsciiFile($obj->fileName);
    }
5de62950   Nathanael Jourdane   Improve the VOTab...
591
592
593
594

    public  function getMyParamInfo($object)
    {
            $objectMgr = new FilesMgr();
16035364   Benjamin Renard   First commit
595
            return  $objectMgr -> getParamInfo($object);
5de62950   Nathanael Jourdane   Improve the VOTab...
596
    }
16035364   Benjamin Renard   First commit
597
598

/*
5de62950   Nathanael Jourdane   Improve the VOTab...
599
600
601
602
*  temporary object from Search
*/
    public  function getTmpObject($folderId, $name, $nodeType) {

aa94fd24   elena   Merge with last svn
603

16035364   Benjamin Renard   First commit
604
	    switch ($nodeType) {
5de62950   Nathanael Jourdane   Improve the VOTab...
605
606
607
		  case 'timeTable' :
			   $objectMgr = new TimeTableMgr();
			   break;
d18b535d   elena   catalog draft + c...
608
		 case 'catalog' :
5de62950   Nathanael Jourdane   Improve the VOTab...
609
610
			   $objectMgr = new CatalogMgr();
			   break;
16035364   Benjamin Renard   First commit
611
612
613
614
		  default:
			    return array("error" => $nodeType." NOT_IMPLEMENTED_YET");
              }
	      return  $objectMgr -> getTmpObject($folderId, $name, true);
aa94fd24   elena   Merge with last svn
615

16035364   Benjamin Renard   First commit
616
    }
16035364   Benjamin Renard   First commit
617

5de62950   Nathanael Jourdane   Improve the VOTab...
618
619
620

    public  function getObject($id, $nodeType) {

16035364   Benjamin Renard   First commit
621
622
	    switch ($nodeType) {
		  case 'myDataParam':
5de62950   Nathanael Jourdane   Improve the VOTab...
623
624
		  case 'derivedParam' :
			   $objectMgr = new DerivedParamMgr($nodeType);
16035364   Benjamin Renard   First commit
625
			   break;
5de62950   Nathanael Jourdane   Improve the VOTab...
626
		  case 'timeTable' :
16035364   Benjamin Renard   First commit
627
		  case 'sharedtimeTable' :
5de62950   Nathanael Jourdane   Improve the VOTab...
628
629
			   $objectMgr = new TimeTableMgr();
			   break;
048b4d77   elena   catalogs +
630
		  case 'catalog' :
169f14d2   Benjamin Renard   Add shared object...
631
          case 'sharedcatalog' :
5de62950   Nathanael Jourdane   Improve the VOTab...
632
633
634
			   $objectMgr = new CatalogMgr();
			   break;
		  case 'condition' :
16035364   Benjamin Renard   First commit
635
		  case 'request' :
5de62950   Nathanael Jourdane   Improve the VOTab...
636
637
			   $objectMgr = new RequestMgr($nodeType);
			   break;
16035364   Benjamin Renard   First commit
638
639
640
641
642
		  case 'bkgWorks' :
		  	require_once(INTEGRATION_SRC_DIR."RequestManager.php");
		  	return $this->executeRequest($id, FunctionTypeEnumClass::PROCESSGETINFO);
			   break;
		  case 'myData' :
5de62950   Nathanael Jourdane   Improve the VOTab...
643
			   $objectMgr = new FilesMgr();
16035364   Benjamin Renard   First commit
644
645
646
647
648
649
650
651
652
653
			   break;
		  default:
			    return array("error" => $nodeType." NOT_IMPLEMENTED_YET");
              }

	    return  $objectMgr -> getObject($id, $nodeType);
    }
/*
*   $obj = { id: node.id, leaf: node.leaf, nodeType: node.nodeType }
*/
5de62950   Nathanael Jourdane   Improve the VOTab...
654
655
656
657
658
659
660
    public  function deleteObject($obj) {

	    switch ($obj->nodeType) {

		  case 'myDataParam' :
		  case 'derivedParam' :
			   $objectMgr = new DerivedParamMgr($obj->nodeType);
16035364   Benjamin Renard   First commit
661
			   break;
5de62950   Nathanael Jourdane   Improve the VOTab...
662
663
		  case 'timeTable' :
			   $objectMgr = new TimeTableMgr();
16035364   Benjamin Renard   First commit
664
			   break;
5de62950   Nathanael Jourdane   Improve the VOTab...
665
666
667
668
		  case 'catalog' :
			   $objectMgr = new CatalogMgr();
			   break;
		  case 'condition' :
16035364   Benjamin Renard   First commit
669
		  case 'request' :
5de62950   Nathanael Jourdane   Improve the VOTab...
670
			   $objectMgr = new RequestMgr($obj->nodeType);
16035364   Benjamin Renard   First commit
671
672
673
674
			   break;
		  case 'alias' :
		  	   $objectMgr = new AliasMgr();
		  	   $obj->id = substr($obj->id,strlen('alias_'));
5de62950   Nathanael Jourdane   Improve the VOTab...
675
		  	   break;
16035364   Benjamin Renard   First commit
676
677
678
		  case 'bkgWorks' :
		  	   require_once(INTEGRATION_SRC_DIR."RequestManager.php");
		  	   return $this->executeRequest($obj, FunctionTypeEnumClass::PROCESSDELETE);
aa94fd24   elena   Merge with last svn
679

16035364   Benjamin Renard   First commit
680
681
682
683
684
685
686
687
688
689
690
691
692
		  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 }
*/
5de62950   Nathanael Jourdane   Improve the VOTab...
693
694
    public  function renameObject($obj) {

16035364   Benjamin Renard   First commit
695
	    switch ($obj->nodeType) {
5de62950   Nathanael Jourdane   Improve the VOTab...
696

16035364   Benjamin Renard   First commit
697
		  case 'myDataParam' :
5de62950   Nathanael Jourdane   Improve the VOTab...
698
699
		  case 'derivedParam' :
			   $objectMgr = new DerivedParamMgr($obj->nodeType);
16035364   Benjamin Renard   First commit
700
			   break;
5de62950   Nathanael Jourdane   Improve the VOTab...
701
702
		  case 'timeTable' :
			   $objectMgr = new TimeTableMgr();
d18b535d   elena   catalog draft + c...
703
			   break;
5de62950   Nathanael Jourdane   Improve the VOTab...
704
705
706
707
708
709
		  case 'catalog' :
			   $objectMgr = new CatalogMgr();
			   break;
		  case 'condition' :
		  case 'request' :
			   $objectMgr = new RequestMgr($obj->nodeType);
16035364   Benjamin Renard   First commit
710
711
			   break;
		  case 'alias' :
5de62950   Nathanael Jourdane   Improve the VOTab...
712
713
		  	   $objectMgr = new AliasMgr();
		  	   break;
16035364   Benjamin Renard   First commit
714
715
716
717
718
719
720
		  default:
			    return array("error" => $obj->nodeType." NOT_IMPLEMENTED_YET");
              }

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

5de62950   Nathanael Jourdane   Improve the VOTab...
721
/*
16035364   Benjamin Renard   First commit
722
723
*   $obj = { name: obj.name, obj.nodeType, obj.leaf (??), OBJ DEPENDENT ATTRIBUTES }
*/
5de62950   Nathanael Jourdane   Improve the VOTab...
724
725
    public  function createObject($obj, $folder) {

16035364   Benjamin Renard   First commit
726
727
	    switch ($obj->nodeType) {

5de62950   Nathanael Jourdane   Improve the VOTab...
728
		  case 'myDataParam' :
16035364   Benjamin Renard   First commit
729
		  case 'derivedParam' :
5de62950   Nathanael Jourdane   Improve the VOTab...
730
                        if ($obj->nodeType == 'derivedParam' &&  $this->amdaStat->success)
16035364   Benjamin Renard   First commit
731
732
                             $this->amdaStat->addTask('create', $this->user, null);

5de62950   Nathanael Jourdane   Improve the VOTab...
733
734
735
736
737
738
739
                        $objectMgr = new DerivedParamMgr($obj->nodeType);
                        break;
		  case 'timeTable' :
                        $objectMgr = new TimeTableMgr();
			   break;
		  case 'catalog' :
                        $objectMgr = new CatalogMgr();
16035364   Benjamin Renard   First commit
740
741
			   break;
		  case 'condition' :
5de62950   Nathanael Jourdane   Improve the VOTab...
742
743
744
		  case 'request' :
			   $objectMgr = new RequestMgr($obj->nodeType);
			   break;
16035364   Benjamin Renard   First commit
745
		  case 'alias' :
5de62950   Nathanael Jourdane   Improve the VOTab...
746
747
			    $objectMgr = new AliasMgr();
			    break;
16035364   Benjamin Renard   First commit
748
749
750
751
752
753
754
		  default:
			    return array("error" => $obj->nodeType." NOT_IMPLEMENTED_YET");
              }

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

5de62950   Nathanael Jourdane   Improve the VOTab...
755
/*
16035364   Benjamin Renard   First commit
756
757
758
*   $obj = { id:obj.id, name: obj.name, obj.nodeType, obj.leaf (??), OBJ DEPENDENT ATTRIBUTES }
*/
    public  function modifyObject($obj) {
16035364   Benjamin Renard   First commit
759

5de62950   Nathanael Jourdane   Improve the VOTab...
760
761
762
763
764
765
766
767
	    switch ($obj->nodeType) {

		  case 'myDataParam' :
		  case 'derivedParam' :
			   $objectMgr = new DerivedParamMgr($obj->nodeType);
			   break;
		  case 'timeTable' :
			   $objectMgr = new TimeTableMgr();
16035364   Benjamin Renard   First commit
768
			   break;
5de62950   Nathanael Jourdane   Improve the VOTab...
769
770
		  case 'catalog' :
			   $objectMgr = new CatalogMgr();
d18b535d   elena   catalog draft + c...
771
			   break;
5de62950   Nathanael Jourdane   Improve the VOTab...
772
		  case 'condition' :
16035364   Benjamin Renard   First commit
773
		  case 'request' :
5de62950   Nathanael Jourdane   Improve the VOTab...
774
			   $objectMgr = new RequestMgr($obj->nodeType);
16035364   Benjamin Renard   First commit
775
776
777
778
779
780
			   break;
		  default:
			    return array("error" => $obj->nodeType." NOT_IMPLEMENTED_YET");
              }

	    return  $objectMgr -> modifyObject($obj);
5de62950   Nathanael Jourdane   Improve the VOTab...
781
    }
16035364   Benjamin Renard   First commit
782
783
784
785
786
787
788
789
790
791
/*
 * {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...
792
			case 'sharedtimeTable' :
16035364   Benjamin Renard   First commit
793
794
				$objectMgr = new TimeTableMgr();
				break;
d18b535d   elena   catalog draft + c...
795
			case 'catalog' :
169f14d2   Benjamin Renard   Add shared object...
796
			case 'sharedcatalog' :
d18b535d   elena   catalog draft + c...
797
798
				$objectMgr = new CatalogMgr();
				break;
16035364   Benjamin Renard   First commit
799
800
801
802
803
804
805
806
807
808
809
810
811
812
			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
813

16035364   Benjamin Renard   First commit
814
815
816
    public  function getJobs()
    {
    	require_once(INTEGRATION_SRC_DIR."RequestManager.php");
5de62950   Nathanael Jourdane   Improve the VOTab...
817
    	return $this->executeRequest($obj, FunctionTypeEnumClass::PROCESSRUNNINGINFO);
16035364   Benjamin Renard   First commit
818
819
820
821
822
823
824
825
826
827
828
829
830
    }


	/* 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);
		}
5de62950   Nathanael Jourdane   Improve the VOTab...
831
832


16035364   Benjamin Renard   First commit
833
834
835
836
837
838
839
840
		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();
5de62950   Nathanael Jourdane   Improve the VOTab...
841
842

        //TODO error handling
16035364   Benjamin Renard   First commit
843
844
        if (($res = $dd -> ddCheckUser()) != 0)
		{
5de62950   Nathanael Jourdane   Improve the VOTab...
845
			if ($res == 156)
16035364   Benjamin Renard   First commit
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
				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');
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
863

16035364   Benjamin Renard   First commit
864
        $this->user = $dd->user;
5de62950   Nathanael Jourdane   Improve the VOTab...
865

16035364   Benjamin Renard   First commit
866
867
		return array('success' => true, 'userHost' => $dd -> getIPclient());
	}
5de62950   Nathanael Jourdane   Improve the VOTab...
868

16035364   Benjamin Renard   First commit
869
870
871
	private function executeRequest($obj, $function)
	{
		$res = $this->checkUser($obj);
5de62950   Nathanael Jourdane   Improve the VOTab...
872

16035364   Benjamin Renard   First commit
873
874
		if (!$res['success'])
			return $res;
5de62950   Nathanael Jourdane   Improve the VOTab...
875

16035364   Benjamin Renard   First commit
876
		$requestManager = new RequestManagerClass();
5de62950   Nathanael Jourdane   Improve the VOTab...
877

16035364   Benjamin Renard   First commit
878
879
880
881
882
		try {
			$res = $requestManager->runIHMRequest($this->user, $res['userHost'], $function, $obj);
		} catch (Exception $e) {
			return array('success' => false, 'message' => 'Exception detected : '.$e->getMessage());
		}
5de62950   Nathanael Jourdane   Improve the VOTab...
883

16035364   Benjamin Renard   First commit
884
885
		return $res;
	}
5de62950   Nathanael Jourdane   Improve the VOTab...
886
887
888

/*
*    Main EXECUTE PROCEDURE
16035364   Benjamin Renard   First commit
889
890
*/
    public  function execute($node, $obj)
5de62950   Nathanael Jourdane   Improve the VOTab...
891
	{
16035364   Benjamin Renard   First commit
892
893
894
895
896
897
		require_once(INTEGRATION_SRC_DIR."RequestManager.php");
		if (isset($obj->action))
			return $this->executeRequest($obj, FunctionTypeEnumClass::ACTION);
		else
			return $this->executeRequest($obj, FunctionTypeEnumClass::PARAMS);
    }
5de62950   Nathanael Jourdane   Improve the VOTab...
898

16035364   Benjamin Renard   First commit
899
/*
a0b3d64e   Benjamin Renard   Derived parameter...
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
 * 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);
5de62950   Nathanael Jourdane   Improve the VOTab...
915

a0b3d64e   Benjamin Renard   Derived parameter...
916
917
		if (!$res['success'])
			return $res;
5de62950   Nathanael Jourdane   Improve the VOTab...
918

a0b3d64e   Benjamin Renard   Derived parameter...
919
920
921
922
923
924
		IHMConfigClass::setUserName($this->user);
		$libParamPath = IHMConfigClass::getCompilationPath()."lib/".$obj->paramId.".so";
		if (file_exists($libParamPath))
			unlink($libParamPath);
    	return array("success" => true);
   }
5de62950   Nathanael Jourdane   Improve the VOTab...
925

a0b3d64e   Benjamin Renard   Derived parameter...
926
/*
e6e5b259   Benjamin Renard   Add kill plot req...
927
 * kill plot process
16035364   Benjamin Renard   First commit
928
 */
5de62950   Nathanael Jourdane   Improve the VOTab...
929

e6e5b259   Benjamin Renard   Add kill plot req...
930
    public function killPlotRequest()
5de62950   Nathanael Jourdane   Improve the VOTab...
931
    {
e6e5b259   Benjamin Renard   Add kill plot req...
932
933
    	require_once(INTEGRATION_SRC_DIR."RequestManager.php");
    	return $this->executeRequest((object) array('nodeType' => 'killplot'), FunctionTypeEnumClass::PARAMS);
16035364   Benjamin Renard   First commit
934
935
936
937
938
939
940
941
942
    }

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

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

16035364   Benjamin Renard   First commit
944
945
946
947
948
949
        $objectMgr = new TimeTableMgr();

    return  $objectMgr -> merge($obj);

    }

5de62950   Nathanael Jourdane   Improve the VOTab...
950

16035364   Benjamin Renard   First commit
951
952
953
954
955
956
957
958
959
960
961
962
963
/*
 * 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;
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
964

f9c8b272   elena   edit catalog
965
        public function initTTCache($isCatalog = false, $nparams)
16035364   Benjamin Renard   First commit
966
        {
048b4d77   elena   catalogs +
967
968
        	if (!$isCatalog) $cacheMgr = new TimeTableCacheMgr();
        	else              $cacheMgr = new CatalogCacheMgr();
5de62950   Nathanael Jourdane   Improve the VOTab...
969

f9c8b272   elena   edit catalog
970
        	return $cacheMgr->initTTCache($nparams);
16035364   Benjamin Renard   First commit
971
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
972
973


16035364   Benjamin Renard   First commit
974
975
        public function initTTCacheFromTT($id, $type)
        {
169f14d2   Benjamin Renard   Add shared object...
976
        	if ($type == 'catalog' || $type == 'sharedcatalog') $cacheMgr = new CatalogCacheMgr();
048b4d77   elena   catalogs +
977
        	else $cacheMgr = new TimeTableCacheMgr();
5de62950   Nathanael Jourdane   Improve the VOTab...
978

16035364   Benjamin Renard   First commit
979
980
        	return $cacheMgr->initFromTT($id, $type);
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
981

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

9d412dda   elena   catalog tmp and r...
986
        	return $objMgr->initForChart($id, $name, $isTmpObject, $type);
86263051   elena   visu second draft
987
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
988

d18b535d   elena   catalog draft + c...
989
        public function initTTCacheFromTmpObject($folderId, $name, $isCatalog = false)
16035364   Benjamin Renard   First commit
990
        {
d18b535d   elena   catalog draft + c...
991
			if (!$isCatalog) $cacheMgr = new TimeTableCacheMgr();
5de62950   Nathanael Jourdane   Improve the VOTab...
992

d18b535d   elena   catalog draft + c...
993
			else              $cacheMgr = new CatalogCacheMgr();
5de62950   Nathanael Jourdane   Improve the VOTab...
994
995
996



16035364   Benjamin Renard   First commit
997
998
        	return $cacheMgr->initFromTmpObject($folderId, $name);
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
999

16035364   Benjamin Renard   First commit
1000
1001
1002
1003
1004
        public function initTTCacheFromUploadedFile($name, $format)
        {
        	$cacheMgr = new TimeTableCacheMgr();
        	return $cacheMgr->initFromUploadedFile($name, $format);
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1005

16035364   Benjamin Renard   First commit
1006
1007
        public function readTTCacheIntervals($o)
        {
169f14d2   Benjamin Renard   Add shared object...
1008
        	if ($o->typeTT == 'catalog' || $type == 'sharedcatalog') $cacheMgr = new CatalogCacheMgr();
d18b535d   elena   catalog draft + c...
1009
        	else $cacheMgr = new TimeTableCacheMgr();
5de62950   Nathanael Jourdane   Improve the VOTab...
1010

16035364   Benjamin Renard   First commit
1011
1012
        	return $cacheMgr->getIntervals($o->start,$o->limit,$o->sort,$o->filter);
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1013

86263051   elena   visu second draft
1014
1015
	 public function readIntervalsForChart($o)
        {
169f14d2   Benjamin Renard   Add shared object...
1016
        	if ($o->typeTT == 'catalog' || $type == 'sharedcatalog') $objMgr = new CatalogMgr();
5de62950   Nathanael Jourdane   Improve the VOTab...
1017
1018


9d412dda   elena   catalog tmp and r...
1019
        	return $objMgr->getIntervalsForChart($o->id, $o->name, $o->fromPlugin, $o->typeTT);
86263051   elena   visu second draft
1020
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1021

16035364   Benjamin Renard   First commit
1022
1023
1024
1025
1026
        public function saveTTCacheIntervalsInTT($o)
        {
        	$cacheMgr = new TimeTableCacheMgr();
            return $cacheMgr->saveInTT($o->ttId,$o->action,$o->cacheToken);
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1027

16035364   Benjamin Renard   First commit
1028
1029
        public function addTTCacheInterval($o)
        {
f9c8b272   elena   edit catalog
1030
1031
          	if ($o->isCatalog) $cacheMgr = new CatalogCacheMgr();
          	else $cacheMgr = new TimeTableCacheMgr();
5de62950   Nathanael Jourdane   Improve the VOTab...
1032

16035364   Benjamin Renard   First commit
1033
1034
            return $cacheMgr->addInterval($o->index, $o->start, $o->stop);
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1035

70aabdee   elena   catalog draft
1036
        public function removeTTCacheIntervalFromId($id, $isCatalog = false)
16035364   Benjamin Renard   First commit
1037
        {
70aabdee   elena   catalog draft
1038
1039
        	if ($isCatalog) $cacheMgr = new CatalogCacheMgr();
        	else $cacheMgr = new TimeTableCacheMgr();
5de62950   Nathanael Jourdane   Improve the VOTab...
1040

16035364   Benjamin Renard   First commit
1041
1042
        	return $cacheMgr->removeIntervalFromId($id);
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1043

16035364   Benjamin Renard   First commit
1044
1045
        public function modifyTTCacheInterval($o)
        {
f9c8b272   elena   edit catalog
1046
        	if ($o->isCatalog) {
5de62950   Nathanael Jourdane   Improve the VOTab...
1047

f9c8b272   elena   edit catalog
1048
1049
			$cacheMgr = new CatalogCacheMgr();
		return $cacheMgr->modifyIntervalFromId($o);
5de62950   Nathanael Jourdane   Improve the VOTab...
1050

f9c8b272   elena   edit catalog
1051
1052
		}
          	else $cacheMgr = new TimeTableCacheMgr();
5de62950   Nathanael Jourdane   Improve the VOTab...
1053

16035364   Benjamin Renard   First commit
1054
1055
        	return $cacheMgr->modifyIntervalFromId($o->cacheId, $o->start, $o->stop);
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1056

16035364   Benjamin Renard   First commit
1057
1058
1059
1060
1061
        public function operationTTCacheIntervals($extendTime, $shiftTime)
        {
        	$cacheMgr = new TimeTableCacheMgr();
        	return $cacheMgr->operationIntervals($extendTime, $shiftTime);
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1062

16035364   Benjamin Renard   First commit
1063
1064
1065
1066
1067
        public function mergeTTCacheIntervals()
        {
        	$cacheMgr = new TimeTableCacheMgr();
        	return $cacheMgr->mergeIntervals();
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1068

16035364   Benjamin Renard   First commit
1069
1070
1071
1072
1073
        public function getTTCacheStatistics()
        {
        	$cacheMgr = new TimeTableCacheMgr();
        	return $cacheMgr->getStatistics();
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1074

16035364   Benjamin Renard   First commit
1075
1076
1077
1078
1079
        public function getTTCacheStatus()
        {
        	$cacheMgr = new TimeTableCacheMgr();
        	return $cacheMgr->getStatus();
        }
aa94fd24   elena   Merge with last svn
1080

16035364   Benjamin Renard   First commit
1081
1082
/*
 * Send a feedback
5de62950   Nathanael Jourdane   Improve the VOTab...
1083
 *
16035364   Benjamin Renard   First commit
1084
1085
1086
1087
1088
1089
 */
        public function sendFeedback($feed)
        {
            $feedMgr = new FeedbackMgr();
            return $feedMgr->addFeedback($feed->user, $feed->interface, $feed->subject, $feed->userText, $feed->userAgent, $feed->attach);
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1090

16035364   Benjamin Renard   First commit
1091
1092
/*
 * Save state
5de62950   Nathanael Jourdane   Improve the VOTab...
1093
 *
16035364   Benjamin Renard   First commit
1094
1095
1096
1097
1098
1099
 */
        public function saveState($datas)
        {
            $myStateMgr = new StateMgr();
            return $myStateMgr->saveState($datas);
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1100

16035364   Benjamin Renard   First commit
1101
1102
/*
 * Load state
5de62950   Nathanael Jourdane   Improve the VOTab...
1103
1104
 *
 */
16035364   Benjamin Renard   First commit
1105
        public function loadState($o)
5de62950   Nathanael Jourdane   Improve the VOTab...
1106
        {
16035364   Benjamin Renard   First commit
1107
1108
1109
                $myStateMgr = new StateMgr();
                return $myStateMgr->loadState();
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1110
1111

/*
16035364   Benjamin Renard   First commit
1112
1113
1114
 * SAMP
 */
        public function sendToSAMP($o)
5de62950   Nathanael Jourdane   Improve the VOTab...
1115
        {
16035364   Benjamin Renard   First commit
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
                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;
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1128

16035364   Benjamin Renard   First commit
1129
1130
1131
1132
1133
1134
1135
/*
 * HST Images
 */
        public function getHstImagesUrl($o)
        {
                if ($this->amdaStat->success)
                    $this->amdaStat->addTask('images', $this->user, null);
5de62950   Nathanael Jourdane   Improve the VOTab...
1136

16035364   Benjamin Renard   First commit
1137
1138
1139
1140
1141
1142
                $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);
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1143

16035364   Benjamin Renard   First commit
1144
1145
        public function getAPISImagesUrl($o)
        {
5de62950   Nathanael Jourdane   Improve the VOTab...
1146
                if ($this->amdaStat->success)
16035364   Benjamin Renard   First commit
1147
                    $this->amdaStat->addTask('images', $this->user, null);
5de62950   Nathanael Jourdane   Improve the VOTab...
1148

16035364   Benjamin Renard   First commit
1149
                $apisMgr = new APISMgr();
b7796276   Benjamin Renard   Migration to supp...
1150
                $res = $apisMgr->get($o->target, $o->startTime, $o->stopTime, $o->datasets);
16035364   Benjamin Renard   First commit
1151
1152

                return $res;
5de62950   Nathanael Jourdane   Improve the VOTab...
1153
        }
16035364   Benjamin Renard   First commit
1154
1155
1156
1157
1158
/*
 * Filters
 */
        public function loadFilterList($o)
        {
5de62950   Nathanael Jourdane   Improve the VOTab...
1159
                $filtersMgr = new FiltersMgr();
16035364   Benjamin Renard   First commit
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
                $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;
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1173

16035364   Benjamin Renard   First commit
1174
1175
        public function saveFilter($o)
        {
5de62950   Nathanael Jourdane   Improve the VOTab...
1176
                $filtersMgr = new FiltersMgr();
16035364   Benjamin Renard   First commit
1177
1178
                return $filtersMgr->save($o);
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1179

16035364   Benjamin Renard   First commit
1180
1181
        public function createFilter($o)
        {
5de62950   Nathanael Jourdane   Improve the VOTab...
1182
                $filtersMgr = new FiltersMgr();
16035364   Benjamin Renard   First commit
1183
1184
                return $filtersMgr->create($o);
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1185

16035364   Benjamin Renard   First commit
1186
1187
1188
1189
1190
1191
        public function destroyFilter($o)
        {
                $filtersMgr = new FiltersMgr();
                $res = $filtersMgr->delete($o);
                return;
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1192

16035364   Benjamin Renard   First commit
1193
1194
1195
1196
1197
1198
        public function getCrtFilterId()
        {
                $filtersMgr = new FiltersMgr();
                $res = $filtersMgr->getCrtId();
                return $res;
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1199

16035364   Benjamin Renard   First commit
1200
1201
        public function getCrtFilterResult()
        {
5de62950   Nathanael Jourdane   Improve the VOTab...
1202
                $filtersMgr = new FiltersMgr();
16035364   Benjamin Renard   First commit
1203
1204
                return $filtersMgr->getCrtResult();
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1205

16035364   Benjamin Renard   First commit
1206
1207
        public function setCrtFilterId($o)
        {
5de62950   Nathanael Jourdane   Improve the VOTab...
1208
                $filtersMgr = new FiltersMgr();
16035364   Benjamin Renard   First commit
1209
1210
                return $filtersMgr->setCrtId($o->id);
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1211

16035364   Benjamin Renard   First commit
1212
1213
1214
1215
1216
1217
        public function resetFilter()
        {
                $filtersMgr = new FiltersMgr();
                $res = $filtersMgr->reset();
                return $res;
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1218

16035364   Benjamin Renard   First commit
1219
1220
1221
1222
1223
1224
1225
1226
	public function logout($isGuest)
	{
                if ($isGuest) {
                    $guestMgr = new Guest($this->user);
                    $guestMgr->deleteGuest();
                }
                else {
                    $myBaseMgr = new BaseManager();
5de62950   Nathanael Jourdane   Improve the VOTab...
1227
1228
1229
                    $myBaseMgr->delSimuFiles('mysimudata');
		    $myBaseMgr->delSimuFiles('mywsrdata');

18d4a11e   Benjamin Renard   Save and load plo...
1230
                    $this->cleanUserWS();
5de62950   Nathanael Jourdane   Improve the VOTab...
1231
                 }
16035364   Benjamin Renard   First commit
1232
		return;
5de62950   Nathanael Jourdane   Improve the VOTab...
1233
	}
16035364   Benjamin Renard   First commit
1234
1235
1236

        public function getInfo($obj)
        {
5de62950   Nathanael Jourdane   Improve the VOTab...
1237
                if (file_exists(HELPPATH.$obj->name))
16035364   Benjamin Renard   First commit
1238
                {
5de62950   Nathanael Jourdane   Improve the VOTab...
1239
                        $content = file_get_contents(HELPPATH.$obj->name);
16035364   Benjamin Renard   First commit
1240
1241
1242
                        return  array('success' => true, 'result' => $content);
                }
                return array('success' => false);
5de62950   Nathanael Jourdane   Improve the VOTab...
1243
1244
1245

        }

16035364   Benjamin Renard   First commit
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
        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);
5de62950   Nathanael Jourdane   Improve the VOTab...
1265
1266

            return  $res;
16035364   Benjamin Renard   First commit
1267
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1268
1269

    //$obj = array of IDs
16035364   Benjamin Renard   First commit
1270
1271
1272
1273
1274
1275
1276
1277
        public function addRun($obj)
        {
            $myBestRunsMgr = new BestRunsMgr();
            $myBestRunsMgr->init();
            $myBestRunsMgr->addRuns($obj);

            $res =  array('success' => true,'addedRuns' => $obj);
        return $res;
5de62950   Nathanael Jourdane   Improve the VOTab...
1278
        }
16035364   Benjamin Renard   First commit
1279
1280
1281
        //AKKA - New action to clean user WS
        public function cleanUserWS()
        {
70aabdee   elena   catalog draft
1282
          	require_once(INTEGRATION_SRC_DIR."RequestManager.php");
e82af71b   elena   catalog draft
1283
         	return $this->executeRequest($obj, FunctionTypeEnumClass::PROCESSCLEAN);
16035364   Benjamin Renard   First commit
1284
1285
1286
1287
        }

        public function deleteSpecialInfo($name)
        {
5de62950   Nathanael Jourdane   Improve the VOTab...
1288
             if (file_exists(USERDIR.$name))
16035364   Benjamin Renard   First commit
1289
1290
1291
                                    unlink(USERDIR.$name);
             return array('success' => true);
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1292

488b1401   Benjamin Renard   Interactive multi...
1293
        public function interactivePlot($obj, $multiPlotState)
9f08f4eb   Benjamin Renard   Zoom in interacti...
1294
1295
        {
        	require_once(INTEGRATION_SRC_DIR."RequestManager.php");
488b1401   Benjamin Renard   Interactive multi...
1296
1297
1298
1299
1300
        	$inputobj = (Object)array(
        		'action' => $obj,
        		'multiPlotState' => $multiPlotState
        	);
        	return $this->executeRequest($inputobj, FunctionTypeEnumClass::ACTION);
9f08f4eb   Benjamin Renard   Zoom in interacti...
1301
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1302

ced82260   Benjamin Renard   Get initial plot ...
1303
1304
1305
1306
1307
1308
1309
1310
1311
        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);
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1312

7ac3ce50   Benjamin Renard   First implementat...
1313
1314
1315
1316
1317
1318
1319
1320
1321
        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);
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1322

169f14d2   Benjamin Renard   Add shared object...
1323
1324
1325
1326
1327
1328
        public function getSharedObjectFolders($obj)
        {
        	$mgr = new SharedObjectsMgr();
        	$folders = $mgr->getFolders($obj->type);
        	return array('success' => true, 'folders' => $folders);
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1329

169f14d2   Benjamin Renard   Add shared object...
1330
1331
1332
1333
1334
1335
1336
1337
        public function shareObjects($obj)
        {
        	$mgr = new SharedObjectsMgr();
        	switch ($obj->type) {
        		case 'timeTable' :
        		case 'catalog' :
        			$src_object_path = USERTTDIR.$obj->object->id.".xml";
        			break;
5de62950   Nathanael Jourdane   Improve the VOTab...
1338

169f14d2   Benjamin Renard   Add shared object...
1339
1340
1341
        		default:
        			return array('success' => false, 'message' => 'Unknown object type');
        	}
5de62950   Nathanael Jourdane   Improve the VOTab...
1342

169f14d2   Benjamin Renard   Add shared object...
1343
1344
1345
        	$result = $mgr->add($obj->type, $obj->name, $obj->folder, $src_object_path, $obj->description, $this->user);
        	if (!$result['success'])
        		return $result;
5de62950   Nathanael Jourdane   Improve the VOTab...
1346

169f14d2   Benjamin Renard   Add shared object...
1347
1348
1349
        	$mgr->updateTree();
        	return $result;
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1350

169f14d2   Benjamin Renard   Add shared object...
1351
1352
1353
1354
1355
1356
        public function isSharedObjectNameAlreadyUsed($obj)
        {
        	$mgr = new SharedObjectsMgr();
        	$alreadyUsed = $mgr->isNameAlreadyUsed($obj->type, $obj->name);
        	return array('success' => true, 'alreadyUsed' => $alreadyUsed);
        }
3fc0b658   Nathanael Jourdane   Add EPN-TAP modul...
1357

210a3164   Nathanael Jourdane   Store actual func...
1358
1359
		public function epnTapGetGranules($table_name, $access_url, $filter, $select) {
			return (new EpnTapMgr)->getGranules($table_name, $access_url, $filter, $select);
3fc0b658   Nathanael Jourdane   Add EPN-TAP modul...
1360
		}
16035364   Benjamin Renard   First commit
1361
1362
}
?>