Commit 0bfe9697f5bfcbab5a589ff95a2b410fdca3ef3f

Authored by Erdogan Furkan
1 parent c0008d6e

Done.

Showing 1 changed file with 53 additions and 55 deletions   Show diff stats
src/InputOutput/IHMImpl/Tools/IHMJobsManagerClass.php
... ... @@ -427,59 +427,57 @@ class IHMJobsManagerClass {
427 427 default:
428 428 $name = "unknown_".time();
429 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   - }
481   -
482   - $infos['Started at'] = gmdate("Y-m-d H:i:s", $start);
  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 + }
483 481  
484 482 $strInfo = '';
485 483 foreach ($infos as $key => $info) {
... ... @@ -511,7 +509,7 @@ class IHMJobsManagerClass {
511 509 $newJob->setAttribute('jobType', $key);
512 510 $newJob->setAttribute('folder', $args['folder']);
513 511 $newJob->setAttribute('result', $args['result']);
514   - $newJob->setAttribute('start', date('d-m-Y H:i:s', $args['start']));
  512 + $newJob->setAttribute('start', date(DATE_ISO8601, $args['start']));
515 513 //to know if know if it's an immediate job or not
516 514 $newJob->setAttribute('immediate', !$args['running']);
517 515 $newJob->setAttribute('exectime', $args['exectime']);
... ... @@ -586,7 +584,7 @@ class IHMJobsManagerClass {
586 584 if ($args['running']) {
587 585 $job->setAttribute('stop', 'unknown');
588 586 } else if ($job->getAttribute('stop') == '' || $job->getAttribute('stop') == 'unknown') {
589   - $job->setAttribute('stop', date('d-m-Y H:i:s', time()));
  587 + $job->setAttribute('stop', date(DATE_ISO8601, time()));
590 588  
591 589 $start = new DateTime($job->getAttribute('start'));
592 590 $interval = (new DateTime('now'))->diff($start);
... ...