Commit 881bd2251a82ea15d9059f1809f9532caf2be0aa

Authored by Benjamin Renard
1 parent dc77849c

Add shared TT support for TT conversion

src/InputOutput/IHMImpl/TimeTables/IHMInputOutputTTClass.php
@@ -35,7 +35,17 @@ class IHMInputOutputTTClass implements InputOutputInterface @@ -35,7 +35,17 @@ class IHMInputOutputTTClass implements InputOutputInterface
35 { 35 {
36 //create a list of data to treat 36 //create a list of data to treat
37 $processData = new TTRequestDataClass(); 37 $processData = new TTRequestDataClass();
38 - $ttName = IHMConfigClass::getUserTTPath().$tt->id.'.xml'; 38 + if (strpos($tt->id,"sharedtimeTable_") === 0) {
  39 + //Shared TimeTable
  40 + $result = IHMSharedObjectsClass::getPath("timeTable", $tt->id);
  41 + if (!$result['success'])
  42 + throw new Exception('Shared TimeTable '.$tt->name.' not found');
  43 + $ttName = $result['path'];
  44 + }
  45 + else {
  46 + //User TimeTable
  47 + $ttName = IHMConfigClass::getUserTTPath().$tt->id.'.xml';
  48 + }
39 if (!file_exists($ttName)) 49 if (!file_exists($ttName))
40 throw new Exception('TimeTable '.$tt->name.' not found'); 50 throw new Exception('TimeTable '.$tt->name.' not found');
41 $processData->setInputFileName($ttName); 51 $processData->setInputFileName($ttName);