Skip to content

Commit 0654537

Browse files
committed
Merge branch '1.11.x' of github.com:chamilo/chamilo-lms into 1.11.x
2 parents 5393257 + 20ec8e7 commit 0654537

File tree

4 files changed

+72
-15
lines changed

4 files changed

+72
-15
lines changed

main/inc/lib/banner.lib.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,22 @@ function get_tabs($courseId = null)
8989
$navigation['session_my_space']['key'] = 'my-space';
9090
$navigation['session_my_space']['icon'] = 'my-space.png';
9191
} else {
92-
$navigation['session_my_progress']['url'] = api_get_path(WEB_CODE_PATH);
93-
// Link to my progress
94-
switch (api_get_setting('gamification_mode')) {
95-
case 1:
96-
$navigation['session_my_progress']['url'] .= 'gamification/my_progress.php';
97-
break;
98-
default:
99-
$navigation['session_my_progress']['url'] .= 'auth/my_progress.php';
100-
}
92+
$hideMyProgressTab = api_get_configuration_value('hide_my_progress_tab');
93+
if (true !== $hideMyProgressTab) {
94+
$navigation['session_my_progress']['url'] = api_get_path(WEB_CODE_PATH);
95+
// Link to my progress
96+
switch (api_get_setting('gamification_mode')) {
97+
case 1:
98+
$navigation['session_my_progress']['url'] .= 'gamification/my_progress.php';
99+
break;
100+
default:
101+
$navigation['session_my_progress']['url'] .= 'auth/my_progress.php';
102+
}
101103

102-
$navigation['session_my_progress']['title'] = get_lang('MyProgress');
103-
$navigation['session_my_progress']['key'] = 'my-progress';
104-
$navigation['session_my_progress']['icon'] = 'my-progress.png';
104+
$navigation['session_my_progress']['title'] = get_lang('MyProgress');
105+
$navigation['session_my_progress']['key'] = 'my-progress';
106+
$navigation['session_my_progress']['icon'] = 'my-progress.png';
107+
}
105108
}
106109
}
107110

main/inc/lib/message.lib.php

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3049,6 +3049,57 @@ public static function getUsersThatHadConversationWithUser($userId, $startDate =
30493049
return $userList;
30503050
}
30513051

3052+
/**
3053+
* Retrieves a list of users with whom the specified user has exchanged messages within an optional date range.
3054+
*
3055+
* @param int $userId The user ID for whom to retrieve message exchange.
3056+
* @param string|null $startDate Start date to filter the messages (optional).
3057+
* @param string|null $endDate End date to filter the messages (optional).
3058+
*
3059+
* @return array Array of user information for each user with whom the specified user has exchanged messages.
3060+
*/
3061+
public static function getMessageExchangeWithUser($userId, $startDate = null, $endDate = null)
3062+
{
3063+
$messagesTable = Database::get_main_table(TABLE_MESSAGE);
3064+
$userId = (int) $userId;
3065+
3066+
if ($startDate !== null) {
3067+
$startDate = Database::escape_string($startDate);
3068+
}
3069+
if ($endDate !== null) {
3070+
$endDate = Database::escape_string($endDate);
3071+
}
3072+
3073+
$sql = "SELECT DISTINCT user_sender_id AS user_id
3074+
FROM $messagesTable
3075+
WHERE user_receiver_id = $userId" .
3076+
($startDate ? " AND send_date >= '$startDate'" : "") .
3077+
($endDate ? " AND send_date <= '$endDate'" : "") .
3078+
" UNION
3079+
SELECT DISTINCT user_receiver_id
3080+
FROM $messagesTable
3081+
WHERE user_sender_id = $userId" .
3082+
($startDate ? " AND send_date >= '$startDate'" : "") .
3083+
($endDate ? " AND send_date <= '$endDate'" : "");
3084+
3085+
$result = Database::query($sql);
3086+
$users = Database::store_result($result);
3087+
3088+
$userList = [];
3089+
foreach ($users as $userData) {
3090+
$userId = $userData['user_id'];
3091+
if (empty($userId)) {
3092+
continue;
3093+
}
3094+
$userInfo = api_get_user_info($userId);
3095+
if ($userInfo) {
3096+
$userList[$userId] = $userInfo;
3097+
}
3098+
}
3099+
3100+
return $userList;
3101+
}
3102+
30523103
/**
30533104
* @param int $userId
30543105
* @param int $otherUserId

main/install/configuration.dist.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,9 @@
990990
// Block access to any user to "my progress" page
991991
//$_configuration['block_my_progress_page'] = false;
992992

993+
// Hides the "my progress" tab from the navigation menu
994+
//$_configuration['hide_my_progress_tab'] = false;
995+
993996
// Add user extra fields in report: main/mySpace/exercise_category_report.php
994997
//$_configuration['exercise_category_report_user_extra_fields'] = ['fields' => ['skype', 'rssfeeds']];
995998

main/mySpace/myStudents.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2405,11 +2405,11 @@ function ($hookHeader) {
24052405
$allow = api_get_configuration_value('allow_user_message_tracking');
24062406
if ($allow && (api_is_drh() || api_is_platform_admin())) {
24072407
if ($filterMessages) {
2408-
$users = MessageManager::getUsersThatHadConversationWithUser($student_id, $coachAccessStartDate, $coachAccessEndDate);
2408+
$users = MessageManager::getMessageExchangeWithUser($student_id, $coachAccessStartDate, $coachAccessEndDate);
24092409
} else {
2410-
$users = MessageManager::getUsersThatHadConversationWithUser($student_id);
2410+
$users = MessageManager::getMessageExchangeWithUser($student_id);
24112411
}
2412-
$users = MessageManager::getUsersThatHadConversationWithUser($student_id);
2412+
24132413
echo Display::page_subheader2(get_lang('MessageTracking'));
24142414

24152415
$table = new HTML_Table(['class' => 'table']);

0 commit comments

Comments
 (0)