Actualización
This commit is contained in:
@@ -0,0 +1,199 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Interfaces\ExtractorInterface;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Interfaces\LoaderInterface;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Interfaces\TransformerInterface;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Messages\ExtractMessage;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Messages\LoadMessage;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Messages\TransformMessage;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Traits\MapTrait\MapTrait;
|
||||
|
||||
/**
|
||||
* Class BaseTask.
|
||||
*/
|
||||
abstract class BaseTask
|
||||
{
|
||||
use MapTrait;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $taskId;
|
||||
/**
|
||||
* @var ExtractorInterface
|
||||
*/
|
||||
protected $extractor;
|
||||
/**
|
||||
* @var TransformerInterface
|
||||
*/
|
||||
protected $transformer;
|
||||
/**
|
||||
* @var LoaderInterface
|
||||
*/
|
||||
protected $loader;
|
||||
|
||||
/**
|
||||
* @var \MigrationMoodlePlugin
|
||||
*/
|
||||
protected $plugin;
|
||||
|
||||
/**
|
||||
* BaseTask constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->plugin = \MigrationMoodlePlugin::create();
|
||||
|
||||
$this->extractor = $this->getExtractor();
|
||||
|
||||
$this->transformer = $this->getTransformer();
|
||||
|
||||
$this->loader = $this->getLoader();
|
||||
|
||||
$this->calledClass = get_called_class();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
abstract public function getExtractConfiguration();
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
abstract public function getTransformConfiguration();
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
abstract public function getLoadConfiguration();
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$outputBuffering = isset($GLOBALS['outputBuffering']) ? $GLOBALS['outputBuffering'] : true;
|
||||
|
||||
$taskId = \Database::insert(
|
||||
'plugin_migrationmoodle_task',
|
||||
['name' => $this->getTaskName()]
|
||||
);
|
||||
|
||||
$i = 0;
|
||||
|
||||
foreach ($this->executeETL() as $hash => $ids) {
|
||||
\Database::insert(
|
||||
'plugin_migrationmoodle_item',
|
||||
[
|
||||
'hash' => $hash,
|
||||
'extracted_id' => (int) $ids['extracted'],
|
||||
'loaded_id' => (int) $ids['loaded'],
|
||||
'task_id' => $taskId,
|
||||
]
|
||||
);
|
||||
|
||||
echo "[".date(\DateTime::ATOM)."]\tData migrated: $hash".PHP_EOL;
|
||||
|
||||
$i++;
|
||||
|
||||
if ($i % 10 === 0 && $outputBuffering) {
|
||||
flush();
|
||||
ob_flush();
|
||||
}
|
||||
}
|
||||
|
||||
if ($outputBuffering) {
|
||||
ob_end_flush();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Generator
|
||||
*/
|
||||
private function executeETL()
|
||||
{
|
||||
foreach ($this->extractFiltered() as $extractedData) {
|
||||
try {
|
||||
$incomingData = $this->transformer->transform($extractedData);
|
||||
} catch (\Exception $exception) {
|
||||
new TransformMessage($extractedData, $exception);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
$loadedId = $this->loader->load($incomingData);
|
||||
} catch (\Exception $exception) {
|
||||
new LoadMessage($incomingData, $exception);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
yield md5("{$extractedData['id']}@@$loadedId") => [
|
||||
'extracted' => $extractedData['id'],
|
||||
'loaded' => $loadedId,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Generator
|
||||
*/
|
||||
private function extractFiltered()
|
||||
{
|
||||
try {
|
||||
foreach ($this->extractor->extract() as $extractedData) {
|
||||
if ($this->extractor->filter($extractedData)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
yield $extractedData;
|
||||
}
|
||||
} catch (\Exception $exception) {
|
||||
new ExtractMessage($exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ExtractorInterface
|
||||
*/
|
||||
private function getExtractor()
|
||||
{
|
||||
$configuration = $this->getExtractConfiguration();
|
||||
|
||||
$extractorClass = $configuration['class'];
|
||||
/** @var ExtractorInterface $extractor */
|
||||
$extractor = new $extractorClass($configuration);
|
||||
|
||||
return $extractor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TransformerInterface
|
||||
*/
|
||||
private function getTransformer()
|
||||
{
|
||||
$configuration = $this->getTransformConfiguration();
|
||||
|
||||
$transformerClass = $configuration['class'];
|
||||
/** @var TransformerInterface $extractor */
|
||||
$extractor = new $transformerClass($configuration);
|
||||
|
||||
return $extractor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return LoaderInterface
|
||||
*/
|
||||
private function getLoader()
|
||||
{
|
||||
$configuration = $this->getLoadConfiguration();
|
||||
|
||||
$loaderClass = $configuration['class'];
|
||||
/** @var LoaderInterface $extractor */
|
||||
$extractor = new $loaderClass($configuration);
|
||||
|
||||
return $extractor;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\BaseExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\CQuizLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\Percentage;
|
||||
|
||||
/**
|
||||
* Class CQuizTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class CQuizTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseExtractor::class,
|
||||
'query' => 'SELECT * FROM mdl_quiz',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'c_id' => [
|
||||
'class' => LoadedCourseLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
'exerciseTitle' => 'name',
|
||||
'exerciseDescription' => 'intro',
|
||||
//'exerciseFeedbackType',
|
||||
//'results_disabled',
|
||||
//'exerciseType',
|
||||
//'question_selection_type',
|
||||
//'randomQuestions' => 'shufflequestions',
|
||||
'randomAnswers' => 'shuffleanswers',
|
||||
//'display_category_name',
|
||||
//'hide_question_title',
|
||||
'exerciseAttempts' => 'attempts',
|
||||
//'activate_start_date_check',
|
||||
'start_time' => 'timeopen',
|
||||
//'activate_end_date_check',
|
||||
'end_time' => 'timeclose',
|
||||
//'enabletimercontrol',
|
||||
'enabletimercontroltotalminutes' => 'timelimit',
|
||||
'pass_percentage' => [
|
||||
'class' => Percentage::class,
|
||||
'properties' => ['sumgrades', 'grade'],
|
||||
],
|
||||
//'text_when_finished',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => CQuizLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\BaseExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\CourseCategoriesLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\CourseCategoryLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\CourseCode;
|
||||
|
||||
/**
|
||||
* Class CourseCategoriesTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class CourseCategoriesTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseExtractor::class,
|
||||
'query' => 'SELECT * FROM mdl_course_categories ORDER BY parent ASC, id ASC',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'name' => 'name',
|
||||
'code' => [
|
||||
'class' => CourseCode::class,
|
||||
'properties' => ['name'],
|
||||
],
|
||||
'description' => 'description',
|
||||
'parent_id' => [
|
||||
'class' => CourseCategoryLookup::class,
|
||||
'properties' => ['parent'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => CourseCategoriesLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\CourseFilesLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseLookup;
|
||||
|
||||
/**
|
||||
* Class CourseFilesTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
abstract class CourseFilesTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'contenthash' => 'contenthash',
|
||||
'filepath' => 'filepath',
|
||||
'filename' => 'filename',
|
||||
'filesize' => 'filesize',
|
||||
'mimetype' => 'mimetype',
|
||||
'course' => [
|
||||
'class' => LoadedCourseLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => CourseFilesLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\CourseIntroductionLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\ReplaceFilePaths;
|
||||
|
||||
/**
|
||||
* Class CourseIntroductionsTask.
|
||||
*
|
||||
* Migrate the first section (section 0) from a moodle course as introduction for a chamilo course.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class CourseIntroductionsTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => "SELECT id, course, name, summary
|
||||
FROM mdl_course_sections
|
||||
WHERE section = 0 AND (summary != '' AND summary IS NOT NULL)",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'c_id' => [
|
||||
'class' => LoadedCourseLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
'name' => 'name',
|
||||
'description' => [
|
||||
'class' => ReplaceFilePaths::class,
|
||||
'properties' => ['summary', 'course'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => CourseIntroductionLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\CourseModulesLessonLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseCodeLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseSectionLookup;
|
||||
|
||||
/**
|
||||
* Class CourseModulesLessonTask.
|
||||
*
|
||||
* Task for convert a Moodle course module in a Chamilo learning path section.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class CourseModulesLessonTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => "SELECT cm.id, l.course, l.name, cm.section
|
||||
FROM mdl_lesson l
|
||||
INNER JOIN mdl_course_modules cm ON (l.course = cm.course AND cm.instance = l.id)
|
||||
INNER JOIN mdl_modules m ON cm.module = m.id
|
||||
INNER JOIN mdl_course_sections cs ON (cm.course = cs.course AND cm.section = cs.id )
|
||||
WHERE m.name = 'lesson'
|
||||
ORDER BY cs.id, FIND_IN_SET(cm.id, cs.sequence)",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'c_code' => [
|
||||
'class' => LoadedCourseCodeLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
'lp_id' => [
|
||||
'class' => LoadedCourseSectionLookup::class,
|
||||
'properties' => ['section'],
|
||||
],
|
||||
'title' => 'name',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => CourseModulesLessonLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\CourseModulesQuizLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseCodeLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseSectionLookup;
|
||||
|
||||
/**
|
||||
* Class CourseModulesQuizTask.
|
||||
*
|
||||
* Task for convert a Moodle quiz inside a page section in a quiz item of Chamilo learning path.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class CourseModulesQuizTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => "SELECT cm.id, q.course, q.name, cm.section
|
||||
FROM mdl_quiz q
|
||||
INNER JOIN mdl_course_modules cm ON (q.course = cm.course AND cm.instance = q.id)
|
||||
INNER JOIN mdl_modules m ON cm.module = m.id
|
||||
INNER JOIN mdl_course_sections cs ON (cm.course = cs.course AND cm.section = cs.id )
|
||||
WHERE m.name = 'quiz'
|
||||
ORDER BY cs.id, FIND_IN_SET(cm.id, cs.sequence)",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'c_code' => [
|
||||
'class' => LoadedCourseCodeLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
'lp_id' => [
|
||||
'class' => LoadedCourseSectionLookup::class,
|
||||
'properties' => ['section'],
|
||||
],
|
||||
'title' => 'name',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => CourseModulesQuizLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\CourseModulesScormLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\DateTimeObject;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseLookup;
|
||||
|
||||
/**
|
||||
* Class CourseModulesScormTask.
|
||||
*
|
||||
* Task to convert Moodle scorm in Chamilo scorm.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class CourseModulesScormTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => "SELECT
|
||||
sco.id,
|
||||
sco.course,
|
||||
sco.name,
|
||||
sco.reference,
|
||||
sco.version,
|
||||
sco.maxgrade,
|
||||
sco.hidetoc,
|
||||
i.identifier,
|
||||
cm.added,
|
||||
sco.timemodified
|
||||
FROM mdl_scorm sco
|
||||
INNER JOIN mdl_scorm_scoes i on sco.id = i.scorm
|
||||
INNER JOIN mdl_course_modules cm ON (sco.course = cm.course AND cm.instance = sco.id)
|
||||
INNER JOIN mdl_modules m ON cm.module = m.id
|
||||
INNER JOIN mdl_course_sections cs ON (cm.course = cs.course AND cm.section = cs.id )
|
||||
WHERE m.name = 'scorm'
|
||||
AND i.parent = '/'
|
||||
ORDER BY cs.id, FIND_IN_SET(cm.id, cs.sequence)",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'c_id' => [
|
||||
'class' => LoadedCourseLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
'name' => 'name',
|
||||
'ref' => 'identifier',
|
||||
'path' => 'reference',
|
||||
'use_max_score' => 'maxgrade',
|
||||
'hide_toc_frame' => 'hidetoc',
|
||||
'created_on' => [
|
||||
'class' => DateTimeObject::class,
|
||||
'properties' => ['added'],
|
||||
],
|
||||
'modified_on' => [
|
||||
'class' => DateTimeObject::class,
|
||||
'properties' => ['timemodified'],
|
||||
],
|
||||
'publicated_on' => [
|
||||
'class' => DateTimeObject::class,
|
||||
'properties' => ['added'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => CourseModulesScormLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\CourseModulesUrlLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseCodeLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseSectionLookup;
|
||||
|
||||
/**
|
||||
* Class CourseModulesUrlTask.
|
||||
*
|
||||
* Task to create a Chamilo Link from a Moodle URL module.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class CourseModulesUrlTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => "SELECT cm.id, u.course, u.name, cm.section
|
||||
FROM mdl_url u
|
||||
INNER JOIN mdl_course_modules cm ON (u.course = cm.course AND cm.instance = u.id)
|
||||
INNER JOIN mdl_modules m ON cm.module = m.id
|
||||
INNER JOIN mdl_course_sections cs ON (cm.course = cs.course AND cm.section = cs.id )
|
||||
WHERE m.name = 'url'
|
||||
AND u.course NOT IN (
|
||||
SELECT sco.course
|
||||
FROM mdl_scorm sco
|
||||
INNER JOIN mdl_course_modules cm ON (sco.course = cm.course AND cm.instance = sco.id)
|
||||
INNER JOIN mdl_modules m ON cm.module = m.id
|
||||
INNER JOIN mdl_course_sections cs ON (cm.course = cs.course AND cm.section = cs.id )
|
||||
WHERE m.name = 'scorm'
|
||||
)",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'c_code' => [
|
||||
'class' => LoadedCourseCodeLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
'lp_id' => [
|
||||
'class' => LoadedCourseSectionLookup::class,
|
||||
'properties' => ['section'],
|
||||
],
|
||||
'title' => 'name',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => CourseModulesUrlLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\CourseSectionsLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseCodeLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\WrapHtmlReplacingFilePaths;
|
||||
|
||||
/**
|
||||
* Class CourseSectionsTask.
|
||||
*
|
||||
* Task to convert Moodle course sections in a Chamilo learning paths.
|
||||
* The section summary will be the first item in the learning path.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class CourseSectionsTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => "SELECT id, course, name, summary
|
||||
FROM mdl_course_sections
|
||||
WHERE section > 0 AND (name != '' OR name IS NOT NULL)
|
||||
AND course NOT IN (
|
||||
SELECT sco.course
|
||||
FROM mdl_scorm sco
|
||||
INNER JOIN mdl_course_modules cm ON (sco.course = cm.course AND cm.instance = sco.id)
|
||||
INNER JOIN mdl_modules m ON cm.module = m.id
|
||||
INNER JOIN mdl_course_sections cs ON (cm.course = cs.course AND cm.section = cs.id )
|
||||
WHERE m.name = 'scorm'
|
||||
)
|
||||
ORDER BY course, section",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'course_code' => [
|
||||
'class' => LoadedCourseCodeLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
'name' => 'name',
|
||||
'description' => [
|
||||
'class' => WrapHtmlReplacingFilePaths::class,
|
||||
'properties' => ['summary', 'course'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => CourseSectionsLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\BaseExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\CoursesLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\CourseCategoryLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\CourseVisibility;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\DateTimeObject;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\Language;
|
||||
|
||||
/**
|
||||
* Class CoursesTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class CoursesTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
$query = "SELECT * FROM mdl_course";
|
||||
|
||||
$userFilter = $this->plugin->getUserFilterSetting();
|
||||
|
||||
if (!empty($userFilter)) {
|
||||
$query = "SELECT DISTINCT c.*
|
||||
FROM mdl_course c
|
||||
INNER JOIN mdl_context ctx ON c.id = ctx.instanceid
|
||||
INNER JOIN mdl_role_assignments ra ON ctx.id = ra.contextid
|
||||
INNER JOIN mdl_user u ON ra.userid = u.id
|
||||
WHERE u.username LIKE '$userFilter%'";
|
||||
}
|
||||
|
||||
return [
|
||||
'class' => BaseExtractor::class,
|
||||
'query' => $query,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'title' => 'fullname',
|
||||
'wanted_code' => 'shortname',
|
||||
'course_category' => [
|
||||
'class' => CourseCategoryLookup::class,
|
||||
'properties' => ['category'],
|
||||
],
|
||||
'course_language' => [
|
||||
'class' => Language::class,
|
||||
'properties' => ['lang'],
|
||||
],
|
||||
'visibility' => [
|
||||
'class' => CourseVisibility::class,
|
||||
'properties' => ['visible'],
|
||||
],
|
||||
'description' => 'summary',
|
||||
'creation_date' => [
|
||||
'class' => DateTimeObject::class,
|
||||
'properties' => ['timecreated'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => CoursesLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
|
||||
/**
|
||||
* Class FilesForCourseIntroductionsTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class FilesForCourseIntroductionsTask extends CourseFilesTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => "SELECT
|
||||
f.id,
|
||||
f.contenthash,
|
||||
f.filepath,
|
||||
f.filename,
|
||||
f.filesize,
|
||||
f.mimetype,
|
||||
c.id course
|
||||
FROM mdl_files f
|
||||
INNER JOIN mdl_context ctx ON f.contextid = ctx.id
|
||||
INNER JOIN mdl_course c ON ctx.instanceid = c.id
|
||||
INNER JOIN mdl_course_sections cs ON (cs.course = c.id AND cs.id = f.itemid)
|
||||
WHERE f.component = 'course'
|
||||
AND f.filearea = 'section'
|
||||
AND ctx.contextlevel = 50
|
||||
AND f.filename NOT IN ('.', '..')
|
||||
AND cs.section = 0 AND (cs.summary != '' AND cs.summary IS NOT NULL)",
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
|
||||
/**
|
||||
* Class FilesForCourseSectionsTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class FilesForCourseSectionsTask extends CourseFilesTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => "SELECT
|
||||
f.id,
|
||||
f.contenthash,
|
||||
f.filepath,
|
||||
f.filename,
|
||||
f.filesize,
|
||||
f.mimetype,
|
||||
c.id course
|
||||
FROM mdl_files f
|
||||
INNER JOIN mdl_context ctx ON f.contextid = ctx.id
|
||||
INNER JOIN mdl_course c ON ctx.instanceid = c.id
|
||||
INNER JOIN mdl_course_sections cs ON (cs.course = c.id AND cs.id = f.itemid)
|
||||
WHERE f.component = 'course'
|
||||
AND f.filearea = 'section'
|
||||
AND ctx.contextlevel = 50
|
||||
AND f.filename NOT IN ('.', '..')
|
||||
AND cs.section > 0
|
||||
AND c.id NOT IN (
|
||||
SELECT sco.course
|
||||
FROM mdl_scorm sco
|
||||
INNER JOIN mdl_course_modules cm ON (sco.course = cm.course AND cm.instance = sco.id)
|
||||
INNER JOIN mdl_modules m ON cm.module = m.id
|
||||
INNER JOIN mdl_course_sections cs ON (cm.course = cs.course AND cm.section = cs.id )
|
||||
WHERE m.name = 'scorm'
|
||||
)",
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
|
||||
/**
|
||||
* Class FilesForLessonAnswersTask.
|
||||
*
|
||||
* Task for migrate the files for Moodle lesson answers in the files for Chamilo course documents.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class FilesForLessonAnswersTask extends CourseFilesTask
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => "SELECT
|
||||
f.id,
|
||||
f.contenthash,
|
||||
f.filepath,
|
||||
f.filename,
|
||||
f.filesize,
|
||||
f.mimetype,
|
||||
cm.course
|
||||
FROM mdl_files f
|
||||
INNER JOIN mdl_context c ON f.contextid = c.id
|
||||
INNER JOIN mdl_course_modules cm ON c.instanceid = cm.id
|
||||
WHERE f.component = 'mod_lesson'
|
||||
AND f.filearea = 'page_answers'
|
||||
AND c.contextlevel = 70
|
||||
AND f.filename NOT IN ('.', '..')",
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
|
||||
/**
|
||||
* Class FilesForLessonPagesTask.
|
||||
*
|
||||
* Task for migrate the files for Moodle lesson pages in the files for Chamilo course documents.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class FilesForLessonPagesTask extends CourseFilesTask
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => "SELECT
|
||||
f.id,
|
||||
f.contenthash,
|
||||
f.filepath,
|
||||
f.filename,
|
||||
f.filesize,
|
||||
f.mimetype,
|
||||
cm.course
|
||||
FROM mdl_files f
|
||||
INNER JOIN mdl_context c ON f.contextid = c.id
|
||||
INNER JOIN mdl_course_modules cm ON c.instanceid = cm.id
|
||||
WHERE f.component = 'mod_lesson'
|
||||
AND f.filearea = 'page_contents'
|
||||
AND c.contextlevel = 70
|
||||
AND f.filename NOT IN ('.', '..')",
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
|
||||
/**
|
||||
* Class FilesForQuizzesTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class FilesForQuizzesTask extends CourseFilesTask
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => "SELECT
|
||||
f.id,
|
||||
f.contenthash,
|
||||
f.filepath,
|
||||
f.filename,
|
||||
f.filesize,
|
||||
f.mimetype,
|
||||
cm.course
|
||||
FROM mdl_files f
|
||||
INNER JOIN mdl_context c ON f.contextid = c.id
|
||||
INNER JOIN mdl_course_modules cm ON c.instanceid = cm.id
|
||||
WHERE f.component = 'mod_quiz'
|
||||
AND f.filearea = 'intro'
|
||||
AND c.contextlevel = 70
|
||||
AND f.filename NOT IN ('.', '..')",
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\FilesForScormScoLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseLookup;
|
||||
|
||||
/**
|
||||
* Class FilesForScormScoesTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class FilesForScormScoesTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => "SELECT
|
||||
f.id,
|
||||
f.contenthash,
|
||||
f.filepath,
|
||||
f.filename,
|
||||
f.mimetype,
|
||||
s.name scorm_name,
|
||||
cm.course
|
||||
FROM mdl_files f
|
||||
INNER JOIN mdl_context ctx ON f.contextid = ctx.id
|
||||
INNER JOIN mdl_course_modules cm ON ctx.instanceid = cm.id
|
||||
INNER JOIN mdl_modules m ON cm.module = m.id
|
||||
INNER JOIN mdl_scorm s ON (cm.course = s.course AND cm.instance = s.id)
|
||||
WHERE
|
||||
m.name = 'scorm'
|
||||
AND ctx.contextlevel = 70
|
||||
AND f.filename NOT IN ('.', '..')
|
||||
AND s.reference != f.filename
|
||||
AND f.filearea = 'content'
|
||||
AND f.component = 'mod_scorm'
|
||||
ORDER BY s.course, s.id",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'contenthash' => 'contenthash',
|
||||
'filepath' => 'filepath',
|
||||
'filename' => 'filename',
|
||||
'mimetype' => 'mimetype',
|
||||
'c_id' => [
|
||||
'class' => LoadedCourseLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
'lp_name' => 'scorm_name',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => FilesForScormScoLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\LessonAnswersEssayLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedLessonPageQuizLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedLessonPageQuizQuestionLookup;
|
||||
|
||||
/**
|
||||
* Class LessonAnswersEssayTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class LessonAnswersEssayTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => 'SELECT la.id, la.pageid, la.score, l.course
|
||||
FROM mdl_lesson_answers la
|
||||
INNER JOIN mdl_lesson_pages lp ON (la.pageid = lp.id AND la.lessonid = lp.lessonid)
|
||||
INNER JOIN mdl_lesson l ON (lp.lessonid = l.id AND la.lessonid = l.id)
|
||||
WHERE lp.qtype = 10
|
||||
ORDER BY lp.id',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'c_id' => [
|
||||
'class' => LoadedCourseLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
'quiz_id' => [
|
||||
'class' => LoadedLessonPageQuizLookup::class,
|
||||
'properties' => ['pageid'],
|
||||
],
|
||||
'question_id' => [
|
||||
'class' => LoadedLessonPageQuizQuestionLookup::class,
|
||||
'properties' => ['pageid'],
|
||||
],
|
||||
'score' => 'score',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LessonAnswersEssayLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\LessonAnswersMatchingLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LessonAnswersMatchingScore;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedLessonPageQuizLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedLessonPageQuizQuestionLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\ReplaceFilePaths;
|
||||
|
||||
/**
|
||||
* Class LessonAnswersMatchingTask.
|
||||
*
|
||||
* Task to convert Matching answers from a lesson page in quiz answers for chamilo.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class LessonAnswersMatchingTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => "SELECT la.id, la.pageid, la.answer, la.response, la.lessonid, l.course
|
||||
FROM mdl_lesson_answers la
|
||||
INNER JOIN mdl_lesson_pages lp ON (la.pageid = lp.id AND la.lessonid = lp.lessonid)
|
||||
INNER JOIN mdl_lesson l ON (lp.lessonid = l.id AND la.lessonid = l.id)
|
||||
WHERE lp.qtype = 5
|
||||
AND (la.response IS NOT NULL OR la.response != '')
|
||||
ORDER BY lp.id",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'c_id' => [
|
||||
'class' => LoadedCourseLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
'quiz_id' => [
|
||||
'class' => LoadedLessonPageQuizLookup::class,
|
||||
'properties' => ['pageid'],
|
||||
],
|
||||
'question_id' => [
|
||||
'class' => LoadedLessonPageQuizQuestionLookup::class,
|
||||
'properties' => ['pageid'],
|
||||
],
|
||||
'score' => [
|
||||
'class' => LessonAnswersMatchingScore::class,
|
||||
'properties' => ['pageid', 'lessonid', 'course'],
|
||||
],
|
||||
'answer' => [
|
||||
'class' => ReplaceFilePaths::class,
|
||||
'properties' => ['answer', 'course'],
|
||||
],
|
||||
'feedback' => 'response',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LessonAnswersMatchingLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\LessonAnswersMultipleAnswerLoader;
|
||||
|
||||
/**
|
||||
* Class LessonAnswersMultipleAnswerTask.
|
||||
*
|
||||
* Task to convert Multiple Choice answers from a Moodle lesson page in answers for Unique Answer question for Chamilo.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class LessonAnswersMultipleAnswerTask extends LessonAnswersMultipleChoiceTask
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => 'SELECT la.id, la.pageid, la.score, la.answer, la.response, l.course
|
||||
FROM mdl_lesson_answers la
|
||||
INNER JOIN mdl_lesson_pages lp ON (la.pageid = lp.id AND la.lessonid = lp.lessonid)
|
||||
INNER JOIN mdl_lesson l ON (lp.lessonid = l.id AND la.lessonid = l.id)
|
||||
WHERE lp.qtype = 3 AND lp.qoption = 1
|
||||
ORDER BY lp.id',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LessonAnswersMultipleAnswerLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\LessonAnswersMultipleChoiceLoader;
|
||||
|
||||
/**
|
||||
* Class LessonAnswersMultipleChoiceTask.
|
||||
*
|
||||
* Task to convert Multiple Choice answers from a Moodle lesson page in answers for Unique Answer question for Chamilo.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class LessonAnswersMultipleChoiceTask extends LessonAnswersTrueFalseTask
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => 'SELECT la.id, la.pageid, la.score, la.answer, la.response, l.course
|
||||
FROM mdl_lesson_answers la
|
||||
INNER JOIN mdl_lesson_pages lp ON (la.pageid = lp.id AND la.lessonid = lp.lessonid)
|
||||
INNER JOIN mdl_lesson l ON (lp.lessonid = l.id AND la.lessonid = l.id)
|
||||
WHERE lp.qtype = 3 AND lp.qoption = 0
|
||||
ORDER BY lp.id',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LessonAnswersMultipleChoiceLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\LessonAnswersShortAnswerLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedLessonPageQuizLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedLessonPageQuizQuestionLookup;
|
||||
|
||||
/**
|
||||
* Class LessonAnswersShortAnswerTask.
|
||||
*
|
||||
* Task to convert Short Answers and Numerical answers from a lesson page in quiz answers for chamilo.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class LessonAnswersShortAnswerTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => "SELECT
|
||||
la.id,
|
||||
la.pageid,
|
||||
GROUP_CONCAT(la.answer SEPARATOR '||') answers,
|
||||
GROUP_CONCAT(la.response SEPARATOR '') comment,
|
||||
MAX(la.score) scores,
|
||||
l.course,
|
||||
COUNT(la.pageid) nb
|
||||
FROM mdl_lesson_answers la
|
||||
INNER JOIN mdl_lesson_pages lp ON (la.pageid = lp.id AND la.lessonid = lp.lessonid)
|
||||
INNER JOIN mdl_lesson l ON (lp.lessonid = l.id AND la.lessonid = l.id)
|
||||
WHERE lp.qtype IN (1, 8)
|
||||
GROUP BY lp.id
|
||||
ORDER BY lp.id",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'c_id' => [
|
||||
'class' => LoadedCourseLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
'quiz_id' => [
|
||||
'class' => LoadedLessonPageQuizLookup::class,
|
||||
'properties' => ['pageid'],
|
||||
],
|
||||
'question_id' => [
|
||||
'class' => LoadedLessonPageQuizQuestionLookup::class,
|
||||
'properties' => ['pageid'],
|
||||
],
|
||||
'scores' => 'scores',
|
||||
'answers' => 'answers',
|
||||
'comment' => 'comment',
|
||||
'nb' => 'nb',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LessonAnswersShortAnswerLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\LessonAnswersTrueFalseLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedLessonPageQuizLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedLessonPageQuizQuestionLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\ReplaceFilePaths;
|
||||
|
||||
/**
|
||||
* Class LessonAnswersTrueFalseTask.
|
||||
*
|
||||
* Task to convert True/False answers from a lesson page in quiz answers for chamilo.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class LessonAnswersTrueFalseTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => 'SELECT la.id, la.pageid, la.score, la.answer, la.response, l.course,
|
||||
(
|
||||
SELECT MIN(id) = la.id
|
||||
FROM mdl_lesson_answers
|
||||
WHERE pageid = la.pageid
|
||||
GROUP BY lessonid, pageid
|
||||
) is_correct
|
||||
FROM mdl_lesson_answers la
|
||||
INNER JOIN mdl_lesson_pages lp ON (la.pageid = lp.id AND la.lessonid = lp.lessonid)
|
||||
INNER JOIN mdl_lesson l ON (lp.lessonid = l.id AND la.lessonid = l.id)
|
||||
WHERE lp.qtype = 2
|
||||
ORDER BY lp.id',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'c_id' => [
|
||||
'class' => LoadedCourseLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
'quiz_id' => [
|
||||
'class' => LoadedLessonPageQuizLookup::class,
|
||||
'properties' => ['pageid'],
|
||||
],
|
||||
'question_id' => [
|
||||
'class' => LoadedLessonPageQuizQuestionLookup::class,
|
||||
'properties' => ['pageid'],
|
||||
],
|
||||
'score' => 'score',
|
||||
'answer' => [
|
||||
'class' => ReplaceFilePaths::class,
|
||||
'properties' => ['answer', 'course'],
|
||||
],
|
||||
'feedback' => 'response',
|
||||
'is_correct' => 'is_correct',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LessonAnswersTrueFalseLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\LessonPagesDocumentLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseSectionFromLessonLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedLessonPageLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\WrapHtmlReplacingFilePaths;
|
||||
|
||||
/**
|
||||
* Class LessonPagesDocumentTask.
|
||||
*
|
||||
* Task for convert the Moodle lesson pages in Chamilo course documents.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class LessonPagesDocumentTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => 'SELECT lp.id, l.id lessonid, l.course, lp.title, lp.contents
|
||||
FROM mdl_lesson_pages lp
|
||||
INNER JOIN mdl_lesson l ON lp.lessonid = l.id
|
||||
WHERE lp.qtype = 20',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'c_id' => [
|
||||
'class' => LoadedCourseLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
'lp_id' => [
|
||||
'class' => LoadedCourseSectionFromLessonLookup::class,
|
||||
'properties' => ['lessonid'],
|
||||
],
|
||||
'item_id' => [
|
||||
'class' => LoadedLessonPageLookup::class,
|
||||
'properties' => ['id'],
|
||||
],
|
||||
'item_title' => 'title',
|
||||
'item_content' => [
|
||||
'class' => WrapHtmlReplacingFilePaths::class,
|
||||
'properties' => ['contents', 'course'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LessonPagesDocumentLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\LessonQuestionPagesQuestionLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedLessonPageQuizLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\QuizQuestionTypeFromLessonPage;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\ReplaceFilePaths;
|
||||
|
||||
/**
|
||||
* Class LessonPagesQuizQuestionTask.
|
||||
*
|
||||
* Task to convert the question pages from a moodle lesson in one chamilo question to be added in quiz already creadted.
|
||||
*
|
||||
* The types question pages are:
|
||||
* 1, short answer; 2, true-false; 3, multiple choice or multiple answer; 5, matching; 8, numerical; 10, essay.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class LessonPagesQuizQuestionTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => 'SELECT lp.id, l.course, lp.contents, lp.qoption, lp.qtype
|
||||
FROM mdl_lesson_pages lp
|
||||
INNER JOIN mdl_lesson l ON lp.lessonid = l.id
|
||||
WHERE lp.qtype IN (1, 2, 3, 5, 8, 10)',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'c_id' => [
|
||||
'class' => LoadedCourseLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
'quiz_id' => [
|
||||
'class' => LoadedLessonPageQuizLookup::class,
|
||||
'properties' => ['id'],
|
||||
],
|
||||
'question_title' => [
|
||||
'class' => ReplaceFilePaths::class,
|
||||
'properties' => ['contents', 'course'],
|
||||
],
|
||||
'question_type' => [
|
||||
'class' => QuizQuestionTypeFromLessonPage::class,
|
||||
'properties' => ['qtype', 'qoption'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LessonQuestionPagesQuestionLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\LessonQuestionPagesQuizLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedLessonPageLookup;
|
||||
|
||||
/**
|
||||
* Class LessonPagesQuizTask.
|
||||
*
|
||||
* Task to convert the question pages from a moodle lesson in one chamilo quiz with one question.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class LessonPagesQuizTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => 'SELECT lp.id, l.course, lp.title
|
||||
FROM mdl_lesson_pages lp
|
||||
INNER JOIN mdl_lesson l ON lp.lessonid = l.id
|
||||
WHERE lp.qtype IN (1, 2, 3, 5, 8, 10)',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'c_id' => [
|
||||
'class' => LoadedCourseLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
'item_id' => [
|
||||
'class' => LoadedLessonPageLookup::class,
|
||||
'properties' => ['id'],
|
||||
],
|
||||
'item_title' => 'title',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LessonQuestionPagesQuizLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\LessonPagesLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LessonPageType;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseCodeLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseModuleLessonLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseSectionFromLessonLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedLessonPageLookup;
|
||||
|
||||
/**
|
||||
* Class LessonPagesTask.
|
||||
*
|
||||
* Task to conver the Moodle lesson pages in items for Chamilo learning paths.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class LessonPagesTask extends BaseTask
|
||||
{
|
||||
public const TYPE_END_BRANCH = 21;
|
||||
public const TYPE_CLUSTER = 30;
|
||||
public const TYPE_END_CLUSTER = 31;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => "WITH RECURSIVE lesson_pages_ordered (id, title, qtype, prev, next, lesson, display_order) AS
|
||||
(
|
||||
SELECT id, title, qtype, prevpageid, nextpageid, lessonid, '01'
|
||||
FROM mdl_lesson_pages
|
||||
WHERE prevpageid = 0
|
||||
UNION
|
||||
SELECT lp.id, lp.title, lp.qtype, lp.prevpageid, lp.nextpageid, lp.lessonid, lpo.display_order + 1
|
||||
FROM lesson_pages_ordered lpo
|
||||
LEFT JOIN mdl_lesson_pages lp
|
||||
ON (lpo.next = lp.id AND lpo.lesson = lp.lessonid)
|
||||
)
|
||||
SELECT
|
||||
lpo.id,
|
||||
lpo.title,
|
||||
lpo.qtype,
|
||||
lpo.prev,
|
||||
lpo.lesson,
|
||||
CAST(lpo.display_order AS SIGNED) lpo_display_order,
|
||||
l.course
|
||||
FROM lesson_pages_ordered lpo
|
||||
INNER JOIN mdl_lesson l ON lpo.lesson = l.id
|
||||
WHERE lpo.qtype NOT IN (".self::TYPE_END_BRANCH.", ".self::TYPE_CLUSTER.", ".self::TYPE_END_CLUSTER.")
|
||||
ORDER BY l.course, lpo.lesson, lpo_display_order",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'c_code' => [
|
||||
'class' => LoadedCourseCodeLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
'lp_id' => [
|
||||
'class' => LoadedCourseSectionFromLessonLookup::class,
|
||||
'properties' => ['lesson'],
|
||||
],
|
||||
'parent' => [
|
||||
'class' => LoadedCourseModuleLessonLookup::class,
|
||||
'properties' => ['lesson'],
|
||||
],
|
||||
'previous' => [
|
||||
'class' => LoadedLessonPageLookup::class,
|
||||
'properties' => ['prev'],
|
||||
],
|
||||
'item_type' => [
|
||||
'class' => LessonPageType::class,
|
||||
'properties' => ['qtype'],
|
||||
],
|
||||
'title' => 'title',
|
||||
'display_order' => 'lpo_display_order',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LessonPagesLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\BaseExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\QuestionCategoriesLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseFromQuestionCategoryLookup;
|
||||
|
||||
/**
|
||||
* Class QuestionCategoriesTask.
|
||||
*
|
||||
* Task for create categories for Chamilo quiz questions coming from a Moodle questions categories.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class QuestionCategoriesTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseExtractor::class,
|
||||
'query' => "SELECT qc.id, qc.name, qc.info, c.contextlevel, c.instanceid
|
||||
FROM mdl_question_categories qc
|
||||
INNER JOIN mdl_context c ON qc.contextid = c.id
|
||||
WHERE c.contextlevel IN (50, 70)
|
||||
AND qc.parent != 0",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'c_id' => [
|
||||
'class' => LoadedCourseFromQuestionCategoryLookup::class,
|
||||
'properties' => ['contextlevel', 'instanceid'],
|
||||
],
|
||||
'name' => 'name',
|
||||
'description' => 'info',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => QuestionCategoriesLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\QuestionGapselectLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedQuestionLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedQuizLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\QuestionGapselectAnswer;
|
||||
|
||||
/**
|
||||
* Class QuestionGapselectTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class QuestionGapselectTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => "SELECT
|
||||
qa.id,
|
||||
qq.id,
|
||||
qa.question,
|
||||
GROUP_CONCAT(
|
||||
CONCAT(qa.feedback, '==>>', qa.answer) ORDER BY qa.id ASC SEPARATOR '@||@'
|
||||
) answers,
|
||||
qq.questiontext,
|
||||
qs.maxmark,
|
||||
qg.correctfeedback,
|
||||
q.id quiz_id,
|
||||
q.course
|
||||
FROM mdl_question_answers qa
|
||||
INNER JOIN mdl_question qq ON qa.question = qq.id
|
||||
INNER JOIN mdl_question_gapselect qg ON qq.id = qg.questionid
|
||||
INNER JOIN mdl_quiz_slots qs ON qq.id = qs.questionid
|
||||
INNER JOIN mdl_quiz q ON qs.quizid = q.id
|
||||
WHERE qq.qtype = 'gapselect'
|
||||
GROUP BY q.id, qq.id
|
||||
ORDER BY q.id, qq.id",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'c_id' => [
|
||||
'class' => LoadedCourseLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
'quiz_id' => [
|
||||
'class' => LoadedQuizLookup::class,
|
||||
'properties' => ['quiz_id'],
|
||||
],
|
||||
'question_id' => [
|
||||
'class' => LoadedQuestionLookup::class,
|
||||
'properties' => ['question'],
|
||||
],
|
||||
'answer' => [
|
||||
'class' => QuestionGapselectAnswer::class,
|
||||
'properties' => ['answers', 'questiontext', 'maxmark'],
|
||||
],
|
||||
'score' => 'maxmark',
|
||||
'comment' => 'correctfeedback',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => QuestionGapselectLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\LessonAnswersMultipleAnswerLoader;
|
||||
|
||||
/**
|
||||
* Class QuestionMultiChoiceMultipleTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class QuestionMultiChoiceMultipleTask extends QuestionMultiChoiceSingleTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => "SELECT
|
||||
qa.id,
|
||||
qa.question,
|
||||
qa.answer,
|
||||
qa.feedback,
|
||||
(qa.fraction * qq.defaultmark) score,
|
||||
IF (qa.fraction > 0, TRUE, FALSE) is_correct,
|
||||
q.id quizid,
|
||||
q.course
|
||||
FROM mdl_question_answers qa
|
||||
INNER JOIN mdl_question qq ON qa.question = qq.id
|
||||
INNER JOIN mdl_qtype_multichoice_options qo ON qq.id = qo.questionid
|
||||
INNER JOIN mdl_quiz_slots qs ON qq.id = qs.questionid
|
||||
INNER JOIN mdl_quiz q ON qs.quizid = q.id
|
||||
WHERE qq.qtype = 'multichoice'
|
||||
AND qo.single = 0",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LessonAnswersMultipleAnswerLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\LessonAnswersMultipleChoiceLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedLessonPageQuizLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedQuestionLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\ReplaceFilePaths;
|
||||
|
||||
/**
|
||||
* Class QuestionMultiChoiceSingleTask.
|
||||
*
|
||||
* Task to convert Moodle question answers of multichoice type in Chamilo unique/multiple answers.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class QuestionMultiChoiceSingleTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => "SELECT
|
||||
qa.id,
|
||||
qa.question,
|
||||
qa.answer,
|
||||
qa.feedback,
|
||||
(qa.fraction * qq.defaultmark) score,
|
||||
IF (qa.fraction = 1, TRUE, FALSE) is_correct,
|
||||
q.id quizid,
|
||||
q.course
|
||||
FROM mdl_question_answers qa
|
||||
INNER JOIN mdl_question qq ON qa.question = qq.id
|
||||
INNER JOIN mdl_qtype_multichoice_options qo ON qq.id = qo.questionid
|
||||
INNER JOIN mdl_quiz_slots qs ON qq.id = qs.questionid
|
||||
INNER JOIN mdl_quiz q ON qs.quizid = q.id
|
||||
WHERE qq.qtype = 'multichoice'
|
||||
AND qo.single = 1",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'c_id' => [
|
||||
'class' => LoadedCourseLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
'quiz_id' => [
|
||||
'class' => LoadedLessonPageQuizLookup::class,
|
||||
'properties' => ['quizid'],
|
||||
],
|
||||
'question_id' => [
|
||||
'class' => LoadedQuestionLookup::class,
|
||||
'properties' => ['question'],
|
||||
],
|
||||
'score' => 'score',
|
||||
'answer' => [
|
||||
'class' => ReplaceFilePaths::class,
|
||||
'properties' => ['answer', 'course'],
|
||||
],
|
||||
'feedback' => [
|
||||
'class' => ReplaceFilePaths::class,
|
||||
'properties' => ['feedback', 'course'],
|
||||
],
|
||||
'is_correct' => 'is_correct',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LessonAnswersMultipleChoiceLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedLessonPageQuizLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedQuestionLookup;
|
||||
|
||||
/**
|
||||
* Class QuestionShortAnswerTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class QuestionShortAnswerTask extends LessonAnswersShortAnswerTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => "SELECT
|
||||
qa.id,
|
||||
qa.question,
|
||||
GROUP_CONCAT(qa.answer SEPARATOR '||') answers,
|
||||
qq.defaultmark,
|
||||
GROUP_CONCAT(qa.feedback SEPARATOR '\n') feedback,
|
||||
COUNT(qa.id) nb,
|
||||
q.id quizid,
|
||||
q.course
|
||||
FROM mdl_question_answers qa
|
||||
INNER JOIN mdl_question qq ON qa.question = qq.id
|
||||
INNER JOIN mdl_qtype_shortanswer_options qo ON qq.id = qo.questionid
|
||||
INNER JOIN mdl_quiz_slots qs ON qq.id = qs.questionid
|
||||
INNER JOIN mdl_quiz q ON qs.quizid = q.id
|
||||
WHERE qq.qtype = 'shortanswer'
|
||||
GROUP BY qq.id
|
||||
ORDER BY q.course, qq.id",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'c_id' => [
|
||||
'class' => LoadedCourseLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
'quiz_id' => [
|
||||
'class' => LoadedLessonPageQuizLookup::class,
|
||||
'properties' => ['quizid'],
|
||||
],
|
||||
'question_id' => [
|
||||
'class' => LoadedQuestionLookup::class,
|
||||
'properties' => ['question'],
|
||||
],
|
||||
'scores' => 'defaultmark',
|
||||
'answers' => 'answers',
|
||||
'comment' => 'feedback',
|
||||
'nb' => 'nb',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\LessonQuestionPagesQuestionLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedQuizLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\QuestionType;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\ReplaceFilePaths;
|
||||
|
||||
/**
|
||||
* Class QuestionsTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class QuestionsTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => "SELECT qq.id, qq.category, qq.questiontext, qq.qtype, q.course, q.id quiz_id
|
||||
FROM mdl_question qq
|
||||
INNER JOIN mdl_quiz_slots qs ON qq.id = qs.questionid
|
||||
INNER JOIN mdl_quiz q ON qs.quizid = q.id
|
||||
INNER JOIN mdl_course_modules cm ON (q.course = cm.course AND cm.instance = q.id)
|
||||
INNER JOIN mdl_modules m ON cm.module = m.id
|
||||
INNER JOIN mdl_course_sections cs ON (cm.course = cs.course AND cm.section = cs.id )
|
||||
WHERE m.name = 'quiz'",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'c_id' => [
|
||||
'class' => LoadedCourseLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
'quiz_id' => [
|
||||
'class' => LoadedQuizLookup::class,
|
||||
'properties' => ['quiz_id'],
|
||||
],
|
||||
'question_title' => [
|
||||
'class' => ReplaceFilePaths::class,
|
||||
'properties' => ['questiontext', 'course'],
|
||||
],
|
||||
'question_type' => [
|
||||
'class' => QuestionType::class,
|
||||
'properties' => ['qtype', 'id'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LessonQuestionPagesQuestionLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
|
||||
/**
|
||||
* Class QuestionsTrueFalseTask.
|
||||
*
|
||||
* Task to convert Moodle question answers of truefalse type in Chamilo unique answers.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class QuestionsTrueFalseTask extends QuestionMultiChoiceSingleTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => "SELECT
|
||||
qa.id,
|
||||
qa.question,
|
||||
qa.answer,
|
||||
qa.feedback,
|
||||
(qa.fraction * qq.defaultmark) score,
|
||||
IF (qa.fraction = 1, TRUE, FALSE) is_correct,
|
||||
q.id quizid,
|
||||
q.course
|
||||
FROM mdl_question_answers qa
|
||||
INNER JOIN mdl_question qq ON qa.question = qq.id
|
||||
INNER JOIN mdl_quiz_slots qs ON qq.id = qs.questionid
|
||||
INNER JOIN mdl_quiz q ON qs.quizid = q.id
|
||||
WHERE qq.qtype = 'truefalse'",
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\QuizzesScoresLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseModuleQuizLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedQuizLookup;
|
||||
|
||||
/**
|
||||
* Class QuizzesScoresTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class QuizzesScoresTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => "SELECT
|
||||
q.id,
|
||||
q.course,
|
||||
cm.section,
|
||||
cm.id cm_id
|
||||
FROM mdl_quiz q
|
||||
INNER JOIN mdl_course_modules cm ON (q.course = cm.course AND cm.instance = q.id)
|
||||
INNER JOIN mdl_modules m ON cm.module = m.id
|
||||
INNER JOIN mdl_course_sections cs ON (cm.course = cs.course AND cm.section = cs.id )
|
||||
WHERE m.name = 'quiz'
|
||||
ORDER BY cs.id, FIND_IN_SET(cm.id, cs.sequence)",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'quiz_id' => [
|
||||
'class' => LoadedQuizLookup::class,
|
||||
'properties' => ['id'],
|
||||
],
|
||||
'c_id' => [
|
||||
'class' => LoadedCourseLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
'item_id' => [
|
||||
'class' => LoadedCourseModuleQuizLookup::class,
|
||||
'properties' => ['cm_id'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => QuizzesScoresLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\QuizzesLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseModuleQuizLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\Percentage;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\ReplaceFilePaths;
|
||||
|
||||
/**
|
||||
* Class QuizzesTask.
|
||||
*
|
||||
* Task for convert a Moodle quiz inside a cours section in a Chamilo quiz for learning path.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class QuizzesTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => "SELECT
|
||||
q.id,
|
||||
q.course,
|
||||
q.name,
|
||||
q.intro,
|
||||
q.shuffleanswers,
|
||||
q.attempts,
|
||||
q.timeopen,
|
||||
q.timeclose,
|
||||
q.timelimit,
|
||||
gi.gradepass,
|
||||
q.grade,
|
||||
cm.id cm_id
|
||||
FROM mdl_quiz q
|
||||
INNER JOIN mdl_course_modules cm ON (q.course = cm.course AND cm.instance = q.id)
|
||||
INNER JOIN mdl_modules m ON cm.module = m.id
|
||||
INNER JOIN mdl_course_sections cs ON (cm.course = cs.course AND cm.section = cs.id )
|
||||
INNER JOIN mdl_grade_items gi ON (q.id = gi.iteminstance AND m.name = gi.itemmodule)
|
||||
WHERE m.name = 'quiz'
|
||||
AND gi.itemtype = 'mod'
|
||||
ORDER BY cs.id, FIND_IN_SET(cm.id, cs.sequence)",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'c_id' => [
|
||||
'class' => LoadedCourseLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
'item_id' => [
|
||||
'class' => LoadedCourseModuleQuizLookup::class,
|
||||
'properties' => ['cm_id'],
|
||||
],
|
||||
'exerciseTitle' => 'name',
|
||||
'exerciseDescription' => [
|
||||
'class' => ReplaceFilePaths::class,
|
||||
'properties' => ['intro', 'course'],
|
||||
],
|
||||
'randomAnswers' => 'shuffleanswers',
|
||||
'exerciseAttempts' => 'attempts',
|
||||
'start_time' => 'timeopen',
|
||||
'end_time' => 'timeclose',
|
||||
'enabletimercontroltotalminutes' => 'timelimit',
|
||||
'pass_percentage' => [
|
||||
'class' => Percentage::class,
|
||||
'properties' => ['gradepass', 'grade'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => QuizzesLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\BaseExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\RoleAssignmentsLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\CourseUserStatus;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseCodeLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedUserLookup;
|
||||
|
||||
/**
|
||||
* Class RoleAssignmentsTask.
|
||||
*
|
||||
* Task to convert the Moodle role assigment in a Chamilo's user course subscription.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class RoleAssignmentsTask extends BaseTask
|
||||
{
|
||||
public const CONTEXT_LEVEL_COURSE = 50;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseExtractor::class,
|
||||
'query' => 'SELECT ra.id, r.archetype, ra.userid, c.id cid
|
||||
FROM mdl_role_assignments ra
|
||||
INNER JOIN mdl_role r ON ra.roleid = r.id
|
||||
INNER JOIN mdl_context ctx ON ra.contextid = ctx.id
|
||||
INNER JOIN mdl_course c ON ctx.instanceid = c.id
|
||||
WHERE ctx.contextlevel = '.self::CONTEXT_LEVEL_COURSE,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'status' => [
|
||||
'class' => CourseUserStatus::class,
|
||||
'properties' => ['archetype'],
|
||||
],
|
||||
'user_id' => [
|
||||
'class' => LoadedUserLookup::class,
|
||||
'properties' => ['userid'],
|
||||
],
|
||||
'course_code' => [
|
||||
'class' => LoadedCourseCodeLookup::class,
|
||||
'properties' => ['cid'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => RoleAssignmentsLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedScormsFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\ScormScoLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseCodeLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedScormLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\ScormScoParentLookup;
|
||||
|
||||
/**
|
||||
* Class ScormScoesTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class ScormScoesTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedScormsFilterExtractor::class,
|
||||
'query' => "SELECT i.id, i.title, i.scormtype, i.launch, i.identifier, i.scorm, i.parent, s.course
|
||||
FROM mdl_scorm_scoes i
|
||||
INNER JOIN mdl_scorm s ON i.scorm = s.id
|
||||
WHERE i.parent != '/' ORDER BY s.id, i.sortorder",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'title' => 'title',
|
||||
'item_type' => 'scormtype',
|
||||
'path' => 'launch',
|
||||
'ref' => 'identifier',
|
||||
'lp_id' => [
|
||||
'class' => LoadedScormLookup::class,
|
||||
'properties' => ['scorm'],
|
||||
],
|
||||
'parent_item_id' => [
|
||||
'class' => ScormScoParentLookup::class,
|
||||
'properties' => ['parent', 'scorm'],
|
||||
],
|
||||
'c_code' => [
|
||||
'class' => LoadedCourseCodeLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => ScormScoLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\SortSectionModuleLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseSectionLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\SectionSequenceLookup;
|
||||
|
||||
/**
|
||||
* Class SortSectionModulesTask.
|
||||
*
|
||||
* Task to fix the display order for learning path items.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class SortSectionModulesTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => "SELECT cm.id, cs.course, cm.section, cs.sequence
|
||||
FROM mdl_course_modules cm
|
||||
INNER JOIN mdl_modules m ON cm.module = m.id
|
||||
INNER JOIN mdl_course_sections cs ON (cm.course = cs.course AND cm.section = cs.id )
|
||||
WHERE cs.course NOT IN (
|
||||
SELECT sco.course
|
||||
FROM mdl_scorm sco
|
||||
INNER JOIN mdl_course_modules cm ON (sco.course = cm.course AND cm.instance = sco.id)
|
||||
INNER JOIN mdl_modules m ON cm.module = m.id
|
||||
INNER JOIN mdl_course_sections cs ON (cm.course = cs.course AND cm.section = cs.id )
|
||||
WHERE m.name = 'scorm'
|
||||
)
|
||||
ORDER BY cs.course, cs.section, FIND_IN_SET(cm.id, cs.sequence)",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'c_id' => [
|
||||
'class' => LoadedCourseLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
'lp_id' => [
|
||||
'class' => LoadedCourseSectionLookup::class,
|
||||
'properties' => ['section'],
|
||||
],
|
||||
'order_list' => [
|
||||
'class' => SectionSequenceLookup::class,
|
||||
'properties' => ['sequence'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => SortSectionModuleLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedUsersFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\TrackCourseAccessLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\DateTimeObject;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedUserLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedUserSessionLookup;
|
||||
|
||||
/**
|
||||
* Class TrackCourseAccessTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class TrackCourseAccessTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
$query = "SELECT id, userid, courseid, timecreated, ip
|
||||
FROM mdl_logstore_standard_log
|
||||
WHERE (userid IS NOT NULL AND userid != 0) AND (courseid IS NOT NULL AND courseid != 0)
|
||||
ORDER BY timecreated";
|
||||
|
||||
$userFilter = $this->plugin->getUserFilterSetting();
|
||||
|
||||
if (!empty($userFilter)) {
|
||||
$query = "SELECT lsl.id, lsl.userid, lsl.courseid, lsl.timecreated, lsl.ip
|
||||
FROM mdl_logstore_standard_log lsl
|
||||
INNER JOIN mdl_user u ON lsl.userid = u.id
|
||||
WHERE (lsl.courseid IS NOT NULL AND lsl.courseid != 0)
|
||||
AND u.username LIKE '$userFilter%'
|
||||
ORDER BY lsl.timecreated";
|
||||
}
|
||||
|
||||
return [
|
||||
'class' => LoadedUsersFilterExtractor::class,
|
||||
'query' => $query,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'user_id' => [
|
||||
'class' => LoadedUserLookup::class,
|
||||
'properties' => ['userid'],
|
||||
],
|
||||
'c_id' => [
|
||||
'class' => LoadedCourseLookup::class,
|
||||
'properties' => ['courseid'],
|
||||
],
|
||||
'login_course_date' => [
|
||||
'class' => DateTimeObject::class,
|
||||
'properties' => ['timecreated'],
|
||||
],
|
||||
'ip' => 'ip',
|
||||
'session_id' => [
|
||||
'class' => LoadedUserSessionLookup::class,
|
||||
'properties' => ['userid'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => TrackCourseAccessLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedUsersFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\TrackLoginLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\DateTimeObject;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedUserLookup;
|
||||
|
||||
/**
|
||||
* Class TrackLoginTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class TrackLoginTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
$query = 'SELECT id, firstaccess, lastaccess FROM mdl_user WHERE firstaccess != 0';
|
||||
|
||||
$userFilter = $this->plugin->getUserFilterSetting();
|
||||
|
||||
if (!empty($userFilter)) {
|
||||
$query .= " AND username LIKE '$userFilter%'";
|
||||
}
|
||||
|
||||
return [
|
||||
'class' => LoadedUsersFilterExtractor::class,
|
||||
'query' => $query,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'login_user_id' => [
|
||||
'class' => LoadedUserLookup::class,
|
||||
'properties' => ['id'],
|
||||
],
|
||||
'login_date' => [
|
||||
'class' => DateTimeObject::class,
|
||||
'properties' => ['firstaccess'],
|
||||
],
|
||||
'logout_date' => [
|
||||
'class' => DateTimeObject::class,
|
||||
'properties' => ['lastaccess'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => TrackLoginLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedCoursesFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\UrlLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseModuleUrlLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseSectionLookup;
|
||||
|
||||
/**
|
||||
* Class UrlsTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class UrlsTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => LoadedCoursesFilterExtractor::class,
|
||||
'query' => "SELECT u.id, u.course, u.name, u.externalurl, cm.section, cm.id cm_id
|
||||
FROM mdl_url u
|
||||
INNER JOIN mdl_course_modules cm ON (u.course = cm.course AND cm.instance = u.id)
|
||||
INNER JOIN mdl_modules m ON cm.module = m.id
|
||||
INNER JOIN mdl_course_sections cs ON (cm.course = cs.course AND cm.section = cs.id )
|
||||
WHERE m.name = 'url'
|
||||
AND u.course NOT IN (
|
||||
SELECT sco.course
|
||||
FROM mdl_scorm sco
|
||||
INNER JOIN mdl_course_modules cm ON (sco.course = cm.course AND cm.instance = sco.id)
|
||||
INNER JOIN mdl_modules m ON cm.module = m.id
|
||||
INNER JOIN mdl_course_sections cs ON (cm.course = cs.course AND cm.section = cs.id )
|
||||
WHERE m.name = 'scorm'
|
||||
)",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'c_id' => [
|
||||
'class' => LoadedCourseLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
'lp_id' => [
|
||||
'class' => LoadedCourseSectionLookup::class,
|
||||
'properties' => ['section'],
|
||||
],
|
||||
'item_id' => [
|
||||
'class' => LoadedCourseModuleUrlLookup::class,
|
||||
'properties' => ['cm_id'],
|
||||
],
|
||||
'title' => 'name',
|
||||
'url' => 'externalurl',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => UrlLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
/**
|
||||
* Class UserQuestionAttemptsGapselectTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class UserQuestionAttemptsGapselectTask extends UserQuestionAttemptsTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
$this->questionType = 'gapselect';
|
||||
|
||||
return parent::getExtractConfiguration();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
/**
|
||||
* Class UserQuestionAttemptsShortanswerTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class UserQuestionAttemptsShortanswerTask extends UserQuestionAttemptsTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
$this->questionType = 'shortanswer';
|
||||
|
||||
return parent::getExtractConfiguration();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedUsersFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\UserQuestionAttemptLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\DateTimeObject;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedQuestionLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedUserLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedUserQuizLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedUserSessionLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\UserQuestionAnswer;
|
||||
|
||||
/**
|
||||
* Class UserQuestionAttemptsTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
abstract class UserQuestionAttemptsTask extends BaseTask
|
||||
{
|
||||
protected $questionType;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
$userFilter = $this->plugin->getUserFilterSetting();
|
||||
|
||||
$userFilterCondition = !empty($userFilter) ? "AND u.username LIKE '$userFilter%'" : '';
|
||||
|
||||
return [
|
||||
'class' => LoadedUsersFilterExtractor::class,
|
||||
'query' => "SELECT
|
||||
qqa.id,
|
||||
qa.userid,
|
||||
qa.id quiz_attempt,
|
||||
qqa.questionid,
|
||||
qqa.questionsummary,
|
||||
qqa.rightanswer,
|
||||
qqa.responsesummary,
|
||||
qqa.timemodified,
|
||||
qqas.fraction,
|
||||
q.course,
|
||||
qq.defaultmark,
|
||||
qq.qtype
|
||||
FROM mdl_question_attempts qqa
|
||||
INNER JOIN mdl_quiz_attempts qa ON qqa.questionusageid = qa.uniqueid
|
||||
INNER JOIN mdl_question_attempt_steps qqas
|
||||
ON (qqa.id = qqas.questionattemptid AND qa.userid = qqas.userid)
|
||||
INNER JOIN mdl_question_attempt_step_data qqasd ON qqas.id = qqasd.attemptstepid
|
||||
INNER JOIN mdl_question qq ON (qqa.questionid = qq.id)
|
||||
INNER JOIN mdl_quiz q ON (qa.quiz = q.id)
|
||||
INNER JOIN mdl_user u ON (qqas.userid = u.id)
|
||||
WHERE qqas.state NOT IN ('todo', 'complete')
|
||||
AND (qqasd.name = '-finish' AND qqasd.value = 1)
|
||||
AND qq.qtype = '{$this->questionType}'
|
||||
$userFilterCondition
|
||||
ORDER BY qa.userid, qa.quiz, qqa.slot",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'exe_id' => [
|
||||
'class' => LoadedUserQuizLookup::class,
|
||||
'properties' => ['quiz_attempt'],
|
||||
],
|
||||
'user_id' => [
|
||||
'class' => LoadedUserLookup::class,
|
||||
'properties' => ['userid'],
|
||||
],
|
||||
'question_id' => [
|
||||
'class' => LoadedQuestionLookup::class,
|
||||
'properties' => ['questionid'],
|
||||
],
|
||||
'answer' => [
|
||||
'class' => UserQuestionAnswer::class,
|
||||
'properties' => [
|
||||
'qtype',
|
||||
'rightanswer',
|
||||
'responsesummary',
|
||||
'fraction',
|
||||
'defaultmark',
|
||||
'questionsummary',
|
||||
'questionid',
|
||||
],
|
||||
],
|
||||
'marks' => 'fraction',
|
||||
'c_id' => [
|
||||
'class' => LoadedCourseLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
'tms' => [
|
||||
'class' => DateTimeObject::class,
|
||||
'properties' => ['timemodified'],
|
||||
],
|
||||
'session_id' => [
|
||||
'class' => LoadedUserSessionLookup::class,
|
||||
'properties' => ['userid'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => UserQuestionAttemptLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
/**
|
||||
* Class UserQuestionAttemptsTruefalseTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class UserQuestionAttemptsTruefalseTask extends UserQuestionAttemptsTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
$this->questionType = 'truefalse';
|
||||
|
||||
return parent::getExtractConfiguration();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedUsersFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\UserSessionLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\CoursesArrayLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedUserLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\SessionName;
|
||||
|
||||
/**
|
||||
* Class UserSessionsTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class UserSessionsTask extends BaseTask
|
||||
{
|
||||
public const SEPARATOR_NAME = ' - ';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
$userFilterCondition = '';
|
||||
|
||||
$userFilter = $this->plugin->getUserFilterSetting();
|
||||
|
||||
if (!empty($userFilter)) {
|
||||
$userFilterCondition = "AND u.username LIKE '$userFilter%'";
|
||||
}
|
||||
|
||||
return [
|
||||
'class' => LoadedUsersFilterExtractor::class,
|
||||
'query' => "SELECT
|
||||
u.id,
|
||||
u.username,
|
||||
GROUP_CONCAT(c.id) course_ids,
|
||||
GROUP_CONCAT(c.shortname SEPARATOR '".self::SEPARATOR_NAME."') session_name
|
||||
FROM mdl_role_assignments ra
|
||||
INNER JOIN mdl_role r ON ra.roleid = r.id
|
||||
INNER JOIN mdl_context ctx ON ra.contextid = ctx.id
|
||||
INNER JOIN mdl_course c ON ctx.instanceid = c.id
|
||||
INNER JOIN mdl_user u ON ra.userid = u.id
|
||||
WHERE ctx.contextlevel = ".RoleAssignmentsTask::CONTEXT_LEVEL_COURSE."
|
||||
$userFilterCondition
|
||||
GROUP BY ra.userid",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'name' => [
|
||||
'class' => SessionName::class,
|
||||
'properties' => ['username', 'session_name'],
|
||||
],
|
||||
'user_id' => [
|
||||
'class' => LoadedUserLookup::class,
|
||||
'properties' => ['id'],
|
||||
],
|
||||
'courses_list' => 'session_name',
|
||||
'course_ids' => [
|
||||
'class' => CoursesArrayLookup::class,
|
||||
'properties' => ['course_ids'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => UserSessionLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedUsersFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\UserLastLoginLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\DateTimeObject;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedUserLookup;
|
||||
|
||||
/**
|
||||
* Class UsersLastLoginTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class UsersLastLoginTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
$query = 'SELECT id, lastlogin FROM mdl_user WHERE lastlogin != 0';
|
||||
|
||||
$userFilter = $this->plugin->getUserFilterSetting();
|
||||
|
||||
if (!empty($userFilter)) {
|
||||
$query = "SELECT id, lastlogin FROM mdl_user
|
||||
WHERE lastlogin != 0 AND username LIKE '$userFilter%'";
|
||||
}
|
||||
|
||||
return [
|
||||
'class' => LoadedUsersFilterExtractor::class,
|
||||
'query' => $query,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'user_id' => [
|
||||
'class' => LoadedUserLookup::class,
|
||||
'properties' => ['id'],
|
||||
],
|
||||
'last_login' => [
|
||||
'class' => DateTimeObject::class,
|
||||
'properties' => ['lastlogin'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => UserLastLoginLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedUsersFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\UserLearnPathLessonAttemptLoader;
|
||||
|
||||
/**
|
||||
* Class UsersLearnPathsLessonAttemptsTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class UsersLearnPathsLessonAttemptsTask extends UsersLearnPathsLessonBranchTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
$query = 'SELECT * FROM mdl_lesson_attempts';
|
||||
|
||||
$userFilter = $this->plugin->getUserFilterSetting();
|
||||
|
||||
if (!empty($userFilter)) {
|
||||
$query = "SELECT la.* FROM mdl_lesson_attempts la
|
||||
INNER JOIN mdl_user u ON la.userid = u.id
|
||||
WHERE u.username LIKE '$userFilter%'";
|
||||
}
|
||||
|
||||
return [
|
||||
'class' => LoadedUsersFilterExtractor::class,
|
||||
'query' => $query,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
$config = parent::getTransformConfiguration();
|
||||
|
||||
$config['map']['is_correct'] = 'correct';
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => UserLearnPathLessonAttemptLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedUsersFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\UserLearnPathLessonBranchLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseModuleLessonLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedLessonPageLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedUserLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedUserSessionLookup;
|
||||
|
||||
/**
|
||||
* Class UsersLearnPathsLessonBranchTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class UsersLearnPathsLessonBranchTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
$query = 'SELECT lb.* FROM mdl_lesson_branch lb
|
||||
INNER JOIN (
|
||||
SELECT lt.lessonid, lt.userid, lt.starttime, lt.lessontime
|
||||
FROM mdl_lesson_timer lt
|
||||
WHERE lt.completed = 1
|
||||
GROUP BY lt.userid, lt.lessonid
|
||||
ORDER BY lt.userid, lt.lessonid, lt.starttime
|
||||
) AS lesson_timer ON (lb.lessonid = lesson_timer.lessonid AND lb.userid = lesson_timer.userid)
|
||||
WHERE lb.timeseen >= lesson_timer.starttime AND lb.timeseen <= lesson_timer.lessontime
|
||||
ORDER BY lb.userid, lb.lessonid, lb.timeseen';
|
||||
|
||||
$userFilter = $this->plugin->getUserFilterSetting();
|
||||
|
||||
if (!empty($userFilter)) {
|
||||
$query = "SELECT lb.* FROM mdl_lesson_branch lb
|
||||
INNER JOIN (
|
||||
SELECT lt.lessonid, lt.userid, lt.starttime, lt.lessontime
|
||||
FROM mdl_lesson_timer lt
|
||||
INNER JOIN mdl_user u ON (lt.userid = u.id)
|
||||
WHERE lt.completed = 1
|
||||
AND u.username LIKE '$userFilter%'
|
||||
GROUP BY lt.userid, lt.lessonid
|
||||
ORDER BY lt.userid, lt.lessonid, lt.starttime
|
||||
) AS lesson_timer ON (lb.lessonid = lesson_timer.lessonid AND lb.userid = lesson_timer.userid)
|
||||
INNER JOIN mdl_user u ON (lb.userid = u.id)
|
||||
WHERE lb.timeseen >= lesson_timer.starttime AND lb.timeseen <= lesson_timer.lessontime
|
||||
AND u.username LIKE '$userFilter%'
|
||||
ORDER BY lb.userid, lb.lessonid, lb.timeseen";
|
||||
}
|
||||
|
||||
return [
|
||||
'class' => LoadedUsersFilterExtractor::class,
|
||||
'query' => $query,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'parent_item_id' => [
|
||||
'class' => LoadedCourseModuleLessonLookup::class,
|
||||
'properties' => ['lessonid'],
|
||||
],
|
||||
'item_id' => [
|
||||
'class' => LoadedLessonPageLookup::class,
|
||||
'properties' => ['pageid'],
|
||||
],
|
||||
'user_id' => [
|
||||
'class' => LoadedUserLookup::class,
|
||||
'properties' => ['userid'],
|
||||
],
|
||||
'end_time' => 'timeseen',
|
||||
'session_id' => [
|
||||
'class' => LoadedUserSessionLookup::class,
|
||||
'properties' => ['userid'],
|
||||
],
|
||||
'view_count' => 'retry',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => UserLearnPathLessonBranchLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedUsersFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\UserLearnPathLessonTimerLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseModuleLessonLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedUserLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedUserSessionLookup;
|
||||
|
||||
/**
|
||||
* Class UsersLearnPathsLessonTimerTask.
|
||||
*
|
||||
* Update lp item (dirs) view.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class UsersLearnPathsLessonTimerTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
$query = 'SELECT * FROM mdl_lesson_timer
|
||||
WHERE completed = 1
|
||||
GROUP BY lt.userid, lt.lessonid
|
||||
ORDER BY userid, lessonid, starttime';
|
||||
|
||||
$userFilter = $this->plugin->getUserFilterSetting();
|
||||
|
||||
if (!empty($userFilter)) {
|
||||
$query = "SELECT lt.* FROM mdl_lesson_timer lt
|
||||
INNER JOIN mdl_user u ON lt.userid = u.id
|
||||
WHERE u.username LIKE '$userFilter%'
|
||||
AND lt.completed = 1
|
||||
GROUP BY lt.userid, lt.lessonid
|
||||
ORDER BY lt.userid, lt.lessonid, lt.starttime";
|
||||
}
|
||||
|
||||
return [
|
||||
'class' => LoadedUsersFilterExtractor::class,
|
||||
'query' => $query,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'parent_item_id' => [
|
||||
'class' => LoadedCourseModuleLessonLookup::class,
|
||||
'properties' => ['lessonid'],
|
||||
],
|
||||
'user_id' => [
|
||||
'class' => LoadedUserLookup::class,
|
||||
'properties' => ['userid'],
|
||||
],
|
||||
'start_time' => 'starttime',
|
||||
'session_id' => [
|
||||
'class' => LoadedUserSessionLookup::class,
|
||||
'properties' => ['userid'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => UserLearnPathLessonTimerLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedUsersFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\UserLearnPathQuizLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LearnPathItemViewQuizStatus;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseModuleQuizByQuizLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedUserLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedUserSessionLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\Subtract;
|
||||
|
||||
/**
|
||||
* Class UsersLearnPathsQuizzesTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class UsersLearnPathsQuizzesTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
$query = 'SELECT id, quiz, userid, timestart, timefinish, state, sumgrades
|
||||
FROM mdl_quiz_attempts
|
||||
WHERE preview = 0';
|
||||
|
||||
$userFilter = $this->plugin->getUserFilterSetting();
|
||||
|
||||
if (!empty($userFilter)) {
|
||||
$query = "SELECT qa.id, qa.quiz, qa.userid, qa.timestart, qa.timefinish, qa.state, qa.sumgrades
|
||||
FROM mdl_quiz_attempts qa
|
||||
INNER JOIN mdl_user u ON qa.userid = u.id
|
||||
WHERE qa.preview = 0
|
||||
AND u.username LIKE '$userFilter%'";
|
||||
}
|
||||
|
||||
return [
|
||||
'class' => LoadedUsersFilterExtractor::class,
|
||||
'query' => $query,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'item_id' => [
|
||||
'class' => LoadedCourseModuleQuizByQuizLookup::class,
|
||||
'properties' => ['quiz'],
|
||||
],
|
||||
'user_id' => [
|
||||
'class' => LoadedUserLookup::class,
|
||||
'properties' => ['userid'],
|
||||
],
|
||||
'session_id' => [
|
||||
'class' => LoadedUserSessionLookup::class,
|
||||
'properties' => ['userid'],
|
||||
],
|
||||
'start_time' => 'timestart',
|
||||
'total_time' => [
|
||||
'class' => Subtract::class,
|
||||
'properties' => ['timefinish', 'timestart'],
|
||||
],
|
||||
'status' => [
|
||||
'class' => LearnPathItemViewQuizStatus::class,
|
||||
'properties' => ['quiz', 'state', 'sumgrades'],
|
||||
],
|
||||
'score' => 'sumgrades',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => UserLearnPathQuizLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedUsersFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\UserLearnPathsLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedUserLookup;
|
||||
|
||||
/**
|
||||
* Class UsersLearnPathsTask.
|
||||
*
|
||||
* Create views LP and LP items for each user in platform.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class UsersLearnPathsTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
$userFilter = $this->plugin->getUserFilterSetting();
|
||||
|
||||
$userFilterCondition = '';
|
||||
|
||||
if (!empty($userFilter)) {
|
||||
$userFilterCondition = "WHERE username LIKE '$userFilter%'";
|
||||
}
|
||||
|
||||
return [
|
||||
'class' => LoadedUsersFilterExtractor::class,
|
||||
'query' => "SELECT id FROM mdl_user $userFilterCondition",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'user_id' => [
|
||||
'class' => LoadedUserLookup::class,
|
||||
'properties' => ['id'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => UserLearnPathsLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedUsersFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\UserQuizAttemptLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\DateTimeObject;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedQuizLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedUserLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedUserSessionLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\QuizDataTracking;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\Subtract;
|
||||
|
||||
/**
|
||||
* Class UsersQuizzesAttemptsTask.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class UsersQuizzesAttemptsTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
$userFilter = $this->plugin->getUserFilterSetting();
|
||||
$userCondition = '';
|
||||
|
||||
if (!empty($userFilter)) {
|
||||
$userCondition = "INNER JOIN mdl_user u ON qa.userid = u.id WHERE u.username LIKE '$userFilter%'";
|
||||
}
|
||||
|
||||
return [
|
||||
'class' => LoadedUsersFilterExtractor::class,
|
||||
'query' => "SELECT
|
||||
qa.id,
|
||||
qa.quiz,
|
||||
qa.userid,
|
||||
qa.layout,
|
||||
qa.state,
|
||||
qa.timestart,
|
||||
qa.timefinish,
|
||||
qa.sumgrades real_result,
|
||||
q.sumgrades weighting
|
||||
FROM mdl_quiz_attempts qa
|
||||
INNER JOIN mdl_quiz q ON qa.quiz = q.id
|
||||
$userCondition
|
||||
ORDER BY qa.userid, q.id, qa.attempt",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'user_id' => [
|
||||
'class' => LoadedUserLookup::class,
|
||||
'properties' => ['userid'],
|
||||
],
|
||||
'date' => [
|
||||
'class' => DateTimeObject::class,
|
||||
'properties' => ['timestart'],
|
||||
],
|
||||
'exo_id' => [
|
||||
'class' => LoadedQuizLookup::class,
|
||||
'properties' => ['quiz'],
|
||||
],
|
||||
'result' => 'real_result',
|
||||
'weighting' => 'weighting',
|
||||
'data_tracking' => [
|
||||
'class' => QuizDataTracking::class,
|
||||
'properties' => ['quiz', 'layout'],
|
||||
],
|
||||
'session_id' => [
|
||||
'class' => LoadedUserSessionLookup::class,
|
||||
'properties' => ['userid'],
|
||||
],
|
||||
'duration' => [
|
||||
'class' => Subtract::class,
|
||||
'properties' => ['timefinish', 'timestart'],
|
||||
],
|
||||
'status' => 'state',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => UserQuizAttemptLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\LoadedUsersFilterExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\UsersScormsViewLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedCourseLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedScormLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedScormScoLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedUserLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\ScormScoTrackData;
|
||||
|
||||
/**
|
||||
* Class UsersScormsViewTask.
|
||||
*
|
||||
* Task for register the LP view of user coming from moodle scorm track.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class UsersScormsViewTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
$userFilter = $this->plugin->getUserFilterSetting();
|
||||
|
||||
$userCondition = '';
|
||||
|
||||
if (!empty($userFilter)) {
|
||||
$userCondition = "INNER JOIN mdl_user u ON sst.userid = u.id WHERE u.username LIKE '$userFilter%'";
|
||||
}
|
||||
|
||||
return [
|
||||
'class' => LoadedUsersFilterExtractor::class,
|
||||
'query' => "SELECT
|
||||
sst.id,
|
||||
sst.userid,
|
||||
s.id scormid,
|
||||
ss.id scoid,
|
||||
sst.attempt,
|
||||
s.course,
|
||||
GROUP_CONCAT(sst.element, '==>>', sst.value ORDER BY sst.id SEPARATOR '|@|') track_data
|
||||
FROM mdl_scorm_scoes_track sst
|
||||
INNER JOIN mdl_scorm_scoes ss ON (sst.scoid = ss.id AND sst.scormid = ss.scorm)
|
||||
INNER JOIN mdl_scorm s ON (ss.scorm = s.id)
|
||||
$userCondition
|
||||
GROUP BY sst.userid, s.id, ss.id, sst.attempt
|
||||
ORDER BY sst.userid, s.course, s.id",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'user_id' => [
|
||||
'class' => LoadedUserLookup::class,
|
||||
'properties' => ['userid'],
|
||||
],
|
||||
'lp_id' => [
|
||||
'class' => LoadedScormLookup::class,
|
||||
'properties' => ['scormid'],
|
||||
],
|
||||
'lp_item_id' => [
|
||||
'class' => LoadedScormScoLookup::class,
|
||||
'properties' => ['scoid'],
|
||||
],
|
||||
'lp_item_view_count' => 'attempt',
|
||||
'c_id' => [
|
||||
'class' => LoadedCourseLookup::class,
|
||||
'properties' => ['course'],
|
||||
],
|
||||
'item_data' => [
|
||||
'class' => ScormScoTrackData::class,
|
||||
'properties' => ['track_data'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => UsersScormsViewLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
|
||||
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Extractor\BaseExtractor;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Loader\UsersLoader;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\AuthLookup;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\DateTimeObject;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\UserActive;
|
||||
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\UserStatus;
|
||||
|
||||
/**
|
||||
* Class UsersTask.
|
||||
*
|
||||
* Task to convert Moodle users in Chamilo users.
|
||||
*
|
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Task
|
||||
*/
|
||||
class UsersTask extends BaseTask
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExtractConfiguration()
|
||||
{
|
||||
$query = "SELECT * FROM mdl_user WHERE username NOT IN ('admin', 'guest')";
|
||||
|
||||
$userFilter = $this->plugin->getUserFilterSetting();
|
||||
|
||||
if (!empty($userFilter)) {
|
||||
$query = "SELECT * FROM mdl_user WHERE username LIKE '$userFilter%'";
|
||||
}
|
||||
|
||||
return [
|
||||
'class' => BaseExtractor::class,
|
||||
'query' => $query,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTransformConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => BaseTransformer::class,
|
||||
'map' => [
|
||||
'lastname' => 'lastname',
|
||||
'firstname' => 'firstname',
|
||||
'email' => 'email',
|
||||
'username' => 'username',
|
||||
'plain_password' => 'password',
|
||||
'language' => 'lang',
|
||||
'phone' => 'phone1',
|
||||
'address' => 'address',
|
||||
'auth_source' => [
|
||||
'class' => AuthLookup::class,
|
||||
'properties' => ['auth'],
|
||||
],
|
||||
'registration_date' => [
|
||||
'class' => DateTimeObject::class,
|
||||
'properties' => ['timecreated'],
|
||||
],
|
||||
'status' => [
|
||||
'class' => UserStatus::class,
|
||||
'properties' => ['id'],
|
||||
],
|
||||
'active' => [
|
||||
'class' => UserActive::class,
|
||||
'properties' => ['deleted', 'suspended'],
|
||||
],
|
||||
'enabled' => [
|
||||
'class' => UserActive::class,
|
||||
'properties' => ['deleted', 'suspended'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getLoadConfiguration()
|
||||
{
|
||||
return [
|
||||
'class' => UsersLoader::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user