<select />
</component>
<component name="ChangeListManager">
- <list default="true" id="5d2ecd5e-a05a-4f96-a195-fa6372618165" name="Default Changelist" comment="wip #5041 @1">
+ <list default="true" id="5d2ecd5e-a05a-4f96-a195-fa6372618165" name="Default Changelist" comment="wip #5041 @0.25">
<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$/app/Http/Controllers/Admin/Operations/ELearningPackage/ImportOperation.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/Admin/Operations/ELearningPackage/ImportOperation.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/app/Http/Controllers/Admin/Operations/ELearningPackage/PreviewOperation.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/Admin/Operations/ELearningPackage/PreviewOperation.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/app/Jobs/ElearningPackageDownload.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Jobs/ElearningPackageDownload.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$/app/Models/Quiz.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Models/Quiz.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/resources/elearningpackage/js/app.js" beforeDir="false" afterPath="$PROJECT_DIR$/resources/elearningpackage/js/app.js" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<workItem from="1644394645639" duration="13635000" />
<workItem from="1644425348765" duration="2270000" />
<workItem from="1644508187200" duration="10853000" />
- <workItem from="1644582031422" duration="8408000" />
- </task>
- <task id="LOCAL-00195" summary="wip #4211 @1.5">
- <created>1636127812133</created>
- <option name="number" value="00195" />
- <option name="presentableId" value="LOCAL-00195" />
- <option name="project" value="LOCAL" />
- <updated>1636127812134</updated>
+ <workItem from="1644582031422" duration="8556000" />
+ <workItem from="1644828785862" duration="4855000" />
</task>
<task id="LOCAL-00196" summary="wip #4211 @0.5">
<created>1636131633680</created>
<option name="project" value="LOCAL" />
<updated>1644602356941</updated>
</task>
- <option name="localTasksCounter" value="244" />
+ <task id="LOCAL-00244" summary="wip #5041 @0.25">
+ <created>1644602746898</created>
+ <option name="number" value="00244" />
+ <option name="presentableId" value="LOCAL-00244" />
+ <option name="project" value="LOCAL" />
+ <updated>1644602746898</updated>
+ </task>
+ <option name="localTasksCounter" value="245" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
<option name="CHECK_NEW_TODO" value="false" />
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
- <MESSAGE value="wait #4891 @2" />
<MESSAGE value="wait #4928 @2" />
<MESSAGE value="wait #4928 @0.25" />
<MESSAGE value="wait #4891 @0.5" />
<MESSAGE value="wip #5041 @1.5" />
<MESSAGE value="wip #5041 @0.5" />
<MESSAGE value="wip #5041 @1" />
- <option name="LAST_COMMIT_MESSAGE" value="wip #5041 @1" />
+ <MESSAGE value="wip #5041 @0.25" />
+ <option name="LAST_COMMIT_MESSAGE" value="wip #5041 @0.25" />
</component>
<component name="XSLT-Support.FileAssociations.UIState">
<expand />
<?php
-namespace App\Http\Controllers\Admin\Operations\ELearningMedia;
+namespace App\Http\Controllers\Admin\Operations\ELearningPackage;
use App\Models\Asset;
use App\Models\ELearningMedia;
<?php
-namespace App\Http\Controllers\Admin\Operations\ELearningMedia;
+namespace App\Http\Controllers\Admin\Operations\ELearningPackage;
use Cubist\Util\Files\Files;
use Illuminate\Support\Facades\Route;
{
try {
$compilepath = $this->entry->getFinalPath();
- $this->entry->compile($compilepath);
+ $this->entry->compile($compilepath,$this->user);
$fname = $this->_fname();
$dest = Files::mkdir(storage_path('app/public/elearningpackage/download/')) . $fname;
namespace App\Models;
-use App\Http\Controllers\Admin\Operations\ELearningMedia\ImportOperation;
-use App\Http\Controllers\Admin\Operations\ELearningMedia\PreviewOperation;
-use App\Http\Controllers\Admin\Operations\ELearningMedia\DownloadOperation;
+use App\Http\Controllers\Admin\Operations\ELearningPackage\ImportOperation;
+use App\Http\Controllers\Admin\Operations\ELearningPackage\PreviewOperation;
+use App\Http\Controllers\Admin\Operations\ELearningPackage\DownloadOperation;
use App\Models\Base\ToolboxModel;
use App\Services\WorkshopV2;
use App\SubForms\ElearningPackageContent;
use Cubist\Util\Files\Files;
use Cubist\Util\Files\VirtualDirectory;
use Cubist\Util\Zip;
-use Spatie\MediaLibrary\MediaCollections\Models\Media;
class ELearningPackage extends ToolboxModel
{
return protected_path('elearningpackage/final/' . $this->id);
}
- public function compile($dest)
+ public function compile($dest, $user = null)
{
+ if (null === $user) {
+ $user = backpack_user();
+ }
$owner = User::withoutGlobalScopes()->findOrFail($this->owner);
$organization = $owner->companyName;
$modules = [];
foreach ($this->contents as $id => $content) {
- $m = $this->_compileModule($id, $content, $vdir);
+ $m = $this->_compileModule($id, $content, $vdir, $user);
if ($m !== false) {
$modules[] = $m;
}
* @param $id int
* @param $c array
* @param $vdir VirtualDirectory
+ * @param $user User
* @return array
*/
- protected function _compileModule($id, $c, $vdir)
+ protected function _compileModule($id, $c, $vdir, $user)
{
$basePath = 'packages/' . $id . '/';
switch ($res['type']) {
case 'FB':
- $moduleTitle = $this->_compileFluidbook($c['fb_id'], $vdir, $basePath);
+ $moduleTitle = $this->_compileFluidbook($c['fb_id'], $vdir, $basePath, $user);
break;
case 'QZ':
$moduleTitle = $this->_compileQuiz($c['quiz_id'], $vdir, $basePath);
* @param $basePath string
* @return string
*/
- protected function _compileFluidbook($id, $vdir, $basePath)
+ protected function _compileFluidbook($id, $vdir, $basePath, $user)
{
$tmp = Files::tmpdir();
$vdir->addTemp($tmp);
- $workshop = new WorkshopV2(backpack_user());
+ $workshop = new WorkshopV2($user);
$workshop->installBook($id, $tmp, [], 'scorm');
$vdir->copyDirectory($tmp, $basePath);
if (null === $quiz) {
return null;
}
- $quiz->compile($tmp);
+ $quiz->compile($tmp, true);
$vdir->copyDirectory($tmp, $basePath);
return $quiz->title;
/**
* @param $quiz self
*/
- public function compile($dest)
+ public function compile($dest, $forceScorm = false)
{
// Clean existing dir and recreate it
if (file_exists($dest)) {
file_put_contents($dest . '/data.js', 'var DATA=' . $json . ';');
- if ($this->getAttribute('scorm')) {
+ if ($forceScorm || $this->getAttribute('scorm')) {
$scorm_js = '<script src="js/libs/scorm/apiwrapper.js"></script>
<script src="js/scorm.js"></script>';
$title = htmlspecialchars($this->getAttribute('title'));
globalScoreItems++;
}
}
+
var score100 = globalScore / globalScoreItems;
if (isNaN(score100)) {
score100 = -1;
}
+ console.log(score100, completed, score);
if (score100 > 0) {
setScormValue('cmi.score.raw', score100);
setScormValue('cmi.score.scaled', score100 / 100);
var max = doubleQuestionMark(s.cmi['cmi.core.score.max'], s.cmi['cmi.score.max'], 100);
var min = doubleQuestionMark(s.cmi['cmi.core.score.min'], s.cmi['cmi.score.min'], 0);
- console.log(raw, max, min);
var scale = max - min;
var norm = raw - min;
if (isNaN(scale) || isNaN(norm)) {