Commit 4dd48d61e446087ec50915ab58e2ac97eeb85787

Authored by Hacene SI HADJ MOHAND
1 parent 3e513d46

us ok

Showing 1 changed file with 58 additions and 84 deletions   Show diff stats
src/InputOutput/IHMImpl/Tools/IHMJobsManagerClass.php
... ... @@ -374,56 +374,18 @@ class IHMJobsManagerClass {
374 374 $infos = [];
375 375 switch ($obj['nodeType']) {
376 376 case 'condition':
377   - $name = 'datamining_'.time();
378   - if($obj['name'] != '') {
379   - $infos['Name'] = $obj['name'];
380   - }
381   - $infos['Condition'] = $obj['expression'];
382   - $infos['Start date'] = $obj['startDate'];
383   - $infos['Stop date'] = $obj['stopDate'];
384   - break;
  377 + $name = 'datamining_'.time();
  378 + if($obj['name'] != '') {
  379 + $infos['Name'] = $obj['name'];
  380 + }
  381 + $infos['Condition'] = $obj['expression'];
  382 + break;
385 383 case 'statistic':
386 384 $name = 'statistics_'.time();
387 385 if($obj['name'] != '') {
388 386 $infos['Name'] = $obj['name'];
389 387 }
390 388  
391   - if(array_key_exists('timeTables', $obj)) {
392   - $ttXml = new DomDocument();
393   - $ttXml->load(USERWSDIR . 'Tt.xml');
394   -
395   - $ttIntervals = [];
396   - foreach ($ttXml->getElementsByTagName('timetab') as $tt) {
397   - $ttIntervals[$tt->getAttribute('name')] = $tt->getAttribute('intervals');
398   - }
399   -
400   - if(count($obj['timeTables']) == 1) {
401   - $infos['Time table'] = $obj['timeTables'][0]->timeTableName;
402   - $infos['Nb Intervals'] = $ttIntervals[$infos['Time table']];
403   - } else {
404   - foreach ($obj['timeTables'] as $tt) {
405   - if($tt === reset($obj['timeTables'])) {
406   - $intervalNb = $ttIntervals[$tt->timeTableName];
407   - if(isset($intervalNb)){
408   - $infos['Time tables'] = $tt->timeTableName . '(' .$intervalNb . ' int.)';
409   - }else{
410   - $infos['Time tables'] = $tt->timeTableName;
411   - }
412   - } else {
413   - $intervalNb = $ttIntervals[$tt->timeTableName];
414   - if(isset($intervalNb)){
415   - $infos['Time tables'] .= ', ' . $tt->timeTableName . '(' .$intervalNb. ' int.)';
416   - }else{
417   - $infos['Time tables'] .= ', ' . $tt->timeTableName;
418   - }
419   - }
420   - }
421   - }
422   - } else {
423   - $infos['Start date'] = $obj['startDate'];
424   - $infos['Stop date'] = $obj['stopDate'];
425   - }
426   -
427 389 if(array_key_exists('expression', $obj)) {
428 390 $infos['Expression'] = $obj['expression'];
429 391 }
... ... @@ -433,7 +395,7 @@ class IHMJobsManagerClass {
433 395 }
434 396 if(count($params) == 1) {
435 397 $infos['Parameter'] = $params[0];
436   - } else {
  398 + } else if(count($params) >1){
437 399 $infos['Parameters'] = '<ul><li>' . join('</li><li>', $params) . '</li></ul>';
438 400 }
439 401 break;
... ... @@ -448,51 +410,12 @@ class IHMJobsManagerClass {
448 410 } else {
449 411 $infos['Parameters'] = join(', ', $params);
450 412 }
451   - $infos['Start date'] = $obj['startDate'];
452   - $infos['Stop date'] = $obj['stopDate'];
453 413 break;
454 414 case 'request':
455 415 $name = "request_".time();
456 416  
457 417 $infos['Output'] = strtolower($obj['file-format']) . ' (' . strtolower($obj['file-output']) . ')';
458 418  
459   - if(array_key_exists('timeTables', $obj)) {
460   - $ttXml = new DomDocument();
461   - $ttXml->load(USERWSDIR . 'Tt.xml');
462   -
463   - $ttIntervals = [];
464   - foreach ($ttXml->getElementsByTagName('timetab') as $tt) {
465   - $ttIntervals[$tt->getAttribute('name')] = $tt->getAttribute('intervals');
466   - }
467   -
468   - if(count($obj['timeTables']) == 1) {
469   - $infos['Time table'] = $obj['timeTables'][0]->timeTableName;
470   - $infos['Nb Intervals'] = $ttIntervals[$infos['Time table']];
471   - } else {
472   - foreach ($obj['timeTables'] as $tt) {
473   - if($tt === reset($obj['timeTables'])) {
474   - $intervalNb = $ttIntervals[$tt->timeTableName];
475   - if(isset($intervalNb)){
476   - $infos['Time tables'] = $tt->timeTableName . '(' .$intervalNb . ' int.)';
477   - }else{
478   - $infos['Time tables'] = $tt->timeTableName;
479   - }
480   - } else {
481   - $intervalNb = $ttIntervals[$tt->timeTableName];
482   - if(isset($intervalNb)){
483   - $infos['Time tables'] .= ', ' . $tt->timeTableName . '(' .$intervalNb. ' int.)';
484   - }else{
485   - $infos['Time tables'] .= ', ' . $tt->timeTableName;
486   - }
487   - }
488   - }
489   - }
490   - } else {
491   - $infos['Start date'] = $obj['startDate'];
492   - $infos['Stop date'] = $obj['stopDate'];
493   - }
494   -
495   -
496 419 foreach ($obj->panels as $panel) {
497 420 $strParams = '';
498 421 foreach ($panel->params as $param) {
... ... @@ -504,6 +427,57 @@ class IHMJobsManagerClass {
504 427 default:
505 428 $name = "unknown_".time();
506 429 }
  430 + if(array_key_exists('timeTables', $obj)) {
  431 + $ttXml = new DomDocument();
  432 + $ttXml->load(USERWSDIR . 'Tt.xml');
  433 +
  434 + $sharedTtXml = new DomDocument();
  435 + $sharedTtXml->load(SHAREDPATH . 'SharedObjectTree.xml');
  436 +
  437 +
  438 + $ttIntervals = [];
  439 + // TT/Cat
  440 + foreach ($ttXml->getElementsByTagName('timetab') as $tt) {
  441 + $ttIntervals[$tt->getAttribute('name')] = $tt->getAttribute('intervals');
  442 + }
  443 + foreach ($ttXml->getElementsByTagName('catalog') as $cat) {
  444 + $ttIntervals[$cat->getAttribute('name')] = $cat->getAttribute('intervals');
  445 + }
  446 +
  447 + // shared TT/Cat
  448 + foreach ($sharedTtXml->getElementsByTagName('timeTable') as $tt) {
  449 + $ttIntervals[$tt->getAttribute('name')] = $tt->getAttribute('nbIntervals');
  450 + }
  451 + foreach ($sharedTtXml->getElementsByTagName('catalog') as $cat) {
  452 + $ttIntervals[$cat->getAttribute('name')] = $cat->getAttribute('nbIntervals');
  453 + }
  454 +
  455 + if(count($obj['timeTables']) == 1) {
  456 + $infos['Time table'] = $obj['timeTables'][0]->timeTableName;
  457 + $infos['Nb Intervals'] = $ttIntervals[$infos['Time table']];
  458 + } else {
  459 + foreach ($obj['timeTables'] as $tt) {
  460 + if($tt === reset($obj['timeTables'])) {
  461 + $intervalNb = $ttIntervals[$tt->timeTableName];
  462 + if(isset($intervalNb)){
  463 + $infos['Time tables'] = $tt->timeTableName . '(' .$intervalNb . ' int.)';
  464 + }else{
  465 + $infos['Time tables'] = $tt->timeTableName;
  466 + }
  467 + } else {
  468 + $intervalNb = $ttIntervals[$tt->timeTableName];
  469 + if(isset($intervalNb)){
  470 + $infos['Time tables'] .= ', ' . $tt->timeTableName . '(' .$intervalNb. ' int.)';
  471 + }else{
  472 + $infos['Time tables'] .= ', ' . $tt->timeTableName;
  473 + }
  474 + }
  475 + }
  476 + }
  477 + } else {
  478 + $infos['Start date'] = $obj['startDate'];
  479 + $infos['Stop date'] = $obj['stopDate'];
  480 + }
507 481  
508 482 $infos['Started at'] = gmdate("Y-m-d H:i:s", $start);
509 483  
... ...