Adding smarty in the social tool + fixin the who is online in order to user pagination

skala
Julio Montoya 13 years ago
parent 12cb3eb44b
commit af39549929
  1. 11
      main/css/base.css
  2. 4
      main/inc/ajax/model.ajax.php
  3. 32
      main/inc/ajax/online.ajax.php
  4. 18
      main/inc/lib/group_portal_manager.lib.php
  5. 132
      main/inc/lib/javascript/jquery-jplayer/jquery.endless-scroll.js
  6. 78
      main/inc/lib/message.lib.php
  7. 79
      main/inc/lib/online.inc.php
  8. 95
      main/inc/lib/social.lib.php
  9. 22
      main/inc/lib/sortabletable.class.php
  10. 10
      main/inc/lib/template.lib.php
  11. 2
      main/inc/lib/usermanager.lib.php
  12. 111
      main/messages/inbox.php
  13. 194
      main/messages/new_message.php
  14. 133
      main/messages/outbox.php
  15. 85
      main/messages/view_message.php
  16. 15
      main/mySpace/myStudents.php
  17. 42
      main/social/friends.php
  18. 33
      main/social/group_add.php
  19. 33
      main/social/group_edit.php
  20. 266
      main/social/group_invitation.php
  21. 111
      main/social/group_members.php
  22. 40
      main/social/group_topics.php
  23. 71
      main/social/group_waiting_list.php
  24. 107
      main/social/groups.php
  25. 74
      main/social/home.php
  26. 46
      main/social/invitations.php
  27. 33
      main/social/myfiles.php
  28. 202
      main/social/profile.php
  29. 287
      main/social/search.php
  30. 15
      main/template/default/layout/social_layout.tpl
  31. 16
      main/user/userInfo.php
  32. 93
      whoisonline.php

@ -4230,6 +4230,17 @@ a:active{
margin-right: 4px; margin-right: 4px;
} }
.offline_user_in_text {
background: url("offline.png") no-repeat scroll right center transparent;
float: left;
height: 16px;
left: 0;
width: 17px;
display:block;
margin-right: 4px;
}
.hide_menu{ .hide_menu{
display:none; display:none;

@ -267,8 +267,8 @@ switch ($action) {
//var_dump($result); //var_dump($result);
//5. Creating an obj to return a json //5. Creating an obj to return a json
if (in_array($action, array('get_careers','get_promotions','get_usergroups','get_gradebooks', 'get_sessions','get_exercise_results'))) { if (in_array($action, array('get_careers', 'get_promotions', 'get_usergroups', 'get_gradebooks', 'get_sessions', 'get_exercise_results'))) {
$response = new stdClass(); $response = new stdClass();
$response->page = $page; $response->page = $page;
$response->total = $total_pages; $response->total = $total_pages;
$response->records = $count; $response->records = $count;

@ -11,20 +11,24 @@ $action = $_GET['a'];
switch($action) { switch($action) {
case 'load_online_user': case 'load_online_user':
$page = intval($_REQUEST['online_page_nr']); $page = intval($_REQUEST['online_page_nr']);
if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) {
$user_list = who_is_online_in_this_course(api_get_user_id(), api_get_setting('time_limit_whosonline'), $_GET['cidReq']); $max_page = round(who_is_online_count()/10);
} else {
$user_list = who_is_online(api_get_setting('time_limit_whosonline')); if (!in_array($page, $_SESSION['online_user_items']) && $page <= $max_page) {
} if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) {
if ($page == 2) { $user_list = who_is_online_in_this_course(api_get_user_id(), api_get_setting('time_limit_whosonline'), $_GET['cidReq']);
$_SESSION['online_user_items'] = array(); } else {
} $page_rows = $page*10;
$max_page = round(count($user_list)/10); $user_list = who_is_online($page_rows, $page_rows + 10);
if (!in_array($page, $_SESSION['online_user_items']) && $page <= $max_page) { }
$_SESSION['online_user_items'][] = $page; if ($page == 1) {
echo SocialManager::display_user_list($user_list); $_SESSION['online_user_items'] = array();
} else { }
echo 'end';
$_SESSION['online_user_items'][] = $page;
if (!empty($user_list)) {
echo SocialManager::display_user_list($user_list);
}
} }
break; break;
default: default:

@ -1025,8 +1025,8 @@ class GroupPortalManager {
* *
*/ */
public static function show_group_column_information($group_id, $user_id, $show = '') { public static function show_group_column_information($group_id, $user_id, $show = '') {
global $relation_group_title, $my_group_role; global $relation_group_title, $my_group_role;
$html = '';
$group_info = GroupPortalManager::get_group_data($group_id); $group_info = GroupPortalManager::get_group_data($group_id);
$picture = GroupPortalManager::get_picture_group($group_id, $group_info['picture_uri'],160,GROUP_IMAGE_SIZE_MEDIUM); $picture = GroupPortalManager::get_picture_group($group_id, $group_info['picture_uri'],160,GROUP_IMAGE_SIZE_MEDIUM);
@ -1039,7 +1039,7 @@ class GroupPortalManager {
$my_group_role = self::get_user_group_role($user_id, $group_id); $my_group_role = self::get_user_group_role($user_id, $group_id);
//@todo this must be move to default.css for dev use only //@todo this must be move to default.css for dev use only
echo '<style> $html .= '<style>
#group_members { width:270px; height:300px; overflow-x:none; overflow-y: auto;} #group_members { width:270px; height:300px; overflow-x:none; overflow-y: auto;}
.group_member_item { width:100px; height:130px; float:left; margin:5px 5px 15px 5px; } .group_member_item { width:100px; height:130px; float:left; margin:5px 5px 15px 5px; }
.group_member_picture { display:block; .group_member_picture { display:block;
@ -1067,7 +1067,7 @@ class GroupPortalManager {
$links .= '<li><a href="group_edit.php?id='.$group_id.'">'. Display::return_icon('group_edit.png', get_lang('EditGroup'), array('hspace'=>'6')).'<span class="'.($show=='group_edit'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('EditGroup').'</span></a></li>'; $links .= '<li><a href="group_edit.php?id='.$group_id.'">'. Display::return_icon('group_edit.png', get_lang('EditGroup'), array('hspace'=>'6')).'<span class="'.($show=='group_edit'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('EditGroup').'</span></a></li>';
//$links .= '<li><a href="group_members.php?id='.$group_id.'">'. Display::return_icon('member_list.png', get_lang('MemberList'), array('hspace'=>'6')).'<span class="'.($show=='member_list'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('MemberList').'</span></a></li>'; //$links .= '<li><a href="group_members.php?id='.$group_id.'">'. Display::return_icon('member_list.png', get_lang('MemberList'), array('hspace'=>'6')).'<span class="'.($show=='member_list'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('MemberList').'</span></a></li>';
//if ($group_info['visibility'] == GROUP_PERMISSION_CLOSED) { //if ($group_info['visibility'] == GROUP_PERMISSION_CLOSED) {
$links .= '<li><a href="group_waiting_list.php?id='.$group_id.'">'. Display::return_icon('waiting_list.png', get_lang('WaitingList'), array('hspace'=>'6')).'<span class="'.($show=='waiting_list'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('WaitingList').'</span></a></li>'; $links .= '<li><a href="group_waiting_list.php?id='.$group_id.'">'. Display::return_icon('waiting_list.png', get_lang('WaitingList'), array('hspace'=>'6')).'<span class="'.($show=='waiting_list'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('WaitingList').'</span></a></li>';
//} //}
$links .= '<li><a href="group_invitation.php?id='.$group_id.'">'. Display::return_icon('invitation_friend.png', get_lang('InviteFriends'), array('hspace'=>'6')).'<span class="'.($show=='invite_friends'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('InviteFriends').'</span></a></li>'; $links .= '<li><a href="group_invitation.php?id='.$group_id.'">'. Display::return_icon('invitation_friend.png', get_lang('InviteFriends'), array('hspace'=>'6')).'<span class="'.($show=='invite_friends'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('InviteFriends').'</span></a></li>';
break; break;
@ -1101,13 +1101,13 @@ class GroupPortalManager {
} }
if (!empty($links)) { if (!empty($links)) {
echo '<ul class="social-menu-groups">'; $html .= '<ul class="social-menu-groups">';
if (!empty($group_info['description'])) { if (!empty($group_info['description'])) {
echo Display::tag('li', Security::remove_XSS($group_info['description'], STUDENT, true), array('class'=>'group_description')); $html .= Display::tag('li', Security::remove_XSS($group_info['description'], STUDENT, true), array('class'=>'group_description'));
} }
echo $links; $html .= $links;
echo '</ul>'; $html .= '</ul>';
} }
return $html;
} }
} }

@ -0,0 +1,132 @@
/**
* Endless Scroll plugin for jQuery
*
* v1.4.8
*
* Copyright (c) 2008 Fred Wu
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
/**
* Usage:
*
* // using default options
* $(document).endlessScroll();
*
* // using some custom options
* $(document).endlessScroll({
* fireOnce: false,
* fireDelay: false,
* loader: "<div class=\"loading\"><div>",
* callback: function(){
* alert("test");
* }
* });
*
* Configuration options:
*
* bottomPixels integer the number of pixels from the bottom of the page that triggers the event
* fireOnce boolean only fire once until the execution of the current event is completed
* fireDelay integer delay the subsequent firing, in milliseconds, 0 or false to disable delay
* loader string the HTML to be displayed during loading
* data string|function plain HTML data, can be either a string or a function that returns a string,
* when passed as a function it accepts one argument: fire sequence (the number
* of times the event triggered during the current page session)
* insertAfter string jQuery selector syntax: where to put the loader as well as the plain HTML data
* callback function callback function, accepts one argument: fire sequence (the number of times
* the event triggered during the current page session)
* resetCounter function resets the fire sequence counter if the function returns true, this function
* could also perform hook actions since it is applied at the start of the event
* ceaseFire function stops the event (no more endless scrolling) if the function returns true
*
* Usage tips:
*
* The plugin is more useful when used with the callback function, which can then make AJAX calls to retrieve content.
* The fire sequence argument (for the callback function) is useful for 'pagination'-like features.
*/
(function($){
$.fn.endlessScroll = function(options) {
var defaults = {
bottomPixels: 50,
fireOnce: true,
fireDelay: 150,
loader: "<br />Loading...<br />",
data: "",
insertAfter: "div:last",
resetCounter: function() { return false; },
callback: function() { return true; },
ceaseFire: function() { return false; }
};
var options = $.extend({}, defaults, options);
var firing = true;
var fired = false;
var fireSequence = 0;
if (options.ceaseFire.apply(this) === true) {
firing = false;
}
if (firing === true) {
$(this).scroll(function() {
if (options.ceaseFire.apply(this) === true) {
firing = false;
return; // Scroll will still get called, but nothing will happen
}
if (this == document || this == window) {
var is_scrollable = $(document).height() - $(window).height() <= $(window).scrollTop() + options.bottomPixels;
} else {
// calculates the actual height of the scrolling container
var inner_wrap = $(".endless_scroll_inner_wrap", this);
if (inner_wrap.length == 0) {
inner_wrap = $(this).wrapInner("<div class=\"endless_scroll_inner_wrap\" />").find(".endless_scroll_inner_wrap");
}
var is_scrollable = inner_wrap.length > 0 &&
(inner_wrap.height() - $(this).height() <= $(this).scrollTop() + options.bottomPixels);
}
if (is_scrollable && (options.fireOnce == false || (options.fireOnce == true && fired != true))) {
if (options.resetCounter.apply(this) === true) fireSequence = 0;
fired = true;
fireSequence++;
$(options.insertAfter).after("<div id=\"endless_scroll_loader\">" + options.loader + "</div>");
data = typeof options.data == 'function' ? options.data.apply(this, [fireSequence]) : options.data;
if (data !== false) {
$(options.insertAfter).after("<div id=\"endless_scroll_data\">" + data + "</div>");
$("div#endless_scroll_data").hide().fadeIn();
$("div#endless_scroll_data").removeAttr("id");
options.callback.apply(this, [fireSequence]);
if (options.fireDelay !== false || options.fireDelay !== 0) {
$("body").after("<div id=\"endless_scroll_marker\"></div>");
// slight delay for preventing event firing twice
$("div#endless_scroll_marker").fadeTo(options.fireDelay, 1, function() {
$(this).remove();
fired = false;
});
}
else {
fired = false;
}
}
$("div#endless_scroll_loader").remove();
}
});
}
};
})(jQuery);

@ -31,10 +31,11 @@ define('MESSAGE_STATUS_INVITATION_DENIED', '7');
*/ */
class MessageManager class MessageManager
{ {
public static function get_online_user_list($current_user_id) { public static function get_online_user_list($current_user_id) {
$min=30;
global $_configuration; global $_configuration;
$userlist = who_is_online($min, true); //@todo this is a bad idea to parse all users online
$count = who_is_online_count();
$userlist = who_is_online(0, $count, null, null, 30, true);
$online_user_list = array(); $online_user_list = array();
foreach($userlist as $row) { foreach($userlist as $row) {
$receiver_id = $row[0]; $receiver_id = $row[0];
@ -67,7 +68,7 @@ class MessageManager
GetFullUserName($uid). GetFullUserName($uid).
"</b>"; "</b>";
} }
Display::display_confirmation_message(api_xml_http_response_encode($success), false); return Display::return_message(api_xml_http_response_encode($success), 'confirmation', false);
} }
/** /**
@ -95,10 +96,10 @@ class MessageManager
/** /**
* Get the list of user_ids of users who are online. * Get the list of user_ids of users who are online.
*/ */
public static function users_connected_by_id() { public static function users_connected_by_id() {
global $_configuration, $_user; $count = who_is_online_count();
$minute=30; $user_connect = who_is_online(0, $count, null, null, 30, true);
$user_connect = who_is_online($minute, true); $user_id_list = array();
for ($i=0; $i<count($user_connect); $i++) { for ($i=0; $i<count($user_connect); $i++) {
$user_id_list[$i]=$user_connect[$i][0]; $user_id_list[$i]=$user_connect[$i][0];
} }
@ -1016,7 +1017,7 @@ class MessageManager
$query_vars = array('id' => $group_id, 'topic_id' => $topic_id , 'topics_page_nr' => 0); $query_vars = array('id' => $group_id, 'topic_id' => $topic_id , 'topics_page_nr' => 0);
// Main message // Main message
$html = '';
$user_link = ''; $user_link = '';
$links = ''; $links = '';
$main_content = ''; $main_content = '';
@ -1024,7 +1025,9 @@ class MessageManager
//$items_page_nr = intval($_GET['items_'.$topic['id'].'_page_nr']); //$items_page_nr = intval($_GET['items_'.$topic['id'].'_page_nr']);
$items_page_nr = null; $items_page_nr = null;
echo Display::tag('h3', Security::remove_XSS($main_message['title'], STUDENT, true)); $html = '';
$html .= Display::tag('h3', Security::remove_XSS($main_message['title'], STUDENT, true));
$user_sender_info = UserManager::get_user_info_by_id($main_message['user_sender_id']); $user_sender_info = UserManager::get_user_info_by_id($main_message['user_sender_id']);
$files_attachments = self::get_links_message_attachment_files($main_message['id']); $files_attachments = self::get_links_message_attachment_files($main_message['id']);
@ -1058,8 +1061,6 @@ class MessageManager
$main_content.= '<div class="message-group-content">'.$links.$user_link.' '.$date.$main_message['content'].$attachment.'</div>'; $main_content.= '<div class="message-group-content">'.$links.$user_link.' '.$date.$main_message['content'].$attachment.'</div>';
$main_content = Security::remove_XSS($main_content, STUDENT, true); $main_content = Security::remove_XSS($main_content, STUDENT, true);
$html = '';
$html .= Display::div(Display::div(Display::div($main_content, array('class'=>'group_social_sub_item', 'style'=>'background-color:#fff;')), array('class' => 'group_social_item')), array('class' => 'group_social_grid')); $html .= Display::div(Display::div(Display::div($main_content, array('class'=>'group_social_sub_item', 'style'=>'background-color:#fff;')), array('class' => 'group_social_item')), array('class' => 'group_social_grid'));
$topic_id = $main_message['id']; $topic_id = $main_message['id'];
@ -1241,9 +1242,9 @@ class MessageManager
//@todo this functions should be in the message class //@todo this functions should be in the message class
function inbox_display() { function inbox_display() {
global $charset; global $charset;
$table_message = Database::get_main_table(TABLE_MESSAGE);
$success = get_lang('SelectedMessagesDeleted'); $success = get_lang('SelectedMessagesDeleted');
$html = '';
if (isset ($_REQUEST['action'])) { if (isset ($_REQUEST['action'])) {
switch ($_REQUEST['action']) { switch ($_REQUEST['action']) {
@ -1252,23 +1253,21 @@ function inbox_display() {
foreach ($_POST['id'] as $index => $message_id) { foreach ($_POST['id'] as $index => $message_id) {
MessageManager::delete_message_by_user_receiver(api_get_user_id(), $message_id); MessageManager::delete_message_by_user_receiver(api_get_user_id(), $message_id);
} }
Display::display_normal_message(api_xml_http_response_encode($success),false); $html .= Display::return_message(api_xml_http_response_encode($success), 'normal', false);
break; break;
case 'deleteone' : case 'deleteone' :
MessageManager::delete_message_by_user_receiver(api_get_user_id(), $_GET['id']); MessageManager::delete_message_by_user_receiver(api_get_user_id(), $_GET['id']);
Display::display_confirmation_message(api_xml_http_response_encode($success),false); $html .= Display::return_message(api_xml_http_response_encode($success),'confirmation', false);
echo '<br />';
break; break;
} }
} }
// display sortable table with messages of the current user
//$table = new SortableTable('messages', 'get_number_of_messages_mask', 'get_message_data_mask', 3, get_number_of_messages_mask(),'DESC'); // display sortable table with messages of the current user
$table = new SortableTable('message_inbox', array('MessageManager','get_number_of_messages'), array('MessageManager','get_message_data'),3,20,'DESC'); $table = new SortableTable('message_inbox', array('MessageManager','get_number_of_messages'), array('MessageManager','get_message_data'),3,20,'DESC');
$table->set_header(0, '', false,array ('style' => 'width:15px;')); $table->set_header(0, '', false,array ('style' => 'width:15px;'));
$title=api_xml_http_response_encode(get_lang('Title')); $title=api_xml_http_response_encode(get_lang('Title'));
$action=api_xml_http_response_encode(get_lang('Modify')); $action=api_xml_http_response_encode(get_lang('Modify'));
$table->set_header(1,api_xml_http_response_encode(get_lang('Messages')),false); $table->set_header(1,api_xml_http_response_encode(get_lang('Messages')),false);
//$table->set_header(2,$title,true);
$table->set_header(2,api_xml_http_response_encode(get_lang('Date')),true, array('style' => 'width:180px;')); $table->set_header(2,api_xml_http_response_encode(get_lang('Date')),true, array('style' => 'width:180px;'));
$table->set_header(3,$action,false,array ('style' => 'width:70px;')); $table->set_header(3,$action,false,array ('style' => 'width:70px;'));
@ -1277,8 +1276,8 @@ function inbox_display() {
$table->set_additional_parameters($parameters); $table->set_additional_parameters($parameters);
} }
$table->set_form_actions(array ('delete' => get_lang('DeleteSelectedMessages'))); $table->set_form_actions(array ('delete' => get_lang('DeleteSelectedMessages')));
$html .= $table->return_table();
$table->display(); return $html;
} }
@ -1294,8 +1293,7 @@ function get_message_data_mask($from, $number_of_items, $column, $direction) {
return MessageManager::get_message_data($from, $number_of_items, $column, $direction); return MessageManager::get_message_data($from, $number_of_items, $column, $direction);
} }
function outbox_display() { function outbox_display() {
$table_message = Database::get_main_table(TABLE_MESSAGE);
$request=api_is_xml_http_request(); $request=api_is_xml_http_request();
global $charset; global $charset;
@ -1303,7 +1301,7 @@ function outbox_display() {
if ($_REQUEST['f']=='social') { if ($_REQUEST['f']=='social') {
$social_link ='f=social'; $social_link ='f=social';
} }
$success= get_lang('SelectedMessagesDeleted').'&nbsp</b><br /><a href="outbox.php?'.$social_link.'">'.get_lang('BackToOutbox').'</a>'; $success = get_lang('SelectedMessagesDeleted').'&nbsp</b><br /><a href="outbox.php?'.$social_link.'">'.get_lang('BackToOutbox').'</a>';
if (isset ($_REQUEST['action'])) { if (isset ($_REQUEST['action'])) {
switch ($_REQUEST['action']) { switch ($_REQUEST['action']) {
@ -1314,18 +1312,17 @@ function outbox_display() {
MessageManager::delete_message_by_user_receiver(api_get_user_id(), $message_id); MessageManager::delete_message_by_user_receiver(api_get_user_id(), $message_id);
} }
} }
Display::display_normal_message(api_xml_http_response_encode($success),false); $html .= Display::return_message(api_xml_http_response_encode($success),'normal', false);
break; break;
case 'deleteone' : case 'deleteone' :
MessageManager::delete_message_by_user_receiver(api_get_user_id(), $_GET['id']); MessageManager::delete_message_by_user_receiver(api_get_user_id(), $_GET['id']);
Display::display_confirmation_message(api_xml_http_response_encode($success),false); $html .=Display::return_message(api_xml_http_response_encode($success), 'normal', false);
echo '<br/>'; $html .= '<br/>';
break; break;
} }
} }
// display sortable table with messages of the current user // display sortable table with messages of the current user
//$table = new SortableTable('messages', 'get_number_of_messages_send_mask', 'get_message_data_send_mask', 3, get_number_of_messages_send_mask(), 'DESC');
$table = new SortableTable('message_outbox', array('MessageManager','get_number_of_messages_sent'), array('MessageManager','get_message_data_sent'),3,20,'DESC'); $table = new SortableTable('message_outbox', array('MessageManager','get_number_of_messages_sent'), array('MessageManager','get_message_data_sent'),3,20,'DESC');
$parameters['f'] = Security::remove_XSS($_GET['f']); $parameters['f'] = Security::remove_XSS($_GET['f']);
@ -1341,21 +1338,22 @@ function outbox_display() {
if ($request===true) { if ($request===true) {
echo '<form name="form_send_out" id="form_send_out" action="" method="post">'; $html .= '<form name="form_send_out" id="form_send_out" action="" method="post">';
echo '<input type="hidden" name="action" value="delete" />'; $html .= '<input type="hidden" name="action" value="delete" />';
$table->display(); $html .= $table->return_table();
echo '</form>'; $html .= '</form>';
if (get_number_of_messages_send_mask() > 0) { if (get_number_of_messages_send_mask() > 0) {
echo '<a href="javascript:void(0)" onclick="selectall_cheks()">'.api_xml_http_response_encode(get_lang('SelectAll')).'</a>&nbsp;&nbsp;&nbsp;'; $html .= '<a href="javascript:void(0)" onclick="selectall_cheks()">'.api_xml_http_response_encode(get_lang('SelectAll')).'</a>&nbsp;&nbsp;&nbsp;';
echo '<a href="javascript:void(0)" onclick="unselectall_cheks()">'.api_xml_http_response_encode(get_lang('UnSelectAll')).'</a>&nbsp;&nbsp;&nbsp;'; $html .= '<a href="javascript:void(0)" onclick="unselectall_cheks()">'.api_xml_http_response_encode(get_lang('UnSelectAll')).'</a>&nbsp;&nbsp;&nbsp;';
echo '<button class="save" name="delete" type="button" value="'.api_xml_http_response_encode(get_lang('DeleteSelectedMessages')).'" onclick="submit_form(\'outbox\')">'.api_xml_http_response_encode(get_lang('DeleteSelectedMessages')).'</button>'; $html .= '<button class="save" name="delete" type="button" value="'.api_xml_http_response_encode(get_lang('DeleteSelectedMessages')).'" onclick="submit_form(\'outbox\')">'.api_xml_http_response_encode(get_lang('DeleteSelectedMessages')).'</button>';
} }
} else { } else {
$table->set_form_actions(array ('delete' => get_lang('DeleteSelectedMessages'))); $table->set_form_actions(array ('delete' => get_lang('DeleteSelectedMessages')));
$table->display(); $html .= $table->return_table();
} }
return $html;
} }
function get_number_of_messages_send_mask() { function get_number_of_messages_send_mask() {
return MessageManager::get_number_of_messages_sent(); return MessageManager::get_number_of_messages_sent();
} }

@ -143,23 +143,53 @@ function user_is_online($user_id) {
* @param bool optionally if it's set to true shows who friends from social network is online otherwise just shows all users online * @param bool optionally if it's set to true shows who friends from social network is online otherwise just shows all users online
* @return array For each line, a list of user IDs and login dates, or FALSE on error or empty results * @return array For each line, a list of user IDs and login dates, or FALSE on error or empty results
*/ */
function who_is_online($valid, $friends = false) { function who_is_online($from, $number_of_items, $column = null, $direction = null, $time_limit = null, $friends = false) {
$valid = (int) $valid;
if (empty($time_limit)) {
$time_limit = api_get_setting('time_limit_whosonline');
} else {
$time_limit = intval($time_limit);
}
$from = intval($from);
$number_of_items = intval($number_of_items);
if (empty($column)) {
$column = 'picture_uri';
if ($friends) {
$column = 'login_date';
}
}
if (empty($direction)) {
$direction = 'DESC';
} else {
if (!in_array(strtolower($direction), array('asc', 'desc'))) {
$direction = 'DESC';
}
}
$current_date = date('Y-m-d H:i:s',time()); $current_date = date('Y-m-d H:i:s',time());
$track_online_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ONLINE); $track_online_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ONLINE);
$friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER); $friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
$table_user = Database::get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
$query = ''; $query = '';
if ($friends) { if ($friends) {
// who friends from social network is online // who friends from social network is online
$query = "SELECT DISTINCT login_user_id,login_date $query = "SELECT DISTINCT login_user_id, login_date
FROM $track_online_table INNER JOIN $friend_user_table ON (friend_user_id = login_user_id) FROM $track_online_table INNER JOIN $friend_user_table ON (friend_user_id = login_user_id)
WHERE DATE_ADD(login_date,INTERVAL $valid MINUTE) >= '".$current_date."' AND friend_user_id <> '".api_get_user_id()."' AND relation_type='".USER_RELATION_TYPE_FRIEND."' AND user_id = '".api_get_user_id()."' "; WHERE DATE_ADD(login_date,INTERVAL $time_limit MINUTE) >= '".$current_date."' AND friend_user_id <> '".api_get_user_id()."' AND relation_type='".USER_RELATION_TYPE_FRIEND."' AND user_id = '".api_get_user_id()."'
ORDER BY $column $direction
LIMIT $from, $number_of_items";
} else { } else {
// all users online // all users online
//$query = "SELECT login_user_id,login_date FROM ".$track_online_table ." WHERE DATE_ADD(login_date,INTERVAL $valid MINUTE) >= '".$current_date."' "; //WHERE DATE_ADD(login_date,INTERVAL $valid MINUTE) >= '".$current_date."' //$query = "SELECT login_user_id,login_date FROM ".$track_online_table ." WHERE DATE_ADD(login_date,INTERVAL $time_limit MINUTE) >= '".$current_date."' "; //WHERE DATE_ADD(login_date,INTERVAL $time_limit MINUTE) >= '".$current_date."'
$query = "SELECT login_user_id,login_date FROM ".$track_online_table ." e INNER JOIN ".$table_user ." u ON (u.user_id=e.login_user_id) WHERE DATE_ADD(login_date,INTERVAL $valid MINUTE) >= '".$current_date."' ORDER BY picture_uri DESC"; $query = "SELECT login_user_id, login_date FROM ".$track_online_table ." e INNER JOIN ".$table_user ." u ON (u.user_id=e.login_user_id)
WHERE DATE_ADD(login_date,INTERVAL $time_limit MINUTE) >= '".$current_date."'
ORDER BY $column $direction
LIMIT $from, $number_of_items";
} }
if (api_get_multiple_access_url()) { if (api_get_multiple_access_url()) {
@ -168,25 +198,31 @@ function who_is_online($valid, $friends = false) {
if ($friends) { if ($friends) {
// friends from social network is online // friends from social network is online
$query = "SELECT distinct login_user_id,login_date $query = "SELECT distinct login_user_id,login_date
FROM $track_online_table track FROM $track_online_table track INNER JOIN $friend_user_table ON (friend_user_id = login_user_id)
INNER JOIN $friend_user_table ON (friend_user_id = login_user_id) WHERE track.access_url_id = $access_url_id AND DATE_ADD(login_date,INTERVAL $time_limit MINUTE) >= '".$current_date."' AND friend_user_id <> '".api_get_user_id()."' AND relation_type='".USER_RELATION_TYPE_FRIEND."'
WHERE track.access_url_id = $access_url_id AND DATE_ADD(login_date,INTERVAL $valid MINUTE) >= '".$current_date."' AND friend_user_id <> '".api_get_user_id()."' AND relation_type='".USER_RELATION_TYPE_FRIEND."' "; ORDER BY $column $direction
LIMIT $from, $number_of_items";
} else { } else {
// all users online // all users online
$query = "SELECT login_user_id,login_date FROM ".$track_online_table ." track INNER JOIN ".$table_user ." u ON (u.user_id=track.login_user_id) $query = "SELECT login_user_id,login_date FROM ".$track_online_table ." track INNER JOIN ".$table_user ." u ON (u.user_id=track.login_user_id)
WHERE track.access_url_id = $access_url_id AND DATE_ADD(login_date,INTERVAL $valid MINUTE) >= '".$current_date."' ORDER BY picture_uri DESC "; WHERE track.access_url_id = $access_url_id AND DATE_ADD(login_date,INTERVAL $time_limit MINUTE) >= '".$current_date."'
ORDER BY $column $direction
LIMIT $from, $number_of_items";
} }
} }
} }
//This query will show all registered users. Only for dev purposes. //This query will show all registered users. Only for dev purposes.
$query = "SELECT DISTINCT u.user_id as login_user_id, login_date FROM ".$track_online_table ." e , $table_user u GROUP by u.user_id ORDER BY picture_uri DESC"; /*$query = "SELECT DISTINCT u.user_id as login_user_id, login_date FROM ".$track_online_table ." e , $table_user u
GROUP by u.user_id
ORDER BY $column $direction
LIMIT $from, $number_of_items";
*/
$result = Database::query($query); $result = Database::query($query);
if ($result) { if ($result) {
$rtime = time(); $rtime = time();
$rdate = date("Y-m-d H:i:s",$rtime); $rdate = date("Y-m-d H:i:s",$rtime);
$validtime = mktime(date("H"),date("i")-$valid,date("s"),date("m"),date("d"),date("Y")); $validtime = mktime(date("H"),date("i")-$time_limit,date("s"),date("m"),date("d"),date("Y"));
$rarray = array(); $rarray = array();
while(list($login_user_id,$login_date)= Database::fetch_row($result)) { while(list($login_user_id,$login_date)= Database::fetch_row($result)) {
@ -214,8 +250,12 @@ function who_is_online($valid, $friends = false) {
} }
} }
function who_is_online_count($valid, $friends = false) { function who_is_online_count($valid = null, $friends = false) {
$valid = (int) $valid; if (empty($valid)) {
$valid = api_get_setting('time_limit_whosonline');
} else {
$valid = intval($valid);
}
$current_date = date('Y-m-d H:i:s',time()); $current_date = date('Y-m-d H:i:s',time());
$track_online_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ONLINE); $track_online_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ONLINE);
$friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER); $friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
@ -231,8 +271,7 @@ function who_is_online_count($valid, $friends = false) {
$query = "SELECT count(login_id) as count FROM ".$track_online_table ." WHERE DATE_ADD(login_date,INTERVAL $valid MINUTE) >= '".$current_date."' "; //WHERE DATE_ADD(login_date,INTERVAL $valid MINUTE) >= '".$current_date."' $query = "SELECT count(login_id) as count FROM ".$track_online_table ." WHERE DATE_ADD(login_date,INTERVAL $valid MINUTE) >= '".$current_date."' "; //WHERE DATE_ADD(login_date,INTERVAL $valid MINUTE) >= '".$current_date."'
} }
if (api_get_multiple_access_url()) { if (api_get_multiple_access_url()) {
$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id(); $access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) { if ($access_url_id != -1) {
if ($friends) { if ($friends) {
@ -248,6 +287,10 @@ function who_is_online_count($valid, $friends = false) {
} }
} }
} }
//dev purposes
//$query = "SELECT count(u.user_id) as count FROM ".$track_online_table ." e , $table_user u ";
$result = Database::query($query); $result = Database::query($query);
if (Database::num_rows($result) > 0) { if (Database::num_rows($result) > 0) {
$row = Database::fetch_array($result); $row = Database::fetch_array($result);

@ -576,9 +576,9 @@ class SocialManager extends UserManager {
$total_invitations = $number_of_new_messages_of_friend + $group_pending_invitations; $total_invitations = $number_of_new_messages_of_friend + $group_pending_invitations;
$total_invitations = (!empty($total_invitations)?' ('.$total_invitations.')':''); $total_invitations = (!empty($total_invitations)?' ('.$total_invitations.')':'');
echo '<div class="social-menu">'; $html = '<div class="social-menu">';
echo '<script type="text/javascript"> $html .= '<script type="text/javascript">
function show_icon_edit(element_html) { function show_icon_edit(element_html) {
ident="#edit_image"; ident="#edit_image";
$(ident).show(); $(ident).show();
@ -595,16 +595,16 @@ class SocialManager extends UserManager {
//--- Group image //--- Group image
$group_info = GroupPortalManager::get_group_data($group_id); $group_info = GroupPortalManager::get_group_data($group_id);
$big = GroupPortalManager::get_picture_group($group_id, $group_info['picture_uri'],160,GROUP_IMAGE_SIZE_BIG); $big = GroupPortalManager::get_picture_group($group_id, $group_info['picture_uri'],160,GROUP_IMAGE_SIZE_BIG);
$original = GroupPortalManager::get_picture_group($group_id, $group_info['picture_uri'],'',GROUP_IMAGE_SIZE_ORIGINAL); //$original = GroupPortalManager::get_picture_group($group_id, $group_info['picture_uri'],'',GROUP_IMAGE_SIZE_ORIGINAL);
echo '<div class="social-content-image">'; $html .= '<div class="social-content-image">';
echo '<div class="social-background-content" onmouseout="hide_icon_edit()" onmouseover="show_icon_edit()"><center>'; $html .= '<div class="social-background-content" onmouseout="hide_icon_edit()" onmouseover="show_icon_edit()"><center>';
echo Display::url('<img src='.$big['file'].' class="social-groups-image" /> </a><br /><br />', api_get_path(WEB_PATH).'main/social/groups.php?id='.$group_id); $html .= Display::url('<img src='.$big['file'].' class="social-groups-image" /> </a><br /><br />', api_get_path(WEB_PATH).'main/social/groups.php?id='.$group_id);
if (GroupPortalManager::is_group_admin($group_id, api_get_user_id())) { if (GroupPortalManager::is_group_admin($group_id, api_get_user_id())) {
echo '<div id="edit_image" class="hidden_message" style="display:none"><a href="'.api_get_path(WEB_PATH).'main/social/group_edit.php?id='.$group_id.'">'.get_lang('EditGroup').'</a></div>'; $html .= '<div id="edit_image" class="hidden_message" style="display:none"><a href="'.api_get_path(WEB_PATH).'main/social/group_edit.php?id='.$group_id.'">'.get_lang('EditGroup').'</a></div>';
} }
echo '</center></div>'; $html .= '</center></div>';
echo '</div>'; $html .= '</div>';
} else { } else {
$img_array = UserManager::get_user_picture_path_by_id($user_id,'web',true,true); $img_array = UserManager::get_user_picture_path_by_id($user_id,'web',true,true);
@ -613,21 +613,20 @@ class SocialManager extends UserManager {
$normal_image = $img_array['dir'].$img_array['file'].'?'.uniqid(); $normal_image = $img_array['dir'].$img_array['file'].'?'.uniqid();
//--- User image //--- User image
echo '<div class="social-content-image">'; $html .= '<div class="social-content-image">';
echo '<div class="social-background-content" onmouseout="hide_icon_edit()" onmouseover="show_icon_edit()"><center>'; $html .= '<div class="social-background-content" onmouseout="hide_icon_edit()" onmouseover="show_icon_edit()"><center>';
if ($img_array['file'] != 'unknown.jpg') { if ($img_array['file'] != 'unknown.jpg') {
echo '<a class="thickbox" href="'.$big_image.'"><img src='.$normal_image.' /> </a>'; $html .= '<a class="thickbox" href="'.$big_image.'"><img src='.$normal_image.' /> </a>';
} else { } else {
echo '<img src='.$normal_image.' width="110px" />'; $html .= '<img src='.$normal_image.' width="110px" />';
} }
if (api_get_user_id() == $user_id) { if (api_get_user_id() == $user_id) {
echo '<div id="edit_image" class="hidden_message" style="display:none">'; $html .= '<div id="edit_image" class="hidden_message" style="display:none">';
echo '<a href="'.api_get_path(WEB_PATH).'main/auth/profile.php">'.get_lang('EditProfile').'</a></div>'; $html .= '<a href="'.api_get_path(WEB_PATH).'main/auth/profile.php">'.get_lang('EditProfile').'</a></div>';
} }
$html .= '</center></div>';
echo '</center></div>'; $html .= '</div>';
echo '</div>';
} }
if (!in_array($show, array('shared_profile', 'groups', 'group_edit', 'member_list','waiting_list','invite_friends'))) { if (!in_array($show, array('shared_profile', 'groups', 'group_edit', 'member_list','waiting_list','invite_friends'))) {
@ -636,64 +635,63 @@ class SocialManager extends UserManager {
echo '<span>'.get_lang('Option').'</span>'; echo '<span>'.get_lang('Option').'</span>';
echo '</div>';*/ echo '</div>';*/
echo '<div class="social_menu_items"><ul>'; $html .= '<div class="social_menu_items"><ul>';
echo '<li><a href="'.api_get_path(WEB_PATH).'main/social/home.php">'.Display::return_icon('home.png',get_lang('Home'),array('hspace'=>'6')).'<span class="'.($show=='home'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('Home').'</span></a></li>'; $html .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/home.php">'.Display::return_icon('home.png',get_lang('Home'),array('hspace'=>'6')).'<span class="'.($show=='home'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('Home').'</span></a></li>';
echo '<li><a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php?f=social">'.Display::return_icon('instant_message.png',get_lang('Messages'),array('hspace'=>'6')).'<span class="'.($show=='messages'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('Messages').$count_unread_message.'</span></a></li>'; $html .= '<li><a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php?f=social">'.Display::return_icon('instant_message.png',get_lang('Messages'),array('hspace'=>'6')).'<span class="'.($show=='messages'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('Messages').$count_unread_message.'</span></a></li>';
//Invitations //Invitations
echo '<li><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.Display::return_icon('invitation.png',get_lang('Invitations'),array('hspace'=>'6')).'<span class="'.($show=='invitations'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('Invitations').$total_invitations.'</span></a></li>'; $html .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.Display::return_icon('invitation.png',get_lang('Invitations'),array('hspace'=>'6')).'<span class="'.($show=='invitations'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('Invitations').$total_invitations.'</span></a></li>';
//Shared profile and groups //Shared profile and groups
echo '<li><a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.Display::return_icon('my_shared_profile.png',get_lang('ViewMySharedProfile'),array('hspace'=>'6')).'<span class="'.($show=='shared_profile'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('ViewMySharedProfile').'</span></a></li> $html .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.Display::return_icon('my_shared_profile.png',get_lang('ViewMySharedProfile'),array('hspace'=>'6')).'<span class="'.($show=='shared_profile'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('ViewMySharedProfile').'</span></a></li>
<li><a href="'.api_get_path(WEB_PATH).'main/social/friends.php">'.Display::return_icon('friend.png',get_lang('Friends'),array('hspace'=>'6')).'<span class="'.($show=='friends'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('Friends').'</span></a></li> <li><a href="'.api_get_path(WEB_PATH).'main/social/friends.php">'.Display::return_icon('friend.png',get_lang('Friends'),array('hspace'=>'6')).'<span class="'.($show=='friends'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('Friends').'</span></a></li>
<li><a href="'.api_get_path(WEB_PATH).'main/social/groups.php">'.Display::return_icon('group.png',get_lang('SocialGroups'),array('hspace'=>'6')).'<span class="'.($show=='browse_groups'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('SocialGroups').'</span></a></li>'; <li><a href="'.api_get_path(WEB_PATH).'main/social/groups.php">'.Display::return_icon('group.png',get_lang('SocialGroups'),array('hspace'=>'6')).'<span class="'.($show=='browse_groups'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('SocialGroups').'</span></a></li>';
//Search users //Search users
echo '<li><a href="'.api_get_path(WEB_PATH).'main/social/search.php">'.Display::return_icon('zoom.png',get_lang('Search'),array('hspace'=>'6')).'<span class="'.($show=='search'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('Search').'</span></a></li>'; $html .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/search.php">'.Display::return_icon('zoom.png',get_lang('Search'),array('hspace'=>'6')).'<span class="'.($show=='search'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('Search').'</span></a></li>';
//My files //My files
echo '<li><a href="'.api_get_path(WEB_PATH).'main/social/myfiles.php">'.Display::return_icon('briefcase.png',get_lang('MyFiles'),array('hspace'=>'6'),16).'<span class="'.($show=='myfiles'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('MyFiles').'</span></a></li>'; $html .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/myfiles.php">'.Display::return_icon('briefcase.png',get_lang('MyFiles'),array('hspace'=>'6'),16).'<span class="'.($show=='myfiles'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('MyFiles').'</span></a></li>';
echo'</ul> $html .='</ul>
</div>'; </div>';
} }
if (in_array($show, $show_groups) && !empty($group_id)) { if (in_array($show, $show_groups) && !empty($group_id)) {
echo GroupPortalManager::show_group_column_information($group_id, api_get_user_id(), $show); $html .= GroupPortalManager::show_group_column_information($group_id, api_get_user_id(), $show);
} }
if ($show == 'shared_profile') { if ($show == 'shared_profile') {
//echo '<div align="center" class="social-menu-title" ><span class="social-menu-text1">'.get_lang('Menu').'</span></div>'; //echo '<div align="center" class="social-menu-title" ><span class="social-menu-text1">'.get_lang('Menu').'</span></div>';
echo '<div class="social_menu_items"> $html .= '<div class="social_menu_items">
<ul>'; <ul>';
// My own profile // My own profile
if ($show_full_profile && $user_id == intval(api_get_user_id())) { if ($show_full_profile && $user_id == intval(api_get_user_id())) {
echo '<li><a href="'.api_get_path(WEB_PATH).'main/social/home.php">'.Display::return_icon('home.png',get_lang('Home'),array('hspace'=>'6')).'<span class="social-menu-text4" >'.get_lang('Home').'</span></a></li> $html .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/home.php">'.Display::return_icon('home.png',get_lang('Home'),array('hspace'=>'6')).'<span class="social-menu-text4" >'.get_lang('Home').'</span></a></li>
<li><a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php?f=social">'.Display::return_icon('instant_message.png',get_lang('Messages'),array('hspace'=>'6')).'<span class="social-menu-text4" >'.get_lang('Messages').$count_unread_message.'</span></a></li>'; <li><a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php?f=social">'.Display::return_icon('instant_message.png',get_lang('Messages'),array('hspace'=>'6')).'<span class="social-menu-text4" >'.get_lang('Messages').$count_unread_message.'</span></a></li>';
echo '<li><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.Display::return_icon('invitation.png',get_lang('Invitations'),array('hspace'=>'6')).'<span class="'.($show=='invitations'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('Invitations').$total_invitations.'</span></a></li>'; $html .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.Display::return_icon('invitation.png',get_lang('Invitations'),array('hspace'=>'6')).'<span class="'.($show=='invitations'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('Invitations').$total_invitations.'</span></a></li>';
echo '<li><a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.Display::return_icon('my_shared_profile.png',get_lang('ViewMySharedProfile'),array('hspace'=>'6','style'=>'float:left')).'<span class="social-menu-text-active" >'.get_lang('ViewMySharedProfile').'</span></a></li> $html .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.Display::return_icon('my_shared_profile.png',get_lang('ViewMySharedProfile'),array('hspace'=>'6','style'=>'float:left')).'<span class="social-menu-text-active" >'.get_lang('ViewMySharedProfile').'</span></a></li>
<li><a href="'.api_get_path(WEB_PATH).'main/social/friends.php">'.Display::return_icon('friend.png',get_lang('Friends'),array('hspace'=>'6')).'<span class="social-menu-text4" >'.get_lang('Friends').'</span></a></li> <li><a href="'.api_get_path(WEB_PATH).'main/social/friends.php">'.Display::return_icon('friend.png',get_lang('Friends'),array('hspace'=>'6')).'<span class="social-menu-text4" >'.get_lang('Friends').'</span></a></li>
<li><a href="'.api_get_path(WEB_PATH).'main/social/groups.php">'.Display::return_icon('group.png',get_lang('SocialGroups'),array('hspace'=>'6')).'<span class="social-menu-text4" >'.get_lang('SocialGroups').'</span></a></li>'; <li><a href="'.api_get_path(WEB_PATH).'main/social/groups.php">'.Display::return_icon('group.png',get_lang('SocialGroups'),array('hspace'=>'6')).'<span class="social-menu-text4" >'.get_lang('SocialGroups').'</span></a></li>';
echo '<li><a href="'.api_get_path(WEB_PATH).'main/social/search.php">'.Display::return_icon('zoom.png',get_lang('Search'),array('hspace'=>'6')).'<span class="'.($show=='search'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('Search').'</span></a></li>'; $html .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/search.php">'.Display::return_icon('zoom.png',get_lang('Search'),array('hspace'=>'6')).'<span class="'.($show=='search'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('Search').'</span></a></li>';
echo '<li><a href="'.api_get_path(WEB_PATH).'main/social/myfiles.php">'.Display::return_icon('briefcase.png',get_lang('MyFiles'),array('hspace'=>'6'),16).'<span class="'.($show=='myfiles'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('MyFiles').'</span></a></li>'; $html .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/myfiles.php">'.Display::return_icon('briefcase.png',get_lang('MyFiles'),array('hspace'=>'6'),16).'<span class="'.($show=='myfiles'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('MyFiles').'</span></a></li>';
} }
// My friend profile // My friend profile
$html_actions = '';
if ($user_id != api_get_user_id()) { if ($user_id != api_get_user_id()) {
echo '<li><a href="'.api_get_path(WEB_PATH).'main/messages/send_message_to_userfriend.inc.php?height=300&width=470&user_friend='.$user_id.'&view=profile&view_panel=1" class="thickbox" title="'.get_lang('SendMessage').'">'; $html .= '<li><a href="'.api_get_path(WEB_PATH).'main/messages/send_message_to_userfriend.inc.php?height=300&width=470&user_friend='.$user_id.'&view=profile&view_panel=1" class="thickbox" title="'.get_lang('SendMessage').'">';
echo Display::return_icon('compose_message.png',get_lang('SendMessage')).'&nbsp;&nbsp;'.get_lang('SendMessage').'</a></li>'; $html .= Display::return_icon('compose_message.png',get_lang('SendMessage')).'&nbsp;&nbsp;'.get_lang('SendMessage').'</a></li>';
} }
//check if I already sent an invitation message //check if I already sent an invitation message
$invitation_sent_list = SocialManager::get_list_invitation_sent_by_user_id(api_get_user_id()); $invitation_sent_list = SocialManager::get_list_invitation_sent_by_user_id(api_get_user_id());
if (isset($invitation_sent_list[$user_id]) && is_array($invitation_sent_list[$user_id]) && count($invitation_sent_list[$user_id]) > 0 ) { if (isset($invitation_sent_list[$user_id]) && is_array($invitation_sent_list[$user_id]) && count($invitation_sent_list[$user_id]) > 0 ) {
echo '<li><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.Display::return_icon('invitation.png',get_lang('YouAlreadySentAnInvitation')).'&nbsp;&nbsp;'.get_lang('YouAlreadySentAnInvitation').'</a></li>'; $html .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.Display::return_icon('invitation.png',get_lang('YouAlreadySentAnInvitation')).'&nbsp;&nbsp;'.get_lang('YouAlreadySentAnInvitation').'</a></li>';
} else { } else {
if (!$show_full_profile) { if (!$show_full_profile) {
echo '<li><a href="'.api_get_path(WEB_PATH).'main/messages/send_message_to_userfriend.inc.php?view_panel=2&height=230&width=500&user_friend='.$user_id.'" class="thickbox" title="'.get_lang('SendInvitation').'">'.Display :: return_icon('invitation.png', get_lang('SocialInvitationToFriends')).'&nbsp;'.get_lang('SendInvitation').'</a></li>'; $html .= '<li><a href="'.api_get_path(WEB_PATH).'main/messages/send_message_to_userfriend.inc.php?view_panel=2&height=230&width=500&user_friend='.$user_id.'" class="thickbox" title="'.get_lang('SendInvitation').'">'.Display :: return_icon('invitation.png', get_lang('SocialInvitationToFriends')).'&nbsp;'.get_lang('SendInvitation').'</a></li>';
} }
} }
@ -703,10 +701,10 @@ class SocialManager extends UserManager {
$user_name = $user_info['complete_name']; $user_name = $user_info['complete_name'];
$options = array('onclick' => "javascript:chatWith('".$user_id."', '".Security::remove_XSS($user_name)."', '".$user_info['user_is_online']."')"); $options = array('onclick' => "javascript:chatWith('".$user_id."', '".Security::remove_XSS($user_name)."', '".$user_info['user_is_online']."')");
$chat_icon = $user_info['user_is_online'] ? Display::return_icon('online.png', get_lang('Online')) : Display::return_icon('offline.png', get_lang('Offline')); $chat_icon = $user_info['user_is_online'] ? Display::return_icon('online.png', get_lang('Online')) : Display::return_icon('offline.png', get_lang('Offline'));
echo Display::tag('li', Display::url($chat_icon.'&nbsp;&nbsp;'.get_lang('Chat'), 'javascript:void(0);', $options)); $html .= Display::tag('li', Display::url($chat_icon.'&nbsp;&nbsp;'.get_lang('Chat'), 'javascript:void(0);', $options));
} }
} }
echo '</ul></div>'; $html .= '</ul></div>';
/* /*
// ---- My Agenda Items // ---- My Agenda Items
@ -758,17 +756,18 @@ class SocialManager extends UserManager {
} }
if (!empty($announcements)) { if (!empty($announcements)) {
//echo '<div align="center" class="social-menu-title" ><span class="social-menu-text1">'.get_lang('ToolAnnouncement').'</span></div>'; //echo '<div align="center" class="social-menu-title" ><span class="social-menu-text1">'.get_lang('ToolAnnouncement').'</span></div>';
echo '<div class="social_menu_items">'; $html .= '<div class="social_menu_items">';
echo '<ul>'; $html .= '<ul>';
foreach ($announcements as $announcement) { foreach ($announcements as $announcement) {
echo $announcement; $html .= $announcement;
} }
echo '</ul>'; $html .= '</ul>';
echo '</div>'; $html .= '</div>';
} }
} }
} }
echo '</div>'; $html .= '</div>';
return $html;
} }
/** /**
@ -837,7 +836,7 @@ class SocialManager extends UserManager {
$params['per_page'] = 10; $params['per_page'] = 10;
} }
$params['hide_navigation'] = true; $params['hide_navigation'] = true;
echo Display::return_sortable_grid('online', $table_header, $table_data, $params, $query_vars); return Display::return_sortable_grid('online', $table_header, $table_data, $params, $query_vars);
//Display::display_sortable_table($table_header, $table_data, array(), array('per_page' => 10), $extra_params, array(),'grid'); //Display::display_sortable_table($table_header, $table_data, array(), array('per_page' => 10), $extra_params, array(),'grid');
} }
} }

@ -166,9 +166,9 @@ class SortableTable extends HTML_Table {
$this->column_filters = array(); $this->column_filters = array();
$this->form_actions = array(); $this->form_actions = array();
$this->checkbox_name = null; $this->checkbox_name = null;
$this->td_attributes = array (); $this->td_attributes = array();
$this->th_attributes = array (); $this->th_attributes = array();
$this->other_tables = array(); $this->other_tables = array();
} }
/** /**
@ -482,7 +482,7 @@ class SortableTable extends HTML_Table {
} }
if ($hide_navigation) { if ($hide_navigation) {
$items = $this->table_data; // This is a faster way to get what we want $items = $this->table_data; // This is a faster way to get what we want
} else { } else {
// The normal way // The normal way
$items = $this->get_clean_html($sort_data); // Getting the items of the table $items = $this->get_clean_html($sort_data); // Getting the items of the table
@ -532,19 +532,19 @@ class SortableTable extends HTML_Table {
* data-pages. * data-pages.
*/ */
public function get_navigation_html () { public function get_navigation_html () {
$pager = $this->get_pager(); $pager = $this->get_pager();
$pager_links = $pager->getLinks(); $pager_links = $pager->getLinks();
$showed_items = $pager->getOffsetByPageId(); $showed_items = $pager->getOffsetByPageId();
$nav = $pager_links['first'].' '.$pager_links['back']; $nav = $pager_links['first'].' '.$pager_links['back'];
$nav .= ' '.$pager->getCurrentPageId().' / '.$pager->numPages().' '; $nav .= ' '.$pager->getCurrentPageId().' / '.$pager->numPages().' ';
$nav .= $pager_links['next'].' '.$pager_links['last']; $nav .= $pager_links['next'].' '.$pager_links['last'];
return $nav; return $nav;
} }
/** /**
* Get the HTML-code with the data-table. * Get the HTML-code with the data-table.
*/ */
public function get_table_html () { public function get_table_html() {
$pager = $this->get_pager(); $pager = $this->get_pager();
$val = $pager->getOffsetByPageId(); $val = $pager->getOffsetByPageId();
$offset = $pager->getOffsetByPageId(); $offset = $pager->getOffsetByPageId();

@ -9,6 +9,7 @@ class Template extends Smarty {
var $style = 'default'; //see the template folder var $style = 'default'; //see the template folder
var $show_header; var $show_header;
var $show_footer; var $show_footer;
var $help;
function __construct($title = '', $show_header = true, $show_footer = true) { function __construct($title = '', $show_header = true, $show_footer = true) {
$this->title = $title; $this->title = $title;
@ -53,6 +54,10 @@ class Template extends Smarty {
$this->assign('style', $this->style); $this->assign('style', $this->style);
} }
function set_help($help) {
$this->help = $help;
}
/* /*
* Use smarty to parse the actions menu * Use smarty to parse the actions menu
@ -183,8 +188,9 @@ class Template extends Smarty {
} }
private function set_header_parameters($help = null) { private function set_header_parameters() {
$nameTools = $this->title; $help = $this->help;
$nameTools = $this->title;
global $_plugins, $lp_theme_css, $mycoursetheme, $user_theme, $platform_theme; global $_plugins, $lp_theme_css, $mycoursetheme, $user_theme, $platform_theme;
global $httpHeadXtra, $htmlHeadXtra, $_course, $_user, $text_dir, $plugins, $_user, global $httpHeadXtra, $htmlHeadXtra, $_course, $_user, $text_dir, $plugins, $_user,
$_cid, $interbreadcrumb, $charset, $language_file, $noPHP_SELF; $_cid, $interbreadcrumb, $charset, $language_file, $noPHP_SELF;

@ -2823,7 +2823,7 @@ class UserManager {
* *
*/ */
public static function get_search_form($query) { public static function get_search_form($query) {
echo'<div class="social-groups-home-title"><b>'.get_lang('Search').'</b > ('.get_lang('UsersGroups').')</div> return '<div class="social-groups-home-title"><b>'.get_lang('Search').'</b > ('.get_lang('UsersGroups').')</div>
<form method="GET" action="'.api_get_path(WEB_PATH).'main/social/search.php"> <form method="GET" action="'.api_get_path(WEB_PATH).'main/social/search.php">
<table cellspacing="0" cellpadding="0"> <table cellspacing="0" cellpadding="0">
<tr> <tr>

@ -24,7 +24,6 @@ if (isset($_GET['messages_page_nr'])) {
if (api_get_setting('allow_message_tool')!='true'){ if (api_get_setting('allow_message_tool')!='true'){
api_not_allowed(); api_not_allowed();
} }
//jquery thickbox already called from main/inc/header.inc.php
$htmlHeadXtra[]='<script language="javascript"> $htmlHeadXtra[]='<script language="javascript">
@ -81,13 +80,13 @@ if (isset($_GET['form_reply']) || isset($_GET['form_delete'])) {
} }
if (isset($user_reply) && !is_null($user_id_by_email) && strlen($info_reply[0]) >0) { if (isset($user_reply) && !is_null($user_id_by_email) && strlen($info_reply[0]) >0) {
MessageManager::send_message($user_id_by_email, $title, $content); MessageManager::send_message($user_id_by_email, $title, $content);
MessageManager::display_success_message($user_id_by_email); $show_message .= MessageManager::return_message($user_id_by_email,'confirmation');
inbox_display(); $social_right_content .= inbox_display();
exit; exit;
} elseif (is_null($user_id_by_email)) { } elseif (is_null($user_id_by_email)) {
$message_box=get_lang('ErrorSendingMessage'); $message_box=get_lang('ErrorSendingMessage');
Display::display_error_message(api_xml_http_response_encode($message_box),false); $show_message .= Display::return_message(api_xml_http_response_encode($message_box),'error');
inbox_display(); $social_right_content .= inbox_display();
exit; exit;
} }
} elseif (trim($info_delete[0])=='delete' ) { } elseif (trim($info_delete[0])=='delete' ) {
@ -95,18 +94,12 @@ if (isset($_GET['form_reply']) || isset($_GET['form_delete'])) {
MessageManager::delete_message_by_user_receiver(api_get_user_id(), $info_delete[$i]); MessageManager::delete_message_by_user_receiver(api_get_user_id(), $info_delete[$i]);
} }
$message_box=get_lang('SelectedMessagesDeleted'); $message_box=get_lang('SelectedMessagesDeleted');
Display::display_normal_message(api_xml_http_response_encode($message_box),false); $show_message .= Display::return_message(api_xml_http_response_encode($message_box));
inbox_display(); $social_right_content .= inbox_display();
exit; exit;
} }
} }
$link_ref="new_message.php";
$table_message = Database::get_main_table(TABLE_MESSAGE);
//api_display_tool_title(api_xml_http_response_encode(get_lang('Inbox')));
if ($_GET['f']=='social') { if ($_GET['f']=='social') {
$this_section = SECTION_SOCIAL; $this_section = SECTION_SOCIAL;
$interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/social/home.php','name' => get_lang('Social')); $interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/social/home.php','name' => get_lang('Social'));
@ -117,63 +110,63 @@ if ($_GET['f']=='social') {
$interbreadcrumb[]= array ('url' => '#','name' => get_lang('Inbox')); $interbreadcrumb[]= array ('url' => '#','name' => get_lang('Inbox'));
} }
Display::display_header(''); //Display::display_header('');
$social_parameter = ''; $social_parameter = '';
if ($_GET['f']=='social' || api_get_setting('allow_social_tool') == 'true') { if ($_GET['f']=='social' || api_get_setting('allow_social_tool') == 'true') {
$social_parameter = '?f=social'; $social_parameter = '?f=social';
} else { } else {
//Comes from normal profile //Comes from normal profile
echo '<div class="actions">';
if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') { if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') {
echo '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).'&nbsp;'.get_lang('ViewSharedProfile').'</a>'; $actions .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).'&nbsp;'.get_lang('ViewSharedProfile').'</a>';
} }
if (api_get_setting('allow_message_tool') == 'true') { if (api_get_setting('allow_message_tool') == 'true') {
//echo '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.Display::return_icon('inbox.png').' '.get_lang('Messages').'</a>'; $actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.Display::return_icon('message_new.png',get_lang('ComposeMessage')).get_lang('ComposeMessage').'</a>';
echo '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.Display::return_icon('message_new.png',get_lang('ComposeMessage')).get_lang('ComposeMessage').'</a>'; $actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.Display::return_icon('inbox.png',get_lang('Inbox')).get_lang('Inbox').'</a>';
echo '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.Display::return_icon('inbox.png',get_lang('Inbox')).get_lang('Inbox').'</a>'; $actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.Display::return_icon('outbox.png',get_lang('Outbox')).get_lang('Outbox').'</a>';
echo '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.Display::return_icon('outbox.png',get_lang('Outbox')).get_lang('Outbox').'</a>';
} }
echo '</div>'; }
//LEFT CONTENT
if (api_get_setting('allow_social_tool') == 'true') {
$social_left_content = SocialManager::show_social_menu('messages');
} }
echo '<div id="social-content">'; //Right content
$id_content_right = '';
//LEFT CONTENT if (api_get_setting('allow_social_tool') == 'true') {
if (api_get_setting('allow_social_tool') != 'true') { $social_right_content .= '<div class="actions">';
$id_content_right = 'inbox'; $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php?f=social">'.Display::return_icon('compose_message.png', get_lang('ComposeMessage'), array(), 32).'</a>';
} else { $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php?f=social">'.Display::return_icon('outbox.png', get_lang('Outbox'), array(), 32).'</a>';
$id_content_right = 'social-content-right'; $social_right_content .= '</div>';
echo '<div id="social-content-left">';
//this include the social menu div
SocialManager::show_social_menu('messages');
echo '</div>';
}
echo '<div id="'.$id_content_right.'">'; }
if (api_get_setting('allow_social_tool') == 'true') { //MAIN CONTENT
echo '<div class="actions">'; if (!isset($_GET['del_msg'])) {
echo '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php?f=social">'.Display::return_icon('compose_message.png', get_lang('ComposeMessage'), array(), 32).'</a>'; $social_right_content .= inbox_display();
echo '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php?f=social">'.Display::return_icon('outbox.png', get_lang('Outbox'), array(), 32).'</a>'; } else {
echo '</div>'; $num_msg = intval($_POST['total']);
for ($i=0;$i<$num_msg;$i++) {
} if($_POST[$i]) {
//MAIN CONTENT //the user_id was necesarry to delete a message??
if (!isset($_GET['del_msg'])) { $show_message .= MessageManager::delete_message_by_user_receiver(api_get_user_id(), $_POST['_'.$i]);
inbox_display(); }
} else { }
$num_msg = intval($_POST['total']); $social_right_content .= inbox_display();
for ($i=0;$i<$num_msg;$i++) { }
if($_POST[$i]) { $social_right_content .= '</div>';
//the user_id was necesarry to delete a message??
MessageManager::delete_message_by_user_receiver(api_get_user_id(), $_POST['_'.$i]);
}
}
inbox_display();
}
echo '</div>';
echo '</div>';
Display::display_footer(); $tpl = new Template($tool_name);
if (api_get_setting('allow_social_tool') == 'true') {
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_left_menu', $social_left_menu);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
$content = $tpl->fetch($social_layout);
}
$tpl->assign('actions', $actions);
$tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();

@ -45,7 +45,6 @@ function validate(form,list) {
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/tag/jquery.fcbkcomplete.js" type="text/javascript" language="javascript"></script>'; $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/tag/jquery.fcbkcomplete.js" type="text/javascript" language="javascript"></script>';
$htmlHeadXtra[] = '<link href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/tag/style.css" rel="stylesheet" type="text/css" />'; $htmlHeadXtra[] = '<link href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/tag/style.css" rel="stylesheet" type="text/css" />';
$htmlHeadXtra[] = '<script type="text/javascript"> $htmlHeadXtra[] = '<script type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
$("#users").fcbkcomplete({ $("#users").fcbkcomplete({
@ -130,7 +129,8 @@ function show_compose_to_any ($user_id) {
$online_user_list = MessageManager::get_online_user_list($user_id); $online_user_list = MessageManager::get_online_user_list($user_id);
$default['user_list'] = 0; $default['user_list'] = 0;
$online_user_list=null; $online_user_list=null;
manage_form($default, $online_user_list); $html = manage_form($default, $online_user_list);
return $html;
} }
function show_compose_reply_to_message($message_id, $receiver_id) { function show_compose_reply_to_message($message_id, $receiver_id) {
@ -140,31 +140,29 @@ function show_compose_reply_to_message($message_id, $receiver_id) {
$result = Database::query($query); $result = Database::query($query);
$row = Database::fetch_array($result,'ASSOC'); $row = Database::fetch_array($result,'ASSOC');
if (!isset($row['user_sender_id'])) { if (!isset($row['user_sender_id'])) {
echo get_lang('InvalidMessageId'); $html = get_lang('InvalidMessageId');
exit; return $html;
} }
$pre_html = '<div class="row"> $pre_html = '<div class="row">
<div class="label">'.get_lang('SendMessageTo').': </div> <div class="label">'.get_lang('SendMessageTo').': </div>
<div class="formw">'; <div class="formw">';
$post = '</div></div>'; $post = '</div></div>';
$multi_select = '<select id="users" name="users"> $sent_to = $pre_html.'<strong>'.GetFullUserName($row['user_sender_id']).'</strong>'.$post;
</select>';
echo $pre_html.'<strong>'.GetFullUserName($row['user_sender_id']).'</strong>'.$post;
$default['users'] = array($row['user_sender_id']); $default['users'] = array($row['user_sender_id']);
manage_form($default); $html .= manage_form($default, null, $sent_to);
return $html;
} }
function show_compose_to_user ($receiver_id) { function show_compose_to_user ($receiver_id) {
global $charset; global $charset;
echo get_lang('To').':&nbsp;<strong>'. GetFullUserName($receiver_id).'</strong>'; $html = get_lang('To').':&nbsp;<strong>'.GetFullUserName($receiver_id).'</strong>';
$default['title'] = api_xml_http_response_encode(get_lang('EnterTitle')); $default['title'] = api_xml_http_response_encode(get_lang('EnterTitle'));
$default['users'] = array($receiver_id); $default['users'] = array($receiver_id);
manage_form($default); $html .= manage_form($default);
return $html;
} }
function manage_form ($default, $select_from_user_list = null) { function manage_form($default, $select_from_user_list = null, $sent_to = null) {
$table_message = Database::get_main_table(TABLE_MESSAGE);
$group_id = isset($_REQUEST['group_id']) ? intval($_REQUEST['group_id']) : null; $group_id = isset($_REQUEST['group_id']) ? intval($_REQUEST['group_id']) : null;
$message_id = isset($_GET['message_id']) ? intval($_GET['message_id']) : null; $message_id = isset($_GET['message_id']) ? intval($_GET['message_id']) : null;
@ -178,12 +176,14 @@ function manage_form ($default, $select_from_user_list = null) {
$form->addElement('html','<div id="id_div_search" style="padding:0px" class="message-select-box" >&nbsp;</div>'); $form->addElement('html','<div id="id_div_search" style="padding:0px" class="message-select-box" >&nbsp;</div>');
$form->addElement('hidden','user_list',0,array('id'=>'user_list')); $form->addElement('hidden','user_list',0,array('id'=>'user_list'));
} else { } else {
if (!empty($sent_to)) {
$form->addElement('html',$sent_to);
}
if (empty($default['users'])) { if (empty($default['users'])) {
//the magic should be here //the magic should be here
$pre_html = '<div class="row"> $pre_html = '<div class="row">
<div class="label">'.get_lang('SendMessageTo').'</div> <div class="label">'.get_lang('SendMessageTo').'</div>
<div class="formw">'; <div class="formw">';
$post = '</div></div>'; $post = '</div></div>';
$multi_select = '<select id="users" name="users"> $multi_select = '<select id="users" name="users">
</select>'; </select>';
@ -231,7 +231,7 @@ function manage_form ($default, $select_from_user_list = null) {
$default['title'] = get_lang('Re:').$message_info['title']; $default['title'] = get_lang('Re:').$message_info['title'];
} }
$form->setDefaults($default); $form->setDefaults($default);
$html = '';
if ($form->validate()) { if ($form->validate()) {
$check = Security::check_token('post'); $check = Security::check_token('post');
if ($check) { if ($check) {
@ -247,9 +247,9 @@ function manage_form ($default, $select_from_user_list = null) {
$res = MessageManager::send_message($user, $title, $content, $_FILES, $file_comments, $group_id, $parent_id); $res = MessageManager::send_message($user, $title, $content, $_FILES, $file_comments, $group_id, $parent_id);
if ($res) { if ($res) {
if (is_string($res)) { if (is_string($res)) {
Display::display_error_message($res); $html .= Display::return_message($res, 'error');
} else { } else {
MessageManager::display_success_message($user); $html .= MessageManager::display_success_message($user);
} }
} }
} }
@ -262,8 +262,9 @@ function manage_form ($default, $select_from_user_list = null) {
$token = Security::get_token(); $token = Security::get_token();
$form->addElement('hidden','sec_token'); $form->addElement('hidden','sec_token');
$form->setConstants(array('sec_token' => $token)); $form->setConstants(array('sec_token' => $token));
$form->display(); $html .= $form->return_form();
} }
return $html;
} }
/* MAIN SECTION */ /* MAIN SECTION */
@ -272,101 +273,96 @@ if ($_GET['f']=='social') {
$interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/social/home.php','name' => get_lang('Social')); $interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/social/home.php','name' => get_lang('Social'));
} else { } else {
$this_section = SECTION_MYPROFILE; $this_section = SECTION_MYPROFILE;
$interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/auth/profile.php','name' => get_lang('Profile')); $interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/auth/profile.php','name' => get_lang('Profile'));
//$interbreadcrumb[]= array ('url' => '#','name' => get_lang('ComposeMessage'));
} }
Display::display_header(get_lang('ComposeMessage')); //Display::display_header(get_lang('ComposeMessage'));
$group_id = isset($_REQUEST['group_id']) ? intval($_REQUEST['group_id']) : null; $group_id = isset($_REQUEST['group_id']) ? intval($_REQUEST['group_id']) : null;
if ($group_id != 0) { if ($group_id != 0) {
echo '<div class=actions>'; $social_right_content .= '<div class=actions>';
echo '<a href="'.api_get_path(WEB_PATH).'main/social/groups.php?id='.$group_id.'">'.Display::return_icon('back.png',api_xml_http_response_encode(get_lang('ComposeMessage'))).api_xml_http_response_encode(get_lang('BackToGroup')).'</a>'; $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/groups.php?id='.$group_id.'">'.Display::return_icon('back.png',api_xml_http_response_encode(get_lang('ComposeMessage'))).api_xml_http_response_encode(get_lang('BackToGroup')).'</a>';
echo '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php?group_id='.$group_id.'">'.Display::return_icon('message_new.png',api_xml_http_response_encode(get_lang('ComposeMessage'))).api_xml_http_response_encode(get_lang('ComposeMessage')).'</a>'; $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php?group_id='.$group_id.'">'.Display::return_icon('message_new.png',api_xml_http_response_encode(get_lang('ComposeMessage'))).api_xml_http_response_encode(get_lang('ComposeMessage')).'</a>';
echo '</div>'; $social_right_content .= '</div>';
} else { } else {
if ($_GET['f']=='social') { if ($_GET['f']=='social') {
} else { } else {
echo '<div class=actions>'; $social_right_content .= '<div class=actions>';
if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') { if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') {
echo '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).'&nbsp;'.get_lang('ViewSharedProfile').'</a>'; $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).'&nbsp;'.get_lang('ViewSharedProfile').'</a>';
} }
if (api_get_setting('allow_message_tool') == 'true') { if (api_get_setting('allow_message_tool') == 'true') {
echo '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.Display::return_icon('message_new.png',get_lang('ComposeMessage')).get_lang('ComposeMessage').'</a>'; $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.Display::return_icon('message_new.png',get_lang('ComposeMessage')).get_lang('ComposeMessage').'</a>';
echo '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.Display::return_icon('inbox.png',get_lang('Inbox')).get_lang('Inbox').'</a>'; $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.Display::return_icon('inbox.png',get_lang('Inbox')).get_lang('Inbox').'</a>';
echo '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.Display::return_icon('outbox.png',get_lang('Outbox')).get_lang('Outbox').'</a>'; $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.Display::return_icon('outbox.png',get_lang('Outbox')).get_lang('Outbox').'</a>';
} }
echo '</div>'; $social_right_content .= '</div>';
} }
} }
echo '<div id="social-content">';
$id_content_right = '';
//LEFT COLUMN
if (api_get_setting('allow_social_tool') != 'true') {
$id_content_right = 'inbox';
} else {
echo '<div id="social-content-left">';
//this include the social menu div
SocialManager::show_social_menu('messages');
echo '</div>';
$id_content_right = 'social-content-right';
}
echo '<div id="'.$id_content_right.'">';
//MAIN CONTENT //LEFT COLUMN
if (api_get_setting('allow_social_tool') == 'true') {
echo '<div class="actions">';
echo '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php?f=social">'.Display::return_icon('back.png', get_lang('Back'), array(), 32).'</a>';
echo '</div>';
}
if (!isset($_POST['compose'])) {
if(isset($_GET['re_id'])) {
show_compose_reply_to_message($_GET['re_id'], api_get_user_id());
} elseif(isset($_GET['send_to_user'])) {
show_compose_to_user($_GET['send_to_user']);
} else {
show_compose_to_any($_user['user_id']);
}
} else {
$restrict = false;
if (isset($_POST['users'])) {
$restrict = true;
} elseif (isset($_POST['group_id'])) {
$restrict = true;
} elseif(isset($_POST['hidden_user'])) {
$restrict = true;
}
$default['title'] = $_POST['title'];
$default['content'] = $_POST['content'];
// comes from a reply button if (api_get_setting('allow_social_tool') == 'true') {
if (isset($_GET['re_id'])) { $social_left_content = SocialManager::show_social_menu('messages');
manage_form($default); $social_right_content .= '<div class="actions">';
} else { $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php?f=social">'.Display::return_icon('back.png', get_lang('Back'), array(), 32).'</a>';
// post $social_right_content .= '</div>';
if ($restrict) { }
if (!isset($_POST['group_id'])) { //MAIN CONTENT
$default['users'] = $_POST['users']; if (!isset($_POST['compose'])) {
} else { if(isset($_GET['re_id'])) {
$default['group_id'] = $_POST['group_id']; $social_right_content .= show_compose_reply_to_message($_GET['re_id'], api_get_user_id());
} } elseif(isset($_GET['send_to_user'])) {
if (isset($_POST['hidden_user'])) { $social_right_content .= show_compose_to_user($_GET['send_to_user']);
$default['users'] = array($_POST['hidden_user']); } else {
} $social_right_content .= show_compose_to_any($_user['user_id']);
manage_form($default); }
} else { } else {
Display::display_error_message(get_lang('ErrorSendingMessage')); $restrict = false;
} if (isset($_POST['users'])) {
} $restrict = true;
} } elseif (isset($_POST['group_id'])) {
echo '</div>'; $restrict = true;
echo '</div>'; } elseif(isset($_POST['hidden_user'])) {
$restrict = true;
}
/* FOOTER */ $default['title'] = $_POST['title'];
Display::display_footer(); $default['content'] = $_POST['content'];
// comes from a reply button
if (isset($_GET['re_id'])) {
$social_right_content .= manage_form($default);
} else {
// post
if ($restrict) {
if (!isset($_POST['group_id'])) {
$default['users'] = $_POST['users'];
} else {
$default['group_id'] = $_POST['group_id'];
}
if (isset($_POST['hidden_user'])) {
$default['users'] = array($_POST['hidden_user']);
}
$social_right_content .= manage_form($default);
} else {
$social_right_content .= Display::return_message(get_lang('ErrorSendingMessage'),'error');
}
}
}
$social_right_content .= '</div>';
$tpl = new Template(get_lang('ComposeMessage'));
if (api_get_setting('allow_social_tool') == 'true') {
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_left_menu', $social_left_menu);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
$content = $tpl->fetch($social_layout);
}
$tpl->assign('actions', $actions);
$tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();

@ -73,28 +73,20 @@ if ($_GET['f']=='social') {
$interbreadcrumb[]= array ('url' => '#','name' => get_lang('Outbox')); $interbreadcrumb[]= array ('url' => '#','name' => get_lang('Outbox'));
} }
Display::display_header('');
if ($_GET['f']=='social') { if ($_GET['f']=='social') {
} else { } else {
if (api_get_setting('extended_profile') == 'true') {
if (api_get_setting('extended_profile') == 'true') {
echo '<div class="actions">';
if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') { if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') {
echo '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).'&nbsp;'.get_lang('ViewSharedProfile').'</a>'; $actions .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).'&nbsp;'.get_lang('ViewSharedProfile').'</a>';
} }
if (api_get_setting('allow_message_tool') == 'true') { if (api_get_setting('allow_message_tool') == 'true') {
//echo '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.Display::return_icon('inbox.png').' '.get_lang('Messages').'</a>'; //echo '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.Display::return_icon('inbox.png').' '.get_lang('Messages').'</a>';
echo '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.Display::return_icon('message_new.png',get_lang('ComposeMessage')).get_lang('ComposeMessage').'</a>'; $actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.Display::return_icon('message_new.png',get_lang('ComposeMessage')).get_lang('ComposeMessage').'</a>';
echo '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.Display::return_icon('inbox.png',get_lang('Inbox')).get_lang('Inbox').'</a>'; $actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.Display::return_icon('inbox.png',get_lang('Inbox')).get_lang('Inbox').'</a>';
echo '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.Display::return_icon('outbox.png',get_lang('Outbox')).get_lang('Outbox').'</a>'; $actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.Display::return_icon('outbox.png',get_lang('Outbox')).get_lang('Outbox').'</a>';
}
}
//echo '<a href="'.api_get_path(WEB_PATH).'main/auth/profile.php?type=reduced">'.Display::return_icon('edit.gif', get_lang('EditNormalProfile')).'&nbsp;'.get_lang('EditNormalProfile').'</a>';
echo '</div>';
} }
} }
@ -106,69 +98,62 @@ if( trim($info_delete_outbox[0])=='delete' ) {
for ($i=1;$i<=$count_delete_outbox;$i++) { for ($i=1;$i<=$count_delete_outbox;$i++) {
MessageManager::delete_message_by_user_sender(api_get_user_id(),$info_delete_outbox[$i]); MessageManager::delete_message_by_user_sender(api_get_user_id(),$info_delete_outbox[$i]);
} }
$message_box=get_lang('SelectedMessagesDeleted'). $message_box=get_lang('SelectedMessagesDeleted').
'&nbsp '&nbsp
<br><a href="../social/index.php?#remote-tab-3">'. <br><a href="../social/index.php?#remote-tab-3">'.
get_lang('BackToOutbox'). get_lang('BackToOutbox').
'</a>'; '</a>';
Display::display_normal_message(api_xml_http_response_encode($message_box),false); Display::display_normal_message(api_xml_http_response_encode($message_box),false);
exit; exit;
} }
$table_message = Database::get_main_table(TABLE_MESSAGE);
$user_sender_id = api_get_user_id();
$action = null; $action = null;
if (isset($_REQUEST['action'])) { if (isset($_REQUEST['action'])) {
$action = $_REQUEST['action']; $action = $_REQUEST['action'];
} }
echo '<div id="social-content">'; if (api_get_setting('allow_social_tool') == 'true') {
$id_content_right = ''; $social_left_content = SocialManager::show_social_menu('messages');
//LEFT COLUMN $social_right_content .= '<div class="actions">';
if (api_get_setting('allow_social_tool') != 'true') { $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php?f=social">'.Display::return_icon('back.png', get_lang('Back'), array(), 32).'</a>';
$id_content_right = 'outbox'; $social_right_content .= '</div>';
} else { }
$id_content_right = 'social-content-right'; //MAIN CONTENT
echo '<div id="social-content-left">'; if ($action == 'delete') {
//this include the social menu div $delete_list_id=array();
SocialManager::show_social_menu('messages'); if (isset($_POST['out'])) {
echo '</div>'; $delete_list_id=$_POST['out'];
} }
if (isset($_POST['id'])) {
echo '<div id="'.$id_content_right.'">'; $delete_list_id=$_POST['id'];
if (api_get_setting('allow_social_tool') == 'true') { }
echo '<div class="actions">'; for ($i=0;$i<count($delete_list_id);$i++) {
echo '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php?f=social">'.Display::return_icon('back.png', get_lang('Back'), array(), 32).'</a>'; MessageManager::delete_message_by_user_sender(api_get_user_id(), $delete_list_id[$i]);
echo '</div>'; }
} $delete_list_id=array();
//MAIN CONTENT $social_right_content .= outbox_display();
if ($action == 'delete') {
$delete_list_id=array(); } elseif($action =='deleteone') {
if (isset($_POST['out'])) { $delete_list_id=array();
$delete_list_id=$_POST['out']; $id = Security::remove_XSS($_GET['id']);
} MessageManager::delete_message_by_user_sender(api_get_user_id(),$id);
if (isset($_POST['id'])) { $delete_list_id=array();
$delete_list_id=$_POST['id']; $social_right_content .= outbox_display();
} } else {
for ($i=0;$i<count($delete_list_id);$i++) { $social_right_content .= outbox_display();
MessageManager::delete_message_by_user_sender(api_get_user_id(), $delete_list_id[$i]); }
}
$delete_list_id=array(); $tpl = new Template(get_lang('ComposeMessage'));
outbox_display(); if (api_get_setting('allow_social_tool') == 'true') {
$tpl->assign('social_left_content', $social_left_content);
} elseif($action =='deleteone') { $tpl->assign('social_left_menu', $social_left_menu);
$delete_list_id=array(); $tpl->assign('social_right_content', $social_right_content);
$id=Security::remove_XSS($_GET['id']); $social_layout = $tpl->get_template('layout/social_layout.tpl');
MessageManager::delete_message_by_user_sender(api_get_user_id(),$id); $content = $tpl->fetch($social_layout);
$delete_list_id=array(); } else {
outbox_display(); $content = $social_right_content;
} else { }
outbox_display(); $tpl->assign('actions', $actions);
} $tpl->assign('message', $show_message);
echo '</div>'; $tpl->assign('content', $content);
echo '</div>'; $tpl->display_one_col_template();
/* FOOTER */
Display::display_footer();

@ -25,64 +25,65 @@ if ($_REQUEST['f']=='social') {
$interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/auth/profile.php','name' => get_lang('Profile')); $interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/auth/profile.php','name' => get_lang('Profile'));
} }
Display::display_header(get_lang('View'));
if ($_GET['f']=='social') { if ($_GET['f']=='social') {
$social_parameter = '?f=social'; $social_parameter = '?f=social';
} else { } else {
if (api_get_setting('extended_profile') == 'true') { if (api_get_setting('extended_profile') == 'true') {
echo '<div class="actions">'; $social_right_content .= '<div class="actions">';
if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') { if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') {
echo '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).'&nbsp;'.get_lang('ViewSharedProfile').'</a>'; $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).'&nbsp;'.get_lang('ViewSharedProfile').'</a>';
} }
if (api_get_setting('allow_message_tool') == 'true') { if (api_get_setting('allow_message_tool') == 'true') {
//echo '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.Display::return_icon('inbox.png').' '.get_lang('Messages').'</a>'; //echo '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.Display::return_icon('inbox.png').' '.get_lang('Messages').'</a>';
echo '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.Display::return_icon('message_new.png',get_lang('ComposeMessage')).get_lang('ComposeMessage').'</a>'; $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.Display::return_icon('message_new.png',get_lang('ComposeMessage')).get_lang('ComposeMessage').'</a>';
echo '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.Display::return_icon('inbox.png',get_lang('Inbox')).get_lang('Inbox').'</a>'; $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.Display::return_icon('inbox.png',get_lang('Inbox')).get_lang('Inbox').'</a>';
echo '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.Display::return_icon('outbox.png',get_lang('Outbox')).get_lang('Outbox').'</a>'; $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.Display::return_icon('outbox.png',get_lang('Outbox')).get_lang('Outbox').'</a>';
} }
//echo '<a href="'.api_get_path(WEB_PATH).'main/auth/profile.php?type=reduced">'.Display::return_icon('edit.gif', get_lang('EditNormalProfile')).'&nbsp;'.get_lang('EditNormalProfile').'</a>'; //echo '<a href="'.api_get_path(WEB_PATH).'main/auth/profile.php?type=reduced">'.Display::return_icon('edit.gif', get_lang('EditNormalProfile')).'&nbsp;'.get_lang('EditNormalProfile').'</a>';
echo '</div>'; $social_right_content .= '</div>';
} }
} }
echo '<div id="social-content">'; if (empty($_GET['id'])) {
if (empty($_GET['id'])) { $id_message = $_GET['id_send'];
$id_message = $_GET['id_send']; $source = 'outbox';
$source = 'outbox'; $show_menu = 'messages_outbox';
$show_menu = 'messages_outbox'; } else {
} else { $id_message = $_GET['id'];
$id_message = $_GET['id']; $source = 'inbox';
$source = 'inbox'; $show_menu = 'messages_inbox';
$show_menu = 'messages_inbox'; }
}
$id_content_right = ''; //LEFT COLUMN
//LEFT COLUMN if (api_get_setting('allow_social_tool') == 'true') {
if (api_get_setting('allow_social_tool') != 'true') { $social_left_content = SocialManager::show_social_menu($show_menu);
$id_content_right = 'inbox'; }
} else { //MAIN CONTENT
$id_content_right = 'social-content-right'; $message = MessageManager::show_message_box($id_message,$source);
echo '<div id="social-content-left">';
//this include the social menu div
SocialManager::show_social_menu($show_menu);
echo '</div>';
}
echo '<div id="'.$id_content_right.'">'; if (!empty($message)) {
//MAIN CONTENT $social_right_content .= $message;
$message = MessageManager::show_message_box($id_message,$source); } else {
api_not_allowed();
if (!empty($message)) { }
echo $message;
} else {
api_not_allowed(); $tpl = new Template(get_lang('View'));
} if (api_get_setting('allow_social_tool') == 'true') {
echo '</div>'; $tpl->assign('social_left_content', $social_left_content);
echo '</div>'; $tpl->assign('social_left_menu', $social_left_menu);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
$content = $tpl->fetch($social_layout);
} else {
$content = $social_right_content;
}
/* FOOTER */ $tpl->assign('actions', $actions);
Display::display_footer(); $tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();

@ -297,16 +297,11 @@ if (!empty($student_id)) {
echo '</div>'; echo '</div>';
// is the user online ? // is the user online ?
$student_online = intval($_GET['student']); if (user_is_online($_GET['student'])) {
$users_online = who_is_online(30); $online = get_lang('Yes');
foreach ($users_online as $online) { } else {
if (in_array($_GET['student'], $online)) { $online = get_lang('No');
$online = get_lang('Yes'); }
break;
} else {
$online = get_lang('No');
}
}
// get average of score and average of progress by student // get average of score and average of progress by student
$avg_student_progress = $avg_student_score = $nb_courses = 0; $avg_student_progress = $avg_student_score = $nb_courses = 0;

@ -85,20 +85,12 @@ function clear_form () {
$interbreadcrumb[]= array ('url' =>'profile.php','name' => get_lang('Social')); $interbreadcrumb[]= array ('url' =>'profile.php','name' => get_lang('Social'));
$interbreadcrumb[]= array ('url' =>'#','name' => get_lang('Friends')); $interbreadcrumb[]= array ('url' =>'#','name' => get_lang('Friends'));
Display :: display_header($tool_name, 'Groups'); //Display :: display_header($tool_name, 'Groups');
echo '<div id="social-content">'; $social_left_content = SocialManager::show_social_menu('friends');
echo '<div id="social-content-left">';
//this include the social menu div
SocialManager::show_social_menu('friends');
echo '</div>';
echo '<div id="social-content-right">';
$language_variable = api_xml_http_response_encode(get_lang('Contacts'));
$user_id = api_get_user_id(); $user_id = api_get_user_id();
$list_path_friends = array();
$user_id = api_get_user_id(); $user_id = api_get_user_id();
$name_search = isset($_POST['search_name_q']) ? $_POST['search_name_q']: null; $name_search = isset($_POST['search_name_q']) ? $_POST['search_name_q']: null;
$number_friends = 0; $number_friends = 0;
@ -109,14 +101,13 @@ if (isset($name_search) && $name_search!='undefined') {
$friends = SocialManager::get_friends($user_id); $friends = SocialManager::get_friends($user_id);
} }
if (count($friends) == 0 ) { if (count($friends) == 0 ) {
echo get_lang('NoFriendsInYourContactList').'<br /><br />'; $social_right_content = get_lang('NoFriendsInYourContactList').'<br /><br />';
echo '<a href="search.php">'.get_lang('TryAndFindSomeFriends').'</a>'; $social_right_content .= '<a href="search.php">'.get_lang('TryAndFindSomeFriends').'</a>';
} else { } else {
echo get_lang('Search') .'&nbsp;&nbsp; : &nbsp;&nbsp;'; ?> $social_right_content = get_lang('Search') .'&nbsp;&nbsp; : &nbsp;&nbsp;';
<input class="social-search-image" type="text" id="id_search_image" name="id_search_image" onkeyup="search_image_social()" /> $social_right_content .= '<input class="social-search-image" type="text" id="id_search_image" name="id_search_image" onkeyup="search_image_social()" />';
<?php
$friend_html = ''; $friend_html = '';
$number_of_images = 8; $number_of_images = 8;
@ -141,8 +132,19 @@ if (count($friends) == 0 ) {
$friend_html.='</td></tr>'; $friend_html.='</td></tr>';
} }
$friend_html.='<br/></table>'; $friend_html.='<br/></table>';
echo $friend_html; $social_right_content .= $friend_html;
} }
echo '</div>'; $social_right_content .= '</div>';
echo '</div>'; $social_right_content .= '</div>';
Display :: display_footer(); $social_right_content .= '</div>';
$tpl = new Template(get_lang('Social'));
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_left_menu', $social_left_menu);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
$content = $tpl->fetch($social_layout);
$tpl->assign('actions', $actions);
$tpl->assign('message', $message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();

@ -102,15 +102,24 @@ $this_section = SECTION_SOCIAL;
$interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social')); $interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social'));
$interbreadcrumb[]= array ('url' =>'groups.php','name' => get_lang('Groups')); $interbreadcrumb[]= array ('url' =>'groups.php','name' => get_lang('Groups'));
$interbreadcrumb[]= array ('url' =>'#','name' => $nameTools); $interbreadcrumb[]= array ('url' =>'#','name' => $nameTools);
Display :: display_header($tool_name, 'Groups'); //Display :: display_header($tool_name, 'Groups');
echo '<div id="social-content">'; $social_left_content = SocialManager::show_social_menu('group_add');
echo '<div id="social-content-left">';
//show the action menu $social_right_content .= $form->return_form();
SocialManager::show_social_menu('group_add');
echo '</div>';
echo '<div id="social-content-right">';
$form->display();
echo '</div>';
echo '</div>'; $tpl = new Template($tool_name);
Display :: display_footer(); $tpl->set_help('Groups');
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_left_menu', $social_left_menu);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
$content = $tpl->fetch($social_layout);
$tpl->assign('actions', $actions);
$tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();

@ -127,8 +127,6 @@ if ( $form->validate()) {
exit(); exit();
} }
Display::display_header($tool_name);
// Group picture // Group picture
$image_path = GroupPortalManager::get_group_picture_path_by_id($group_id,'web'); $image_path = GroupPortalManager::get_group_picture_path_by_id($group_id,'web');
$image_dir = $image_path['dir']; $image_dir = $image_path['dir'];
@ -143,19 +141,18 @@ $big_image_width = $big_image_size['width'];
$big_image_height = $big_image_size['height']; $big_image_height = $big_image_size['height'];
$url_big_image = $big_image.'?rnd='.time(); $url_big_image = $big_image.'?rnd='.time();
//Shows left column $social_left_content = SocialManager::show_social_menu('group_edit',$group_id);
//echo GroupPortalManager::show_group_column_information($group_id, api_get_user_id()); $social_right_content = $form->return_form();
echo '<div id="social-content">';
echo '<div id="social-content-left">'; $tpl = new Template($tool_name);
//this include the social menu div $tpl->set_help('Groups');
SocialManager::show_social_menu('group_edit',$group_id); $tpl->assign('social_left_content', $social_left_content);
echo '</div>'; $tpl->assign('social_left_menu', $social_left_menu);
echo '<div id="social-content-right">'; $tpl->assign('social_right_content', $social_right_content);
// Display form $social_layout = $tpl->get_template('layout/social_layout.tpl');
$form->display(); $content = $tpl->fetch($social_layout);
echo '</div>'; $tpl->assign('actions', $actions);
echo '</div>'; $tpl->assign('message', $show_message);
$tpl->assign('content', $content);
// Footer $tpl->display_one_col_template();
Display::display_footer();

@ -144,7 +144,6 @@ function search_users($needle,$type) {
$return .= '...<br />'; $return .= '...<br />';
} }
} }
$xajax_response -> addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return)); $xajax_response -> addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return));
} else { } else {
@ -158,7 +157,6 @@ function search_users($needle,$type) {
$xajax_response -> addAssign('ajax_list_users_multiple','innerHTML',api_utf8_encode($return)); $xajax_response -> addAssign('ajax_list_users_multiple','innerHTML',api_utf8_encode($return));
} }
} }
return $xajax_response; return $xajax_response;
} }
@ -202,14 +200,13 @@ $errorMsg=$firstLetterUser=$firstLetterSession='';
$UserList=$SessionList=array(); $UserList=$SessionList=array();
$users=$sessions=array(); $users=$sessions=array();
Display :: display_header($tool_name, 'Groups'); //Display :: display_header($tool_name, 'Groups');
if($_POST['form_sent']) { if ($_POST['form_sent']) {
$form_sent = $_POST['form_sent']; $form_sent = $_POST['form_sent'];
$firstLetterUser = $_POST['firstLetterUser']; $firstLetterUser = $_POST['firstLetterUser'];
$firstLetterSession = $_POST['firstLetterSession']; $firstLetterSession = $_POST['firstLetterSession'];
$user_list = $_POST['sessionUsersList']; $user_list = $_POST['sessionUsersList'];
$group_id = intval($_POST['id']); $group_id = intval($_POST['id']);
if(!is_array($user_list)) { if(!is_array($user_list)) {
@ -307,50 +304,36 @@ if ($add_type == 'multiple') {
$link_add_type_unique = Display::return_icon('single.gif').get_lang('SessionAddTypeUnique'); $link_add_type_unique = Display::return_icon('single.gif').get_lang('SessionAddTypeUnique');
$link_add_type_multiple = '<a href="'.api_get_self().'?id='.$group_id.'&add='.Security::remove_XSS($_GET['add']).'&add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>'; $link_add_type_multiple = '<a href="'.api_get_self().'?id='.$group_id.'&add='.Security::remove_XSS($_GET['add']).'&add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>';
} }
/* <?php $link_add_type_unique ?>&nbsp;|&nbsp;<?php $link_add_type_multiple ?> */
//Shows left column
//echo GroupPortalManager::show_group_column_information($group_id, api_get_user_id());
echo '<div id="social-content">';
echo '<div id="social-content-left">';
//this include the social menu div
SocialManager::show_social_menu('invite_friends',$group_id);
echo '</div>';
echo '<div id="social-content-right">'; $social_left_content = SocialManager::show_social_menu('invite_friends',$group_id);
echo '<h2>'.Security::remove_XSS($group_info['name'], STUDENT, true).'</h2>'; $social_right_content .= '<h2>'.Security::remove_XSS($group_info['name'], STUDENT, true).'</h2>';
if (count($nosessionUsersList) == 0) { if (count($nosessionUsersList) == 0) {
$friends = SocialManager::get_friends(api_get_user_id()); $friends = SocialManager::get_friends(api_get_user_id());
if ($friends == 0) { if ($friends == 0) {
echo get_lang('YouNeedToHaveFriendsInYourSocialNetwork'); $social_right_content .= get_lang('YouNeedToHaveFriendsInYourSocialNetwork');
} else { } else {
echo get_lang('YouAlreadyInviteAllYourContacts'); $social_right_content .= get_lang('YouAlreadyInviteAllYourContacts');
} }
echo '<div>'; $social_right_content .= '<div>';
echo '<a href="search.php">'.get_lang('TryAndFindSomeFriends').'</a>'; $social_right_content .= '<a href="search.php">'.get_lang('TryAndFindSomeFriends').'</a>';
echo '</div>'; $social_right_content .= '</div>';
}
echo '</div>'; // end layout right
echo '</div>'; //
Display::display_footer();
exit;
}
?>
<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $group_id; ?><?php if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>> if (!empty($_GET['add'])) $add_true = '&add=true';
if ($ajax_search) $ajax = 'onsubmit="valide();"';
$form = '<form name="formulaire" method="post" action="'.api_get_self().'?id='.$group_id.$add_true.'" style="margin:0px;" '.$ajax.'>';
<?php
if ($add_type=='multiple') { if ($add_type=='multiple') {
if (is_array($extra_field_list)) { if (is_array($extra_field_list)) {
if (is_array($new_field_list) && count($new_field_list)>0 ) { if (is_array($new_field_list) && count($new_field_list)>0 ) {
echo '<h3>'.get_lang('FilterUsers').'</h3>'; $form .= '<h3>'.get_lang('FilterUsers').'</h3>';
foreach ($new_field_list as $new_field) { foreach ($new_field_list as $new_field) {
echo $new_field['name']; $form .= $new_field['name'];
$varname = 'field_'.$new_field['variable']; $varname = 'field_'.$new_field['variable'];
echo '&nbsp;<select name="'.$varname.'">'; $form .= '&nbsp;<select name="'.$varname.'">';
echo '<option value="0">--'.get_lang('Select').'--</option>'; $form .= '<option value="0">--'.get_lang('Select').'--</option>';
foreach ($new_field['data'] as $option) { foreach ($new_field['data'] as $option) {
$checked=''; $checked='';
if (isset($_POST[$varname])) { if (isset($_POST[$varname])) {
@ -358,126 +341,99 @@ if ($add_type=='multiple') {
$checked = 'selected="true"'; $checked = 'selected="true"';
} }
} }
echo '<option value="'.$option[1].'" '.$checked.'>'.$option[1].'</option>'; $form .= '<option value="'.$option[1].'" '.$checked.'>'.$option[1].'</option>';
} }
echo '</select>'; $form .= '</select>';
echo '&nbsp;&nbsp;'; $form .= '&nbsp;&nbsp;';
} }
echo '<input type="button" value="'.get_lang('Filter').'" onclick="validate_filter()" />'; $form .= '<input type="button" value="'.get_lang('Filter').'" onclick="validate_filter()" />';
echo '<br /><br />'; $form .= '<br /><br />';
} }
} }
} }
?>
<input type="hidden" name="form_sent" value="1" /> $form .= '<input type="hidden" name="form_sent" value="1" />';
<input type="hidden" name="id" value="<?php echo $group_id?>" /> $form .= '<input type="hidden" name="id" value="'.$group_id.'">';
<input type="hidden" name="add_type" /> $form .= '<input type="hidden" name="add_type" />';
<?php
if(!empty($errorMsg)) { if(!empty($errorMsg)) {
Display::display_error_message($errorMsg); //main API $form .= Display::return_message($errorMsg,'error'); //main API
} }
?>
<table border="0" cellpadding="5" cellspacing="0" width="100%"> $form .= '<table border="0" cellpadding="5" cellspacing="0" width="100%">
<!-- Users -->
<tr> <tr>
<td align="center"><b><?php echo get_lang('Friends') ?> :</b> <td align="center"><b>'.get_lang('Friends').' :</b>
</td> </td>
<td></td> <td></td>
<td align="center"><b><?php echo get_lang('SendInvitationTo') ?> :</b></td> <td align="center"><b>'.get_lang('SendInvitationTo').':</b></td></tr>';
</tr>
if ($add_type=='no') {
<?php if ($add_type=='no') { ?> $form .='
<tr> <tr>
<td align="center"> <td align="center">'.get_lang('FirstLetterUser').' :
<select name="firstLetterUser" onchange = "xajax_search_users(this.value,\'multiple\')" >
<?php echo get_lang('FirstLetterUser'); ?> : <option value = "%">--</option>
<select name="firstLetterUser" onchange = "xajax_search_users(this.value,'multiple')" > '.Display :: get_alphabet_options().'
<option value = "%">--</option> </select>
<?php </td>
echo Display :: get_alphabet_options(); <td align="center">&nbsp;</td>
?> </tr>';
</select> }
</td>
<td align="center">&nbsp;</td>
</tr>
<?php } ?>
$form .= '
<tr> <tr>
<td align="center"> <td align="center">
<div id="content_source"> <div id="content_source">';
<?php
if (!($add_type=='multiple')) { if (!($add_type=='multiple')) {
?> $form .='<input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,\'single\')" /><div id="ajax_list_users_single"></div>';
<input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" /> } else {
<div id="ajax_list_users_single"></div> $form .= '<div id="ajax_list_users_multiple">
<?php <select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" style="width:290px;">';
} else {
?> foreach($nosessionUsersList as $enreg) {
<div id="ajax_list_users_multiple"> $selected = '';
<select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" style="width:290px;"> if(in_array($enreg['user_id'],$UserList)) $selected = 'selected="selected"';
<?php $form .= '<option value="'.$enreg['user_id'].'" '.$selected.'>'.api_get_person_name($enreg['firstname'], $enreg['lastname']).' ('.$enreg['username'].') </option>';
foreach($nosessionUsersList as $enreg) { }
?> $form .= '</select>';
<option value="<?php echo $enreg['user_id']; ?>" <?php if(in_array($enreg['user_id'],$UserList)) echo 'selected="selected"'; ?>><?php echo api_get_person_name($enreg['firstname'], $enreg['lastname']).' ('.$enreg['username'].')'; ?></option> $form .= '</div>';
<?php }
}
?> unset($nosessionUsersList);
</select> $form .= '</div>';
</div> $form .= '</td><td width="10%" valign="middle" align="center">';
<?php
} if ($ajax_search) {
unset($nosessionUsersList); $form .= '<button class="arrowl" type="button" onclick="remove_item(document.getElementById(\'destination_users\'))" ></button>';
?> } else {
</div> $form .= '<button class="arrowr" type="button" onclick="moveItem(document.getElementById(\'origin_users\'), document.getElementById(\'destination_users\'))" ></button>
</td> <br /><br />
<td width="10%" valign="middle" align="center"> <button class="arrowl" type="button" onclick="moveItem(document.getElementById(\'destination_users\'), document.getElementById(\'origin_users\'))" ></button>
<?php <br /><br />';
if ($ajax_search) { }
?>
<button class="arrowl" type="button" onclick="remove_item(document.getElementById('destination_users'))" ></button> $form .= ' <br /><br /><br /><br /><br />
<?php
} else {
?>
<button class="arrowr" type="button" onclick="moveItem(document.getElementById('origin_users'), document.getElementById('destination_users'))" ></button>
<br /><br />
<button class="arrowl" type="button" onclick="moveItem(document.getElementById('destination_users'), document.getElementById('origin_users'))" ></button>
<br /><br />
<?php
}
?>
<br /><br /><br /><br /><br />
</td> </td>
<td align="center"> <td align="center">
<select id="destination_users" name="sessionUsersList[]" multiple="multiple" size="15" style="width:290px;"> <select id="destination_users" name="sessionUsersList[]" multiple="multiple" size="15" style="width:290px;">';
<?php
foreach($sessionUsersList as $enreg) { foreach($sessionUsersList as $enreg) {
?> $form .= ' <option value="'.$enreg['user_id'].'">'.api_get_person_name($enreg['firstname'], $enreg['lastname']).' ('.$enreg['username'].')</option>';
<option value="<?php echo $enreg['user_id']; ?>"><?php echo api_get_person_name($enreg['firstname'], $enreg['lastname']).' ('.$enreg['username'].')'; ?></option>
<?php
} }
unset($sessionUsersList); unset($sessionUsersList);
?> $form .= '</select></td>
</select></td>
</tr> </tr>
<tr> <tr>
<td colspan="3" align="center"> <td colspan="3" align="center">
<br /> <br />
<?php <button class="save" type="button" value="" onclick="valide()" >'.get_lang('InviteUsersToGroup').'</button>
echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang('InviteUsersToGroup').'</button>';
?>
</td> </td>
</tr> </tr>
</table> </table>
</form> </form>';
<?php
$social_right_content .= $form;
//current group members //current group members
$members = GroupPortalManager::get_users_by_group($group_id, false, array(GROUP_USER_PERMISSION_PENDING_INVITATION)); $members = GroupPortalManager::get_users_by_group($group_id, false, array(GROUP_USER_PERMISSION_PENDING_INVITATION));
@ -487,13 +443,11 @@ if (is_array($members) && count($members)>0) {
$picture = UserManager::get_picture_user($member['user_id'], $image_path['file'],80); $picture = UserManager::get_picture_user($member['user_id'], $image_path['file'],80);
$member['image'] = '<img src="'.$picture['file'].'" width="50px" height="50px" />'; $member['image'] = '<img src="'.$picture['file'].'" width="50px" height="50px" />';
} }
echo '<span class="social-groups-text1"><strong>'.get_lang('UsersAlreadyInvited').'</strong></span>'; $social_right_content .= '<h3>'.get_lang('UsersAlreadyInvited').'</h3>';
Display::display_sortable_grid('invitation_profile', array(), $members, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, false, true,true)); $social_right_content .= Display::return_sortable_grid('invitation_profile', array(), $members, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, false, true,true));
} }
echo '</div>'; // end layout right
echo '</div>';
?>
$htmlHeadXtra[] = '
<script type="text/javascript"> <script type="text/javascript">
<!-- <!--
function moveItem(origin , destination) { function moveItem(origin , destination) {
@ -532,7 +486,7 @@ function mysort(a, b){
} }
function valide(){ function valide(){
var options = document.getElementById('destination_users').options; var options = document.getElementById(\'destination_users\').options;
for (i = 0 ; i<options.length ; i++) for (i = 0 ; i<options.length ; i++)
options[i].selected = true; options[i].selected = true;
document.forms.formulaire.submit(); document.forms.formulaire.submit();
@ -550,21 +504,18 @@ function loadUsersInSelect(select){
else // XMLHttpRequest non supporté par le navigateur else // XMLHttpRequest non supporté par le navigateur
alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
//xhr_object.open("GET", "loadUsersInSelect.ajax.php?id_session=<?php echo $id_session ?>&letter="+select.options[select.selectedIndex].text, false);
xhr_object.open("POST", "loadUsersInSelect.ajax.php"); xhr_object.open("POST", "loadUsersInSelect.ajax.php");
xhr_object.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr_object.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
nosessionUsers = makepost(document.getElementById("origin_users"));
nosessionUsers = makepost(document.getElementById('origin_users')); sessionUsers = makepost(document.getElementById("destination_users"));
sessionUsers = makepost(document.getElementById('destination_users')); nosessionClasses = makepost(document.getElementById("origin_classes"));
nosessionClasses = makepost(document.getElementById('origin_classes')); sessionClasses = makepost(document.getElementById("destination_classes"));
sessionClasses = makepost(document.getElementById('destination_classes'));
xhr_object.send("nosessionusers="+nosessionUsers+"&sessionusers="+sessionUsers+"&nosessionclasses="+nosessionClasses+"&sessionclasses="+sessionClasses); xhr_object.send("nosessionusers="+nosessionUsers+"&sessionusers="+sessionUsers+"&nosessionclasses="+nosessionClasses+"&sessionclasses="+sessionClasses);
xhr_object.onreadystatechange = function() { xhr_object.onreadystatechange = function() {
if(xhr_object.readyState == 4) { if(xhr_object.readyState == 4) {
document.getElementById('content_source').innerHTML = result = xhr_object.responseText; document.getElementById("content_source").innerHTML = result = xhr_object.responseText;
//alert(xhr_object.responseText); //alert(xhr_object.responseText);
} }
} }
@ -574,12 +525,21 @@ function makepost(select) {
var options = select.options; var options = select.options;
var ret = ""; var ret = "";
for (i = 0 ; i<options.length ; i++) for (i = 0 ; i<options.length ; i++)
ret = ret + options[i].value +'::'+options[i].text+";;"; ret = ret + options[i].value +\'::\'+options[i].text+";;";
return ret; return ret;
} }
--> -->
</script> </script>';
<?php
/* FOOTER */
Display::display_footer(); $tpl = new Template($tool_name);
$tpl->set_help('Groups');
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_left_menu', $social_left_menu);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
$content = $tpl->fetch($social_layout);
$tpl->assign('actions', $actions);
$tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();

@ -39,11 +39,6 @@ if (empty($group_id)) {
} }
} }
Display :: display_header($tool_name, 'Groups');
$user_online_list = who_is_online(api_get_setting('time_limit_whosonline'), true);
$user_online_count = count($user_online_list);
$show_message = ''; $show_message = '';
//if i'm a moderator //if i'm a moderator
if (isset($_GET['action']) && $_GET['action']=='add') { if (isset($_GET['action']) && $_GET['action']=='add') {
@ -91,54 +86,60 @@ if (isset($_GET['action']) && $_GET['action']=='delete_moderator') {
$users = GroupPortalManager::get_users_by_group($group_id, false, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_MODERATOR), 0 , 1000); $users = GroupPortalManager::get_users_by_group($group_id, false, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_MODERATOR), 0 , 1000);
$new_member_list = array(); $new_member_list = array();
echo '<div id="social-content">'; $social_left_content = SocialManager::show_social_menu('member_list',$group_id);
echo '<div id="social-content-left">';
//this include the social menu div $social_right_content = '<h2>'.$group_info['name'].'</h2>';
SocialManager::show_social_menu('member_list',$group_id);
echo '</div>';
echo '<div id="social-content-right">';
echo '<h2>'.$group_info['name'].'</h2>';
echo '<div style="width:90%">'; $social_right_content .= '<div style="width:90%">';
if (! empty($show_message)){ if (! empty($show_message)){
Display :: display_confirmation_message($show_message); $social_right_content .= Display :: return_message($show_message,'confirmation', false);
} }
foreach($users as $user) {
switch ($user['relation_type']) { foreach($users as $user) {
case GROUP_USER_PERMISSION_ADMIN: switch ($user['relation_type']) {
$user['link'] = Display::return_icon('social_group_admin.png', get_lang('Admin')); case GROUP_USER_PERMISSION_ADMIN:
break; $user['link'] = Display::return_icon('social_group_admin.png', get_lang('Admin'));
case GROUP_USER_PERMISSION_READER: break;
if (in_array($user_role, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_MODERATOR))) { case GROUP_USER_PERMISSION_READER:
$user['link'] = '<a href="group_members.php?id='.$group_id.'&u='.$user['user_id'].'&action=delete">'.Display::return_icon('delete.png', get_lang('DeleteFromGroup')).'</a>'. if (in_array($user_role, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_MODERATOR))) {
'<a href="group_members.php?id='.$group_id.'&u='.$user['user_id'].'&action=set_moderator">'.Display::return_icon('social_moderator_add.png', get_lang('AddModerator')).'</a>'; $user['link'] = '<a href="group_members.php?id='.$group_id.'&u='.$user['user_id'].'&action=delete">'.Display::return_icon('delete.png', get_lang('DeleteFromGroup')).'</a>'.
} '<a href="group_members.php?id='.$group_id.'&u='.$user['user_id'].'&action=set_moderator">'.Display::return_icon('social_moderator_add.png', get_lang('AddModerator')).'</a>';
break; }
case GROUP_USER_PERMISSION_PENDING_INVITATION: break;
$user['link'] = '<a href="group_members.php?id='.$group_id.'&u='.$user['user_id'].'&action=add">'.Display::return_icon('pending_invitation.png', get_lang('PendingInvitation')).'</a>'; case GROUP_USER_PERMISSION_PENDING_INVITATION:
break; $user['link'] = '<a href="group_members.php?id='.$group_id.'&u='.$user['user_id'].'&action=add">'.Display::return_icon('pending_invitation.png', get_lang('PendingInvitation')).'</a>';
case GROUP_USER_PERMISSION_MODERATOR: break;
$user['link'] = Display::return_icon('social_group_moderator.png', get_lang('Moderator')); case GROUP_USER_PERMISSION_MODERATOR:
//only group admin can manage moderators $user['link'] = Display::return_icon('social_group_moderator.png', get_lang('Moderator'));
if ($user_role == GROUP_USER_PERMISSION_ADMIN) { //only group admin can manage moderators
$user['link'] .='<a href="group_members.php?id='.$group_id.'&u='.$user['user_id'].'&action=delete_moderator">'.Display::return_icon('social_moderator_delete.png', get_lang('DeleteModerator')).'</a>'; if ($user_role == GROUP_USER_PERMISSION_ADMIN) {
} $user['link'] .='<a href="group_members.php?id='.$group_id.'&u='.$user['user_id'].'&action=delete_moderator">'.Display::return_icon('social_moderator_delete.png', get_lang('DeleteModerator')).'</a>';
break; }
} break;
}
$image_path = UserManager::get_user_picture_path_by_id($user['user_id'], 'web', false, true);
$picture = UserManager::get_picture_user($user['user_id'], $image_path['file'],80); $image_path = UserManager::get_user_picture_path_by_id($user['user_id'], 'web', false, true);
$user['image'] = '<img src="'.$picture['file'].'" width="50px" height="50px" />'; $picture = UserManager::get_picture_user($user['user_id'], $image_path['file'],80);
$user['image'] = '<img src="'.$picture['file'].'" width="50px" height="50px" />';
$new_member_list[] = $user;
} $new_member_list[] = $user;
if (count($new_member_list) > 0) { }
Display::display_sortable_grid('list_members', array(), $new_member_list, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, false, true,true,false,true,true)); if (count($new_member_list) > 0) {
} $social_right_content .= Display::return_sortable_grid('list_members', array(), $new_member_list, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, false, true,true,false,true,true));
echo '</div>'; }
echo '</div>'; $social_right_content .= '</div>';
echo '</div>';
Display :: display_footer();
$tpl = new Template($tool_name);
$tpl->set_help('Groups');
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_left_menu', $social_left_menu);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
$content = $tpl->fetch($social_layout);
$tpl->assign('actions', $actions);
$tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();

@ -60,7 +60,7 @@ if (isset($_POST['token']) && $_POST['token'] === $_SESSION['sec_token']) {
// display error messages // display error messages
if (!$res) { if (!$res) {
Display::display_error_message(get_lang('Error')); $social_right_content .= Display::return_message(get_lang('Error'),'error');
} }
$topic_id = intval($_GET['topic_id']); $topic_id = intval($_GET['topic_id']);
if ($_POST['action'] == 'add_message_group') { if ($_POST['action'] == 'add_message_group') {
@ -164,26 +164,26 @@ $(document).ready(function() {
</script>'; </script>';
$this_section = SECTION_SOCIAL; $this_section = SECTION_SOCIAL;
$interbreadcrumb[]= array ('url' =>'home.php', 'name' => get_lang('Social')); $interbreadcrumb[] = array ('url' =>'home.php', 'name' => get_lang('Social'));
$interbreadcrumb[] = array('url' => 'groups.php', 'name' => get_lang('Groups')); $interbreadcrumb[] = array('url' => 'groups.php', 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Thread')); $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Thread'));
Display::display_header($tool_name, 'Groups'); $social_left_content = SocialManager::show_social_menu('member_list', $group_id);
$social_right_content .= '<h2><a href="groups.php?id='.$group_id.'">'.Security::remove_XSS($group_info['name'], STUDENT, true).'</a> &raquo; <a href="groups.php?id='.$group_id.'#tabs_2">'.get_lang('Discussions').'</a></h2>';
echo '<div id="social-content">';
echo '<div id="social-content-left">';
//this include the social menu div
SocialManager::show_social_menu('member_list', $group_id);
echo '</div>';
echo '<div id="social-content-right">';
echo '<h2><a href="groups.php?id='.$group_id.'">'.Security::remove_XSS($group_info['name'], STUDENT, true).'</a> &raquo; <a href="groups.php?id='.$group_id.'#tabs_2">'.get_lang('Discussions').'</a></h2>';
if (!empty($show_message)){ if (!empty($show_message)){
Display::display_confirmation_message($show_message); $social_right_content .= Display::return_message($show_message, 'confirmation');
} }
$content = MessageManager::display_message_for_group($group_id, $topic_id, $is_member, $message_id); $social_right_content .= MessageManager::display_message_for_group($group_id, $topic_id, $is_member, $message_id);
echo $content;
echo '</div>'; $tpl = new Template($tool_name);
echo '</div>'; $tpl->set_help('Groups');
$tpl->assign('social_left_content', $social_left_content);
Display :: display_footer(); $tpl->assign('social_left_menu', $social_left_menu);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
$content = $tpl->fetch($social_layout);
$tpl->assign('actions', $actions);
$tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();

@ -41,9 +41,6 @@ if (empty($group_id)) {
} }
} }
Display :: display_header($tool_name, 'Groups');
// Group information // Group information
$admins = GroupPortalManager::get_users_by_group($group_id, true, array(GROUP_USER_PERMISSION_ADMIN), 0, 1000); $admins = GroupPortalManager::get_users_by_group($group_id, true, array(GROUP_USER_PERMISSION_ADMIN), 0, 1000);
$show_message = ''; $show_message = '';
@ -82,37 +79,37 @@ if (isset($_GET['action']) && $_GET['action']=='set_moderator') {
$users = GroupPortalManager::get_users_by_group($group_id, true, array(GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER), 0, 1000); $users = GroupPortalManager::get_users_by_group($group_id, true, array(GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER), 0, 1000);
$new_member_list = array(); $new_member_list = array();
//Shows left column $social_left_content = SocialManager::show_social_menu('waiting_list',$group_id);
//echo GroupPortalManager::show_group_column_information($group_id, api_get_user_id());
echo '<div id="social-content">'; if (!empty($show_message)){
echo '<div id="social-content-left">'; $social_right_content .= Display :: return_message($show_message);
//this include the social menu div }
SocialManager::show_social_menu('waiting_list',$group_id); // Display form
echo '</div>'; foreach($users as $user) {
echo '<div id="social-content-right">'; switch ($user['relation_type']) {
if (!empty($show_message)){ case GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER:
Display :: display_normal_message($show_message); $user['link'] = '<a href="group_waiting_list.php?id='.$group_id.'&u='.$user['user_id'].'&action=accept">'.Display::return_icon('invitation_friend.png', get_lang('AddNormalUser')).'</a>';
} $user['link'] .= '<a href="group_waiting_list.php?id='.$group_id.'&u='.$user['user_id'].'&action=set_moderator">'.Display::return_icon('social_moderator_add.png', get_lang('AddModerator')).'</a>';
// Display form $user['link'] .= '<a href="group_waiting_list.php?id='.$group_id.'&u='.$user['user_id'].'&action=deny">'.Display::return_icon('user_delete.png', get_lang('DenyEntry')).'</a>';
foreach($users as $user) { break;
switch ($user['relation_type']) { }
case GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER: $new_member_list[] = $user;
$user['link'] = '<a href="group_waiting_list.php?id='.$group_id.'&u='.$user['user_id'].'&action=accept">'.Display::return_icon('invitation_friend.png', get_lang('AddNormalUser')).'</a>'; }
$user['link'] .= '<a href="group_waiting_list.php?id='.$group_id.'&u='.$user['user_id'].'&action=set_moderator">'.Display::return_icon('social_moderator_add.png', get_lang('AddModerator')).'</a>';
$user['link'] .= '<a href="group_waiting_list.php?id='.$group_id.'&u='.$user['user_id'].'&action=deny">'.Display::return_icon('user_delete.png', get_lang('DenyEntry')).'</a>'; if (count($new_member_list) > 0) {
break; $social_right_content .= Display::return_sortable_grid('search_users', array(), $new_member_list, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, false, true,true,false,true,true));
} } else {
$new_member_list[] = $user; $social_right_content .= Display :: return_message(get_lang('ThereAreNotUsersInTheWaitingList'));
} }
if (count($new_member_list) > 0) { $tpl = new Template($tool_name);
Display::display_sortable_grid('search_users', array(), $new_member_list, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, false, true,true,false,true,true)); $tpl->set_help('Groups');
} else { $tpl->assign('social_left_content', $social_left_content);
Display :: display_normal_message(get_lang('ThereAreNotUsersInTheWaitingList')); $tpl->assign('social_left_menu', $social_left_menu);
} $tpl->assign('social_right_content', $social_right_content);
echo '</div>'; $social_layout = $tpl->get_template('layout/social_layout.tpl');
echo '</div>'; $content = $tpl->fetch($social_layout);
$tpl->assign('actions', $actions);
$tpl->assign('message', $show_message);
Display :: display_footer(); $tpl->assign('content', $content);
?> $tpl->display_one_col_template();

@ -140,12 +140,13 @@ if (isset($_GET['view']) && in_array($_GET['view'],$allowed_views)) {
} }
} }
Display :: display_header($tool_name, 'Groups'); //Display :: display_header($tool_name, 'Groups');
// getting group information // getting group information
$group_id = isset($_GET['id']) ? intval($_GET['id']) : null; $group_id = isset($_GET['id']) ? intval($_GET['id']) : null;
$relation_group_title = ''; $relation_group_title = '';
$my_group_role = 0; $my_group_role = 0;
if ($group_id != 0 ) { if ($group_id != 0 ) {
$user_leave_message = false; $user_leave_message = false;
$user_added_group_message = false; $user_added_group_message = false;
@ -177,21 +178,15 @@ if ($group_id != 0 ) {
} }
$create_thread_link = ''; $create_thread_link = '';
echo '<div id="social-content">'; if ($group_id != 0 ) {
echo '<div id="social-content-left">'; $social_left_content = SocialManager::show_social_menu('groups',$group_id);
//this include the social menu div } else {
if ($group_id != 0 ) { $show_menu = 'browse_groups';
SocialManager::show_social_menu('groups',$group_id); if (isset($_GET['view']) && $_GET['view'] == 'mygroups') {
} else { $show_menu = $_GET['view'];
$show_menu = 'browse_groups'; }
if (isset($_GET['view']) && $_GET['view'] == 'mygroups') { $social_left_content = SocialManager::show_social_menu($show_menu);
$show_menu = $_GET['view']; }
}
SocialManager::show_social_menu($show_menu);
}
echo '</div>';
echo '<div id="social-content-right">';
if ($group_id != 0 ) { if ($group_id != 0 ) {
@ -199,47 +194,47 @@ if ($group_id != 0 ) {
//Loading group information //Loading group information
if (isset($_GET['status']) && $_GET['status']=='sent') { if (isset($_GET['status']) && $_GET['status']=='sent') {
Display::display_confirmation_message(get_lang('MessageHasBeenSent'), false); $social_right_content .= Display::return_message(get_lang('MessageHasBeenSent'), 'confirmation', false);
} }
if ($user_leave_message) { if ($user_leave_message) {
Display::display_confirmation_message(get_lang('UserIsNotSubscribedToThisGroup'), false); $social_right_content .= Display::return_message(get_lang('UserIsNotSubscribedToThisGroup'), 'confirmation', false);
} }
if ($user_added_group_message) { if ($user_added_group_message) {
Display::display_confirmation_message(get_lang('UserIsSubscribedToThisGroup'), false); $social_right_content .= Display::return_message(get_lang('UserIsSubscribedToThisGroup'), 'confirmation', false);
} }
if ($user_invitation_sent) { if ($user_invitation_sent) {
Display::display_confirmation_message(get_lang('InvitationSent'), false); $social_right_content .= Display::return_message(get_lang('InvitationSent'), 'confirmation', false);
} }
$is_group_member = GroupPortalManager::is_group_member($group_id); $is_group_member = GroupPortalManager::is_group_member($group_id);
// details about the current group // details about the current group
echo '<div class="head_group">'; $social_right_content = '<div class="head_group">';
echo '<div id="social-group-details">'; $social_right_content .= '<div id="social-group-details">';
//Group's title //Group's title
echo Display::tag('h2', Security::remove_XSS($group_info['name'], STUDENT, true)); $social_right_content .= Display::tag('h2', Security::remove_XSS($group_info['name'], STUDENT, true));
//echo '<div class="social-group-details-info"><a target="_blank" href="'.$group_info['url'].'">'.$group_info['url'].'</a></div>'; //echo '<div class="social-group-details-info"><a target="_blank" href="'.$group_info['url'].'">'.$group_info['url'].'</a></div>';
//Privacy //Privacy
if (!$is_group_member) { if (!$is_group_member) {
echo '<div class="social-group-details-info">'; $social_right_content .= '<div class="social-group-details-info">';
echo '<span>'.get_lang('Privacy').' : </span>'; $social_right_content .= '<span>'.get_lang('Privacy').' : </span>';
if ($group_info['visibility']== GROUP_PERMISSION_OPEN) { if ($group_info['visibility']== GROUP_PERMISSION_OPEN) {
echo get_lang('ThisIsAnOpenGroup'); $social_right_content .= get_lang('ThisIsAnOpenGroup');
} elseif ($group_info['visibility']== GROUP_PERMISSION_CLOSED) { } elseif ($group_info['visibility']== GROUP_PERMISSION_CLOSED) {
echo get_lang('ThisIsACloseGroup'); $social_right_content .= get_lang('ThisIsACloseGroup');
} }
echo '</div>'; $social_right_content .= '</div>';
} }
if (!$is_group_member && $group_info['visibility'] == GROUP_PERMISSION_CLOSED) { if (!$is_group_member && $group_info['visibility'] == GROUP_PERMISSION_CLOSED) {
$role = GroupPortalManager::get_user_group_role(api_get_user_id(), $group_id); $role = GroupPortalManager::get_user_group_role(api_get_user_id(), $group_id);
if ($role == GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER) { if ($role == GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER) {
echo Display::display_normal_message(get_lang('YouAlreadySentAnInvitation')); $social_right_content .= Display::return_message(get_lang('YouAlreadySentAnInvitation'));
} }
} }
@ -252,23 +247,23 @@ if ($group_id != 0 ) {
} }
//Group's tags //Group's tags
if (!empty($tags)) { if (!empty($tags)) {
echo '<div id="social-group-details-info"><span>'.get_lang('Tags').' : </span>'.$tags.'</div>'; $social_right_content .= '<div id="social-group-details-info"><span>'.get_lang('Tags').' : </span>'.$tags.'</div>';
} }
echo '</div>'; $social_right_content .= '</div>';
echo '</div>'; $social_right_content .= '</div>';
echo '<div class="clear"></div>'; $social_right_content .= '<div class="clear"></div>';
//-- Show message groups //-- Show message groups
echo '<div class="messages" style="width:700px">'; $social_right_content .= '<div class="messages" style="width:700px">';
if ($is_group_member || $group_info['visibility'] == GROUP_PERMISSION_OPEN) { if ($is_group_member || $group_info['visibility'] == GROUP_PERMISSION_OPEN) {
if (!$is_group_member) { if (!$is_group_member) {
if (!in_array($my_group_role, array(GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER, GROUP_USER_PERMISSION_PENDING_INVITATION))) { if (!in_array($my_group_role, array(GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER, GROUP_USER_PERMISSION_PENDING_INVITATION))) {
echo '<a class="a_button white medium" href="groups.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.get_lang('JoinGroup').'</a>'; $social_right_content .= '<a class="a_button white medium" href="groups.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.get_lang('JoinGroup').'</a>';
} elseif ($my_group_role == GROUP_USER_PERMISSION_PENDING_INVITATION) { } elseif ($my_group_role == GROUP_USER_PERMISSION_PENDING_INVITATION) {
echo '<a class="a_button white medium" href="groups.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.get_lang('YouHaveBeenInvitedJoinNow').'</a>'; $social_right_content .= '<a class="a_button white medium" href="groups.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.get_lang('YouHaveBeenInvitedJoinNow').'</a>';
} }
echo '<br /><br />'; $social_right_content .= '<br /><br />';
} }
$content = MessageManager::display_messages_for_group($group_id); $content = MessageManager::display_messages_for_group($group_id);
@ -276,11 +271,10 @@ if ($group_id != 0 ) {
if (empty($content)) { if (empty($content)) {
$create_thread_link = '<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?view_panel=1&height=400&width=610&&user_friend='.api_get_user_id().'&group_id='.$group_id.'&action=add_message_group" class="a_button white medium thickbox" title="'.get_lang('ComposeMessage').'">'.get_lang('YouShouldCreateATopic').'</a></li>'; $create_thread_link = '<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?view_panel=1&height=400&width=610&&user_friend='.api_get_user_id().'&group_id='.$group_id.'&action=add_message_group" class="a_button white medium thickbox" title="'.get_lang('ComposeMessage').'">'.get_lang('YouShouldCreateATopic').'</a></li>';
} else { } else {
$create_thread_link = '<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?view_panel=1&height=400&width=610&&user_friend='.api_get_user_id().'&group_id='.$group_id.'&action=add_message_group" class="a_button white medium thickbox" title="'.get_lang('ComposeMessage').'">'.get_lang('NewTopic').'</a>'; $create_thread_link = '<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?view_panel=1&height=400&width=610&&user_friend='.api_get_user_id().'&group_id='.$group_id.'&action=add_message_group" class="a_button white medium thickbox" title="'.get_lang('ComposeMessage').'">'.get_lang('NewTopic').'</a>';
} }
} }
$members = GroupPortalManager::get_users_by_group($group_id); $members = GroupPortalManager::get_users_by_group($group_id);
$member_content = ''; $member_content = '';
//Members //Members
@ -318,16 +312,16 @@ if ($group_id != 0 ) {
//$updates = //$updates =
//get_lang('Updates'), //get_lang('Updates'),
$headers = array(get_lang('Discussions'), get_lang('Members')); $headers = array(get_lang('Discussions'), get_lang('Members'));
echo Display::tabs($headers, array($create_thread_link.$content, $member_content),'tabs'); $social_right_content .= Display::tabs($headers, array($create_thread_link.$content, $member_content),'tabs');
} else { } else {
// if I already sent an invitation message // if I already sent an invitation message
if (!in_array($my_group_role, array(GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER, GROUP_USER_PERMISSION_PENDING_INVITATION))) { if (!in_array($my_group_role, array(GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER, GROUP_USER_PERMISSION_PENDING_INVITATION))) {
echo '<a class="a_button white medium" href="groups.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.get_lang('JoinGroup').'</a>'; $social_right_content .= '<a class="a_button white medium" href="groups.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.get_lang('JoinGroup').'</a>';
} elseif ($my_group_role == GROUP_USER_PERMISSION_PENDING_INVITATION) { } elseif ($my_group_role == GROUP_USER_PERMISSION_PENDING_INVITATION) {
echo '<a class="a_button white medium" href="groups.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.get_lang('YouHaveBeenInvitedJoinNow').'</a>'; $social_right_content .= '<a class="a_button white medium" href="groups.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.get_lang('YouHaveBeenInvitedJoinNow').'</a>';
} }
} }
echo '</div>'; // end layout messages $social_right_content .= '</div>'; // end layout messages
} else { } else {
// My groups ----- // My groups -----
@ -531,11 +525,24 @@ if ($group_id != 0 ) {
} }
if (!empty($create_group_item)) { if (!empty($create_group_item)) {
echo Display::div($create_group_item, array('style'=>'padding-top:12px;height:30px')); $social_right_content .= Display::div($create_group_item, array('style'=>'padding-top:12px;height:30px'));
} }
$headers = array(get_lang('MyGroups'), get_lang('Newest'), get_lang('Popular')); $headers = array(get_lang('Newest'), get_lang('Popular'), get_lang('MyGroups'));
echo Display::tabs($headers, array($my_group_content, $newest_content, $popular_content),'tab_browse'); $social_right_content .= Display::tabs($headers, array($newest_content, $popular_content, $my_group_content),'tab_browse');
} }
echo '</div>'; $social_right_content .= '</div>';
echo '</div>';
Display :: display_footer(); //Display :: display_footer();
$tpl = new Template($tool_name);
$tpl->set_help('Groups');
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_left_menu', $social_left_menu);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
$content = $tpl->fetch($social_layout);
$tpl->assign('actions', $actions);
$tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();

@ -21,7 +21,6 @@ $this_section = SECTION_SOCIAL;
unset($_SESSION['this_section']);//for hmtl editor repository unset($_SESSION['this_section']);//for hmtl editor repository
api_block_anonymous_users(); api_block_anonymous_users();
if (api_get_setting('allow_social_tool') !='true' ){ if (api_get_setting('allow_social_tool') !='true' ){
api_not_allowed(); api_not_allowed();
} }
@ -66,27 +65,16 @@ if (api_get_setting('profile', 'picture') == 'true') {
} }
} }
Display :: display_header(get_lang('Social'));
$user_info = UserManager :: get_user_info_by_id(api_get_user_id()); $user_info = UserManager :: get_user_info_by_id(api_get_user_id());
$user_online_list = who_is_online(api_get_setting('time_limit_whosonline'),true);
$user_online_count = count($user_online_list);
echo '<div id="social-content">';
echo '<div id="social-content-left">'; $social_left_content = SocialManager::show_social_menu('home');
//this include the social menu div
SocialManager::show_social_menu('home'); $social_right_content .= '<div class="social_user_information" style="width:280px">';
echo '</div>';
echo '<div id="social-content-right">';
echo '<div class="social_user_information" style="width:280px">';
echo '<div class="social-groups-home-title">'.get_lang('ContactInformation').'</div>'; $social_right_content .= '<div class="social-groups-home-title">'.get_lang('ContactInformation').'</div>';
// information current user // information current user
echo '<div> $social_right_content .= '<div>
<p><strong>'.get_lang('Name').'</strong><br /> <p><strong>'.get_lang('Name').'</strong><br />
<span class="social-groups-text4">'.api_get_person_name($user_info['firstname'], $user_info['lastname']).'</span></p> <span class="social-groups-text4">'.api_get_person_name($user_info['firstname'], $user_info['lastname']).'</span></p>
</div> </div>
@ -102,31 +90,26 @@ echo '<div id="social-content">';
$skill = new Skill(); $skill = new Skill();
$skills = $skill->get_user_skills(api_get_user_id(), true); $skills = $skill->get_user_skills(api_get_user_id(), true);
echo '<div class="left" style="width:280px">'; $social_right_content .= '<div class="left" style="width:280px">';
echo '<div class="social-groups-home-title">'.get_lang('Skills').'</div>'; $social_right_content .= '<div class="social-groups-home-title">'.get_lang('Skills').'</div>';
$lis = ''; $lis = '';
if (!empty($skills)) { if (!empty($skills)) {
foreach($skills as $skill) { foreach($skills as $skill) {
$lis .= Display::tag('li', Display::span($skill['name'], array('class'=>'label_tag skill'))); $lis .= Display::tag('li', Display::span($skill['name'], array('class'=>'label_tag skill')));
} }
echo Display::tag('ul', $lis); $social_right_content .= Display::tag('ul', $lis);
} }
$url = api_get_path(WEB_CODE_PATH).'social/skills_tree.php'; $url = api_get_path(WEB_CODE_PATH).'social/skills_tree.php';
echo Display::url(get_lang('ViewSkillsTree'), $url); $social_right_content .= Display::url(get_lang('ViewSkillsTree'), $url);
echo '</div>'; $social_right_content .= '</div>';
$social_right_content .= '</div>'; // end social_user_information
echo '</div>'; // end social_user_information
//Search box //Search box
echo '<div class="social-box-right">'; $social_right_content .= '<div class="social-box-right">';
echo UserManager::get_search_form(''); $social_right_content .= UserManager::get_search_form('');
echo '<br />'; $social_right_content .= '<br />';
//Group box by age //Group box by age
$results = GroupPortalManager::get_groups_by_age(1,false); $results = GroupPortalManager::get_groups_by_age(1,false);
@ -171,22 +154,25 @@ echo '<div id="social-content">';
$actions = '<div class="box_description_group_actions" ><a href="groups.php?#tab_browse-3">'.get_lang('SeeMore').'</a></div>'; $actions = '<div class="box_description_group_actions" ><a href="groups.php?#tab_browse-3">'.get_lang('SeeMore').'</a></div>';
$groups_pop[]= array(Display::url($result['picture_uri'], $group_url) , $result['name'], cut($result['description'],120,true).$actions); $groups_pop[]= array(Display::url($result['picture_uri'], $group_url) , $result['name'], cut($result['description'],120,true).$actions);
} }
if (count($groups_newest) > 0) { if (count($groups_newest) > 0) {
echo '<div class="social-groups-home-title">'.get_lang('Newest').'</div>'; $social_right_content .= '<div class="social-groups-home-title">'.get_lang('Newest').'</div>';
Display::display_sortable_grid('home_group', array(), $groups_newest, array('hide_navigation'=>true, 'per_page' => 100), array(), false, array(true, true, true,false)); $social_right_content .= Display::return_sortable_grid('home_group', array(), $groups_newest, array('hide_navigation'=>true, 'per_page' => 100), array(), false, array(true, true, true,false));
} }
if (count($groups_pop) > 0) { if (count($groups_pop) > 0) {
echo '<div class="social-groups-home-title">'.get_lang('Popular').'</div>'; $social_right_content .= '<div class="social-groups-home-title">'.get_lang('Popular').'</div>';
Display::display_sortable_grid('home_group', array(), $groups_pop, array('hide_navigation'=>true, 'per_page' => 100), array(), false, array(true, true, true,true,true)); $social_right_content .= Display::return_sortable_grid('home_group', array(), $groups_pop, array('hide_navigation'=>true, 'per_page' => 100), array(), false, array(true, true, true,true,true));
} }
$social_right_content .= '</div>';
echo '</div>';
$tpl = new Template(get_lang('Social'));
$tpl->assign('social_left_content', $social_left_content);
echo '</div>'; $tpl->assign('social_left_menu', $social_left_menu);
echo '</div>'; $tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
Display :: display_footer(); $content = $tpl->fetch($social_layout);
$tpl->assign('actions', $actions);
$tpl->assign('message', $message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();

@ -67,7 +67,7 @@ function register_friend(element_input) {
</script>'; </script>';
api_block_anonymous_users(); api_block_anonymous_users();
Display :: display_header($tool_name, 'Groups'); //Display :: display_header($tool_name, 'Groups');
// easy links // easy links
if (is_array($_GET) && count($_GET)>0) { if (is_array($_GET) && count($_GET)>0) {
@ -92,25 +92,11 @@ if (is_array($_GET) && count($_GET)>0) {
} }
} }
} }
$social_left_content = SocialManager::show_social_menu('invitations');
$language_variable = get_lang('PendingInvitations'); $social_right_content = '<div id="id_response" align="center"></div>';
$language_comment = get_lang('SocialInvitesComment');
echo '<div id="social-content">'; $list_get_invitation = array();
echo '<div id="social-content-left">';
//this include the social menu div
SocialManager::show_social_menu('invitations');
echo '</div>';
echo '<div id="social-content-right">';
if (!empty($show_message)) {
Display :: display_normal_message($show_message);
}
echo '<div id="id_response" align="center"></div>';
$list_get_invitation=array();
$user_id = api_get_user_id(); $user_id = api_get_user_id();
$list_get_invitation = SocialManager::get_list_invitation_of_friends_by_user_id($user_id); $list_get_invitation = SocialManager::get_list_invitation_of_friends_by_user_id($user_id);
@ -121,11 +107,11 @@ echo '<div id="social-content">';
$total_invitations = $number_loop + count($list_get_invitation_sent) + count($pending_invitations); $total_invitations = $number_loop + count($list_get_invitation_sent) + count($pending_invitations);
if ($total_invitations == 0 && count($_GET) <= 0) { if ($total_invitations == 0 && count($_GET) <= 0) {
echo '<a href="search.php">'.get_lang('TryAndFindSomeFriends').'</a><br /><br />'; $social_right_content .= '<a href="search.php">'.get_lang('TryAndFindSomeFriends').'</a><br /><br />';
} }
if ($number_loop != 0) { if ($number_loop != 0) {
echo '<h2>'.get_lang('InvitationReceived').'</h2>'; $social_right_content .= '<h2>'.get_lang('InvitationReceived').'</h2>';
foreach ($list_get_invitation as $invitation) { foreach ($list_get_invitation as $invitation) {
$sender_user_id = $invitation['user_sender_id'] $sender_user_id = $invitation['user_sender_id']
@ -209,7 +195,7 @@ echo '<div id="social-content">';
} }
if (count($pending_invitations) > 0) { if (count($pending_invitations) > 0) {
echo '<h2>'.get_lang('GroupsWaitingApproval').'</h2>'; $social_right_content .= '<h2>'.get_lang('GroupsWaitingApproval').'</h2>';
$new_invitation = array(); $new_invitation = array();
foreach ($pending_invitations as $invitation) { foreach ($pending_invitations as $invitation) {
$picture = GroupPortalManager::get_picture_group($invitation['id'], $invitation['picture_uri'],80); $picture = GroupPortalManager::get_picture_group($invitation['id'], $invitation['picture_uri'],80);
@ -222,8 +208,18 @@ echo '<div id="social-content">';
$invitation['description'] = cut($invitation['description'],220,true); $invitation['description'] = cut($invitation['description'],220,true);
$new_invitation[]=$invitation; $new_invitation[]=$invitation;
} }
Display::display_sortable_grid('waiting_user', array(), $new_invitation, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, true, true,false,false,true,true,true,true)); $social_right_content .= Display::display_return_grid('waiting_user', array(), $new_invitation, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, true, true,false,false,true,true,true,true));
} }
echo '</div>'; $social_right_content .= '</div>';
echo '</div>';
Display::display_footer();
$tpl = new Template($tool_name);
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_left_menu', $social_left_menu);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
$content = $tpl->fetch($social_layout);
$tpl->assign('actions', $actions);
$tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();

@ -67,7 +67,7 @@ function register_friend(element_input) {
</script>'; </script>';
Display :: display_header($tool_name, 'Groups'); //Display :: display_header($tool_name, 'Groups');
// easy links // easy links
if (is_array($_GET) && count($_GET)>0) { if (is_array($_GET) && count($_GET)>0) {
@ -93,19 +93,22 @@ if (is_array($_GET) && count($_GET)>0) {
} }
} }
$language_variable = get_lang('PendingInvitations'); $social_left_content = SocialManager::show_social_menu('myfiles');
$language_comment = get_lang('SocialInvitesComment'); $social_right_content .= '<a href=""></a>';//TODO: hack and delete this line
$social_right_content .= '<br />';
$social_right_content .= '<table><tr><td><iframe name="fileManager" id="fileManager" src="'.api_get_path(WEB_PATH).'main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajaxfilemanager.php?editor=stand_alone" scrolling="no" noresize="noresize" frameborder="no" style="height:450px; width:700px; float:left"></iframe></td></tr></table>';
$social_right_content .= '</div>';
$social_right_content .= '</div>';
echo '<div id="social-content">';
echo '<div id="social-content-left">';
//this include the social menu div
SocialManager::show_social_menu('myfiles');
echo '</div>';
echo '<div id="social-content-right>';
echo '<a href=""></a>';//TODO: hack and delete this line $tpl = new Template(get_lang('Social'));
echo '<br />'; $tpl->assign('social_left_content', $social_left_content);
echo '<table><tr><td><iframe name="fileManager" id="fileManager" src="'.api_get_path(WEB_PATH).'main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajaxfilemanager.php?editor=stand_alone" scrolling="no" noresize="noresize" frameborder="no" style="height:450px; width:700px; float:left"></iframe></td></tr></table>'; $tpl->assign('social_left_menu', $social_left_menu);
echo '</div>'; $tpl->assign('social_right_content', $social_right_content);
echo '</div>'; $social_layout = $tpl->get_template('layout/social_layout.tpl');
Display::display_footer(); $content = $tpl->fetch($social_layout);
$tpl->assign('actions', $actions);
$tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();

@ -206,8 +206,6 @@ $_SESSION['social_user_id'] = intval($user_id);
* Display * Display
*/ */
Display :: display_header($nametool);
//Setting some course info //Setting some course info
$my_user_id=isset($_GET['u']) ? Security::remove_XSS($_GET['u']) : api_get_user_id(); $my_user_id=isset($_GET['u']) ? Security::remove_XSS($_GET['u']) : api_get_user_id();
$personal_course_list = UserManager::get_personal_session_course_list($my_user_id); $personal_course_list = UserManager::get_personal_session_course_list($my_user_id);
@ -228,52 +226,41 @@ if (is_array($personal_course_list)) {
$course_list_code = array_unique_dimensional($course_list_code); $course_list_code = array_unique_dimensional($course_list_code);
} }
$user_online_list = who_is_online(api_get_setting('time_limit_whosonline'), true); $social_left_content = SocialManager::show_social_menu('shared_profile', null, $user_id, $show_full_profile);
$user_online_count = count($user_online_list); $social_right_content = '<div class="rounded_div" style="width:280px">';
echo '<div id="social-content">';
echo '<div id="social-content-left">';
//this include the social menu div
SocialManager::show_social_menu('shared_profile', null, $user_id, $show_full_profile);
echo '</div>';
echo '<div id="social-content-right">';
echo '<div class="rounded_div" style="width:280px">';
if (!empty($user_info['firstname']) || !empty($user_info['lastname'])) { if (!empty($user_info['firstname']) || !empty($user_info['lastname'])) {
echo '<div><h3>'.api_get_person_name($user_info['firstname'], $user_info['lastname']).'</h3></div>'; $social_right_content .= '<div><h3>'.api_get_person_name($user_info['firstname'], $user_info['lastname']).'</h3></div>';
} else { } else {
//--- Basic Information //--- Basic Information
echo '<div><h3>'.get_lang('Profile').'</h3></div>'; $social_right_content .= '<div><h3>'.get_lang('Profile').'</h3></div>';
} }
if ($show_full_profile) { if ($show_full_profile) {
echo '<div class="social-profile-info">'; $social_right_content .= '<div class="social-profile-info">';
echo '<dl>'; $social_right_content .= '<dl>';
echo '<dt>'.get_lang('UserName').'</dt><dd>'. $user_info['username'].' </dd>'; $social_right_content .= '<dt>'.get_lang('UserName').'</dt><dd>'. $user_info['username'].' </dd>';
if (!empty($user_info['firstname']) || !empty($user_info['lastname'])) if (!empty($user_info['firstname']) || !empty($user_info['lastname']))
echo '<dt>'.get_lang('Name').'</dt><dd>'. api_get_person_name($user_info['firstname'], $user_info['lastname']).'</dd>'; $social_right_content .= '<dt>'.get_lang('Name').'</dt><dd>'. api_get_person_name($user_info['firstname'], $user_info['lastname']).'</dd>';
if (!empty($user_info['official_code'])) if (!empty($user_info['official_code']))
echo '<dt>'.get_lang('OfficialCode').'</dt><dd>'.$user_info['official_code'].'</dd>'; $social_right_content .= '<dt>'.get_lang('OfficialCode').'</dt><dd>'.$user_info['official_code'].'</dd>';
if (!empty($user_info['email'])) if (!empty($user_info['email']))
if (api_get_setting('show_email_addresses')=='true') if (api_get_setting('show_email_addresses')=='true')
echo '<dt>'.get_lang('Email').'</dt><dd>'.$user_info['email'].'</dd>'; $social_right_content .= '<dt>'.get_lang('Email').'</dt><dd>'.$user_info['email'].'</dd>';
if (!empty($user_info['phone'])) if (!empty($user_info['phone']))
echo '<dt>'.get_lang('Phone').'</dt><dd>'. $user_info['phone'].'</dd>'; $social_right_content .= '<dt>'.get_lang('Phone').'</dt><dd>'. $user_info['phone'].'</dd>';
echo '</dl>'; $social_right_content .= '</dl>';
echo '</div>'; $social_right_content .= '</div>';
} else { } else {
echo '<div class="social-profile-info">'; $social_right_content .= '<div class="social-profile-info">';
echo '<dl>'; $social_right_content .= '<dl>';
if (!empty($user_info['username'])) if (!empty($user_info['username']))
echo '<dt>'.get_lang('UserName').'</dt><dd>'. $user_info['username'].'</dd>'; $social_right_content .= '<dt>'.get_lang('UserName').'</dt><dd>'. $user_info['username'].'</dd>';
echo '</dl>'; $social_right_content .= '</dl>';
echo '</div>'; $social_right_content .= '</div>';
} }
echo '<div class="clear"></div>'; $social_right_content .= '<div class="clear"></div>';
// Extra information // Extra information
if ($show_full_profile) { if ($show_full_profile) {
@ -346,15 +333,15 @@ if ($show_full_profile) {
$extra_information .= '</div>'; //social-profile-info $extra_information .= '</div>'; //social-profile-info
} }
// if there are information to show // if there are information to show
if (!empty($extra_information_value)) echo $extra_information; if (!empty($extra_information_value)) $social_right_content .= $extra_information;
} }
echo '</div>'; // close div tag rounded $social_right_content .= '</div>'; // close div tag rounded
if ($show_full_profile) { if ($show_full_profile) {
echo '<div class="rounded_div" style="width:288px">'; $social_right_content .= '<div class="rounded_div" style="width:288px">';
$list_path_friends= $list_path_normal_friends = $list_path_parents = array(); $list_path_friends= $list_path_normal_friends = $list_path_parents = array();
//SOCIALGOODFRIEND , USER_RELATION_TYPE_FRIEND, USER_RELATION_TYPE_PARENT //SOCIALGOODFRIEND , USER_RELATION_TYPE_FRIEND, USER_RELATION_TYPE_PARENT
@ -429,8 +416,8 @@ if ($show_full_profile) {
$friend_html.= '</div>'; // close div friend-header $friend_html.= '</div>'; // close div friend-header
} }
$friend_html.= '</div>'; $friend_html.= '</div>';
echo $friend_html; $social_right_content .= $friend_html;
echo '</div>'; // close div tag rounded $social_right_content .= '</div>'; // close div tag rounded
} }
if ($show_full_profile) { if ($show_full_profile) {
@ -478,47 +465,47 @@ if ($show_full_profile) {
} }
if (count($grid_my_groups) > 0) { if (count($grid_my_groups) > 0) {
echo '<div class="rounded_div" style="width:90%">'; $social_right_content .= '<div class="rounded_div" style="width:90%">';
$count_groups = 0; $count_groups = 0;
if (count($results) == 1 ) { if (count($results) == 1 ) {
$count_groups = count($results); $count_groups = count($results);
} else { } else {
$count_groups = count($results); $count_groups = count($results);
} }
echo '<div><h3>'.get_lang('MyGroups').' ('.$count_groups.') </h3></div>'; $social_right_content .= '<div><h3>'.get_lang('MyGroups').' ('.$count_groups.') </h3></div>';
if ($i > $max_numbers_of_group) { if ($i > $max_numbers_of_group) {
if (api_get_user_id() == $user_id) { if (api_get_user_id() == $user_id) {
echo '<div class="box_shared_profile_group_actions"><a href="groups.php?#tab_browse-1">'.get_lang('SeeAllMyGroups').'</a></div>'; $social_right_content .= '<div class="box_shared_profile_group_actions"><a href="groups.php?#tab_browse-1">'.get_lang('SeeAllMyGroups').'</a></div>';
} else { } else {
echo '<div class="box_shared_profile_group_actions"><a href="'.api_get_path(WEB_CODE_PATH).'social/profile_friends_and_groups.inc.php?view=mygroups&height=390&width=610&&user_id='.$user_id.'" class="thickbox" title="'.get_lang('SeeAll').'" >'.get_lang('SeeAllMyGroups').'</a></div>'; $social_right_content .= '<div class="box_shared_profile_group_actions"><a href="'.api_get_path(WEB_CODE_PATH).'social/profile_friends_and_groups.inc.php?view=mygroups&height=390&width=610&&user_id='.$user_id.'" class="thickbox" title="'.get_lang('SeeAll').'" >'.get_lang('SeeAllMyGroups').'</a></div>';
} }
} }
//Display::display_sortable_grid('shared_profile_mygroups', array(), $grid_my_groups, array('hide_navigation'=>true, 'per_page' => 2), $query_vars, false, array(true, true, true,false)); //Display::display_sortable_grid('shared_profile_mygroups', array(), $grid_my_groups, array('hide_navigation'=>true, 'per_page' => 2), $query_vars, false, array(true, true, true,false));
$total = count($grid_my_groups); $total = count($grid_my_groups);
$i = 1; $i = 1;
foreach($grid_my_groups as $group) { foreach($grid_my_groups as $group) {
echo $group[0]; $social_right_content .= $group[0];
if ($i < $total) { if ($i < $total) {
echo ', '; $social_right_content .= ', ';
} }
$i++; $i++;
} }
echo '<br /><br /></div>'; //close rounded $social_right_content .= '<br /><br /></div>'; //close rounded
} }
// COURSES LIST // COURSES LIST
if ( is_array($list) ) { if ( is_array($list) ) {
echo '<div class="rounded_div" style="width:90%">'; $social_right_content .= '<div class="rounded_div" style="width:90%">';
echo '<div><h3>'.api_ucfirst(get_lang('MyCourses')).'</h3></div>'; $social_right_content .= '<div><h3>'.api_ucfirst(get_lang('MyCourses')).'</h3></div>';
echo '<div class="social-content-training">'; $social_right_content .= '<div class="social-content-training">';
//Courses whithout sessions //Courses whithout sessions
$old_user_category = 0; $old_user_category = 0;
$i=1; $i=1;
foreach($list as $key=>$value) { foreach($list as $key=>$value) {
if ( empty($value[2]) ) { //if out of any session if ( empty($value[2]) ) { //if out of any session
echo $value[1]; $social_right_content .= $value[1];
echo '<div id="social_content'.$i.'" class="course_social_content" style="display:none" ></div>'; $social_right_content .= '<div id="social_content'.$i.'" class="course_social_content" style="display:none" ></div>';
$i++; $i++;
} }
} }
@ -530,16 +517,16 @@ if ($show_full_profile) {
$listInactives[] = $value; $listInactives[] = $value;
} }
} }
echo '</div>'; //social-content-training $social_right_content .= '</div>'; //social-content-training
echo '</div>'; //close rounded $social_right_content .= '</div>'; //close rounded
} }
// user feeds // user feeds
$user_feeds = SocialManager::get_user_feeds($user_id); $user_feeds = SocialManager::get_user_feeds($user_id);
if (!empty($user_feeds)) { if (!empty($user_feeds)) {
echo '<div class="rounded_div" style="width:90%">'; $social_right_content .= '<div class="rounded_div" style="width:90%">';
echo '<div><h3>'.get_lang('RSSFeeds').'</h3></div>'; $social_right_content .= '<div><h3>'.get_lang('RSSFeeds').'</h3></div>';
echo '<div class="social-content-training">'.$user_feeds.'</div>'; $social_right_content .= '<div class="social-content-training">'.$user_feeds.'</div>';
echo '</div>'; $social_right_content .= '</div>';
} }
//--Productions //--Productions
@ -560,34 +547,34 @@ if ($show_full_profile) {
$count_pending_invitations = count($pending_invitations); $count_pending_invitations = count($pending_invitations);
} }
echo '<div class="social-box-main1">'; $social_right_content .= '<div class="social-box-main1">';
if (!empty($production_list) || !empty($file_list) || $count_pending_invitations > 0) { if (!empty($production_list) || !empty($file_list) || $count_pending_invitations > 0) {
//Pending invitations //Pending invitations
if (!isset($_GET['u']) || (isset($_GET['u']) && $_GET['u']==api_get_user_id())) { if (!isset($_GET['u']) || (isset($_GET['u']) && $_GET['u']==api_get_user_id())) {
if ($count_pending_invitations > 0) { if ($count_pending_invitations > 0) {
echo '<div class="rounded_div" style="width:280px">'; $social_right_content .= '<div class="rounded_div" style="width:280px">';
echo '<div><h3>'.get_lang('PendingInvitations').'</h3></div>'; $social_right_content .= '<div><h3>'.get_lang('PendingInvitations').'</h3></div>';
for ($i=0;$i<$count_pending_invitations;$i++) { for ($i=0;$i<$count_pending_invitations;$i++) {
$user_invitation_id = $pending_invitations[$i]['user_sender_id']; $user_invitation_id = $pending_invitations[$i]['user_sender_id'];
echo '<div id="dpending_'.$user_invitation_id.'" class="friend_invitations">'; $social_right_content .= '<div id="dpending_'.$user_invitation_id.'" class="friend_invitations">';
echo '<div style="float:left;width:60px;" >'; $social_right_content .= '<div style="float:left;width:60px;" >';
echo '<img style="margin-bottom:5px;" src="'.$list_get_path_web[$i]['dir'].'/'.$list_get_path_web[$i]['file'].'" width="60px">'; $social_right_content .= '<img style="margin-bottom:5px;" src="'.$list_get_path_web[$i]['dir'].'/'.$list_get_path_web[$i]['file'].'" width="60px">';
echo '</div>'; $social_right_content .= '</div>';
echo '<div style="padding-left:70px;">'; $social_right_content .= '<div style="padding-left:70px;">';
$user_invitation_info = api_get_user_info($user_invitation_id); $user_invitation_info = api_get_user_info($user_invitation_id);
echo '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_invitation_id.'">'.api_get_person_name($user_invitation_info['firstname'], $user_invitation_info['lastname']).'</a>'; $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_invitation_id.'">'.api_get_person_name($user_invitation_info['firstname'], $user_invitation_info['lastname']).'</a>';
echo '<br />'; $social_right_content .= '<br />';
echo Security::remove_XSS(cut($pending_invitations[$i]['content'], 50), STUDENT, true); $social_right_content .= Security::remove_XSS(cut($pending_invitations[$i]['content'], 50), STUDENT, true);
echo '<br />'; $social_right_content .= '<br />';
echo '<a id="btn_accepted_'.$user_invitation_id.'" onclick="register_friend(this)" href="javascript:void(0)">'.get_lang('SocialAddToFriends').'</a>'; $social_right_content .= '<a id="btn_accepted_'.$user_invitation_id.'" onclick="register_friend(this)" href="javascript:void(0)">'.get_lang('SocialAddToFriends').'</a>';
echo '<div id="id_response"></div>'; $social_right_content .= '<div id="id_response"></div>';
echo '</div>'; $social_right_content .= '</div>';
echo '</div>'; $social_right_content .= '</div>';
} }
echo '</div>'; //close rounded $social_right_content .= '</div>'; //close rounded
} }
} }
@ -609,51 +596,60 @@ if ($show_full_profile) {
$product_content .= '</div>'; $product_content .= '</div>';
} }
if (!empty($product_content)) { if (!empty($product_content)) {
echo '<div class="rounded_div" style="width:280px">'; $social_right_content .= '<div class="rounded_div" style="width:280px">';
echo $product_content; $social_right_content .= $product_content;
echo '</div>'; // close rounded $social_right_content .= '</div>'; // close rounded
} }
} }
if (!empty($user_info['competences']) || !empty($user_info['diplomas']) || !empty($user_info['openarea']) || !empty($user_info['teach']) ) { if (!empty($user_info['competences']) || !empty($user_info['diplomas']) || !empty($user_info['openarea']) || !empty($user_info['teach']) ) {
echo '<div class="rounded_div" style="width:280px">'; $social_right_content .= '<div class="rounded_div" style="width:280px">';
echo '<div><h3>'.get_lang('MoreInformation').'</h3></div>'; $social_right_content .= '<div><h3>'.get_lang('MoreInformation').'</h3></div>';
$cut_size = 220; $cut_size = 220;
if (!empty($user_info['competences'])) { if (!empty($user_info['competences'])) {
echo '<br />'; $social_right_content .= '<br />';
echo '<div class="social-background-content" style="width:100%;">'; $social_right_content .= '<div class="social-background-content" style="width:100%;">';
echo '<div class="social-actions-message"><strong>'.get_lang('MyCompetences').'</strong></div>'; $social_right_content .= '<div class="social-actions-message"><strong>'.get_lang('MyCompetences').'</strong></div>';
echo '<div class="social-profile-extended">'.$user_info['competences'].'</div>'; $social_right_content .= '<div class="social-profile-extended">'.$user_info['competences'].'</div>';
echo '</div>'; $social_right_content .= '</div>';
echo '<br />'; $social_right_content .= '<br />';
} }
if (!empty($user_info['diplomas'])) { if (!empty($user_info['diplomas'])) {
echo '<div class="social-background-content" style="width:100%;" >'; $social_right_content .= '<div class="social-background-content" style="width:100%;" >';
echo '<div class="social-actions-message"><strong>'.get_lang('MyDiplomas').'</strong></div>'; $social_right_content .= '<div class="social-actions-message"><strong>'.get_lang('MyDiplomas').'</strong></div>';
echo '<div class="social-profile-extended">'.$user_info['diplomas'].'</div>'; $social_right_content .= '<div class="social-profile-extended">'.$user_info['diplomas'].'</div>';
echo '</div>'; $social_right_content .= '</div>';
echo '<br />'; $social_right_content .= '<br />';
} }
if (!empty($user_info['openarea'])) { if (!empty($user_info['openarea'])) {
echo '<div class="social-background-content" style="width:100%;" >'; $social_right_content .= '<div class="social-background-content" style="width:100%;" >';
echo '<div class="social-actions-message"><strong>'.get_lang('MyPersonalOpenArea').'</strong></div>'; $social_right_content .= '<div class="social-actions-message"><strong>'.get_lang('MyPersonalOpenArea').'</strong></div>';
echo '<div class="social-profile-extended">'.$user_info['openarea'].'</div>'; $social_right_content .= '<div class="social-profile-extended">'.$user_info['openarea'].'</div>';
echo '</div>'; $social_right_content .= '</div>';
echo '<br />'; $social_right_content .= '<br />';
} }
if (!empty($user_info['teach'])) { if (!empty($user_info['teach'])) {
echo '<div class="social-background-content" style="width:100%;" >'; $social_right_content .= '<div class="social-background-content" style="width:100%;" >';
echo '<div class="social-actions-message"><strong>'.get_lang('MyTeach').'</strong></div>'; $social_right_content .= '<div class="social-actions-message"><strong>'.get_lang('MyTeach').'</strong></div>';
echo '<div class="social-profile-extended">'.$user_info['teach'].'</div>'; $social_right_content .= '<div class="social-profile-extended">'.$user_info['teach'].'</div>';
echo '</div>'; $social_right_content .= '</div>';
echo '<br />'; $social_right_content .= '<br />';
} }
echo '</div>'; //rounded $social_right_content .= '</div>'; //rounded
} }
echo '</div>'; // close social-box-main1 $social_right_content .= '</div>'; // close social-box-main1
} }
echo '</div>';
echo '</div>';
Display :: display_footer(); $tpl = new Template(get_lang('Social'));
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_left_menu', $social_left_menu);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
$content = $tpl->fetch($social_layout);
$tpl->assign('actions', $actions);
$tpl->assign('message', $message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();

@ -26,149 +26,150 @@ $query_vars = array();
$query = isset($_GET['q']) ? $_GET['q'] : null; $query = isset($_GET['q']) ? $_GET['q'] : null;
Display :: display_header($tool_name); $social_left_content = SocialManager::show_social_menu('search');
echo '<div id="social-content">';
echo '<div id="social-content-left">';
//show the action menu
SocialManager::show_social_menu('search');
echo '</div>';
echo '<div id="social-content-right">';
echo UserManager::get_search_form($query); $social_right_content = UserManager::get_search_form($query);
//I'm searching something //I'm searching something
if ($query !='') { if ($query !='') {
//get users from tags //get users from tags
$users = UserManager::get_all_user_tags($_GET['q'], 0, 0, 5); $users = UserManager::get_all_user_tags($_GET['q'], 0, 0, 5);
$groups = GroupPortalManager::get_all_group_tags($_GET['q']); $groups = GroupPortalManager::get_all_group_tags($_GET['q']);
if (empty($users) && empty($groups)) { if (empty($users) && empty($groups)) {
echo get_lang('SorryNoResults'); $social_right_content .= get_lang('SorryNoResults');
} }
$results = array(); $results = array();
if (is_array($users) && count($users)> 0) { if (is_array($users) && count($users)> 0) {
echo '<h2>'.get_lang('Users').'</h2>'; $social_right_content .= '<h2>'.get_lang('Users').'</h2>';
foreach($users as $user) { foreach($users as $user) {
$user_info = api_get_user_info($user['user_id'], true); $user_info = api_get_user_info($user['user_id'], true);
$url = api_get_path(WEB_PATH).'main/social/profile.php?u='.$user['user_id']; $url = api_get_path(WEB_PATH).'main/social/profile.php?u='.$user['user_id'];
if (empty($user['picture_uri'])) { if (empty($user['picture_uri'])) {
$picture['file'] = api_get_path(WEB_CODE_PATH).'img/unknown_180_100.jpg'; $picture['file'] = api_get_path(WEB_CODE_PATH).'img/unknown_180_100.jpg';
$img = Display::url('<img title class="social-home-anonymous-online" src="'.$picture['file'].'">', $url); $img = Display::url('<img title class="social-home-anonymous-online" src="'.$picture['file'].'">', $url);
} else { } else {
$picture = UserManager::get_picture_user($user['user_id'], $user['picture_uri'], 80, USER_IMAGE_SIZE_ORIGINAL ); $picture = UserManager::get_picture_user($user['user_id'], $user['picture_uri'], 80, USER_IMAGE_SIZE_ORIGINAL );
$img = '<img src="'.$picture['file'].'">'; $img = '<img src="'.$picture['file'].'">';
$clip = 'clip_vertical'; $clip = 'clip_vertical';
if ($picture['original_height'] > $picture['original_width']) { if ($picture['original_height'] > $picture['original_width']) {
$clip = 'clip_horizontal'; $clip = 'clip_horizontal';
}
$img = Display::url(Display::div(Display::div($img, array('class'=>$clip)), array('class'=>'clip-wrapper')) , $url);
}
if ($user_info['user_is_online']) {
$status_icon = Display::span('', array('class' => 'online_user'));
} else {
$status_icon = Display::span('', array('class' => 'offline_user'));
} }
$img = $status_icon.$img; $img = Display::url(Display::div(Display::div($img, array('class'=>$clip)), array('class'=>'clip-wrapper')) , $url);
}
$user['firstname'] = Display::url($user['firstname'], $url); if ($user_info['user_is_online']) {
$user['lastname'] = Display::url($user['lastname'], $url); $status_icon = Display::span('', array('class' => 'online_user_in_text'));
$user['tag'] = isset($user['tag']) ? $user['tag'] : null; } else {
$results[] = array($img, $user['firstname'], $user['lastname'], $user['tag']); $status_icon = Display::span('', array('class' => 'offline_user_in_text'));
} }
$img = $img;
echo '<div id="div_content_table">';
Display::display_sortable_grid('online', array(), $results, array('hide_navigation'=>true, 'per_page' => 5), $query_vars, false ,true); $user['tag'] = isset($user['tag']) ? $user['tag'] : null;
echo '</div>'; $user_info['complete_name'] = Display::url($user_info['complete_name'], $url).'<br >'.$user['tag'];
}
$results[] = array($img, $status_icon.$user_info['complete_name'], $user['tag']);
//Get users from tags this loop does not make sense for now ... }
/*
if (is_array($results) && count($results) > 0) { $social_right_content .= '<div id="div_content_table">';
foreach ($results as $result) { $social_right_content .= Display::return_sortable_grid('online', array(), $results, array('hide_navigation'=>true, 'per_page' => 5), $query_vars, false ,true);
$social_right_content .= '</div>';
$id = $result['id']; }
$url_open = '<a href="groups.php?id='.$id.'">';
$url_close = '</a>'; //Get users from tags this loop does not make sense for now ...
/*
$name = api_strtoupper(cut($result['name'],25,true)); if (is_array($results) && count($results) > 0) {
if (isset($result['relation_type']) && $result['relation_type'] == GROUP_USER_PERMISSION_ADMIN) { foreach ($results as $result) {
$name .= Display::return_icon('social_group_admin.png', get_lang('Admin'), array('style'=>'vertical-align:middle'));
} elseif (isset($result['relation_type']) && $result['relation_type'] == GROUP_USER_PERMISSION_MODERATOR) { $id = $result['id'];
$name .= Display::return_icon('social_group_moderator.png', get_lang('Moderator'), array('style'=>'vertical-align:middle')); $url_open = '<a href="groups.php?id='.$id.'">';
} $url_close = '</a>';
$count_users_group = count(GroupPortalManager::get_all_users_by_group($id));
if ($count_users_group == 1 ) { $name = api_strtoupper(cut($result['name'],25,true));
$count_users_group = $count_users_group.' '.get_lang('Member'); if (isset($result['relation_type']) && $result['relation_type'] == GROUP_USER_PERMISSION_ADMIN) {
} else { $name .= Display::return_icon('social_group_admin.png', get_lang('Admin'), array('style'=>'vertical-align:middle'));
$count_users_group = $count_users_group.' '.get_lang('Members'); } elseif (isset($result['relation_type']) && $result['relation_type'] == GROUP_USER_PERMISSION_MODERATOR) {
} $name .= Display::return_icon('social_group_moderator.png', get_lang('Moderator'), array('style'=>'vertical-align:middle'));
}
$picture = GroupPortalManager::get_picture_group($id, $result['picture_uri'],80); $count_users_group = count(GroupPortalManager::get_all_users_by_group($id));
if ($count_users_group == 1 ) {
$result['picture_uri'] = '<img class="social-groups-image" src="'.$picture['file'].'" hspace="4" height="50" border="2" align="left" width="50" />'; $count_users_group = $count_users_group.' '.get_lang('Member');
$grid_item_1 = Display::return_icon('boxmygroups.jpg'); } else {
$item_1 = '<div>'.$url_open.$result['picture_uri'].'<strong>'.$name.'<br />('.$count_users_group.')</strong>'.$url_close.'</div>'; $count_users_group = $count_users_group.' '.get_lang('Members');
}
if ($result['description'] != '') {
$item_2 = '<div class="box_description_group_title" ><span class="social-groups-text2">'.get_lang('Description').'</span></div>'; $picture = GroupPortalManager::get_picture_group($id, $result['picture_uri'],80);
$item_3 = '<div class="box_description_group_content" >'.cut($result['description'],100,true).'</div>';
} else { $result['picture_uri'] = '<img class="social-groups-image" src="'.$picture['file'].'" hspace="4" height="50" border="2" align="left" width="50" />';
$item_2 = '<div class="box_description_group_title" ><span class="social-groups-text2"></span></div>'; $grid_item_1 = Display::return_icon('boxmygroups.jpg');
$item_3 = '<div class="box_description_group_content" ></div>'; $item_1 = '<div>'.$url_open.$result['picture_uri'].'<strong>'.$name.'<br />('.$count_users_group.')</strong>'.$url_close.'</div>';
}
$item_4 = '<div class="box_description_group_actions" >'.$url_open.get_lang('SeeMore').$url_close.'</div>'; if ($result['description'] != '') {
$grid_item_2 = $item_1.$item_2.$item_3.$item_4; $item_2 = '<div class="box_description_group_title" ><span class="social-groups-text2">'.get_lang('Description').'</span></div>';
$grid_my_groups[]= array($grid_item_1,$grid_item_2); $item_3 = '<div class="box_description_group_content" >'.cut($result['description'],100,true).'</div>';
} } else {
}*/ $item_2 = '<div class="box_description_group_title" ><span class="social-groups-text2"></span></div>';
$item_3 = '<div class="box_description_group_content" ></div>';
$grid_groups = array(); }
if (is_array($groups) && count($groups)>0) { $item_4 = '<div class="box_description_group_actions" >'.$url_open.get_lang('SeeMore').$url_close.'</div>';
echo '<h2>'.get_lang('Groups').'</h2>'; $grid_item_2 = $item_1.$item_2.$item_3.$item_4;
foreach($groups as $group) { $grid_my_groups[]= array($grid_item_1,$grid_item_2);
$group['name'] = Security::remove_XSS($group['name'], STUDENT, true); }
$$group['description'] = Security::remove_XSS($group['description'], STUDENT, true); }*/
$id = $group['id'];
$url_open = '<a href="groups.php?id='.$id.'">'; $grid_groups = array();
$url_close = '</a>'; if (is_array($groups) && count($groups)>0) {
$name = cut($group['name'],25,true); $social_right_content .= '<h2>'.get_lang('Groups').'</h2>';
$count_users_group = count(GroupPortalManager::get_all_users_by_group($id)); foreach($groups as $group) {
if ($count_users_group == 1 ) { $group['name'] = Security::remove_XSS($group['name'], STUDENT, true);
$count_users_group = $count_users_group.' '.get_lang('Member'); $$group['description'] = Security::remove_XSS($group['description'], STUDENT, true);
} else { $id = $group['id'];
$count_users_group = $count_users_group.' '.get_lang('Members'); $url_open = '<a href="groups.php?id='.$id.'">';
} $url_close = '</a>';
$picture = GroupPortalManager::get_picture_group($group['id'], $group['picture_uri'],80); $name = cut($group['name'],25,true);
$tags = GroupPortalManager::get_group_tags($group['id']); $count_users_group = count(GroupPortalManager::get_all_users_by_group($id));
$group['picture_uri'] = '<img class="social-groups-image" src="'.$picture['file'].'" hspace="4" height="50" border="2" align="left" width="50" />'; if ($count_users_group == 1 ) {
$count_users_group = $count_users_group.' '.get_lang('Member');
} else {
$item_0 = Display::div($group['picture_uri'], array('class'=>'box_description_group_image')); $count_users_group = $count_users_group.' '.get_lang('Members');
$members = Display::span($count_users_group, array('class'=>'box_description_group_member')); }
$item_1 = Display::div(Display::tag('h3', $url_open.$name.$url_close).$members, array('class'=>'box_description_group_title')); $picture = GroupPortalManager::get_picture_group($group['id'], $group['picture_uri'],80);
$tags = GroupPortalManager::get_group_tags($group['id']);
$item_2 = ''; $group['picture_uri'] = '<img class="social-groups-image" src="'.$picture['file'].'" hspace="4" height="50" border="2" align="left" width="50" />';
$item_3 = '';
if ($group['description'] != '') {
$item_3 = '<div class="box_description_group_content" >'.cut($group['description'],100,true).'</div>'; $item_0 = Display::div($group['picture_uri'], array('class'=>'box_description_group_image'));
} else { $members = Display::span($count_users_group, array('class'=>'box_description_group_member'));
$item_2 = '<div class="box_description_group_title" ><span class="social-groups-text2"></span></div>'; $item_1 = Display::div(Display::tag('h3', $url_open.$name.$url_close).$members, array('class'=>'box_description_group_title'));
$item_3 = '<div class="box_description_group_content" ></div>';
} $item_2 = '';
$item_4 = '<div class="box_description_group_tags" >'.$tags.'</div>'; $item_3 = '';
$item_5 = '<div class="box_description_group_actions" >'.$url_open.get_lang('SeeMore').$url_close.'</div>'; if ($group['description'] != '') {
$grid_item_2 = $item_0.$item_1.$item_2.$item_3.$item_4.$item_5; $item_3 = '<div class="box_description_group_content" >'.cut($group['description'],100,true).'</div>';
$grid_groups[]= array('',$grid_item_2); } else {
} $item_2 = '<div class="box_description_group_title" ><span class="social-groups-text2"></span></div>';
} $item_3 = '<div class="box_description_group_content" ></div>';
$visibility = array(true,true,true,true,true); }
Display::display_sortable_grid('mygroups', array(), $grid_groups, array('hide_navigation'=>true, 'per_page' => 5), $query_vars, false, $visibility); $item_4 = '<div class="box_description_group_tags" >'.$tags.'</div>';
} $item_5 = '<div class="box_description_group_actions" >'.$url_open.get_lang('SeeMore').$url_close.'</div>';
$grid_item_2 = $item_0.$item_1.$item_2.$item_3.$item_4.$item_5;
echo '</div>'; $grid_groups[]= array('',$grid_item_2);
echo '</div>'; }
Display :: display_footer(); }
$visibility = array(true,true,true,true,true);
$social_right_content .= Display::return_sortable_grid('mygroups', array(), $grid_groups, array('hide_navigation'=>true, 'per_page' => 5), $query_vars, false, $visibility);
}
$social_right_content .= '</div>';
$tpl = new Template($tool_name);
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_left_menu', $social_left_menu);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
$content = $tpl->fetch($social_layout);
$tpl->assign('actions', $actions);
$tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();

@ -0,0 +1,15 @@
<div id="social-content">
<div id="social-content-left">
{$social_left_content}
</div>
<div class="social-menu">
{$social_left_menu}
</div>
<div id="social-content-right">
{$social_right_content}
</div>
</div>
<div class="clear">&nbsp;</div>

@ -446,17 +446,11 @@ elseif ($displayMode == "viewContentEdit") {
echo '<input type="image" src="'.$image_array['dir'].$image_array['file'].'" onclick="return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');"/>'; echo '<input type="image" src="'.$image_array['dir'].$image_array['file'].'" onclick="return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');"/>';
} }
// is the user online ? // is the user online?
$users_online = who_is_online(30); $online ='';
foreach ($users_online as $online) { if (user_is_online($userIdViewed)) {
if (in_array($userIdViewed, $online)) { $online = Display::return_icon('online.gif', get_lang('OnLine'),array('style'=>'with="8"; height="8"'));
$online = Display::return_icon('online.gif', get_lang('OnLine'),array('style'=>'with="8"; height="8"')); }
break;
} else {
$online ='';
}
}
//DISPLAY TABLE HEADING //DISPLAY TABLE HEADING
if ($origin == 'learnpath') { $allowedToEditDef=false; $is_allowedToTrack=false; } if ($origin == 'learnpath') { $allowedToEditDef=false; $is_allowedToTrack=false; }

@ -106,18 +106,21 @@ function hide_icon_edit(element_html) {
} }
$(document).ready(function() {
$(document).ready(function() {
$(document).endlessScroll({ $(document).endlessScroll({
fireOnce: false, fireOnce: false,
fireDelay: false, fireDelay: false,
loader: "<div class=\'loading\'>Loading<div>", loader: "<div class=\'loading\'>Loading<div>",
callback: function(page) { callback: function(page) {
page = page + 1; page = page;
$.ajax({
$.ajax({
beforeSend: function(objeto) { beforeSend: function(objeto) {
$("#display_response_id").html("Loading"); }, $("#display_response_id").html("Loading");
},
type: "GET", type: "GET",
url: "main/inc/ajax/online.ajax.php?a=load_online_user", url: "main/inc/ajax/online.ajax.php?a=load_online_user",
data: "online_page_nr="+page, data: "online_page_nr="+page,
success: function(data) { success: function(data) {
if (data != "end") { if (data != "end") {
@ -126,12 +129,10 @@ $(document).ready(function() {
} }
} }
}); });
}
}
}); });
}); });
</script>'; </script>';
if ($_GET['chatid'] != '') { if ($_GET['chatid'] != '') {
@ -155,57 +156,57 @@ if ((api_get_setting('showonline', 'world') == 'true' && !$_user['user_id']) ||
if(isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) { if(isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) {
$user_list = who_is_online_in_this_course(api_get_user_id(), api_get_setting('time_limit_whosonline'), $_GET['cidReq']); $user_list = who_is_online_in_this_course(api_get_user_id(), api_get_setting('time_limit_whosonline'), $_GET['cidReq']);
} else { } else {
$user_list = who_is_online(api_get_setting('time_limit_whosonline')); $user_list = who_is_online(0, 10);
} }
$total = count($user_list); if (!isset($_GET['id'])) {
if (!isset($_GET['id'])) {
$header_title = get_lang('UsersOnLineList');
if (!api_get_user_id()) {
$header_title = null;
}
Display::display_header($header_title);
if (api_get_setting('allow_social_tool') == 'true') { if (api_get_setting('allow_social_tool') == 'true') {
if (!api_is_anonymous()) { if (!api_is_anonymous()) {
echo '<div id="social-content-left">';
//this include the social menu div //this include the social menu div
SocialManager::show_social_menu('whoisonline'); $social_left_content = SocialManager::show_social_menu('whoisonline');
echo '</div>';
} }
} else { } else {
echo '<div class="actions-title">'; $social_right_content .= '<div class="actions-title">';
echo get_lang('UsersOnLineList'); $social_right_content .= get_lang('UsersOnLineList');
echo '</div>'; $social_right_content .= '</div>';
} }
} }
if ($user_list) { if ($user_list) {
if (!isset($_GET['id'])) { if (!isset($_GET['id'])) {
if (api_get_setting('allow_social_tool') == 'true') { if (api_get_setting('allow_social_tool') == 'true') {
echo '<div id="social-content-right">';
//this include the social menu div
if (!api_is_anonymous()) { if (!api_is_anonymous()) {
$query = isset($_GET['q']) ? $_GET['q']: null; $query = isset($_GET['q']) ? $_GET['q']: null;
echo UserManager::get_search_form($query); $social_right_content .= UserManager::get_search_form($query);
} }
} }
echo Display::tag('h2', get_lang('UsersOnLineList')); $social_right_content .= Display::tag('h2', get_lang('UsersOnLineList'));
SocialManager::display_user_list($user_list); $social_right_content .= SocialManager::display_user_list($user_list);
if (api_get_setting('allow_social_tool') == 'true') {
echo '</div>';
}
} else {
//individual user information - also displays header info
SocialManager::display_individual_user($_GET['id']);
} }
} elseif (isset($_GET['id'])) {
Display::display_header(get_lang('UsersOnLineList'));
echo '<div class="actions-title">';
echo get_lang('UsersOnLineList');
echo '</div>';
} }
if (isset($_GET['id'])) {
//SocialManager::display_individual_user($_GET['id']);
header("Location: ".api_get_path(WEB_CODE_PATH)."social/profile.php?u=?".$_GET['id']);
exit;
}
} else {
api_not_allowed();
exit;
}
$tpl = new Template(get_lang('UsersOnLineList'));
if (api_get_setting('allow_social_tool') == 'true') {
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_left_menu', $social_left_menu);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
$content = $tpl->fetch($social_layout);
} else { } else {
Display::display_header(get_lang('UsersOnLineList')); $content = $social_right_content;
Display::display_error_message(get_lang('AccessNotAllowed'));
} }
Display::display_footer();
$tpl->assign('actions', $actions);
$tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();

Loading…
Cancel
Save