Exemplo n.º 1
0
 public function export(Workspace $workspace, array &$files, Path $path)
 {
     $data = [];
     // Get path data
     $pathData = [];
     $pathData['description'] = $path->getDescription();
     $pathData['breadcrumbs'] = $path->hasBreadcrumbs();
     $pathData['modified'] = $path->isModified();
     $pathData['published'] = $path->isPublished();
     $pathData['summaryDisplayed'] = $path->isSummaryDisplayed();
     $pathData['completeBlockingCondition'] = $path->isCompleteBlockingCondition();
     $pathData['manualProgressionAllowed'] = $path->isManualProgressionAllowed();
     // Get path structure into a file (to replace resources ID with placeholders)
     $uid = uniqid() . '.txt';
     $tmpPath = $this->ch->getParameter('tmp_dir') . DIRECTORY_SEPARATOR . $uid;
     $structure = $path->getStructure();
     file_put_contents($tmpPath, $structure);
     $files[$uid] = $tmpPath;
     $pathData['structure'] = $uid;
     $data['path'] = $pathData;
     // Process Steps
     $data['steps'] = [];
     if ($path->isPublished()) {
         $stepsData = [];
         foreach ($path->getSteps() as $step) {
             $stepsData[] = $this->stepManager->export($step);
         }
         $data['steps'] = $stepsData;
     }
     return $data;
 }