/** * Check that all Activities and Resources as at least same rights than the Path * @return \Innova\PathBundle\Manager\PublishingManager */ protected function manageRights() { // Grab Resources and Activities $nodes = $this->retrieveAllNodes($this->path->getSteps()->toArray()); if (!empty($nodes)) { $pathRights = $this->path->getResourceNode()->getRights(); foreach ($nodes as $node) { foreach ($pathRights as $right) { if ($right->getMask() & 1) { $this->rightsManager->editPerms($right->getMask(), $right->getRole(), $node, true); } } } } return $this; }
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; }