Tracking: Show register/teacher for teachers when student_follow_page_add_LP_subscription_info is enabled - refs BT#18671

pull/3888/head
Angel Fernando Quiroz Campos 5 years ago
parent 517abe3e03
commit 6121789553
  1. 7
      main/auth/my_progress.php
  2. 25
      main/inc/lib/StudentFollowPage.php
  3. 15
      main/inc/lib/tracking.lib.php

@ -43,6 +43,8 @@ $allowCareerUser = api_get_configuration_value('allow_career_users');
$showGraph = false === api_get_configuration_value('hide_session_graph_in_my_progress');
$isAllowedToEdit = api_is_allowed_to_edit();
if (!empty($courseUserList)) {
$items = MySpace::get_connections_from_course_list(
$user_id,
@ -100,11 +102,12 @@ if ($showAllSessionCourses && !empty($sessionId) && empty($courseCode)) {
$content .= Tracking::show_course_detail(
$user_id,
$userSessionCourse['course_code'],
$sessionId
$sessionId,
$isAllowedToEdit
);
}
} else {
$content .= Tracking::show_course_detail($user_id, $courseCode, $sessionId);
$content .= Tracking::show_course_detail($user_id, $courseCode, $sessionId, $isAllowedToEdit);
}
if (!empty($dates)) {

@ -16,7 +16,8 @@ class StudentFollowPage
array $lpInfo,
int $studentId,
int $courseId,
int $sessionId = 0
int $sessionId = 0,
bool $showTeacherName = true
): string {
$em = Database::getManager();
@ -52,7 +53,17 @@ class StudentFollowPage
return '-';
}
return api_convert_and_format_date($itemProperty->getInsertDate(), DATE_TIME_FORMAT_LONG);
$formattedDate = api_convert_and_format_date($itemProperty->getInsertDate(), DATE_TIME_FORMAT_LONG);
if ($showTeacherName) {
$insertUser = $itemProperty->getInsertUser()->getId() !== $studentId
? $itemProperty->getInsertUser()->getCompleteName()
: '-';
return "$insertUser<br>".Display::tag('small', $formattedDate);
}
return $formattedDate;
}
$subscriptionEvent = Event::findUserSubscriptionToCourse($studentId, $courseId, $sessionId);
@ -61,7 +72,15 @@ class StudentFollowPage
return '-';
}
return api_convert_and_format_date($subscriptionEvent['default_date'], DATE_TIME_FORMAT_LONG);
$formattedDate = api_convert_and_format_date($subscriptionEvent['default_date'], DATE_TIME_FORMAT_LONG);
if ($showTeacherName) {
$creator = api_get_user_entity($subscriptionEvent['default_user_id']);
return "{$creator->getCompleteName()}<br>".Display::tag('small', $formattedDate);
}
return $formattedDate;
}
public static function getLpAcquisition(

@ -5456,7 +5456,7 @@ class Tracking
* @param string $course_code
* @param int $session_id
*/
public static function show_course_detail($user_id, $course_code, $session_id): string
public static function show_course_detail($user_id, $course_code, $session_id, $isAllowedToEdit = true): string
{
if (empty($user_id) || empty($course_code)) {
return '';
@ -5476,7 +5476,7 @@ class Tracking
// Show exercise results of invisible exercises? see BT#4091
$quizzesHtml = self::generateQuizzesTable($course_info, $session_id);
// LP table results
$learningPathsHtml = self::generateLearningPathsTable($user, $course_info, $session_id);
$learningPathsHtml = self::generateLearningPathsTable($user, $course_info, $session_id, $isAllowedToEdit);
$skillsHtml = self::displayUserSkills($user_id, $course_info['id'], $session_id);
$toolsHtml = [
@ -7504,8 +7504,12 @@ class Tracking
);
}
private static function generateLearningPathsTable(User $user, array $courseInfo, int $sessionId = 0): string
{
private static function generateLearningPathsTable(
User $user,
array $courseInfo,
int $sessionId = 0,
bool $isAllowedToEdit = true
) : string {
$html = [];
$columnHeaders = [
@ -7687,7 +7691,8 @@ class Tracking
$learnpath,
$user->getId(),
$courseInfo['real_id'],
$sessionId
$sessionId,
$isAllowedToEdit
);
}

Loading…
Cancel
Save