Flint fixes

pull/3140/head
Julio Montoya 6 years ago
parent eddd71d18d
commit 0ac4bcc4f6
  1. 26
      main/admin/statistics/index.php
  2. 81
      main/inc/lib/statistics.lib.php
  3. 96
      plugin/migrationmoodle/run_cli.php
  4. 2
      plugin/migrationmoodle/src/Loader/TrackLoginLoader.php
  5. 2
      plugin/migrationmoodle/src/Loader/UserLastLoginLoader.php
  6. 6
      plugin/migrationmoodle/src/Task/TrackLoginTask.php
  7. 6
      plugin/migrationmoodle/src/Task/UsersLastLoginTask.php

@ -498,9 +498,9 @@ switch ($report) {
$column = 0;
foreach ($headers as $header) {
$tableCourse->setHeaderContents($row, $column, $header);
++$column;
$column++;
}
++$row;
$row++;
if (!empty($courseSessions)) {
arsort($courseSessions);
@ -508,7 +508,7 @@ switch ($report) {
$courseInfo = api_get_course_info_by_id($courseId);
$tableCourse->setCellContents($row, 0, $courseInfo['name']);
$tableCourse->setCellContents($row, 1, $count);
++$row;
$row++;
}
}
@ -854,7 +854,7 @@ switch ($report) {
$item[] = $certificate ? get_lang('Yes') : get_lang('No');
$item[] = $birthDate;
$data[] = $item;
++$row;
$row++;
}
if (isset($_REQUEST['action_table']) && 'export' === $_REQUEST['action_table']) {
@ -931,15 +931,15 @@ switch ($report) {
$column = 0;
foreach ($headers as $header) {
$table->setHeaderContents($row, $column, $header);
++$column;
$column++;
}
++$row;
$row++;
$table->setCellContents($row, 0, get_lang('Total'));
$table->setCellContents($row, 1, $totalCount);
$table->setCellContents($row, 2, '100 %');
++$row;
$row++;
$total = 0;
foreach ($all as $name => $value) {
$total += $value;
@ -949,7 +949,7 @@ switch ($report) {
$table->setCellContents($row, 0, $name);
$table->setCellContents($row, 1, $value);
$table->setCellContents($row, 2, $percentage);
++$row;
$row++;
}
$extraTables = Display::page_subheader2($reportName1).$table->toHtml();
@ -1206,7 +1206,7 @@ switch ($report) {
);
if (!empty($certificate)) {
++$certificateCount;
$certificateCount++;
}
}
@ -1260,20 +1260,20 @@ switch ($report) {
];
while ($row = Database::fetch_array($query)) {
++$usersFound;
$usersFound++;
if (!empty($row['value'])) {
$date1 = new DateTime($row['value']);
$interval = $now->diff($date1);
$years = (int) $interval->y;
if ($years >= 16 && $years <= 17) {
++$all['16-17'];
$all['16-17']++;
}
if ($years >= 18 && $years <= 25) {
++$all['18-25'];
$all['18-25']++;
}
if ($years >= 26 && $years <= 30) {
++$all['26-30'];
$all['26-30']++;
}
/*if ($years >= 31) {
$all[get_lang('N/A')] += 1;

@ -1,7 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Component\Utils\ChamiloApi;
/**
@ -567,7 +566,7 @@ class Statistics
}
$content .= self::printStats(get_lang('LastLogins').' ('.$period.')', $result_last_x, true);
flush(); //flush web request at this point to see something already while the full data set is loading
$content .= '<br />';
$content .= '<br />';
}
$res = Database::query($sql);
$result = [];
@ -661,10 +660,9 @@ class Statistics
$content = self::printStats(get_lang('DistinctUsersLogins'), $totalLogin, false);
} else {
$content = self::printStats(get_lang('Logins'), $totalLogin, false);
}
}
return $content;
}
/**
@ -1120,6 +1118,7 @@ class Statistics
$r = $total - $obj->number;
$totalLogin[$index] = $r < 0 ? 0 : $r;
}
return self::printStats(
get_lang('StatsUsersDidNotLoginInLastPeriods'),
$totalLogin,
@ -1343,15 +1342,50 @@ class Statistics
$content = $table->toHtml();
}
$content.= $form->returnForm();
$content .= $form->returnForm();
if (!empty($actions)) {
$content.= Display::toolbarAction('logins_by_date_toolbar', [$actions]);
$content .= Display::toolbarAction('logins_by_date_toolbar', [$actions]);
}
return $content;
}
public static function getBossTable($bossId)
{
$students = UserManager::getUsersFollowedByStudentBoss($bossId);
if (!empty($students)) {
$table = new HTML_Table(['class' => 'table table-responsive', 'id' => 'table_'.$bossId]);
$headers = [
get_lang('Name'),
//get_lang('LastName'),
];
$row = 0;
$column = 0;
foreach ($headers as $header) {
$table->setHeaderContents($row, $column, $header);
$column++;
}
$row++;
foreach ($students as $student) {
$column = 0;
$content = api_get_person_name($student['firstname'], $student['lastname']).'';
$content = '<div style="width: 200px; overflow-wrap: break-word;">'.$content.'</div>';
$table->setCellContents(
$row,
$column++,
$content
);
$row++;
}
return $table->toHtml();
}
return '<table id="table_'.$bossId.'"></table>';
}
/**
* @param string $startDate
* @param string $endDate
@ -1398,39 +1432,4 @@ class Statistics
return $result;
}
public static function getBossTable($bossId)
{
$students = UserManager::getUsersFollowedByStudentBoss($bossId);
if (!empty($students)) {
$table = new HTML_Table(['class' => 'table table-responsive', 'id' => 'table_'.$bossId]);
$headers = [
get_lang('Name'),
//get_lang('LastName'),
];
$row = 0;
$column = 0;
foreach ($headers as $header) {
$table->setHeaderContents($row, $column, $header);
$column++;
}
$row++;
foreach ($students as $student) {
$column = 0;
$content = api_get_person_name($student['firstname'], $student['lastname']). '';
$content = '<div style="width: 200px; overflow-wrap: break-word;">'.$content.'</div>';
$table->setCellContents(
$row,
$column++,
$content
);
$row++;
}
return $table->toHtml();
}
return '<table id="table_'.$bossId.'"></table>';
}
}

@ -27,55 +27,55 @@ $plugin = MigrationMoodlePlugin::create();
$taskNames = [
'course_categories',
'courses',
/**/'course_introductions',
/**//**/'files_for_course_introductions',
/**/'course_sections',
/**//**/'files_for_course_sections',
/**//**/'course_modules_lesson',
/**//**//**/'lesson_pages',
/**//**//**//**/'lesson_pages_document',
/**//**//**//**//**/'files_for_lesson_pages',
/**//**//**//**/'lesson_pages_quiz',
/**//**//**//**//**/'lesson_pages_quiz_question',
/**//**//**//**//**//**/'lesson_answers_true_false',
/**//**//**//**//**//**/'lesson_answers_multiple_choice',
/**//**//**//**//**//**/'lesson_answers_multiple_answer',
/**//**//**//**//**//**/'lesson_answers_matching',
/**//**//**//**//**//**/'lesson_answers_essay',
/**//**//**//**//**//**/'lesson_answers_short_answer',
/**//**//**//**//**/'files_for_lesson_answers',
/**//**/'course_modules_quiz',
/**//**//**/'quizzes',
/**//**//**//**/'files_for_quizzes',
/**//**//**//**/'question_categories',
/**//**//**//**/'questions',
/**//**//**//**//**/'question_multi_choice_single',
/**//**//**//**//**/'question_multi_choice_multiple',
/**//**//**//**//**/'questions_true_false',
/**//**//**//**//**/'question_short_answer',
/**//**//**//**//**/'question_gapselect',
/**//**//**/'quizzes_scores',
/**//**/'course_modules_url',
/**//**//**/'urls',
/**//**/'sort_section_modules',
/**/'course_modules_scorm',
/**//**/'scorm_scoes',
/**//**//**/'files_for_scorm_scoes',
'course_introductions',
'files_for_course_introductions',
'course_sections',
'files_for_course_sections',
'course_modules_lesson',
'lesson_pages',
'lesson_pages_document',
'files_for_lesson_pages',
'lesson_pages_quiz',
'lesson_pages_quiz_question',
'lesson_answers_true_false',
'lesson_answers_multiple_choice',
'lesson_answers_multiple_answer',
'lesson_answers_matching',
'lesson_answers_essay',
'lesson_answers_short_answer',
'files_for_lesson_answers',
'course_modules_quiz',
'quizzes',
'files_for_quizzes',
'question_categories',
'questions',
'question_multi_choice_single',
'question_multi_choice_multiple',
'questions_true_false',
'question_short_answer',
'question_gapselect',
'quizzes_scores',
'course_modules_url',
'urls',
'sort_section_modules',
'course_modules_scorm',
'scorm_scoes',
'files_for_scorm_scoes',
'users',
/**/'users_last_login',
/**/'track_login',
/**/'user_sessions',
/**//**/'users_learn_paths',
/**//**//**/'users_learn_paths_lesson_timer',
/**//**//**/'users_learn_paths_lesson_branch',
/**//**//**/'users_learn_paths_lesson_attempts',
/**//**//**/'users_learn_paths_quizzes',
/**//**//**//**/'users_quizzes_attempts',
/**//**//**//**//**/'user_question_attempts_shortanswer',
/**//**//**//**//**/'user_question_attempts_gapselect',
/**//**//**//**//**/'user_question_attempts_truefalse',
/**//**/'users_scorms_view',
/**//**//**/'users_scorms_progress',
'users_last_login',
'track_login',
'user_sessions',
'users_learn_paths',
'users_learn_paths_lesson_timer',
'users_learn_paths_lesson_branch',
'users_learn_paths_lesson_attempts',
'users_learn_paths_quizzes',
'users_quizzes_attempts',
'user_question_attempts_shortanswer',
'user_question_attempts_gapselect',
'user_question_attempts_truefalse',
'users_scorms_view',
'users_scorms_progress',
];
foreach ($taskNames as $i => $taskName) {

@ -13,7 +13,7 @@ use Chamilo\PluginBundle\MigrationMoodle\Interfaces\LoaderInterface;
class TrackLoginLoader implements LoaderInterface
{
/**
* @inheritDoc
* {@inheritdoc}
*/
public function load(array $incomingData)
{

@ -13,7 +13,7 @@ use Chamilo\PluginBundle\MigrationMoodle\Interfaces\LoaderInterface;
class UserLastLoginLoader implements LoaderInterface
{
/**
* @inheritDoc
* {@inheritdoc}
*/
public function load(array $incomingData)
{

@ -17,7 +17,7 @@ use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedUserLookup;
class TrackLoginTask extends BaseTask
{
/**
* @inheritDoc
* {@inheritdoc}
*/
public function getExtractConfiguration()
{
@ -28,7 +28,7 @@ class TrackLoginTask extends BaseTask
}
/**
* @inheritDoc
* {@inheritdoc}
*/
public function getTransformConfiguration()
{
@ -52,7 +52,7 @@ class TrackLoginTask extends BaseTask
}
/**
* @inheritDoc
* {@inheritdoc}
*/
public function getLoadConfiguration()
{

@ -17,7 +17,7 @@ use Chamilo\PluginBundle\MigrationMoodle\Transformer\Property\LoadedUserLookup;
class UsersLastLoginTask extends BaseTask
{
/**
* @inheritDoc
* {@inheritdoc}
*/
public function getExtractConfiguration()
{
@ -28,7 +28,7 @@ class UsersLastLoginTask extends BaseTask
}
/**
* @inheritDoc
* {@inheritdoc}
*/
public function getTransformConfiguration()
{
@ -48,7 +48,7 @@ class UsersLastLoginTask extends BaseTask
}
/**
* @inheritDoc
* {@inheritdoc}
*/
public function getLoadConfiguration()
{

Loading…
Cancel
Save