<select />
</component>
<component name="ChangeListManager">
- <list default="true" id="5d2ecd5e-a05a-4f96-a195-fa6372618165" name="Default Changelist" comment="wip #5041 @1.5">
+ <list default="true" id="5d2ecd5e-a05a-4f96-a195-fa6372618165" name="Default Changelist" comment="wip #5041">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/resources/elearningmedia/js/app.js" beforeDir="false" afterPath="$PROJECT_DIR$/resources/elearningmedia/js/app.js" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/resources/elearningmedia/js/spectrum.js" beforeDir="false" afterPath="$PROJECT_DIR$/resources/elearningmedia/js/spectrum.js" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/app/Models/ELearningMedia.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Models/ELearningMedia.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/app/Models/ELearningPackage.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Models/ELearningPackage.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/resources/elearningpackage/js/app.js" beforeDir="false" afterPath="$PROJECT_DIR$/resources/elearningpackage/js/app.js" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/resources/views/elearningmedia/index.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/elearningmedia/index.blade.php" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<workItem from="1644343001625" duration="4220000" />
<workItem from="1644394645639" duration="13635000" />
<workItem from="1644425348765" duration="2270000" />
- <workItem from="1644508187200" duration="9909000" />
- </task>
- <task id="LOCAL-00190" summary="wip #4857 @1">
- <created>1635949750599</created>
- <option name="number" value="00190" />
- <option name="presentableId" value="LOCAL-00190" />
- <option name="project" value="LOCAL" />
- <updated>1635949750599</updated>
+ <workItem from="1644508187200" duration="10853000" />
+ <workItem from="1644582031422" duration="1260000" />
</task>
<task id="LOCAL-00191" summary="wip #3753 @2">
<created>1636044131486</created>
<option name="project" value="LOCAL" />
<updated>1644578113366</updated>
</task>
- <option name="localTasksCounter" value="239" />
+ <task id="LOCAL-00239" summary="wip #5041">
+ <created>1644578457525</created>
+ <option name="number" value="00239" />
+ <option name="presentableId" value="LOCAL-00239" />
+ <option name="project" value="LOCAL" />
+ <updated>1644578457525</updated>
+ </task>
+ <option name="localTasksCounter" value="240" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<MESSAGE value="wip #5045 @0.75" />
<MESSAGE value="wip #5045 @1.1" />
<MESSAGE value="wait #5045 @0.5" />
- <MESSAGE value="wip #5041" />
<MESSAGE value="wip #5041 @1" />
<MESSAGE value="wip #5041 @3" />
<MESSAGE value="wip #5041 @1.5" />
- <option name="LAST_COMMIT_MESSAGE" value="wip #5041 @1.5" />
+ <MESSAGE value="wip #5041" />
+ <option name="LAST_COMMIT_MESSAGE" value="wip #5041" />
</component>
<component name="XSLT-Support.FileAssociations.UIState">
<expand />
$owner = User::withoutGlobalScopes()->findOrFail($this->owner);
$organization = $owner->companyName;
+
+ /** @var Media $file */
+ $file = $this->getMediaInField('file')->first()->getPath();
+ self::compileFromFile($file, $dest, $this->title, $organization, 'MEDIA_' . $this->id, 75);
+ }
+
+ /**
+ * @param $file string
+ * @param $dest string
+ * @param $title string
+ * @param $organization string
+ * @param $reference string
+ * @param $complete_pct int
+ * @return string
+ * @throws \Exception
+ */
+ public static function compileFromFile($file, $dest, $title, $organization, $reference, $complete_pct = 75)
+ {
+ $spl = new \SplFileInfo($file);
+ $ext = mb_strtolower($spl->getExtension());
+ if (!$title) {
+ $title = $spl->getBasename('.' . $spl->getExtension());
+ }
$vdir = new VirtualDirectory($dest);
- $vdir->file_put_contents('imsmanifest.xml', new Manifest($this->title, Manifest::SCORM_2004, $organization, 'MEDIA_' . $this->id));
+ $vdir->file_put_contents('imsmanifest.xml', new Manifest($title, Manifest::SCORM_2004, $organization, $reference));
$vdir->copyDirectory(resource_path('elearningmedia/dist/css'), 'css');
$vdir->copyDirectory(resource_path('elearningmedia/dist/js'), 'js');
- /** @var Media $file */
- $file = $this->getMediaInField('file')->first();
- $spl = new \SplFileInfo($file->getPath());
- $ext = mb_strtolower($spl->getExtension());
- $vdir->copy($file->getPath(), 'media.' . $ext);
- $vdir->file_put_contents('index.html', view('elearningmedia.index', ['media' => $this->getPageData(), 'type' => $ext === 'mp3' ? 'audio' : 'video']));
+ $vdir->copy($file, 'media.' . $ext);
+ $vdir->file_put_contents('index.html', view('elearningmedia.index', ['complete_pct' => $complete_pct, 'title' => $title, 'type' => $ext === 'mp3' ? 'audio' : 'video']));
$vdir->sync(true);
+ return $title;
}
public function getIdTitleAttribute()
$modules[] = $this->_compileModule($id, $content, $vdir);
}
- $data = ['title' => $this->title, 'description' => $this->description, 'module' => $modules];
+ $data = ['title' => $this->title, 'description' => $this->description, 'modules' => $modules];
$vdir->file_put_contents('data.js', 'const DATA=' . json_encode($data) . ';');
$vdir->file_put_contents('imsmanifest.xml', new Manifest($this->title, Manifest::SCORM_2004, $organization, 'PACKAGE_' . $this->id));
return $quiz->title;
}
- protected function _compileMedia($c, $vdir, $basePath)
+ protected function _compileMedia($media_id, $media_file, $vdir, $basePath)
{
+ if ($media_id) {
+ return $this->_compileMediaFromElearningMedia($media_id, $vdir, $basePath);
+ }
+ $tmp = Files::tmpdir();
+ $vdir->addTemp($tmp);
+
+ $owner = User::withoutGlobalScopes()->findOrFail($this->owner);
+ $organization = $owner->companyName;
+
+ $file = $this->getMediaByCollection($media_file)->first()->getPath();
+ return ELearningMedia::compileFromFile($file, $tmp, '', $organization, 'MEDIA_' . $media_file);
+ }
+ protected function _compileMediaFromElearningMedia($id, $vdir, $basePath)
+ {
+ $tmp = Files::tmpdir();
+ $vdir->addTemp($tmp);
+
+ $media = ELearningMedia::find($id);
+ $media->compile($tmp);
+
+ $vdir->copyDirectory($tmp, $basePath);
+ return $media->title;
}
protected function _compilePDF($collection, $vdir, $basePath)
}
var vcheck = getSpriteIcon('check-ok');
var xcheck = getSpriteIcon('check-nok');
- var types = {IN: 'Infographic PDF', AN: 'Animation', VI: 'Video', FB: 'Fluidbook', PC: 'Podcast HTML', QZ: 'Quiz'};
+ var types = {
+ IN: 'Infographic PDF',
+ AN: 'Animation',
+ FC: 'Flipcards',
+ Ti5: 'Video',
+ VI: 'Video',
+ FB: 'Fluidbook',
+ PD: 'Podcast',
+ QZ: 'Quiz'
+ };
$('header h1').text(DATA.title);
$('header p').text(DATA.description);
$('title').text(DATA.title);
<head>
<meta charset="UTF-8">
<link href="css/app.css" rel="stylesheet">
- <title>{{$media->get('title')}}</title>
+ <title>{{$title}}</title>
</head>
<body>
@if($type==='audio')
<source src="media.mp4" type="video/mp4"/>
</video>
@endif
-<script>var progressComplete = {{$media->get('complete_pct')}};</script>
+<script>var progressComplete = {{$complete_pct}};</script>
<script src="js/app.js"></script>
</body>
</html>