Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
chamilo-lms/plugin/migrationmoodle/src/Task/EfcUserSessionsTask.php

62 lines
1.8 KiB

<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\PluginBundle\MigrationMoodle\Task;
use Chamilo\PluginBundle\MigrationMoodle\Extractor\UserExtractor;
use Chamilo\PluginBundle\MigrationMoodle\Loader\EfcUserSessionLoader;
use Chamilo\PluginBundle\MigrationMoodle\Transformer\BaseTransformer;
use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\SessionName;
/**
* Class EfcUserSessionsTask.
*
* @package Chamilo\PluginBundle\MigrationMoodle\Task
*/
class EfcUserSessionsTask extends BaseTask
{
/**
* @inheritDoc
*/
public function getExtractConfiguration()
{
return [
'class' => UserExtractor::class,
'query' => 'SELECT u.id, u.username, GROUP_CONCAT(c.shortname SEPARATOR " - ") 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.'
AND u.username LIKE "efc%"
GROUP BY ra.userid',
];
}
/**
* @inheritDoc
*/
public function getTransformConfiguration()
{
return [
'class' => BaseTransformer::class,
'map' => [
'name' => [
'class' => SessionName::class,
'properties' => ['username', 'session_name']
],
],
];
}
/**
* @inheritDoc
*/
public function getLoadConfiguration()
{
return [
'class' => EfcUserSessionLoader::class,
];
}
}