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 {

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
                $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;

5de62950   Nathanael Jourdane   Improve the VOTab...
148
                switch ($nodeType)
16035364   Benjamin Renard   First commit
149
                {
5de62950   Nathanael Jourdane   Improve the VOTab...
150
		    case 'bkgWorks':
16035364   Benjamin Renard   First commit
151
152
			$specialNode = true;
			$status = $child->getAttribute('status');
5de62950   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,
5de62950   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();
5de62950   Nathanael Jourdane   Improve the VOTab...
161
162
			$info = $objectMgr->getObject($id)->expression;
		    break;
16035364   Benjamin Renard   First commit
163
164

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

16035364   Benjamin Renard   First commit
166
		 	$objectMgr = new RequestMgr();
5de62950   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

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

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

                    case 'timeTable':
5de62950   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;
5de62950   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";
				}
			   }
16035364   Benjamin Renard   First commit
227

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

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

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

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

aec5ba13   Elena.Budnik   not tested param ...
245
                                }
5de62950   Nathanael Jourdane   Improve the VOTab...
246
247
248

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

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

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

16035364   Benjamin Renard   First commit
254
                        }
5de62950   Nathanael Jourdane   Improve the VOTab...
255

16035364   Benjamin Renard   First commit
256

63ac7745   Benjamin Renard   Support component...
257
                        $component_info = array();
16035364   Benjamin Renard   First commit
258
259
260
261
262
263
264
265
                        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...
266
267
                                    $globalStop = $child->parentNode->parentNode->getAttribute('dataStop');
                                }
16035364   Benjamin Renard   First commit
268

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

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

                                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...
279

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

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

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

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

                        if ($isParameter)
16035364   Benjamin Renard   First commit
299
300
                        {
                            if ($child->tagName == 'parameter' && $child->childNodes->length == 1)
5de62950   Nathanael Jourdane   Improve the VOTab...
301
302
303
304
                            {
                                $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
305

f740e66b   Nathanael Jourdane   Improve the VOTab...
306
                             {
16035364   Benjamin Renard   First commit
307
                                 $needsArgs = true;
86939396   Elena.Budnik   merge conflict re...
308

16035364   Benjamin Renard   First commit
309
310
311
312
                             }

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

                            $childrenToReturn[] = array('text' => $name,'alias' => $alias,
63ac7745   Benjamin Renard   Support component...
315
                                'id' => $id,'nodeType' => $nodeType, 'info' => $info, "component_info" => $component_info,
16035364   Benjamin Renard   First commit
316
317
318
319
                                '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...
320
                        else
16035364   Benjamin Renard   First commit
321
                        {
5de62950   Nathanael Jourdane   Improve the VOTab...
322
                            if ($child->tagName == 'mission')
16035364   Benjamin Renard   First commit
323
                            {
0f5fecfc   Elena.Budnik   only "restriction...
324
                                $disable = $child->hasAttribute('restriction');
16035364   Benjamin Renard   First commit
325
326
327
328
                                $rank = $child->getAttribute('rank');
                            }
                            else
                            {
0f5fecfc   Elena.Budnik   only "restriction...
329
                                $disable = $child->hasAttribute('restriction');
16035364   Benjamin Renard   First commit
330
                            }
5de62950   Nathanael Jourdane   Improve the VOTab...
331

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

5de62950   Nathanael Jourdane   Improve the VOTab...
342
343
                            $childrenToReturn[] = array('text' => $name, 'id' => $id,'nodeType' => $nodeType,  'info' => $info,
                                'leaf' => false, 'help' => $help, 'disable' => $disable, 'rank' => $rank);
16035364   Benjamin Renard   First commit
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
                        }
                    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...
361
                        if ($child->tagName == 'simulationRegion')
16035364   Benjamin Renard   First commit
362
363
364
365
                            {
                                 $rank = $child->getAttribute('rank');
                            }
 		    case 'remoteParam' :
5de62950   Nathanael Jourdane   Improve the VOTab...
366

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

                        $isDeletable = $child->hasAttribute('isDeletable');
5de62950   Nathanael Jourdane   Improve the VOTab...
373

f740e66b   Nathanael Jourdane   Improve the VOTab...
374

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

                        switch ($id)

16035364   Benjamin Renard   First commit
381
                        {
5de62950   Nathanael Jourdane   Improve the VOTab...
382
383
                            case 'CDAWEB'  :
                            case 'OMNIWEB' :
16035364   Benjamin Renard   First commit
384
385
386
387
388
389
390
391
392
393
394
395
396
                                            $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...
397

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

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

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

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

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

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


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

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

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

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

16035364   Benjamin Renard   First commit
455
456
457
458
459
460
461
462
463
464
465
466
467
468
                            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;
5de62950   Nathanael Jourdane   Improve the VOTab...
469

f740e66b   Nathanael Jourdane   Improve the VOTab...
470

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

16035364   Benjamin Renard   First commit
475
			  }
f740e66b   Nathanael Jourdane   Improve the VOTab...
476

16035364   Benjamin Renard   First commit
477
		    break;
f740e66b   Nathanael Jourdane   Improve the VOTab...
478

5de62950   Nathanael Jourdane   Improve the VOTab...
479
		     case 'myData' :
16035364   Benjamin Renard   First commit
480
			    $info = $child->hasAttribute('info') ? $child->getAttribute('info') : $child->nodeValue;
16035364   Benjamin Renard   First commit
481
482
483
484
485
486
487
488
489
490
491
492
			    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...
493

16035364   Benjamin Renard   First commit
494
495
496
497
498
499
500
                        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...
501
502
                            $globalStart = substr($child->getAttribute('desc'), 0, 19);
                            $globalStop =  substr($child->getAttribute('desc'), 20);
16035364   Benjamin Renard   First commit
503
504
                        }

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

                        break;
5de62950   Nathanael Jourdane   Improve the VOTab...
511
                    default:
16035364   Benjamin Renard   First commit
512
		}
5de62950   Nathanael Jourdane   Improve the VOTab...
513

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

      return  $childrenToReturn;
 }

5de62950   Nathanael Jourdane   Improve the VOTab...
530
    public  function saveTree($obj)
16035364   Benjamin Renard   First commit
531
532
    {
            $paramMgr = new ParamMgr();
5de62950   Nathanael Jourdane   Improve the VOTab...
533
            return $paramMgr->saveTree($obj);
16035364   Benjamin Renard   First commit
534
535
    }

5de62950   Nathanael Jourdane   Improve the VOTab...
536
537
    public  function doNothing($obj)
    {
16035364   Benjamin Renard   First commit
538
        return array("res" => 'ok');
5de62950   Nathanael Jourdane   Improve the VOTab...
539

16035364   Benjamin Renard   First commit
540
541
    }

5de62950   Nathanael Jourdane   Improve the VOTab...
542
543
    public  function deleteFromTree($obj)
    {
16035364   Benjamin Renard   First commit
544
545
        $paramMgr = new ParamMgr();
        return $paramMgr->deleteFromTree($obj);
5de62950   Nathanael Jourdane   Improve the VOTab...
546

16035364   Benjamin Renard   First commit
547
548
549
550
    }

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

5de62950   Nathanael Jourdane   Improve the VOTab...
567
    }
16035364   Benjamin Renard   First commit
568
569

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

    public  function getMyParamInfo($object)
    {
            $objectMgr = new FilesMgr();
16035364   Benjamin Renard   First commit
581
            return  $objectMgr -> getParamInfo($object);
5de62950   Nathanael Jourdane   Improve the VOTab...
582
    }
16035364   Benjamin Renard   First commit
583
584

/*
5de62950   Nathanael Jourdane   Improve the VOTab...
585
586
587
588
*  temporary object from Search
*/
    public  function getTmpObject($folderId, $name, $nodeType) {

aa94fd24   elena   Merge with last svn
589

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

16035364   Benjamin Renard   First commit
602
    }
16035364   Benjamin Renard   First commit
603

5de62950   Nathanael Jourdane   Improve the VOTab...
604
605
606

    public  function getObject($id, $nodeType) {

16035364   Benjamin Renard   First commit
607
608
	    switch ($nodeType) {
		  case 'myDataParam':
5de62950   Nathanael Jourdane   Improve the VOTab...
609
610
		  case 'derivedParam' :
			   $objectMgr = new DerivedParamMgr($nodeType);
16035364   Benjamin Renard   First commit
611
			   break;
5de62950   Nathanael Jourdane   Improve the VOTab...
612
		  case 'timeTable' :
16035364   Benjamin Renard   First commit
613
		  case 'sharedtimeTable' :
5de62950   Nathanael Jourdane   Improve the VOTab...
614
615
			   $objectMgr = new TimeTableMgr();
			   break;
048b4d77   elena   catalogs +
616
		  case 'catalog' :
169f14d2   Benjamin Renard   Add shared object...
617
          case 'sharedcatalog' :
5de62950   Nathanael Jourdane   Improve the VOTab...
618
619
620
			   $objectMgr = new CatalogMgr();
			   break;
		  case 'condition' :
16035364   Benjamin Renard   First commit
621
		  case 'request' :
5de62950   Nathanael Jourdane   Improve the VOTab...
622
623
			   $objectMgr = new RequestMgr($nodeType);
			   break;
16035364   Benjamin Renard   First commit
624
625
626
627
628
		  case 'bkgWorks' :
		  	require_once(INTEGRATION_SRC_DIR."RequestManager.php");
		  	return $this->executeRequest($id, FunctionTypeEnumClass::PROCESSGETINFO);
			   break;
		  case 'myData' :
5de62950   Nathanael Jourdane   Improve the VOTab...
629
			   $objectMgr = new FilesMgr();
16035364   Benjamin Renard   First commit
630
631
632
633
634
635
636
637
638
639
			   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...
640
641
642
643
644
645
646
    public  function deleteObject($obj) {

	    switch ($obj->nodeType) {

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

16035364   Benjamin Renard   First commit
666
667
668
669
670
671
672
673
674
675
676
677
678
		  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...
679
680
    public  function renameObject($obj) {

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

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

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

5de62950   Nathanael Jourdane   Improve the VOTab...
707
/*
16035364   Benjamin Renard   First commit
708
709
*   $obj = { name: obj.name, obj.nodeType, obj.leaf (??), OBJ DEPENDENT ATTRIBUTES }
*/
5de62950   Nathanael Jourdane   Improve the VOTab...
710
711
    public  function createObject($obj, $folder) {

16035364   Benjamin Renard   First commit
712
713
	    switch ($obj->nodeType) {

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

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

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

5de62950   Nathanael Jourdane   Improve the VOTab...
741
/*
16035364   Benjamin Renard   First commit
742
743
744
*   $obj = { id:obj.id, name: obj.name, obj.nodeType, obj.leaf (??), OBJ DEPENDENT ATTRIBUTES }
*/
    public  function modifyObject($obj) {
16035364   Benjamin Renard   First commit
745

5de62950   Nathanael Jourdane   Improve the VOTab...
746
747
748
749
750
751
752
753
	    switch ($obj->nodeType) {

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

	    return  $objectMgr -> modifyObject($obj);
5de62950   Nathanael Jourdane   Improve the VOTab...
767
    }
16035364   Benjamin Renard   First commit
768
769
770
771
772
773
774
775
776
777
/*
 * {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...
778
			case 'sharedtimeTable' :
16035364   Benjamin Renard   First commit
779
780
				$objectMgr = new TimeTableMgr();
				break;
d18b535d   elena   catalog draft + c...
781
			case 'catalog' :
169f14d2   Benjamin Renard   Add shared object...
782
			case 'sharedcatalog' :
d18b535d   elena   catalog draft + c...
783
784
				$objectMgr = new CatalogMgr();
				break;
16035364   Benjamin Renard   First commit
785
786
787
788
789
790
791
792
793
794
795
796
797
798
			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
799

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


	/* 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...
817
818


16035364   Benjamin Renard   First commit
819
820
821
822
823
824
825
826
		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...
827
828

        //TODO error handling
16035364   Benjamin Renard   First commit
829
830
        if (($res = $dd -> ddCheckUser()) != 0)
		{
5de62950   Nathanael Jourdane   Improve the VOTab...
831
			if ($res == 156)
16035364   Benjamin Renard   First commit
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
				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...
849

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

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

16035364   Benjamin Renard   First commit
855
856
857
	private function executeRequest($obj, $function)
	{
		$res = $this->checkUser($obj);
5de62950   Nathanael Jourdane   Improve the VOTab...
858

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

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

16035364   Benjamin Renard   First commit
864
865
866
867
868
		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...
869

16035364   Benjamin Renard   First commit
870
871
		return $res;
	}
5de62950   Nathanael Jourdane   Improve the VOTab...
872
873
874

/*
*    Main EXECUTE PROCEDURE
16035364   Benjamin Renard   First commit
875
876
*/
    public  function execute($node, $obj)
5de62950   Nathanael Jourdane   Improve the VOTab...
877
	{
16035364   Benjamin Renard   First commit
878
879
880
881
882
883
		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...
884

16035364   Benjamin Renard   First commit
885
/*
a0b3d64e   Benjamin Renard   Derived parameter...
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
 * 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...
901

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

a0b3d64e   Benjamin Renard   Derived parameter...
905
906
907
908
909
910
		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...
911

a0b3d64e   Benjamin Renard   Derived parameter...
912
/*
e6e5b259   Benjamin Renard   Add kill plot req...
913
 * kill plot process
16035364   Benjamin Renard   First commit
914
 */
5de62950   Nathanael Jourdane   Improve the VOTab...
915

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

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

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

16035364   Benjamin Renard   First commit
930
931
932
933
934
935
        $objectMgr = new TimeTableMgr();

    return  $objectMgr -> merge($obj);

    }

5de62950   Nathanael Jourdane   Improve the VOTab...
936

16035364   Benjamin Renard   First commit
937
938
939
940
941
942
943
944
945
946
947
948
949
/*
 * 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...
950

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

f9c8b272   elena   edit catalog
956
        	return $cacheMgr->initTTCache($nparams);
16035364   Benjamin Renard   First commit
957
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
958
959


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

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

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

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

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

d18b535d   elena   catalog draft + c...
979
			else              $cacheMgr = new CatalogCacheMgr();
5de62950   Nathanael Jourdane   Improve the VOTab...
980
981
982



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

16035364   Benjamin Renard   First commit
986
987
988
989
990
        public function initTTCacheFromUploadedFile($name, $format)
        {
        	$cacheMgr = new TimeTableCacheMgr();
        	return $cacheMgr->initFromUploadedFile($name, $format);
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
991

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

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

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


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

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

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

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

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

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

16035364   Benjamin Renard   First commit
1030
1031
        public function modifyTTCacheInterval($o)
        {
f9c8b272   elena   edit catalog
1032
        	if ($o->isCatalog) {
5de62950   Nathanael Jourdane   Improve the VOTab...
1033

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

f9c8b272   elena   edit catalog
1037
1038
		}
          	else $cacheMgr = new TimeTableCacheMgr();
5de62950   Nathanael Jourdane   Improve the VOTab...
1039

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

16035364   Benjamin Renard   First commit
1043
1044
1045
1046
1047
        public function operationTTCacheIntervals($extendTime, $shiftTime)
        {
        	$cacheMgr = new TimeTableCacheMgr();
        	return $cacheMgr->operationIntervals($extendTime, $shiftTime);
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1048

16035364   Benjamin Renard   First commit
1049
1050
1051
1052
1053
        public function mergeTTCacheIntervals()
        {
        	$cacheMgr = new TimeTableCacheMgr();
        	return $cacheMgr->mergeIntervals();
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1054

16035364   Benjamin Renard   First commit
1055
1056
1057
1058
1059
        public function getTTCacheStatistics()
        {
        	$cacheMgr = new TimeTableCacheMgr();
        	return $cacheMgr->getStatistics();
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1060

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

16035364   Benjamin Renard   First commit
1067
1068
/*
 * Send a feedback
5de62950   Nathanael Jourdane   Improve the VOTab...
1069
 *
16035364   Benjamin Renard   First commit
1070
1071
1072
1073
1074
1075
 */
        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...
1076

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

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

/*
16035364   Benjamin Renard   First commit
1098
1099
1100
 * SAMP
 */
        public function sendToSAMP($o)
5de62950   Nathanael Jourdane   Improve the VOTab...
1101
        {
16035364   Benjamin Renard   First commit
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
                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...
1114

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

16035364   Benjamin Renard   First commit
1123
1124
1125
1126
1127
1128
                $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...
1129

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

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

                return $res;
5de62950   Nathanael Jourdane   Improve the VOTab...
1139
        }
16035364   Benjamin Renard   First commit
1140
1141
1142
1143
1144
/*
 * Filters
 */
        public function loadFilterList($o)
        {
5de62950   Nathanael Jourdane   Improve the VOTab...
1145
                $filtersMgr = new FiltersMgr();
16035364   Benjamin Renard   First commit
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
                $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...
1159

16035364   Benjamin Renard   First commit
1160
1161
        public function saveFilter($o)
        {
5de62950   Nathanael Jourdane   Improve the VOTab...
1162
                $filtersMgr = new FiltersMgr();
16035364   Benjamin Renard   First commit
1163
1164
                return $filtersMgr->save($o);
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1165

16035364   Benjamin Renard   First commit
1166
1167
        public function createFilter($o)
        {
5de62950   Nathanael Jourdane   Improve the VOTab...
1168
                $filtersMgr = new FiltersMgr();
16035364   Benjamin Renard   First commit
1169
1170
                return $filtersMgr->create($o);
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1171

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

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

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

16035364   Benjamin Renard   First commit
1192
1193
        public function setCrtFilterId($o)
        {
5de62950   Nathanael Jourdane   Improve the VOTab...
1194
                $filtersMgr = new FiltersMgr();
16035364   Benjamin Renard   First commit
1195
1196
                return $filtersMgr->setCrtId($o->id);
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1197

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

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

18d4a11e   Benjamin Renard   Save and load plo...
1216
                    $this->cleanUserWS();
5de62950   Nathanael Jourdane   Improve the VOTab...
1217
                 }
16035364   Benjamin Renard   First commit
1218
		return;
5de62950   Nathanael Jourdane   Improve the VOTab...
1219
	}
16035364   Benjamin Renard   First commit
1220
1221
1222

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

        }

16035364   Benjamin Renard   First commit
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
        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...
1251
1252

            return  $res;
16035364   Benjamin Renard   First commit
1253
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1254
1255

    //$obj = array of IDs
16035364   Benjamin Renard   First commit
1256
1257
1258
1259
1260
1261
1262
1263
        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...
1264
        }
16035364   Benjamin Renard   First commit
1265
1266
1267
        //AKKA - New action to clean user WS
        public function cleanUserWS()
        {
70aabdee   elena   catalog draft
1268
          	require_once(INTEGRATION_SRC_DIR."RequestManager.php");
e82af71b   elena   catalog draft
1269
         	return $this->executeRequest($obj, FunctionTypeEnumClass::PROCESSCLEAN);
16035364   Benjamin Renard   First commit
1270
1271
1272
1273
        }

        public function deleteSpecialInfo($name)
        {
5de62950   Nathanael Jourdane   Improve the VOTab...
1274
             if (file_exists(USERDIR.$name))
16035364   Benjamin Renard   First commit
1275
1276
1277
                                    unlink(USERDIR.$name);
             return array('success' => true);
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1278

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

ced82260   Benjamin Renard   Get initial plot ...
1289
1290
1291
1292
1293
1294
1295
1296
1297
        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...
1298

7ac3ce50   Benjamin Renard   First implementat...
1299
1300
1301
1302
1303
1304
1305
1306
1307
        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...
1308

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

169f14d2   Benjamin Renard   Add shared object...
1316
1317
1318
1319
1320
1321
1322
1323
        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...
1324

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

169f14d2   Benjamin Renard   Add shared object...
1329
1330
1331
        	$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...
1332

169f14d2   Benjamin Renard   Add shared object...
1333
1334
1335
        	$mgr->updateTree();
        	return $result;
        }
5de62950   Nathanael Jourdane   Improve the VOTab...
1336

169f14d2   Benjamin Renard   Add shared object...
1337
1338
1339
1340
1341
1342
        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...
1343

67a4e0da   Nathanael Jourdane   Add a function to...
1344
1345
1346
1347
1348
1349
		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);
3fc0b658   Nathanael Jourdane   Add EPN-TAP modul...
1350
		}
16035364   Benjamin Renard   First commit
1351
1352
}
?>