Update from 1.11.x

pull/3706/head
Julio Montoya 4 years ago
parent 47d563a183
commit 9c9267348d
  1. 1
      public/main/glossary/index.php
  2. 5
      public/main/group/group_category.php
  3. 7
      public/main/inc/ajax/sequence.ajax.php
  4. 40
      public/main/inc/ajax/user_manager.ajax.php
  5. 2
      public/main/inc/lib/export.lib.inc.php
  6. 4
      public/main/inc/lib/groupmanager.lib.php
  7. 7
      public/main/inc/lib/message.lib.php
  8. 2
      public/main/inc/lib/plugin.lib.php
  9. 6
      public/main/inc/lib/sessionmanager.lib.php
  10. 8
      public/main/inc/lib/webservices/Rest.php

@ -13,6 +13,7 @@ require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_GLOSSARY;
// Notification for unauthorized people.
$this_section = SECTION_COURSES;
api_protect_course_script(true);
// Additional javascripts.

@ -9,10 +9,6 @@ $current_course_tool = TOOL_GROUP;
// Notice for unauthorized people.
api_protect_course_script(true);
if ('false' == api_get_setting('allow_group_categories')) {
api_not_allowed(true);
}
$sessionId = api_get_session_id();
if (!api_is_allowed_to_edit(false, true) ||
@ -297,6 +293,7 @@ $group = [
$form->createElement('radio', 'announcements_state', get_lang('Announcements'), get_lang('Not available'), GroupManager::TOOL_NOT_AVAILABLE),
$form->createElement('radio', 'announcements_state', null, get_lang('Public access (access authorized to any member of the course)'), GroupManager::TOOL_PUBLIC),
$form->createElement('radio', 'announcements_state', null, get_lang('Private access (access authorized to group members only)'), GroupManager::TOOL_PRIVATE),
$form->createElement('radio', 'announcements_state', null, get_lang('PrivateBetweenUsers'), GroupManager::TOOL_PRIVATE_BETWEEN_USERS),
];
$form->addGroup(
$group,

@ -401,8 +401,11 @@ switch ($action) {
break;
case 'get_requirements':
$sessionId = isset($_REQUEST['sid']) ? (int) $_REQUEST['sid'] : 0;
$userId = api_get_user_id();
$resourceName = '';
$template = '';
switch ($type) {
case SequenceResource::SESSION_TYPE:
$resourceData = api_get_session_info($id);
@ -416,7 +419,7 @@ switch ($action) {
break;
}
if (empty($resourceData)) {
if (empty($resourceData) || empty($template)) {
exit;
}
@ -426,7 +429,7 @@ switch ($action) {
exit;
}
$sequenceList = $sequenceResourceRepository->checkRequirementsForUser($sequences, $type, $userId);
$sequenceList = $sequenceResourceRepository->checkRequirementsForUser($sequences, $type, $userId, $sessionId);
$allowSubscription = $sequenceResourceRepository->checkSequenceAreCompleted($sequenceList);
$view = new Template(null, false, false, false, false, false);

@ -39,33 +39,41 @@ switch ($action) {
$user_info = api_get_user_info($_REQUEST['user_id']);
$isAnonymous = api_is_anonymous();
if ($isAnonymous && $courseId) {
if ('false' === api_get_setting('course_catalog_published')) {
break;
}
$coursesNotInCatalog = CoursesAndSessionsCatalog::getCoursesToAvoid();
if (in_array($courseId, $coursesNotInCatalog)) {
break;
}
}
echo '<div class="row">';
echo '<div class="col-sm-5">';
echo '<div class="thumbnail">';
echo '<img src="'.$user_info['avatar'].'" /> ';
echo Display::img($user_info['avatar'], $user_info['complete_name']);
echo '</div>';
echo '</div>';
echo '<div class="col-sm-7">';
if ('false' == api_get_setting('show_email_addresses')) {
if ($isAnonymous || api_get_setting('show_email_addresses') == 'false') {
$user_info['mail'] = ' ';
} else {
$user_info['mail'] = ' '.$user_info['mail'].' ';
}
if ($isAnonymous) {
$user_info['mail'] = ' ';
}
$userData = '<h3>'.$user_info['complete_name'].'</h3>'
.PHP_EOL
.$user_info['mail']
.PHP_EOL
.$user_info['official_code'];
$userData = '<h3>'.$user_info['complete_name'].'</h3>'.$user_info['mail'].$user_info['official_code'];
if ($isAnonymous) {
// Only allow anonymous users to see user popup if the popup user
// is a teacher (which might be necessary to illustrate a course)
if (COURSEMANAGER === $user_info['status']) {
if ((int) $user_info['status'] === COURSEMANAGER) {
echo $userData;
} else {
echo '<h3>-</h3>';
}
} else {
echo Display::url(
@ -76,7 +84,15 @@ switch ($action) {
echo '</div>';
echo '</div>';
$url = api_get_path(WEB_AJAX_PATH).'message.ajax.php?a=send_message&user_id='.$user_info['user_id'].'&course_id='.$courseId.'&session_id='.$sessionId;
$url = api_get_path(WEB_AJAX_PATH).'message.ajax.php?'
.http_build_query(
[
'a' => 'send_message',
'user_id' => $user_info['user_id'],
'course_id' => $courseId,
'session_id' => $sessionId,
]
);
if (false === $isAnonymous &&
'true' == api_get_setting('allow_message_tool')

@ -188,7 +188,7 @@ class Export
unset($data[0]);
$header_attributes = isset($params['header_attributes']) ? $params['header_attributes'] : [];
$table = new HTML_Table(['class' => 'data_table', 'repeat_header' => '1']);
$table = new HTML_Table(['class' => 'table table-hover table-striped data_table', 'repeat_header' => '1']);
$row = 0;
$column = 0;
foreach ($headers as $header) {

@ -99,6 +99,7 @@ class GroupManager
* @param int $status group status
* @param int $sessionId
* @param bool $getCount
* @param bool $notInGroup Get groups not in a category
*
* @return array an array with all information about the groups
*/
@ -180,6 +181,9 @@ class GroupManager
}
//$sql .= " AND g.c_id = $course_id ";
if ($notInGroup) {
$sql .= " AND (g.category_id IS NULL OR g.category_id = 0) ";
}
if (!empty($session_condition)) {
$sql .= $session_condition;

@ -439,6 +439,7 @@ class MessageManager
/**
* Sends a message to a user/group.
*
* @param int $receiverUserId
* @param string $subject
* @param string $content
* @param array $attachments files array($_FILES) (optional)
@ -1349,6 +1350,9 @@ class MessageManager
$table = Database::get_main_table(TABLE_MESSAGE);
if (empty($type)) {
return '';
}
switch ($type) {
case self::MESSAGE_TYPE_OUTBOX:
$status = MESSAGE_STATUS_OUTBOX;
@ -2314,9 +2318,8 @@ class MessageManager
}
$actions = ['reply', 'mark_as_unread', 'mark_as_read', 'forward', 'delete'];
$html = self::getMessageGrid(self::MESSAGE_TYPE_INBOX, $keyword, $actions);
return $html;
return self::getMessageGrid(self::MESSAGE_TYPE_INBOX, $keyword, $actions);
}
/**

@ -742,7 +742,7 @@ class AppPlugin
if (false === $obj->validateCourseSetting($setting['name'])) {
continue;
}
if ('checkbox' != $setting['type']) {
if ('checkbox' !== $setting['type']) {
$form->addElement($setting['type'], $setting['name'], $obj->get_lang($setting['name']));
} else {
$element = &$form->createElement(

@ -2797,14 +2797,14 @@ class SessionManager
'qualification' => $work['qualification'],
'allow_text_assignment' => $work['allow_text_assignment'],
];
addDir(
// @todo add addDir with resources
/*addDir(
$values,
api_get_user_id(),
$courseInfo,
0,
$sessionId
);
);*/
}
}
// If the course isn't subscribed yet

@ -1548,12 +1548,15 @@ class Rest extends WebService
{
$sessionId = $params['id_session'];
$courseList = $params['list_courses'];
$importAssignments = isset($params['import_assignments']) ? 1 === (int) $params['import_assignments'] : false;
$result = SessionManager::add_courses_to_session(
$sessionId,
$courseList,
true,
false
false,
false,
$importAssignments
);
if ($result) {
@ -1561,13 +1564,12 @@ class Rest extends WebService
'status' => $result,
'message' => get_lang('Updated'),
];
} else {
}
return [
'status' => $result,
'message' => get_lang('ErrorOccurred'),
];
}
}
/**
* @return array

Loading…
Cancel
Save