Update from 1.11.x

pull/3544/head
Julio Montoya 5 years ago
parent 0085e57b2b
commit 46ed10dbd3
  1. 2
      public/main/exercise/exercise.class.php
  2. 7
      public/main/group/group.php
  3. 2
      public/main/group/group_category.php
  4. 2
      public/main/group/group_creation.php
  5. 1
      public/main/group/group_space.php
  6. 2
      public/main/group/settings.php
  7. 2
      public/main/link/link.php
  8. 1
      public/main/link/link_goto.php
  9. 29
      public/main/plagiarism/compilatio/compiladmin.php
  10. 99
      public/main/tracking/courseLog.php
  11. 4
      public/main/tracking/exams.php
  12. 3
      public/main/tracking/question_course_report.php
  13. 25
      public/main/user/class.php
  14. 4
      public/main/user/resume_session.php
  15. 13
      public/main/user/user.php

@ -2985,7 +2985,7 @@ class Exercise
$exerciseObject->sessionId = api_get_session_id();
$courseId = api_get_course_int_id();
$exerciseObject->save();
$newId = $exerciseObject->selectId();
$newId = $exerciseObject->getId();
$exerciseRelQuestionTable = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
$count = 1;

@ -198,12 +198,9 @@ if (api_is_allowed_to_edit(false, true)) {
$actionsLeft .= '<a href="group_creation.php?'.api_get_cidreq().'">'.
Display::return_icon('add-groups.png', get_lang('Create new group(s)'), '', ICON_SIZE_MEDIUM).'</a>';
if ('true' === api_get_setting('allow_group_categories') && empty($sessionId)) {
if (empty($sessionId) && 'true' === api_get_setting('allow_group_categories')) {
$actionsLeft .= '<a href="group_category.php?'.api_get_cidreq().'&action=add_category">'.
Display::return_icon('new_folder.png', get_lang('Add category'), '', ICON_SIZE_MEDIUM).'</a>';
} else {
$actionsLeft .= '<a href="group_category.php?'.api_get_cidreq().'&id=2">'.
Display::return_icon('settings.png', get_lang('Edit settings'), '', ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('new_folder.png', get_lang('AddCategory'), '', ICON_SIZE_MEDIUM).'</a>';
}
$actionsLeft .= '<a href="import.php?'.api_get_cidreq().'&action=import">'.

@ -4,6 +4,8 @@
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_COURSES;
$current_course_tool = TOOL_GROUP;
// Notice for unauthorized people.
api_protect_course_script(true);

@ -3,6 +3,8 @@
/* For licensing terms, see /license.txt */
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_COURSES;
$current_course_tool = TOOL_GROUP;
api_protect_course_script(true);

@ -9,6 +9,7 @@
* @todo Display error message if no group ID specified
*/
require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_GROUP;
// Notice for unauthorized people.
api_protect_course_script(true, false, 'group');

@ -11,6 +11,8 @@
* @todo course admin functionality to create groups based on who is in which course (or class).
*/
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_COURSES;
$current_course_tool = TOOL_GROUP;
api_protect_course_script(true);

@ -19,6 +19,8 @@
*/
require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_LINK;
$this_section = SECTION_COURSES;
api_protect_course_script(true);
$htmlHeadXtra[] = '<script>

@ -16,6 +16,7 @@
* @author Thomas Depraetere, Hugues Peeters, Christophe Gesch<EFBFBD> - original versions
*/
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_COURSES;
$linkId = isset($_GET['link_id']) ? $_GET['link_id'] : 0;
$linkInfo = Link::getLinkInfo($linkId);

@ -12,17 +12,13 @@ $compilatio = new Compilatio();
$use_space = number_format($quotas->usedSpace / 1000000, 2);
$total_space = $quotas->space / 1000000;
echo "<h3>".get_lang('compilatioDescription')."</h3>";
echo "<h3>".get_lang('CompilatioDescription')."</h3>";
echo "<b>"
.get_lang('compilatioQuota')
.get_lang('CompilatioQuota')
.":"
." </b><br>"
.get_lang('compilatioCredit')
.": "
.$quotas->usedCredits
.get_lang('compilatioOn')
.$quotas->credits;
.sprintf(get_lang('CompilatioCreditXOnY'), $quotas->usedCredits, $quotas->credits);
?>
<br><br>
@ -35,13 +31,13 @@ if (!isset($_GET['action'])) {
</form>
<?php
} else {
echo get_lang('compilatioConnectionTestSoap')."<br>";
echo "1) ".get_lang('compilatioServerConnection')."<br>";
echo get_lang('CompilatioConnectionTestSoap')."<br>";
echo "1) ".get_lang('CompilatioServerConnection')."<br>";
$compilatio = new Compilatio();
if ($compilatio) {
echo get_lang('compilatioConnectionAccomplished')."<br>";
echo "2) ".get_lang('compilatioSendTextToServer')."<br>";
$text = get_lang('compilatioTestSendText').$compilatio->getKey();
echo get_lang('CompilatioConnectionSuccessful')."<br>";
echo "2) ".get_lang('CompilatioSendTextToServer')."<br>";
$text = sprintf(get_lang('CompilatioTextSendingTestKeyX'), $compilatio->getKey());
$id_compi = $compilatio->SendDoc(
'Doc de test',
'test',
@ -50,13 +46,14 @@ if (!isset($_GET['action'])) {
$text
);
if (Compilatio::isMd5($id_compi)) {
echo get_lang('compilatioSuccessfulTransfer')."<br>";
echo get_lang('CompilatioSuccessfulTransfer')."<br>";
} else {
echo get_lang('compilatioFailedTransfer')."<br>";
echo get_lang('CompilatioFailedTransfer')."<br>";
echo get_lang('CompilatioParamVerification')."<br>";
}
} else {
echo get_lang('compilatioNotConnection')."<br>";
echo get_lang('compilatioParamVerification')."<br>";
echo get_lang('CompilatioNoConnection')."<br>";
echo get_lang('CompilatioParamVerification')."<br>";
}
}
?>

@ -227,6 +227,7 @@ $form_search = new FormValidator(
$form_search->addHidden('from', Security::remove_XSS($from));
$form_search->addHidden('session_id', $sessionId);
$form_search->addHidden('id_session', $sessionId);
$form_search->addHidden('cidReq', $courseCode);
$form_search->addElement('text', 'user_keyword');
$form_search->addButtonSearch(get_lang('Search users'));
echo Display::toolbarAction(
@ -492,7 +493,7 @@ if ($nbStudents > 0) {
$scoresDistribution[$reducedAverage]++;
}
$scoreStudent = substr($userTracking[5], 0, -1) + substr($userTracking[7], 0, -1);
list($hours, $minutes, $seconds) = preg_split('/:/', $userTracking[4]);
[$hours, $minutes, $seconds] = preg_split('/:/', $userTracking[4]);
$minutes = round((3600 * $hours + 60 * $minutes + $seconds) / 60);
$certificate = false;
@ -532,6 +533,7 @@ if ($nbStudents > 0) {
$html .= Display::page_subheader2(get_lang('Learners list'));
$bestScoreLabel = get_lang('Score').' - '.get_lang('BestAttempt');
if ($nbStudents > 0) {
$mainForm = new FormValidator(
'filter',
@ -621,33 +623,34 @@ if ($nbStudents > 0) {
$parameters['id_session'] = $sessionId;
$parameters['from'] = isset($_GET['myspace']) ? Security::remove_XSS($_GET['myspace']) : null;
$headerCounter = 0;
$headers = [];
// tab of header texts
$table->set_header(0, get_lang('Code'), true);
$headers['official_code'] = get_lang('Code');
$table->set_header($headerCounter++, get_lang('OfficialCode'), true);
$headers['official_code'] = get_lang('OfficialCode');
if ($sortByFirstName) {
$table->set_header(1, get_lang('First name'), true);
$table->set_header(2, get_lang('Last name'), true);
$headers['firstname'] = get_lang('First name');
$headers['lastname'] = get_lang('Last name');
$table->set_header($headerCounter++, get_lang('FirstName'), true);
$table->set_header($headerCounter++, get_lang('LastName'), true);
$headers['firstname'] = get_lang('FirstName');
$headers['lastname'] = get_lang('LastName');
} else {
$table->set_header(1, get_lang('Last name'), true);
$table->set_header(2, get_lang('First name'), true);
$headers['lastname'] = get_lang('Last name');
$headers['firstname'] = get_lang('First name');
$table->set_header($headerCounter++, get_lang('LastName'), true);
$table->set_header($headerCounter++, get_lang('FirstName'), true);
$headers['lastname'] = get_lang('LastName');
$headers['firstname'] = get_lang('FirstName');
}
$table->set_header(3, get_lang('Login'), false);
$table->set_header($headerCounter++, get_lang('Login'), false);
$headers['login'] = get_lang('Login');
$table->set_header(
4,
$headerCounter++,
get_lang('TrainingTime').'&nbsp;'.
Display::return_icon('info3.gif', get_lang('CourseTimeInfo'), [], ICON_SIZE_TINY),
false
);
$headers['training_time'] = get_lang('TrainingTime');
$table->set_header(
5,
$headerCounter++,
get_lang('CourseProgress').'&nbsp;'.
Display::return_icon('info3.gif', get_lang('ScormAndLPProgressTotalAverage'), [], ICON_SIZE_TINY),
false
@ -655,46 +658,75 @@ if ($nbStudents > 0) {
$headers['course_progress'] = get_lang('CourseProgress');
$table->set_header(
6,
$headerCounter++,
get_lang('ExerciseProgress').'&nbsp;'.
Display::return_icon('info3.gif', get_lang('ExerciseProgressInfo'), [], ICON_SIZE_TINY),
false
);
$headers['exercise_progress'] = get_lang('ExerciseProgress');
$table->set_header(
7,
$headerCounter++,
get_lang('ExerciseAverage').'&nbsp;'.
Display::return_icon('info3.gif', get_lang('ExerciseAverageInfo'), [], ICON_SIZE_TINY),
false
);
$headers['exercise_average'] = get_lang('ExerciseAverage');
$table->set_header(
8,
$headerCounter++,
get_lang('Score').'&nbsp;'.
Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), [], ICON_SIZE_TINY),
false
);
$headers['score'] = get_lang('Score');
$table->set_header(9, get_lang('Assignments'), false);
$headers['student_publication'] = get_lang('Assignments');
$table->set_header(10, get_lang('Messages'), false);
$table->set_header(
$headerCounter++,
$bestScoreLabel.'&nbsp;'.
Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), [], ICON_SIZE_TINY),
false
);
$headers['score_best'] = $bestScoreLabel;
$addExerciseOption = api_get_configuration_value('add_exercise_best_attempt_in_report');
$exerciseResultHeaders = [];
if (!empty($addExerciseOption) && isset($addExerciseOption['courses']) &&
isset($addExerciseOption['courses'][$courseCode])
) {
foreach ($addExerciseOption['courses'][$courseCode] as $exerciseId) {
$exercise = new Exercise();
$exercise->read($exerciseId);
if ($exercise->iId) {
$title = get_lang('Exercise').': '.$exercise->get_formated_title();
$table->set_header(
$headerCounter++,
$title,
false
);
$exerciseResultHeaders[] = $title;
$headers['exercise_'.$exercise->iId] = $title;
}
}
}
$table->set_header($headerCounter++, get_lang('Student_publication'), false);
$headers['student_publication'] = get_lang('Student_publication');
$table->set_header($headerCounter++, get_lang('Messages'), false);
$headers['messages'] = get_lang('Messages');
$table->set_header(11, get_lang('Classes'));
$headers['clasess'] = get_lang('Classes');
$table->set_header($headerCounter++, get_lang('Classes'));
$headers['classes'] = get_lang('Classes');
if (empty($sessionId)) {
$table->set_header(12, get_lang('Survey'), false);
$table->set_header($headerCounter++, get_lang('Survey'), false);
$headers['survey'] = get_lang('Survey');
} else {
$table->set_header(12, get_lang('RegisteredDate'), false);
$table->set_header($headerCounter++, get_lang('RegisteredDate'), false);
$headers['registered_at'] = get_lang('RegisteredDate');
}
$table->set_header(13, get_lang('FirstLoginInCourse'), false);
$table->set_header($headerCounter++, get_lang('FirstLoginInCourse'), false);
$headers['first_login'] = get_lang('FirstLoginInCourse');
$table->set_header(14, get_lang('LatestLoginInCourse'), false);
$table->set_header($headerCounter++, get_lang('LatestLoginInCourse'), false);
$headers['latest_login'] = get_lang('LatestLoginInCourse');
$counter = 15;
if ('true' === api_get_setting('show_email_addresses')) {
$counter = $headerCounter;
if (api_get_setting('show_email_addresses') === 'true') {
$table->set_header($counter, get_lang('Email'), false);
$headers['email'] = get_lang('Email');
$counter++;
@ -750,7 +782,7 @@ if ($nbStudents > 0) {
$groupContent = '';
echo Display::panel($html, $titleSession);
$groupTable = new HTML_Table(['class' => 'table table-bordered data_table']);
$groupTable = new HTML_Table(['class' => 'table table-hover table-striped table-bordered data_table']);
$column = 0;
$groupTable->setHeaderContents(0, $column++, get_lang('Name'));
$groupTable->setHeaderContents(0, $column++, get_lang('TrainingTime'));
@ -891,7 +923,6 @@ if (!empty($groupList)) {
$sessionId
);
$averageTime = null;
$time = null;
if (!empty($timeInSeconds)) {
$time = api_time_to_hms($timeInSeconds);
$averageTime = $timeInSeconds / $nbStudents;
@ -973,7 +1004,13 @@ if ($export_csv) {
$csv_headers[] = get_lang('Exercise progress');
$csv_headers[] = get_lang('Exercise average');
$csv_headers[] = get_lang('Score');
$csv_headers[] = get_lang('Assignments');
$csv_headers[] = $bestScoreLabel;
if (!empty($exerciseResultHeaders)) {
foreach ($exerciseResultHeaders as $exerciseLabel) {
$csv_headers[] = $exerciseLabel;
}
}
$csv_headers[] = get_lang('Student_publication');
$csv_headers[] = get_lang('Messages');
if (empty($sessionId)) {

@ -130,7 +130,8 @@ if (!$exportToXLS) {
echo '<h3>'.sprintf(get_lang('Filtering with score %s'), $filter_score).'%</h3>';
}
$html = '<table class="data_table">';
$html = '<div class="table-responsive">';
$html .= '<table class="table table-hover table-striped data_table">';
if ($global) {
$html .= '<tr>';
$html .= '<th>'.get_lang('Courses').'</th>';
@ -340,6 +341,7 @@ if (!empty($courseList) && is_array($courseList)) {
}
$html .= '</table>';
$html .= '</div>';
if (!$exportToXLS) {
echo $html;

@ -2,9 +2,6 @@
/* For licensing terms, see /license.txt */
/**
* Report.
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';

@ -41,6 +41,7 @@ $actionsRight = '';
$usergroup = new UserGroup();
$actions = '';
$sessionId = api_get_session_id();
if (api_is_allowed_to_edit()) {
if ('registered' === $type) {
$actionsLeft .= '<a href="class.php?'.api_get_cidreq().'&type=not_registered">'.
@ -82,7 +83,7 @@ if (api_is_allowed_to_edit()) {
switch ($action) {
case 'add_class_to_course':
$id = $_GET['id'];
if (!empty($id)) {
if (!empty($id) && $sessionId == 0) {
$usergroup->subscribe_courses_to_usergroup(
$id,
[api_get_course_int_id()],
@ -91,6 +92,12 @@ if (api_is_allowed_to_edit()) {
Display::addFlash(Display::return_message(get_lang('Added')));
header('Location: class.php?'.api_get_cidreq().'&type=registered');
exit;
} elseif ($sessionId != 0) {
/* To suscribe session*/
$usergroup->subscribe_sessions_to_usergroup($id, [$sessionId]);
Display::addFlash(Display::return_message(get_lang('Added')));
header('Location: class.php?'.api_get_cidreq().'&type=registered');
exit;
}
break;
case 'remove_class_from_course':
@ -98,9 +105,20 @@ if (api_is_allowed_to_edit()) {
if (!empty($id)) {
$usergroup->unsubscribe_courses_from_usergroup(
$id,
[api_get_course_int_id()]
[api_get_course_int_id()],
$sessionId
);
Display::addFlash(Display::return_message(get_lang('Deleted')));
$user_list = $usergroup->get_users_by_usergroup($id);
if (!empty($user_list)) {
foreach ($user_list as $user_id) {
SessionManager::unsubscribe_user_from_session($id, $user_id);
}
}
Database::delete(
$usergroup->usergroup_rel_session_table,
['usergroup_id = ? AND session_id = ?' => [$id, $sessionId]]
);
}
break;
}
@ -120,7 +138,8 @@ $columns = [
// Column config
$columnModel = [
['name' => 'name',
[
'name' => 'name',
'index' => 'name',
'width' => '35',
'align' => 'left',

@ -216,7 +216,7 @@ if ('true' === $allowTutors) {
<?php
echo Display::page_subheader(get_lang('Course list').$url); ?>
<!--List of courses -->
<table class="data_table">
<table class="table table-hover table-striped data_table">
<tr>
<th width="35%"><?php echo get_lang('Course title'); ?></th>
<th width="30%"><?php echo get_lang('Course coach'); ?></th>
@ -295,7 +295,7 @@ if ('true' === $allowTutors) {
<?php
echo Display::page_subheader(get_lang('User list').$url); ?>
<!--List of users -->
<table class="data_table">
<table class="table table-hover table-striped data_table">
<tr>
<th>
<?php echo get_lang('User'); ?>

@ -36,13 +36,22 @@ $_user = api_get_user_info();
$courseCode = $course_info['code'];
$courseId = $course_info['real_id'];
$type = isset($_REQUEST['type']) ? (int) $_REQUEST['type'] : STUDENT;
$canEditUsers = 'true' == api_get_setting('allow_user_course_subscription_by_course_admin') || api_is_platform_admin();
$canEditUsers = api_get_setting('allow_user_course_subscription_by_course_admin') === 'true' || api_is_platform_admin();
$canEdit = api_is_allowed_to_edit(null, true);
$canRead = api_is_allowed_to_edit(null, true) || api_is_coach();
// Can't auto unregister from a session
if (!empty($sessionId)) {
$course_info['unsubscribe'] = 0;
}
$disableUsers = 3 === (int) $course_info['visibility'] &&
api_get_configuration_value('disable_change_user_visibility_for_public_courses');
if (false === $canEdit && $disableUsers) {
api_not_allowed(true);
}
/* Un registering a user section */
if (api_is_allowed_to_edit(null, true)) {
if (isset($_POST['action'])) {
@ -67,8 +76,6 @@ $extraField = new ExtraField('user');
$extraFields = $extraField->get_all(['filter = ?' => 1]);
$user_image_pdf_size = 80;
$canEdit = api_is_allowed_to_edit(null, true);
$canRead = api_is_allowed_to_edit(null, true) || api_is_coach();
if (isset($_GET['action'])) {
switch ($_GET['action']) {

Loading…
Cancel
Save