Merge branch '1.10.x' of github.com:chamilo/chamilo-lms into 1.10.x

1.10.x
Julio Montoya 9 years ago
commit 2462c6ca30
  1. 12
      main/group/group_space.php
  2. 1
      main/inc/lib/api.lib.php
  3. 14
      main/inc/lib/social.lib.php
  4. 4
      main/install/data.sql
  5. 25
      main/template/default/social/user_block.tpl

@ -401,7 +401,7 @@ function get_group_user_data($from, $number_of_items, $column, $direction)
// Query
if (api_get_setting('show_email_addresses') == 'true') {
$sql = "SELECT user.user_id AS col0,
$sql = "SELECT user.id AS col0,
".(api_is_western_name_order() ?
"user.firstname AS col1,
user.lastname AS col2,"
@ -411,14 +411,14 @@ function get_group_user_data($from, $number_of_items, $column, $direction)
)."
user.email AS col3
FROM ".$table_user." user, ".$table_group_user." group_rel_user
WHERE group_rel_user.c_id = $course_id AND group_rel_user.user_id = user.user_id
WHERE group_rel_user.c_id = $course_id AND group_rel_user.user_id = user.id
AND group_rel_user.group_id = '".Database::escape_string($current_group['id'])."'";
$sql .= " ORDER BY col$column $direction ";
$sql .= " LIMIT $from,$number_of_items";
} else {
if (api_is_allowed_to_edit()) {
$sql = "SELECT DISTINCT
u.user_id AS col0,
u.id AS col0,
".(api_is_western_name_order() ?
"u.firstname AS col1,
u.lastname AS col2,"
@ -427,13 +427,13 @@ function get_group_user_data($from, $number_of_items, $column, $direction)
u.firstname AS col2,"
)."
u.email AS col3
FROM ".$table_user." u INNER JOIN ".$table_group_user." gu ON (gu.user_id = u.user_id) AND gu.c_id = $course_id
FROM ".$table_user." u INNER JOIN ".$table_group_user." gu ON (gu.user_id = u.id) AND gu.c_id = $course_id
WHERE gu.group_id = '".Database::escape_string($current_group['id'])."'";
$sql .= " ORDER BY col$column $direction ";
$sql .= " LIMIT $from,$number_of_items";
} else {
$sql = "SELECT DISTINCT
user.user_id AS col0,
user.id AS col0,
". (api_is_western_name_order() ?
"user.firstname AS col1,
user.lastname AS col2 "
@ -442,7 +442,7 @@ function get_group_user_data($from, $number_of_items, $column, $direction)
user.firstname AS col2 "
)."
FROM ".$table_user." user, ".$table_group_user." group_rel_user
WHERE group_rel_user.c_id = $course_id AND group_rel_user.user_id = user.user_id
WHERE group_rel_user.c_id = $course_id AND group_rel_user.user_id = user.id
AND group_rel_user.group_id = '".Database::escape_string($current_group['id'])."'";
$sql .= " ORDER BY col$column $direction ";
$sql .= " LIMIT $from,$number_of_items";

@ -1444,6 +1444,7 @@ function _api_format_user($user, $add_password = false)
$result['email'] = isset($user['mail'])? $user['mail'] : null;
}
$user_id = intval($user['user_id']);
// Maintain the user_id index for backwards compatibility
$result['user_id'] = $result['id'] = $user_id;
$saveUserLastLogin = api_get_configuration_value('save_user_last_login');

@ -1649,6 +1649,10 @@ class SocialManager extends UserManager
return '';
}
$currentUserId = api_get_user_id();
$userId = intval($userId);
$userRelationType = 0;
$socialAvatarBlock = SocialManager::show_social_avatar_block(
$groupBlock,
$groupId,
@ -1656,8 +1660,14 @@ class SocialManager extends UserManager
);
$profileEditionLink = null;
if (api_get_user_id() == $userId) {
if ($currentUserId === $userId) {
$profileEditionLink = Display::getProfileEditionLink($userId);
} else {
$userRelationType = SocialManager::get_relation_between_contacts(
$currentUserId,
$userId
);
}
$vCardUserLink = Display::getVCardUserLink($userId);
@ -1684,6 +1694,8 @@ class SocialManager extends UserManager
}
$chatEnabled = api_is_global_chat_enabled();
$template->assign('chat_enabled', $chatEnabled);
$template->assign('user_relation', $userRelationType);
$template->assign('user_relation_type_friend', USER_RELATION_TYPE_FRIEND);
$templateName = $template->get_template('social/user_block.tpl');
if (in_array($groupBlock, ['groups', 'group_edit', 'member_list'])) {

@ -775,11 +775,9 @@ INSERT INTO extra_field_options (field_id, option_value, display_text, option_or
INSERT INTO access_url(url, description, active, created_by) VALUES ('http://localhost/',' ',1,1);
-- Adding admin to the first portal
INSERT INTO access_url_rel_user VALUES(1, 1);
-- INSERT INTO access_url_rel_user VALUES(1, 1);
-- Adding the platform templates
-- Adding the platform templates
INSERT INTO system_template (title, comment, image, content) VALUES
('TemplateTitleCourseTitle', 'TemplateTitleCourseTitleDescription', 'coursetitle.gif', '
<head>

@ -32,20 +32,19 @@
</li>
{% endif %}
{% if chat_enabled == 1 %}
<li class="item">
{% if user.id == _u.id %}
<img src="{{ "online.png" | icon }}" alt="{{ "Online" | get_lang }}">
{{ "Chat" | get_lang }} ({{ "Online" | get_lang }})
{% elseif user.user_is_online_in_chat != 0 %}
<a onclick="javascript:chatWith('{{ user.id }}', '{{ user.complete_name }}', '{{ user.user_is_online }}','{{ user.avatar_small }}')" href="javascript:void(0);">
<img src="{{ "online.png" | icon }}" alt="{{ "Online" | get_lang }}">
{{ "Chat" | get_lang }} ({{ "Online" | get_lang }})
</a>
{% else %}
<img src="{{ "offline.png" | icon }}" alt="{{ "Online" | get_lang }}">
{{ "Chat" | get_lang }} ({{ "Offline" | get_lang }})
{% if user.user_is_online_in_chat != 0 %}
{% if user_relation == user_relation_type_friend %}
<li class="item">
<a onclick="javascript:chatWith('{{ user.id }}', '{{ user.complete_name }}', '{{ user.user_is_online }}','{{ user.avatar_small }}')" href="javascript:void(0);">
<img src="{{ "online.png" | icon }}" alt="{{ "Online" | get_lang }}">
{{ "Chat" | get_lang }} ({{ "Online" | get_lang }})
</a>
</li>
{# else #}
{# <img src="{{ "offline.png" | icon }}" alt="{{ "Online" | get_lang }}"> #}
{# {{ "Chat" | get_lang }} ({{ "Offline" | get_lang }}) #}
{% endif %}
</li>
{% endif %}
{% endif %}
{% if not profile_edition_link is empty %}

Loading…
Cancel
Save