Merge remote-tracking branch 'origin/master'

pull/4615/head
Angel Fernando Quiroz Campos 2 years ago
commit f797f35762
  1. 2
      assets/css/app.scss
  2. 6
      assets/css/scorm.scss
  3. 2
      public/main/forum/forumfunction.inc.php
  4. 7
      public/main/forum/viewthread.php
  5. 2
      public/main/gradebook/lib/be/category.class.php
  6. 17
      public/main/inc/lib/course.lib.php
  7. 10
      public/main/inc/lib/display.lib.php
  8. 4
      public/main/inc/lib/notification.lib.php
  9. 26
      public/main/inc/lib/tracking.lib.php
  10. 1
      public/main/lp/learnpathItem.class.php
  11. 6
      public/main/lp/lp_view.php
  12. 1
      src/CoreBundle/Repository/ExtraFieldValuesRepository.php

@ -183,4 +183,4 @@
//@import "~jquery-ui-timepicker-addon/dist/jquery-ui-timepicker-addon.css";
@import "~@fancyapps/fancybox/dist/jquery.fancybox.css";
@import "~timepicker/jquery.timepicker.min.css";
//@import "~jquery-contextmenu/dist/jquery.contextMenu.css";
@import "~qtip2/dist/jquery.qtip.min.css";

@ -718,11 +718,13 @@ body {
bottom: 0;
left: 0;
position: absolute;
top: 60px;
top: 70px;
right: 0;
}
#item-parent-names {
margin: 5px 0px;
}
/* END LP VIEW COLLAPSE */

@ -4887,7 +4887,7 @@ function editAttachedFile($array, $id, $courseId = null)
$setString = substr($setString, 0, strlen($setString) - 2);
$forumAttachmentTable = Database::get_course_table(TABLE_FORUM_ATTACHMENT);
$sql = "UPDATE $forumAttachmentTable
SET $setString WHERE c_id = $courseId AND id = $id";
SET $setString WHERE c_id = $courseId AND iid = $id";
$result = Database::query($sql);
if (false !== $result) {
$affectedRows = Database::affected_rows($result);

@ -309,6 +309,13 @@ if (($current_forum_category &&
) {
// The link should only appear when the user is logged in or when anonymous posts are allowed.
if ($_user['user_id'] || (1 == $forumEntity->getAllowAnonymous() && !$_user['user_id'])) {
// back link inside lp
if ('learnpath' == $origin && !empty($threadId)) {
$actions .= '<a href="'.$forumUrl.'viewforum.php?forum='.$forumId.'&'.api_get_cidreq().'">'
.Display::return_icon('back.png', get_lang('Back to forum'), '', ICON_SIZE_MEDIUM).'</a>';
}
// reply link
if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) {
$actions .= '<a href="'.$forumUrl.'reply.php?'.api_get_cidreq().'&forum='.$forumId.'&thread='

@ -482,6 +482,8 @@ class Category implements GradebookItem
$courseInfo = api_get_course_info($course_code);
if ($courseInfo) {
$sql .= " c_id = '".intval($courseInfo['real_id'])."'";
} else {
$sql .= ' c_id is null ';
}
}

@ -1238,7 +1238,7 @@ class CourseManager
* Return user info array of all users registered in a course
* This only returns the users that are registered in this actual course, not linked courses.
*
* @param string $courseCode
* @param string|null $courseCode Cours code is allowed to be null if we want all users
* @param int $sessionId
* @param string $limit
* @param string $order_by the field to order the users by.
@ -1351,7 +1351,10 @@ class CourseManager
$sessionCondition = " session_course_user.session_id IN ('$sessionIdListToString') ";
}
$courseCondition = " course.id = $courseId";
$courseCondition = " course.id IS NOT NULL ";
if (!empty($courseId)) {
$courseCondition = " course.id = $courseId";
}
if (!empty($courseCodeList)) {
$courseCodeListForSession = array_map(['Database', 'escape_string'], $courseCodeList);
$courseCodeListForSession = implode("','", $courseCodeListForSession);
@ -1565,7 +1568,7 @@ class CourseManager
$users[$row_key]['training_hours'] += Tracking::get_time_spent_on_the_course(
$user['user_id'],
$courseId,
$user['c_id'],
$sessionId
);
@ -1587,7 +1590,7 @@ class CourseManager
$category = Category:: load(
null,
null,
$courseCode,
$user['code'],
null,
null,
$sessionId
@ -1620,7 +1623,7 @@ class CourseManager
$report_info['time'] = api_time_to_hms(
Tracking::get_time_spent_on_the_course(
$user['user_id'],
empty($user['c_id']) ? $courseId : $user['c_id'],
$user['c_id'],
$sessionId
)
);
@ -1628,7 +1631,7 @@ class CourseManager
$category = Category:: load(
null,
null,
$courseCode,
$user['code'],
null,
null,
$sessionId
@ -1638,7 +1641,7 @@ class CourseManager
if (isset($category[0]) && $category[0]->is_certificate_available($user['user_id'])) {
$report_info['certificate'] = Display::label(get_lang('Yes'), 'success');
}
$course = api_get_course_entity($user['c_id']);
$progress = (int) Tracking::get_avg_student_progress(
$user['user_id'],
$course,

@ -2158,11 +2158,17 @@ class Display
return self::url("$icon $text", $url, $attributes);
}
/**
* Generate an HTML "p-toolbar" div element with the given id attribute.
* @param string $id The HTML div's "id" attribute to set
* @param array $contentList Array of left-center-right elements for the toolbar. If only 2 elements are defined, this becomes left-right (no center)
* @return string HTML div for the toolbar
*/
public static function toolbarAction(string $id, array $contentList): string
{
$contentList = array_filter($contentList);
$contentListPurged = array_filter($contentList);
if (empty($contentList)) {
if (empty($contentListPurged)) {
return '';
}

@ -63,8 +63,8 @@ class Notification extends Model
$this->adminName = api_get_setting('siteName');
$this->titlePrefix = '['.api_get_setting('siteName').'] ';
// If no-reply email doesn't exist use the admin name/email
if (empty($this->adminEmail)) {
// If no-reply email doesn't exist or is something '@example.com', use the admin name/email
if (empty($this->adminEmail) || substr($this->adminEmail, -12) === '@example.com') {
$this->adminEmail = api_get_setting('emailAdministrator');
$this->adminName = api_get_person_name(
api_get_setting('administratorName'),

@ -1809,38 +1809,38 @@ class Tracking
/**
* Calculates the time spent on the course.
*
* @param array|int $user_id
* @param array|int $userId
* @param int $courseId
* @param int $sessionId
*
* @return int Time in seconds
*/
public static function get_time_spent_on_the_course(
$user_id,
$userId,
$courseId,
$sessionId = 0
) {
$courseId = (int) $courseId;
if (empty($courseId) || empty($user_id)) {
if (empty($courseId) || empty($userId)) {
return 0;
}
if (self::minimumTimeAvailable($sessionId, $courseId)) {
$courseTime = self::getCalculateTime($user_id, $courseId, $sessionId);
$courseTime = self::getCalculateTime($userId, $courseId, $sessionId);
return isset($courseTime['total_time']) ? $courseTime['total_time'] : 0;
}
$conditionUser = '';
$sessionId = (int) $sessionId;
if (is_array($user_id)) {
$user_id = array_map('intval', $user_id);
$conditionUser = " AND user_id IN (".implode(',', $user_id).") ";
if (is_array($userId)) {
$userId = array_map('intval', $userId);
$conditionUser = " AND user_id IN (".implode(',', $userId).") ";
} else {
if (!empty($user_id)) {
$user_id = (int) $user_id;
$conditionUser = " AND user_id = $user_id ";
if (!empty($userId)) {
$userId = (int) $userId;
$conditionUser = " AND user_id = $userId ";
}
}
@ -2589,6 +2589,7 @@ class Tracking
* course, it will take into account the progress that were not started.
*
* @param int|array $studentId
* @param Course $course The course object
* @param array $lpIdList Limit average to listed lp ids
* @param SessionEntity $session Session id (optional),
* if parameter $sessionId is null(default) it'll return results including
@ -2601,7 +2602,7 @@ class Tracking
*/
public static function get_avg_student_progress(
$studentId,
Course $course,
Course $course = null,
$lpIdList = [],
SessionEntity $session = null,
$returnArray = false,
@ -2611,6 +2612,9 @@ class Tracking
if (empty($studentId)) {
return false;
}
if (empty($course)) {
return false;
}
$repo = Container::getLpRepository();
$qb = $repo->findAllByCourse($course, $session);

@ -96,6 +96,7 @@ class learnpathItem
{
$items_table = Database::get_course_table(TABLE_LP_ITEM);
$id = (int) $id;
$this->courseId = api_get_course_int_id();
if (!empty($id)) {
$sql = "SELECT * FROM $items_table

@ -125,7 +125,7 @@ $allowLpItemTip = false === api_get_configuration_value('hide_accessibility_labe
if ($allowLpItemTip) {
$htmlHeadXtra[] = '<script>
$(function() {
/*$(".scorm_item_normal").qtip({
$(".scorm_item_normal").qtip({
content: {
text: function(event, api) {
var item = $(this);
@ -145,13 +145,13 @@ if ($allowLpItemTip) {
textToShow = content;
api.set("style.classes", "qtip-red qtip-shadow");
}
api.set("content.text", textToShow);
return textToShow;
});
return textToShow;
}
}
});*/
});
});
</script>';
}

@ -104,6 +104,7 @@ class ExtraFieldValuesRepository extends ServiceEntityRepository
$em->persist($extraFieldValues);
} else {
$extraFieldValues->setFieldValue($data);
$em->persist($extraFieldValues);
}
$em->flush();

Loading…
Cancel
Save