public function onExportScorm(ExportScormResourceEvent $event)
 {
     $resource = $event->getResource();
     $template = $this->container->get('templating')->render('ClarolineImagePlayerBundle:Scorm:export.html.twig', ['_resource' => $resource]);
     // Set export template
     $event->setTemplate($template);
     // Add Image file
     $event->addFile('file_' . $resource->getResourceNode()->getId(), $resource->getHashName());
     $event->stopPropagation();
 }
 public function onExportScorm(ExportScormResourceEvent $event)
 {
     $resource = $event->getResource();
     $template = $this->container->get('templating')->render('ClarolinePdfPlayerBundle:Scorm:export.html.twig', ['_resource' => $resource]);
     // Set export template
     $event->setTemplate($template);
     // Add PDF file
     $event->addFile('file_' . $resource->getResourceNode()->getId(), $resource->getHashName());
     // Add assets
     $webpack = $this->container->get('claroline.extension.webpack');
     $event->addAsset('claroline-distribution-plugin-pdf-player-pdf-viewer.js', $webpack->hotAsset('dist/claroline-distribution-plugin-pdf-player-pdf-viewer.js', true));
     // Add translations
     $event->addTranslationDomain('widget');
     $event->stopPropagation();
 }
Esempio n. 3
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);
         }
     }
 }
Esempio n. 4
0
 /**
  * @DI\Observe("export_scorm_text")
  *
  * @param ExportScormResourceEvent $event
  */
 public function onExportScorm(ExportScormResourceEvent $event)
 {
     $text = $event->getResource();
     $revisionRepo = $this->container->get('doctrine.orm.entity_manager')->getRepository('ClarolineCoreBundle:Resource\\Revision');
     $textContent = $revisionRepo->getLastRevision($text)->getContent();
     $parsed = $this->container->get('claroline.scorm.rich_text_exporter')->parse($textContent);
     $template = $this->container->get('templating')->render('ClarolineCoreBundle:Text:scorm-export.html.twig', ['text' => $parsed['text'], '_resource' => $text]);
     // Set export template
     $event->setTemplate($template);
     $event->setEmbedResources($parsed['resources']);
     $event->stopPropagation();
 }
 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;
 }
 /**
  * @DI\Observe("export_scorm_claroline_web_resource")
  *
  * @param ExportScormResourceEvent $event
  */
 public function onExportScorm(ExportScormResourceEvent $event)
 {
     $resource = $event->getResource();
     $hash = $resource->getHashName();
     $filename = 'file_' . $resource->getResourceNode()->getId();
     $template = $this->container->get('templating')->render('ClarolineWebResourceBundle:Scorm:export.html.twig', ['path' => $filename . '/' . $this->guessRootFileFromUnzipped($this->zipPath . $hash), '_resource' => $event->getResource()]);
     // Set export template
     $event->setTemplate($template);
     $event->addFile($filename, $this->zipPath . $hash, true);
     $event->stopPropagation();
 }
Esempio n. 7
0
 /**
  * @DI\Observe("export_scorm_file")
  *
  * @param ExportScormResourceEvent $event
  */
 public function onExportScorm(ExportScormResourceEvent $event)
 {
     $resource = $event->getResource();
     // Forward event to the correct player
     $this->container->get('event_dispatcher')->dispatch($this->generateEventName($resource->getResourceNode(), 'export_scorm_file_'), $event);
     if (!$event->isPopulated()) {
         // Event not caught, try the fallback event name
         $this->container->get('event_dispatcher')->dispatch($this->generateEventName($resource->getResourceNode(), 'export_scorm_file_', true), $event);
     }
     $event->stopPropagation();
 }