qMerge branch '1.11.x' of https://github.com/chamilo/chamilo-lms into 1.11.x

pull/3888/head
Christian 5 years ago
commit 44251f9d10
  1. 6
      main/admin/user_information.php
  2. 39
      main/auth/my_progress.php
  3. 1
      main/forum/viewthread.php
  4. 6
      main/inc/lib/MyStudents.php
  5. 73
      main/inc/lib/sessionmanager.lib.php
  6. 55
      main/inc/lib/tracking.lib.php
  7. 2
      main/inc/lib/webservices/Rest.php
  8. 3
      main/install/configuration.dist.php
  9. 5
      main/mySpace/myStudents.php
  10. 4
      main/mySpace/student_follow_export.php
  11. 1
      main/template/default/career/diagram_full.tpl
  12. 1
      main/template/default/career/diagram_iframe.tpl

@ -698,11 +698,9 @@ $content = $tpl->fetch($layoutTemplate);
echo $content;
if (api_get_configuration_value('allow_career_users')) {
if (!empty($sessions)) {
foreach ($sessions as $session) {
echo SessionManager::getCareerDiagramPerSession($session['session_id'], $userId);
}
$sessions = array_column($sessions, 'session_id');
echo SessionManager::getCareerDiagramPerSessionList($sessions, $userId);
}
echo Display::page_subheader(get_lang('Careers'), null, 'h3', ['class' => 'section-title']);
echo MyStudents::userCareersTable($userId);
}

@ -41,6 +41,8 @@ $sessionId = isset($_GET['session_id']) ? (int) $_GET['session_id'] : 0;
$courseCode = isset($_GET['course']) ? Security::remove_XSS($_GET['course']) : null;
$allowCareerUser = api_get_configuration_value('allow_career_users');
$showGraph = false === api_get_configuration_value('hide_session_graph_in_my_progress');
if (!empty($courseUserList)) {
$items = MySpace::get_connections_from_course_list(
$user_id,
@ -81,12 +83,19 @@ if (!empty($courseUserList)) {
}
}
$content = Tracking::showUserProgress($user_id, $sessionId);
$content = Tracking::showUserProgress(
$user_id,
$sessionId,
'',
true,
true,
false,
$showGraph
);
$showAllSessionCourses = api_get_configuration_value('my_progress_session_show_all_courses');
if ($showAllSessionCourses && !empty($sessionId) && empty($courseCode)) {
$userSessionCourses = UserManager::get_courses_list_by_session($user_id, $sessionId);
foreach ($userSessionCourses as $userSessionCourse) {
$content .= Tracking::show_course_detail(
$user_id,
@ -102,19 +111,19 @@ if ($showAllSessionCourses && !empty($sessionId) && empty($courseCode)) {
if (!empty($dates)) {
$content .= Display::page_subheader(get_lang('Timeline'));
$content .= '
<div class="row">
<div class="col-md-12">
<div id="my_timeline">
<ul id="dates">'.$dates.'</ul>
<ul id="issues">'.$issues.'</ul>
<div id="grad_left"></div>
<div id="grad_right"></div>
<a href="#" id="prev"></a>
<a href="#" id="next"></a>
</div>
</div>
</div>
';
<div class="row">
<div class="col-md-12">
<div id="my_timeline">
<ul id="dates">'.$dates.'</ul>
<ul id="issues">'.$issues.'</ul>
<div id="grad_left"></div>
<div id="grad_right"></div>
<a href="#" id="prev"></a>
<a href="#" id="next"></a>
</div>
</div>
</div>
';
}
if (api_get_configuration_value('private_messages_about_user_visible_to_user') === true) {

@ -624,6 +624,7 @@ foreach ($posts as $post) {
$post['post_title'] .= Display::tag('div', $titlePost, ['class' => 'post-header']);
// the post body
$post['post_text'] = Security::remove_XSS($post['post_text']);
$post['post_data'] = Display::tag('div', $post['post_text'], ['class' => 'post-body']);
// The check if there is an attachment

@ -16,7 +16,9 @@ class MyStudents
return '';
}
return self::getCareersTable($careers);
$title = Display::page_subheader(get_lang('Careers'), null, 'h3', ['class' => 'section-title']);
return $title.self::getCareersTable($careers);
}
public static function getCareersTable(array $careers): string
@ -52,13 +54,11 @@ class MyStudents
return $table->toHtml();
}
public static function getBlockForSkills(int $studentId, int $courseId, int $sessionId): string
{
$allowAll = api_get_configuration_value('allow_teacher_access_student_skills');
if ($allowAll) {
// Show all skills
return Tracking::displayUserSkills($studentId, 0, 0, true);
}

@ -9660,47 +9660,46 @@ class SessionManager
return $careers;
}
public static function getCareerDiagramPerSession($sessionId, $userId): string
public static function getCareerDiagramPerSessionList($sessionList, $userId)
{
$sessionId = (int) $sessionId;
$userId = (int) $userId;
$visibility = api_get_session_visibility($sessionId, null, false, $userId);
$content = '';
if (SESSION_AVAILABLE === $visibility) {
$careerList = self::getCareersFromSession($sessionId);
if (empty($sessionList) || empty($userId)) {
return '';
}
if (empty($careerList)) {
return '';
$userId = (int) $userId;
$content = Display::page_subheader(get_lang('OngoingTraining'));
$content .= '
<script>
resizeIframe = function(iFrame) {
iFrame.height = iFrame.contentWindow.document.body.scrollHeight + 20;
}
foreach ($careerList as $career) {
$careerUrl = api_get_path(WEB_CODE_PATH).'user/career_diagram.php?iframe=1&career_id='.$career['id'].'&user_id='.$userId;
$content .= '
<iframe
onload="resizeIframe(this)"
style="width:100%;"
border="0"
frameborder="0"
scrolling="no"
src="'.$careerUrl.'"
></iframe>';
}
}
if (!empty($content)) {
$content .= '
<script>
resizeIframe = function(iFrame) {
//iFrame.width = iFrame.contentWindow.document.body.scrollWidth;
iFrame.height = iFrame.contentWindow.document.body.scrollHeight + 20;
</script>
';
$careersAdded = [];
foreach ($sessionList as $sessionId) {
$visibility = api_get_session_visibility($sessionId, null, false, $userId);
if (SESSION_AVAILABLE === $visibility) {
$careerList = self::getCareersFromSession($sessionId);
if (empty($careerList)) {
continue;
}
</script>
';
}
if (!empty($content)) {
$content = Display::page_subheader(get_lang('OngoingTraining')).$content;
foreach ($careerList as $career) {
$careerId = $career['id'];
if (!in_array($careerId, $careersAdded)) {
$careersAdded[] = $careerId;
$careerUrl = api_get_path(WEB_CODE_PATH).'user/career_diagram.php?iframe=1&career_id='.$career['id'].'&user_id='.$userId;
$content .= '
<iframe
onload="resizeIframe(this)"
style="width:100%;"
border="0"
frameborder="0"
scrolling="no"
src="'.$careerUrl.'"
></iframe>';
}
}
}
}
return $content;

@ -4703,7 +4703,8 @@ class Tracking
$extra_params = '',
$show_courses = true,
$showAllSessions = true,
$returnArray = false
$returnArray = false,
$showGraph = true
) {
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
@ -5004,6 +5005,7 @@ class Tracking
$allowCareerUser = api_get_configuration_value('allow_career_users');
// Session list.
$visibleSessions = [];
if (!empty($course_in_session)) {
$main_session_graph = '';
// Load graphics only when calling to an specific session
@ -5011,7 +5013,6 @@ class Tracking
$my_results = [];
$all_exercise_graph_list = [];
$all_exercise_start_time = [];
$allCareers = [];
foreach ($course_in_session as $my_session_id => $session_data) {
$course_list = $session_data['course_list'];
$user_count = count(SessionManager::get_users_by_session($my_session_id));
@ -5021,10 +5022,7 @@ class Tracking
$visibility = api_get_session_visibility($my_session_id, null, false, $user_id);
if (SESSION_AVAILABLE === $visibility) {
$careers = SessionManager::getCareersFromSession($my_session_id);
if (!empty($careers)) {
$allCareers = array_merge($allCareers, $careers);
}
$visibleSessions[] = $my_session_id;
}
foreach ($course_list as $course_data) {
@ -5103,13 +5101,15 @@ class Tracking
$my_results_final[] = $my_results[$key];
$final_all_exercise_graph_list[] = $all_exercise_graph_list[$key];
}
$main_session_graph = '<div class="row"><div class="col-md-10 col-md-offset-1">'
.self::generate_session_exercise_graph(
$final_all_exercise_graph_name_list,
$my_results_final,
$final_all_exercise_graph_list
)
.'</div></div>';
if ($showGraph) {
$main_session_graph = '<div class="row"><div class="col-md-10 col-md-offset-1">'
.self::generate_session_exercise_graph(
$final_all_exercise_graph_name_list,
$my_results_final,
$final_all_exercise_graph_list
)
.'</div></div>';
}
}
$sessionIcon = Display::return_icon('session.png', get_lang('Sessions'));
@ -5209,24 +5209,25 @@ class Tracking
);
}
if ($allowCareerUser && !empty($allCareers)) {
$careers = [];
foreach ($allCareers as $career) {
$careers[$career['id']] = $career;
if ($allowCareerUser) {
$diagrams = '';
if (!empty($visibleSessions)) {
$diagrams .= SessionManager::getCareerDiagramPerSessionList($visibleSessions, $user_id);
}
$title = Display::page_subheader(get_lang('OngoingTraining'));
$html .= $title.MyStudents::getCareersTable($careers);
$html .= $diagrams.MyStudents::userCareersTable($user_id);
}
$html .= Display::div($sessionsTable->toHtml(), ['class' => 'table-responsive']);
$html .= Display::div(
$main_session_graph,
[
'id' => 'session_graph',
'class' => 'chart-session',
]
);
if ($showGraph) {
$html .= Display::div(
$main_session_graph,
[
'id' => 'session_graph',
'class' => 'chart-session',
]
);
}
// Checking selected session.
if (isset($_GET['session_id'])) {

@ -1456,7 +1456,7 @@ class Rest extends WebService
$course_code = CourseManager::get_course_code_from_course_id($course_id);
}
if (CourseManager::subscribeUser($user_id, $course_code, $status)) {
if (CourseManager::subscribeUser($user_id, $course_code, $status, 0, 0, false)) {
return [true];
}

@ -1921,6 +1921,9 @@ ALTER TABLE gradebook_comment ADD CONSTRAINT FK_C3B70763AD3ED51C FOREIGN KEY (gr
// Replace the Chamilo logo URL.
//$_configuration['platform_logo_url'] = 'https://chamilo.org';
// Hides the session graph in the main/auth/my_progress.php page.
//$_configuration['hide_session_graph_in_my_progress'] = true;
// KEEP THIS AT THE END
// -------- Custom DB changes
// Add user activation by confirmation email

@ -946,10 +946,9 @@ echo $content;
// Careers.
if (api_get_configuration_value('allow_career_users')) {
foreach ($courses_in_session as $sId => $courses) {
echo SessionManager::getCareerDiagramPerSession($sId, $student_id);
if (!empty($courses_in_session)) {
echo SessionManager::getCareerDiagramPerSessionList(array_keys($courses_in_session), $student_id);
}
echo Display::page_subheader(get_lang('Careers'), null, 'h3', ['class' => 'section-title']);
echo MyStudents::userCareersTable($student_id);
}

@ -503,10 +503,10 @@ if ($form->validate()) {
$coursesInfo[] = generateHtmlForCourse($studentInfo['id'], $coursesInSessions, $courseId, $sessionId);
}
}
$title = Display::page_subheader(get_lang('Careers'), null, 'h3', ['class' => 'section-title']);
$view = new Template('', false, false, false, true, false, false);
$view->assign('user_info', $studentInfo);
$view->assign('careers', $title.MyStudents::userCareersTable($studentInfo['id']));
$view->assign('careers', MyStudents::userCareersTable($studentInfo['id']));
$view->assign('skills', Tracking::displayUserSkills($studentInfo['id']));
$view->assign('classes', MyStudents::getBlockForClasses($studentInfo['id']));
$view->assign('courses_info', $coursesInfo);

@ -2,5 +2,4 @@
{% block content %}
{% include 'career/diagram.tpl' |get_template %}
{{ content }}
{% endblock %}

@ -2,5 +2,4 @@
{% block body %}
{% include 'career/diagram.tpl' |get_template %}
{{ content }}
{% endblock %}
Loading…
Cancel
Save