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

1.10.x
Yannick Warnier 11 years ago
commit 04c42fe32e
  1. 2
      main/gradebook/gradebook_flatview.php
  2. 33
      main/gradebook/lib/be/exerciselink.class.php
  3. 8
      main/gradebook/lib/fe/linkaddeditform.class.php
  4. 21
      main/gradebook/lib/flatview_data_generator.class.php
  5. 27
      main/inc/lib/display.lib.php
  6. 4
      main/inc/lib/message.lib.php
  7. 29
      main/inc/lib/social.lib.php
  8. 2
      main/messages/inbox.php
  9. 2
      main/messages/new_message.php
  10. 2
      main/messages/outbox.php
  11. 2
      main/messages/view_message.php
  12. 2
      main/social/friends.php
  13. 4
      main/social/groups.php
  14. 2
      main/social/home.php
  15. 2
      main/social/invitations.php
  16. 2
      main/social/myfiles.php
  17. 52
      main/social/profile.php
  18. 2
      main/social/search.php
  19. 44
      main/template/default/social/form_modals.tpl
  20. 3
      main/template/default/social/profile.tpl
  21. 2
      main/template/default/social/user_block.tpl

@ -267,7 +267,7 @@ if (isset($_GET['isStudentView']) && $_GET['isStudentView'] == 'false') {
$simple_search_form
);
// main graph
// Table
$flatviewtable->display();
//@todo load images with jquery
echo '<div id="contentArea" style="text-align: center;" >';

@ -194,15 +194,34 @@ class ExerciseLink extends AbstractLink
in exercice/exercice.php, look for note-query-exe-results marker*/
$session_id = api_get_session_id();
$courseId = $this->getCourseId();
$exercise = new Exercise();
$exercise->read($this->get_ref_id());
if (!$this->is_hp) {
$sql = "SELECT * FROM $tblStats
WHERE
exe_exo_id = ".intval($this->get_ref_id())." AND
orig_lp_id = 0 AND
orig_lp_item_id = 0 AND
status <> 'incomplete' AND
session_id = $session_id";
if ($exercise->exercise_was_added_in_lp == false) {
$sql = "SELECT * FROM $tblStats
WHERE
exe_exo_id = ".intval($this->get_ref_id())." AND
orig_lp_id = 0 AND
orig_lp_item_id = 0 AND
status <> 'incomplete' AND
session_id = $session_id";
} else {
$lpId = null;
if (!empty($exercise->lpList)) {
// Taking only the first LP
$lpId = current($exercise->lpList);
$lpId = $lpId['lp_id'];
}
$sql = "SELECT * FROM $tblStats
WHERE
exe_exo_id = ".intval($this->get_ref_id())." AND
orig_lp_id = $lpId AND
status <> 'incomplete' AND
session_id = $session_id";
}
if (isset($stud_id)) {
$sql .= " AND c_id = $courseId AND exe_user_id = $stud_id ";

@ -63,7 +63,13 @@ class LinkAddEditForm extends FormValidator
if (count($category_object) == 1) {
$this->addElement('hidden', 'select_gradebook', $category_object[0]->get_id());
} else {
$select_gradebook = $this->addElement('select', 'select_gradebook', get_lang('SelectGradebook'), array(), array('id' => 'hide_category_id'));
$select_gradebook = $this->addElement(
'select',
'select_gradebook',
get_lang('SelectGradebook'),
array(),
array('id' => 'hide_category_id')
);
$this->addRule('select_gradebook', get_lang('ThisFieldIsRequired'), 'nonzero');
$default_weight = 0;

@ -439,7 +439,8 @@ class FlatViewDataGenerator
}
if (!isset($this->params['only_total_category']) ||
(isset($this->params['only_total_category']) && $this->params['only_total_category'] == false)
(isset($this->params['only_total_category']) &&
$this->params['only_total_category'] == false)
) {
if (!$show_all) {
$row[] = $temp_score.' ';
@ -534,7 +535,7 @@ class FlatViewDataGenerator
$evaluationsAdded = array();
for ($count = 0; ($count < $items_count) && ($items_start + $count < count($this->evals_links)); $count++) {
for ($count = 0; $count < $items_count && ($items_start + $count < count($this->evals_links)); $count++) {
/** @var AbstractLink $item */
$item = $this->evals_links[$count + $items_start];
@ -592,14 +593,14 @@ class FlatViewDataGenerator
) {
if (!$show_all) {
if (in_array($item->get_type(), array(
LINK_EXERCISE,
LINK_DROPBOX,
LINK_STUDENTPUBLICATION,
LINK_LEARNPATH,
LINK_FORUM_THREAD,
LINK_ATTENDANCE,
LINK_SURVEY,
LINK_HOTPOTATOES)
LINK_EXERCISE,
LINK_DROPBOX,
LINK_STUDENTPUBLICATION,
LINK_LEARNPATH,
LINK_FORUM_THREAD,
LINK_ATTENDANCE,
LINK_SURVEY,
LINK_HOTPOTATOES)
)
) {
if (!empty($score[0])) {

@ -2042,31 +2042,4 @@ class Display
return $editProfileUrl;
}
/**
* Generate the social block for a user
* @param int $userId The user id
* @param string $groupBlock Optional. Highlight link possible values: group_add, home, messages, messages_inbox,
* messages_compose ,messages_outbox ,invitations, shared_profile, friends, groups search
* @param int $groupId Optional. Group ID
* @return string The HTML code with the social block
*/
public static function getSocialUserBlock($userId, $groupBlock = '', $groupId = 0)
{
$userInfo = api_get_user_info($userId);
$socialAvarBlock = SocialManager::show_social_avatar_block($groupBlock, $groupId, $userId);
$profileEditionLink = null;
if (api_get_user_id() == $userId) {
$profileEditionLink = Display::getProfileEditionLink($userId);
}
$template = new Template();
$template->assign('user', $userInfo);
$template->assign('socialAvatarBlock', $socialAvarBlock);
$template->assign('profileEditionLink', $profileEditionLink);
return $template->fetch('default/social/user_block.tpl');
}
}

@ -1389,8 +1389,8 @@ class MessageManager
$form = new FormValidator('send_message', null, 'post', null, array('id' => $id.'_form', 'class' => 'form-vertical'));
$form->addElement('text', 'subject', get_lang('Subject'), array('id' => 'subject_id', 'class' => 'span5'));
$form->addElement('textarea', 'content', get_lang('Message'), array('id' => 'content_id', 'rows' => '5', 'class' => 'span5'));
$div = Display::div($form->return_form(), array('id' => $id.'_div', 'style' => 'display:none'));
return $div;
return $form->return_form();
}
public static function generate_invitation_form($id, $params = array())

@ -760,7 +760,7 @@ class SocialManager extends UserManager
// My friend profile.
if ($user_id != api_get_user_id()) {
$html .= '<li><a href="javascript:void(0);" onclick="javascript:send_message_to_user(\''.$user_id.'\');" title="'.get_lang('SendMessage').'">';
$html .= '<li><a href="#" id="btn-to-send-message" title="'.get_lang('SendMessage').'">';
$html .= Display::return_icon('compose_message.png', get_lang('SendMessage')).'&nbsp;&nbsp;'.get_lang('SendMessage').'</a></li>';
}
@ -1520,4 +1520,31 @@ class SocialManager extends UserManager
return Database::query($sql);
}
/**
* Generate the social block for a user
* @param int $userId The user id
* @param string $groupBlock Optional. Highlight link possible values: group_add, home, messages, messages_inbox,
* messages_compose ,messages_outbox ,invitations, shared_profile, friends, groups search
* @param int $groupId Optional. Group ID
* @return string The HTML code with the social block
*/
public static function getSocialUserBlock($userId, $groupBlock = '', $groupId = 0)
{
$userInfo = api_get_user_info($userId, true);
$socialAvarBlock = SocialManager::show_social_avatar_block($groupBlock, $groupId, $userId);
$profileEditionLink = null;
if (api_get_user_id() == $userId) {
$profileEditionLink = Display::getProfileEditionLink($userId);
}
$template = new Template();
$template->assign('user', $userInfo);
$template->assign('socialAvatarBlock', $socialAvarBlock);
$template->assign('profileEditionLink', $profileEditionLink);
return $template->fetch('default/social/user_block.tpl');
}
}

@ -131,7 +131,7 @@ $userInfo = UserManager::get_user_info_by_id($user_id);
//LEFT CONTENT
if (api_get_setting('allow_social_tool') == 'true') {
//Block Social Avatar
$social_avatar_block = Display::getSocialUserBlock($user_id, 'messages');
$social_avatar_block = SocialManager::getSocialUserBlock($user_id, 'messages');
//Block Social Menu
$social_menu_block = SocialManager::show_social_menu('messages');
}

@ -312,7 +312,7 @@ $social_left_content = null;
$userInfo = UserManager::get_user_info_by_id($user_id);
if (api_get_setting('allow_social_tool') == 'true') {
//Block Social Avatar
$social_avatar_block = Display::getSocialUserBlock($user_id, 'messages');
$social_avatar_block = SocialManager::getSocialUserBlock($user_id, 'messages');
//Block Social Menu
$social_menu_block = SocialManager::show_social_menu('messages');
$social_right_content .= '<div class="span9">';

@ -111,7 +111,7 @@ $social_right_content = '';
$userInfo = UserManager::get_user_info_by_id($user_id);
if (api_get_setting('allow_social_tool') == 'true') {
//Block Social Avatar
$social_avatar_block = Display::getSocialUserBlock($user_id, 'messages');
$social_avatar_block = SocialManager::getSocialUserBlock($user_id, 'messages');
//Block Social Menu
$social_menu_block = SocialManager::show_social_menu('messages');
$social_right_content .= '<div class="span9">';

@ -56,7 +56,7 @@ $message = '';
$userInfo = UserManager::get_user_info_by_id($user_id);
if (api_get_setting('allow_social_tool') == 'true') {
//Block Social Avatar
$social_avatar_block = Display::getSocialUserBlock($user_id, $show_menu);
$social_avatar_block = SocialManager::getSocialUserBlock($user_id, $show_menu);
//Block Social Menu
$social_menu_block = SocialManager::show_social_menu($show_menu);
$message .='<div class="span9">';

@ -82,7 +82,7 @@ $interbreadcrumb[] = array('url' => 'profile.php', 'name' => get_lang('SocialNet
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Friends'));
//Block Social Avatar
$user_info = UserManager::get_user_info_by_id($user_id);
$social_avatar_block = Display::getSocialUserBlock($user_id, 'friends');
$social_avatar_block = SocialManager::getSocialUserBlock($user_id, 'friends');
//Block Social Menu
$social_menu_block = SocialManager::show_social_menu('friends');

@ -221,7 +221,7 @@ $create_thread_link = '';
$userInfo = api_get_user_info(api_get_user_id(), true);
if ($group_id != 0) {
//Block Social Avatar
$social_avatar_block = Display::getSocialUserBlock($user_id, 'groups', $group_id);
$social_avatar_block = SocialManager::getSocialUserBlock($user_id, 'groups', $group_id);
//Block Social Menu
$social_menu_block = SocialManager::show_social_menu('groups', $group_id);
} else {
@ -230,7 +230,7 @@ if ($group_id != 0) {
$show_menu = $_GET['view'];
}
//Block Social Avatar
$social_avatar_block = Display::getSocialUserBlock($user_id, $show_menu, $group_id);
$social_avatar_block = SocialManager::getSocialUserBlock($user_id, $show_menu, $group_id);
$social_menu_block = SocialManager::show_social_menu($show_menu, $group_id);
}

@ -83,7 +83,7 @@ if (api_get_setting('profile', 'picture') == 'true') {
}
}
$social_avatar_block = Display::getSocialUserBlock(api_get_user_id(), 'home');
$social_avatar_block = SocialManager::getSocialUserBlock(api_get_user_id(), 'home');
//Block Menu
$social_menu_block = SocialManager::show_social_menu('home');

@ -94,7 +94,7 @@ if (is_array($_GET) && count($_GET)>0) {
//Block Avatar Social
$userInfo = UserManager::get_user_info_by_id($user_id);
$social_avatar_block = Display::getSocialUserBlock($user_id, invitations);
$social_avatar_block = SocialManager::getSocialUserBlock($user_id, invitations);
//Block Menu Social
$social_menu_block = SocialManager::show_social_menu('invitations');
//Block Invitations

@ -131,7 +131,7 @@ if (is_array($_GET) && count($_GET) > 0) {
}
//Social Avatar BLock
$user_info = UserManager::get_user_info_by_id($user_id);
$social_avatar_block = Display::getSocialUserBlock($user_id, 'myfiles');
$social_avatar_block = SocialManager::getSocialUserBlock($user_id, 'myfiles');
//Social Menu Block
$social_menu_block = SocialManager::show_social_menu('myfiles');
$actions = null;

@ -144,47 +144,6 @@ function checkLength( o, n, min, max ) {
}
}
function send_message_to_user(user_id) {
var subject = $( "#subject_id" );
var content = $( "#content_id" );
$("#send_message_form").show();
$("#send_message_div").dialog({
modal:true,
height:350,
buttons: {
"'. addslashes(get_lang('Send')).'": function() {
var bValid = true;
bValid = bValid && checkLength( subject, "subject", 1, 255 );
bValid = bValid && checkLength( content, "content", 1, 255 );
if ( bValid ) {
var url = "'.$ajax_url.'?a=send_message&user_id="+user_id;
var params = $("#send_message_form").serialize();
$.ajax({
url: url+"&"+params,
success:function(data) {
$("#message_ajax_reponse").attr("class", "");
$("#message_ajax_reponse").html(data);
$("#message_ajax_reponse").show();
$("#send_message_div").dialog({ buttons:{}});
$("#send_message_form").hide();
$("#send_message_div").dialog("close");
$("#subject_id").val("");
$("#content_id").val("");
}
});
}
}
},
close: function() {
}
});
$("#send_message_div").dialog("open");
//prevent the browser to follow the link
}
function send_invitation_to_user(user_id) {
var content = $( "#content_invitation_id" );
$("#send_invitation_form").show();
@ -375,7 +334,7 @@ if (is_array($personal_course_list)) {
$course_list_code = array_unique_dimensional($course_list_code);
}
//Block Avatar Social
$social_avatar_block = Display::getSocialUserBlock($user_id, 'shared_profile');
$social_avatar_block = SocialManager::getSocialUserBlock($user_id, 'shared_profile');
//Social Block Menu
$social_menu_block = SocialManager::show_social_menu('shared_profile', null, $user_id, $show_full_profile);
@ -878,7 +837,7 @@ if ($show_full_profile) {
$socialRightInformation .= SocialManager::social_wrapper_div($more_info, 4);
}
}
$social_right_content .= MessageManager::generate_message_form('send_message');
$social_right_content .= MessageManager::generate_invitation_form('send_invitation');
@ -895,6 +854,13 @@ $tpl->assign('social_skill_block', $social_skill_block);
$tpl->assign('social_session_block', $social_session_block);
$tpl->assign('socialRightInformation', $socialRightInformation);
$tpl->assign('socialAutoExtendLink', $socialAutoExtendLink);
$formModalTpl = new Template();
$formModalTpl->assign('friendId', $friendId);
$formModalTpl->assign('messageForm', MessageManager::generate_message_form('send_message'));
$formModals = $formModalTpl->fetch('default/social/form_modals.tpl');
$tpl->assign('formModals', $formModals);
$social_layout = $tpl->get_template('social/profile.tpl');
$tpl->display($social_layout);

@ -148,7 +148,7 @@ if (!empty($extra_fields)) {
}
$user_info = UserManager::get_user_info_by_id($user_id);
//Block Social Avatar
$social_avatar_block = Display::getSocialUserBlock($user_id, 'search');
$social_avatar_block = SocialManager::getSocialUserBlock($user_id, 'search');
//Block Social Menu
$social_menu_block = SocialManager::show_social_menu('search');
$social_right_content = '<div class="span9">'.UserManager::get_search_form($query).'</div>';

@ -0,0 +1,44 @@
<div class="modal fade" id="send-message-modal" tabindex="-1" role="dialog" aria-labelledby="send-message-modal-title" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="{{ 'Close' | get_lang }}">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="send-message-modal-title">{{ 'SendMessage' | get_lang }}</h4>
</div>
<div class="modal-body">
<div id="send-message-alert"></div>
{{ messageForm }}
</div>
<div class="modal-footer">
<button type="button" id="btn-send-message" class="btn btn-primary">{{ 'Send' | get_lang }}</button>
</div>
</div>
</div>
</div>
<script>
$(document).on('ready', function() {
var $sendMessageModal = $('#send-message-modal');
$('#btn-to-send-message').on('click', function(e) {
e.preventDefault();
$sendMessageModal.modal('show');
});
$('#btn-send-message').on('click', function(e) {
e.preventDefault();
var $frmSendMessage = $sendMessageModal.find('.modal-body form'),
url = '{{ _p.web_ajax }}message.ajax.php?a=send_message&user_id={{ friendId }}';
$.get(url, $frmSendMessage.serialize(), function(response) {
$('#send-message-alert').html(response);
$frmSendMessage[0].reset();
});
});
});
</script>

@ -33,4 +33,7 @@
</div>
</div>
{% if formModals is defined %}
{{ formModals }}
{% endif %}
{% endblock %}

@ -5,7 +5,7 @@
<img src="{{ "instant_message.png" | icon }}" atl="{{ "Email" | get_lang }}">
{{ user.email}}
</p>
{% if not user.extra.user_chat_status is empty %}
{% if user.user_is_online_in_chat != 0 %}
<p>
<img src="{{ "online.png" | icon }}" alt="{{ "Online" | get_lang }}">
{{ "Chat" | get_lang }} ({{ "Online" | get_lang }})

Loading…
Cancel
Save