Example #1
0
 private function exportStepResources(ExportScormResourceEvent $event, \stdClass $step)
 {
     if (!empty($step->description)) {
         $parsed = $this->container->get('claroline.scorm.rich_text_exporter')->parse($step->description);
         $step->description = $parsed['text'];
         foreach ($parsed['resources'] as $resource) {
             $event->addEmbedResource($resource);
         }
     }
     if (!empty($step->primaryResource)) {
         foreach ($step->primaryResource as $primary) {
             $resource = $this->getResource($primary->resourceId);
             $event->addEmbedResource($resource);
             // Generate resource URL
             $primary->url = '../scos/resource_' . $primary->resourceId . '.html';
         }
     }
     if (!empty($step->resources)) {
         foreach ($step->resources as $secondary) {
             $resource = $this->getResource($secondary->resourceId);
             $event->addEmbedResource($resource);
             // Generate resource URL
             $secondary->url = '../scos/resource_' . $secondary->resourceId . '.html';
         }
     }
     if (!empty($step->children)) {
         foreach ($step->children as $child) {
             $this->exportStepResources($event, $child);
         }
     }
 }
 private function exportHtmlContent(ExportScormResourceEvent $event, $content)
 {
     if ($content) {
         $parsed = $this->container->get('claroline.scorm.rich_text_exporter')->parse($content);
         $content = $parsed['text'];
         foreach ($parsed['resources'] as $resource) {
             $event->addEmbedResource($resource);
         }
     }
     return $content;
 }