diff --git a/dokeos_license.txt b/dokeos_license.txt deleted file mode 100755 index 8c9d4d38ce..0000000000 --- a/dokeos_license.txt +++ /dev/null @@ -1,25 +0,0 @@ -=============================================================================== - Dokeos - elearning and course management software - - Copyright (c) 2004-2009 Dokeos SPRL - Copyright (c) 2009 Dokeos Latinoamérica SAC - Copyright (c) 2003-2007 Ghent University (UGent) - Copyright (c) 2001 Universite catholique de Louvain (UCL) - Copyright (c) 2003-2008 Vrije Universiteit Brussel (VUB) - Copyright (c) 2004-2008 Hoogeschool Gent (HoGent) - For a full list of contributors detaining copyrights over parts of - the Dokeos software, see "documentation/credits.html". - The full license can be read in "documentation/license.html". - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - See the GNU General Public License for more details. - - Contact address: Dokeos, Rue du Corbeau, 108, B-1030 Brussels, Belgium - Mail: info@dokeos.com -=============================================================================== -This license is referenced throughout the code using the following header line: -/* For licensing terms, see /dokeos_license.txt */ \ No newline at end of file diff --git a/main/css/blue_lagoon/default.css b/main/css/blue_lagoon/default.css index e583cbc3aa..639d4e3e31 100755 --- a/main/css/blue_lagoon/default.css +++ b/main/css/blue_lagoon/default.css @@ -2207,7 +2207,7 @@ div.comments { margin-right:-100px; } .message-title { - /* color:#ff0000;*/ + color:#ff0000; font-size:12px; } .message-body { @@ -2624,7 +2624,7 @@ input.arrowl { -/* UI improvements */ +/* UI improvements for 1.8.6.2 this should be move to the chamilo theme and reproduce in all CSS*/ * { @@ -2672,4 +2672,120 @@ a.read { a.unread { -} \ No newline at end of file +} + + +#inbox-wrapper {width:100%;} + +#inbox {width:90%;float:left;} + +#inbox-menu ul { + list-style-image:none; + list-style-position:outside; + list-style-type:none; + margin:0; + padding:0; + width:10%; + float:left; +} + +#message-reply-link { + float:right; +} + +.social-plugin-item { + float:left; + width:50%; + background-color:#ccc; + margin: 0px; +} + + +#social-plugins { + float:left; + background-color:#f00; + width:100%; + margin: 0px; + padding:2px; +} + +.groups_grid_item { + width:80px; + float:left; + margin:5px; +} + +.groups_grid_container { + +} + +.message-item { + -moz-background-clip:border; + -moz-background-inline-policy:continuous; + -moz-background-origin:padding; + -moz-border-radius-bottomleft:8px; + -moz-border-radius-bottomright:8px; + -moz-border-radius-topleft:8px; + -moz-border-radius-topright:8px; + background:#eee none repeat scroll 0 0; + margin:0 0 5px; + padding:10px; +} + +.message-topic { + -moz-background-clip:border; + -moz-background-inline-policy:continuous; + -moz-background-origin:padding; + -moz-border-radius-bottomleft:8px; + -moz-border-radius-bottomright:8px; + -moz-border-radius-topleft:8px; + -moz-border-radius-topright:8px; + background:#ccc none repeat scroll 0 0; + margin:0 0 5px; + padding:10px; + +} + +.message-group-title-topic { + font-size:180%; + margin:5px 0px 5px 0px; +} +.message-group-title { + font-size:120%; +} + +.message-group-author { + margin:5px 0px 5px 0px; +} + +.message-group-content { + line-height:150% +} + +.view-message-content { + line-height:150%; + font-size:110%; +} + +.actions { + + + background:#efefef; + border:1px solid #ccc; + padding:2px; + margin-bottom: 5px; + vertical-align:middle; +} + +.actions-title { + + + background:#efefef; + border:1px solid #ccc; + padding:4px; + margin-bottom: 5px; + font-size:14px; + font-weight:bolder; + vertical-align:middle; +} + diff --git a/main/inc/lib/group_portal_manager.lib.php b/main/inc/lib/group_portal_manager.lib.php index 0d6c21bd7e..faea573925 100755 --- a/main/inc/lib/group_portal_manager.lib.php +++ b/main/inc/lib/group_portal_manager.lib.php @@ -186,7 +186,7 @@ class GroupPortalManager $table = Database :: get_main_table(TABLE_MAIN_GROUP); $group_id = intval($group_id); $user_condition = ''; - $sql = "SELECT name, description, picture_uri, visibility FROM $table WHERE id = $group_id "; + $sql = "SELECT name, description, picture_uri, url, visibility FROM $table WHERE id = $group_id "; $res = Database::query($sql, __FILE__, __LINE__); $item = array(); if (Database::num_rows($res)>0) { @@ -384,7 +384,7 @@ class GroupPortalManager $where_relation_condition = "AND gu.relation_type IN ($relation_type) "; } - $sql="SELECT picture_uri, u.user_id, u.firstname, u.lastname, relation_type FROM $tbl_user u + $sql="SELECT picture_uri as image, u.user_id, u.firstname, u.lastname, relation_type FROM $tbl_user u INNER JOIN $table_group_rel_user gu ON (gu.user_id = u.user_id) WHERE gu.group_id= $group_id $where_relation_condition ORDER BY relation_type, firstname LIMIT $limit"; @@ -392,7 +392,7 @@ class GroupPortalManager $array = array(); while ($row = Database::fetch_array($result, 'ASSOC')) { if ($with_image == true) { - $picture = UserManager::get_picture_user($row['user_id'], $row['picture_uri'],$image_conf['height'],$image_conf['size']); + $picture = UserManager::get_picture_user($row['user_id'], $row['picture_uri'],$image_conf['height'],$image_conf['size']); $row['image'] = ''; } $array[$row['user_id']] = $row; diff --git a/main/inc/lib/magpierss/rss_fetch.inc b/main/inc/lib/magpierss/rss_fetch.inc index a8d3cd8888..c8b2fdb5d6 100755 --- a/main/inc/lib/magpierss/rss_fetch.inc +++ b/main/inc/lib/magpierss/rss_fetch.inc @@ -213,7 +213,8 @@ function fetch_rss ($url) { } // else we totally failed - error( $errormsg ); + //hide the error + //error( $errormsg ); return false; diff --git a/main/inc/lib/message.lib.php b/main/inc/lib/message.lib.php index b632ae5c8e..859580fb57 100755 --- a/main/inc/lib/message.lib.php +++ b/main/inc/lib/message.lib.php @@ -30,9 +30,6 @@ define('MESSAGE_STATUS_INVITATION_DENIED', '7'); class MessageManager { - function MessageManager() { - - } public static function get_online_user_list($current_user_id) { $min=30; global $_configuration; @@ -544,32 +541,32 @@ class MessageManager /** * display message box in the inbox + * @param int the message id * @return string html with the message content */ - public static function show_message_box() { - global $charset; - + public static function show_message_box($message_id) { $table_message = Database::get_main_table(TABLE_MESSAGE); $tbl_message_attach = Database::get_main_table(TABLE_MESSAGE_ATTACHMENT); - $message_id = ''; - if (isset($_GET['id_send']) && is_numeric($_GET['id_send'])) { + + /* if (isset($_GET['id_send']) && is_numeric($_GET['id_send'])) { // when I get here ? by Julio Montoya $query = "SELECT * FROM $table_message WHERE user_sender_id=".api_get_user_id()." AND id=".intval(Database::escape_string($_GET['id_send']))." AND msg_status=4;"; $result = Database::query($query,__FILE__,__LINE__); $path='outbox.php'; $message_id = intval($_GET['id_send']); - } else { - if (is_numeric($_GET['id'])) { - $message_id = intval($_GET['id']); - $query = "UPDATE $table_message SET msg_status = '".MESSAGE_STATUS_NEW."' WHERE user_receiver_id=".api_get_user_id()." AND id='".$message_id."';"; - $result = Database::query($query,__FILE__,__LINE__); - - $query = "SELECT * FROM $table_message WHERE msg_status<>4 AND user_receiver_id=".api_get_user_id()." AND id='".$message_id."';"; - $result = Database::query($query,__FILE__,__LINE__); - } + } else {*/ + + $message_id = intval($message_id); + if (is_numeric($message_id) && !empty($message_id)) { + $query = "UPDATE $table_message SET msg_status = '".MESSAGE_STATUS_NEW."' WHERE user_receiver_id=".api_get_user_id()." AND id='".$message_id."';"; + $result = Database::query($query,__FILE__,__LINE__); + + $query = "SELECT * FROM $table_message WHERE msg_status<>4 AND user_receiver_id=".api_get_user_id()." AND id='".$message_id."';"; + $result = Database::query($query,__FILE__,__LINE__); + } $path='inbox.php'; - } + //} $row = Database::fetch_array($result); @@ -591,7 +588,7 @@ class MessageManager

'.str_replace("\\","",$row[5]).'

+

'.str_replace("\\","",$row[5]).'

'; if (api_get_setting('allow_social_tool') == 'true') { @@ -617,13 +614,20 @@ class MessageManager
-
- +
'.str_replace("\\","",$row[6]).''.str_replace("\\","",$row[6]).'
'.(!empty($files_attachments)?implode(' | ',$files_attachments):'').'
-
-   +
'; + + $message_content .= ''.Display::return_icon('message_reply.png',get_lang('ReplyToMessage')).get_lang('ReplyToMessage').'  '; + $message_content .= ''.Display::return_icon('message_delete.png',get_lang('DeleteMessage')).''.get_lang('DeleteMessage').' '; + + + + $message_content .='
+ '; return $message_content; @@ -712,9 +716,8 @@ class MessageManager } /** - * display messages for group with nested view + * Displays messages of a group with nested view * @param int group id - * @return void */ public static function display_messages_for_group($group_id) { @@ -723,34 +726,43 @@ class MessageManager $rows = self::calculate_children($rows); $group_info = GroupPortalManager::get_group_data($group_id); $count=0; - - foreach ($rows as $message) { - $indent = $message['indent_cnt']*'20'; - $user_sender_info = UserManager::get_user_info_by_id($message['user_sender_id']); - if (!empty($message['parent_id'])) { - $message_parent_info = self::get_message_by_id($message['parent_id']); - $user_parent_info = UserManager::get_user_info_by_id($message_parent_info['user_sender_id']); - $name_user_parent = api_get_person_name($user_parent_info['firstname'], $user_parent_info['lastname']); - } - - // get file attachments by message id - $files_attachments = self::get_links_message_attachment_files($message['id']); - - $name=api_get_person_name($user_sender_info['firstname'], $user_sender_info['lastname']); - echo "
"; - echo '
'.$message['title'].' ( '.$message['send_date'].' ) 
'; - echo '
'.get_lang('From').' '.$name.' '.get_lang('ToGroup').' '.(!empty($message['parent_id'])?$name_user_parent:$group_info['name']).'
'; - echo '
'.$message['content'].'
'; - echo '
'.(!empty($files_attachments)?implode(' | ',$files_attachments):'').'
'; - echo '
'; - - if (!isset($message['children'])) { - echo ''.Display :: return_icon('forumthread_new.gif', api_xml_http_response_encode(get_lang('Reply'))).' '.api_xml_http_response_encode(get_lang('Reply')).''; - //echo ''.Display::return_icon('forumthread_new.gif',api_xml_http_response_encode(get_lang('Reply'))).' '.api_xml_http_response_encode(get_lang('Reply')).''; + if (is_array($rows) && count($rows)> 0) { + foreach ($rows as $message) { + $indent = $message['indent_cnt']*'20'; + $user_sender_info = UserManager::get_user_info_by_id($message['user_sender_id']); + + if (!empty($message['parent_id'])) { + $message_parent_info = self::get_message_by_id($message['parent_id']); + $user_parent_info = UserManager::get_user_info_by_id($message_parent_info['user_sender_id']); + $name_user_parent = api_get_person_name($user_parent_info['firstname'], $user_parent_info['lastname']); + + $message_item = 'message-item'; + $message_title_item = 'message-group-title'; + } else { + $message_item = 'message-topic'; + $message_title_item = 'message-group-title-topic'; + } + + // get file attachments by message id + $files_attachments = self::get_links_message_attachment_files($message['id']); + + $name = api_get_person_name($user_sender_info['firstname'], $user_sender_info['lastname']); + echo '
'; + + //if (!isset($message['children'])) { + echo ''; + //echo ''.Display::return_icon('forumthread_new.gif',api_xml_http_response_encode(get_lang('Reply'))).' '.api_xml_http_response_encode(get_lang('Reply')).''; + //} + + echo '
'.$message['title'].' ( '.date_to_str_ago($message['send_date']).' ) 
'; + + echo '
'.get_lang('From').' '.$name.' 
'; + echo '
'.$message['content'].'
'; + echo '
'.(!empty($files_attachments)?implode(' | ',$files_attachments):'').'
'; + + echo '
'; + $count++; } - echo '
'; - echo '
'; - $count++; } } diff --git a/main/inc/lib/social.lib.php b/main/inc/lib/social.lib.php index e0bf48313a..353a2e5717 100755 --- a/main/inc/lib/social.lib.php +++ b/main/inc/lib/social.lib.php @@ -20,6 +20,11 @@ define('SOCIALGOODFRIEND','4'); define('SOCIALENEMY', '5'); define('SOCIALDELETED', '6'); +//PLUGIN PLACES +define('SOCIAL_LEFT_PLUGIN', '1'); +define('SOCIAL_CENTER_PLUGIN', '2'); +define('SOCIAL_RIGHT_PLUGIN', '3'); + require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php'; require_once api_get_path(LIBRARY_PATH).'message.lib.php'; @@ -46,18 +51,23 @@ class SocialManager extends UserManager { $sql = 'SELECT COUNT(*) as count FROM ' . $tbl_my_friend . ' WHERE friend_user_id=' .$friend_id.' AND user_id='.$my_user_id; + $result = Database::query($sql, __FILE__, __LINE__); $row = Database :: fetch_array($result, 'ASSOC'); + error_log('1'.$row['count']); if ($row['count'] == 0) { $current_date=date('Y-m-d H:i:s'); $sql_i = 'INSERT INTO ' . $tbl_my_friend . '(friend_user_id,user_id,relation_type,last_edit)values(' . $friend_id . ','.$my_user_id.','.$relation_type.',"'.$current_date.'");'; + error_log($sql_i); Database::query($sql_i, __FILE__, __LINE__); } else { $sql = 'SELECT COUNT(*) as count FROM ' . $tbl_my_friend . ' WHERE friend_user_id=' . $friend_id . ' AND user_id='.$my_user_id; $result = Database::query($sql, __FILE__, __LINE__); $row = Database :: fetch_array($result, 'ASSOC'); + error_log($row['count']); if ($row['count'] == 1) { $sql_i = 'UPDATE ' . $tbl_my_friend . ' SET relation_type='.$relation_type.' WHERE friend_user_id=' . $friend_id.' AND user_id='.$my_user_id; + error_log($sql_i); Database::query($sql_i, __FILE__, __LINE__); } } @@ -658,4 +668,227 @@ class SocialManager extends UserManager { */ echo ''; } + + + + /** + * Displays a sortable table with the list of online users. + * @param array $user_list + */ + function display_user_list($user_list, $_plugins) { + global $charset; + if ($_GET['id'] == '') { + $extra_params = array(); + $course_url = ''; + if (strlen($_GET['cidReq']) > 0) { + $extra_params['cidReq'] = Security::remove_XSS($_GET['cidReq']); + $course_url = '&cidReq='.Security::remove_XSS($_GET['cidReq']); + } + + foreach ($user_list as $user) { + $uid = $user[0]; + $user_info = api_get_user_info($uid); + $table_row = array(); + if (api_get_setting('allow_social_tool')=='true') { + $url = api_get_path(WEB_PATH).'main/social/profile.php?u='.$uid.$course_url; + } else { + $url = '?id='.$uid.$course_url; + } + $image_array = UserManager::get_user_picture_path_by_id($uid, 'system', false, true); + + $friends_profile = SocialManager::get_picture_user($uid, $image_array['file'], 92, 'medium_', ' width="90" height="90" '); + // reduce image + $name = api_get_person_name($user_info['firstName'], $user_info['lastName']); + $table_row[] = ''.$name.''; + $table_row[] = ''.api_get_person_name($user_info['firstName'], $user_info['lastName']).''; + + //$table_row[] = ''.$user_info['lastName'].''; + + if (api_get_setting('show_email_addresses') == 'true') { + $table_row[] = Display::encrypted_mailto_link($user_info['mail']); + } + $user_anonymous = api_get_anonymous_id(); + $table_data[] = $table_row; + } + $table_header[] = array(get_lang('UserPicture'), false, 'width="90"'); + ///$table_header[] = array(get_lang('Name'), true); + //$table_header[] = array(get_lang('LastName'), true); + + if (api_get_setting('show_email_addresses') == 'true') { + $table_header[] = array(get_lang('Email'), true); + } + Display::display_sortable_table($table_header, $table_data, array(), array('per_page' => 30), $extra_params,array(),'grid'); + } + } + /** + * Displays the information of an individual user + * @param int $user_id + */ + function display_individual_user($user_id) { + global $interbreadcrumb; + $safe_user_id = Database::escape_string($user_id); + + // to prevent a hacking attempt: http://www.dokeos.com/forum/viewtopic.php?t=5363 + $user_table = Database::get_main_table(TABLE_MAIN_USER); + $sql = "SELECT * FROM $user_table WHERE user_id='".$safe_user_id."'"; + $result = Database::query($sql, __FILE__, __LINE__); + if (Database::num_rows($result) == 1) { + $user_object = Database::fetch_object($result); + $name = GetFullUserName($user_id).($_SESSION['_uid'] == $user_id ? ' ('.get_lang('Me').')' : '' ); + $alt = GetFullUserName($user_id).($_SESSION['_uid'] == $user_id ? ' ('.get_lang('Me').')' : ''); + $status = ($user_object->status == COURSEMANAGER ? get_lang('Teacher') : get_lang('Student')); + $interbreadcrumb[] = array('url' => 'whoisonline.php', 'name' => get_lang('UsersOnLineList')); + Display::display_header($alt); + echo '
'; + echo $alt; + echo '

'; + echo '
'; + if (strlen(trim($user_object->picture_uri)) > 0) { + $sysdir_array = UserManager::get_user_picture_path_by_id($safe_user_id, 'system'); + $sysdir = $sysdir_array['dir']; + $webdir_array = UserManager::get_user_picture_path_by_id($safe_user_id, 'web'); + $webdir = $webdir_array['dir']; + $fullurl = $webdir.$user_object->picture_uri; + $system_image_path = $sysdir.$user_object->picture_uri; + list($width, $height, $type, $attr) = @getimagesize($system_image_path); + $resizing = (($height > 200) ? 'height="200"' : ''); + $height += 30; + $width += 30; + $window_name = 'window'.uniqid(''); + // get the path,width and height from original picture + $big_image = $webdir.'big_'.$user_object->picture_uri; + $big_image_size = api_getimagesize($big_image); + $big_image_width = $big_image_size[0]; + $big_image_height = $big_image_size[1]; + $url_big_image = $big_image.'?rnd='.time(); + echo '
'; + } else { + echo Display::return_icon('unknown.jpg', get_lang('Unknown')); + echo '
'; + } + + echo '
'.$status.'
'; + + global $user_anonymous; + if (api_get_setting('allow_social_tool') == 'true' && api_get_user_id() <> $user_anonymous && api_get_user_id() <> 0) { + echo '
'; + echo ''.get_lang('ViewSharedProfile').''; + echo '
'; + + $user_anonymous = api_get_anonymous_id(); + + if ($safe_user_id != api_get_user_id() && !api_is_anonymous($safe_user_id)) { + $user_relation = SocialManager::get_relation_between_contacts(api_get_user_id(), $safe_user_id); + if ($user_relation == 0 || $user_relation == 6) { + echo ''.Display :: return_icon('add_multiple_users.gif', get_lang('SocialInvitationToFriends')).' '.get_lang('SendInvitation').'
+ '.Display :: return_icon('mail_send.png', get_lang('SendAMessage')).' '.get_lang('SendAMessage').''; + } else { + echo ''.Display :: return_icon('mail_send.png', get_lang('SendAMessage')).' '.get_lang('SendAMessage').''; + } + } + } + + if (api_get_setting('show_email_addresses') == 'true') { + echo Display::encrypted_mailto_link($user_object->email,$user_object->email).'
'; + } + + echo '
'; + if ($user_object->competences) { + echo '
'.get_lang('MyCompetences').'
'; + echo '
'.$user_object->competences.'
'; + } + if ($user_object->diplomas) { + echo '
'.get_lang('MyDiplomas').'
'; + echo '
'.$user_object->diplomas.'
'; + } + if ($user_object->teach) { + echo '
'.get_lang('MyTeach').'
'; + echo '
'.$user_object->teach.'
';; + } + display_productions($user_object->user_id); + if ($user_object->openarea) { + echo '
'.get_lang('MyPersonalOpenArea').'
'; + echo '
'.$user_object->openarea.'
'; + } + } + else + { + Display::display_header(get_lang('UsersOnLineList')); + echo '
'; + echo get_lang('UsersOnLineList'); + echo '
'; + } + } + /** + * Display productions in whoisonline + * @param int $user_id User id + * @todo use the correct api_get_path instead of $clarolineRepositoryWeb + */ + function display_productions($user_id) { + $sysdir_array = UserManager::get_user_picture_path_by_id($user_id, 'system', true); + $sysdir = $sysdir_array['dir'].$user_id.'/'; + $webdir_array = UserManager::get_user_picture_path_by_id($user_id, 'web', true); + $webdir = $webdir_array['dir'].$user_id.'/'; + if (!is_dir($sysdir)) { + mkpath($sysdir); + } + /* + $handle = opendir($sysdir); + $productions = array(); + while ($file = readdir($handle)) { + if ($file == '.' || $file == '..' || $file == '.htaccess') { + continue; // Skip current and parent directories + } + if (preg_match('/('.$user_id.'|[0-9a-f]{13}|saved)_.+\.(png|jpg|jpeg|gif)$/i', $file)) { + // User's photos should not be listed as productions. + continue; + } + $productions[] = $file; + } + */ + $productions = UserManager::get_user_productions($user_id); + + if (count($productions) > 0) { + echo '
'.get_lang('Productions').'
'; + echo '
'; + } + } + public static function get_plugins($place = SOCIAL_CENTER_PLUGIN) { + $content = ''; + switch ($place) { + case SOCIAL_CENTER_PLUGIN: + $social_plugins = array(1, 2); + if (is_array($social_plugins) && count($social_plugins)>0) { + $content.= '
'; + foreach($social_plugins as $plugin ) { + $content.= '
'; + $content.= $plugin; + $content.= '
'; + } + $content.= '
'; + } + break; + case SOCIAL_LEFT_PLUGIN: + break; + case SOCIAL_RIGHT_PLUGIN: + break; + } + return $content; + } } \ No newline at end of file diff --git a/main/messages/inbox.php b/main/messages/inbox.php index c879325a23..3f5e5c99df 100755 --- a/main/messages/inbox.php +++ b/main/messages/inbox.php @@ -126,6 +126,7 @@ if ($_GET['f']=='social') { } Display::display_header(''); +$social_parameter = ''; if ($_GET['f']=='social') { require_once api_get_path(LIBRARY_PATH).'social.lib.php'; @@ -133,35 +134,76 @@ if ($_GET['f']=='social') { echo '
'; echo get_lang('Messages'); echo '
'; + $social_parameter = '?f=social'; } else { //comes from normal profile + /* echo '
'; echo ''.Display::return_icon('inbox.png',api_xml_http_response_encode(get_lang('Inbox'))).api_xml_http_response_encode(get_lang('Inbox')).''; echo ''.Display::return_icon('message_new.png',api_xml_http_response_encode(get_lang('ComposeMessage'))).api_xml_http_response_encode(get_lang('ComposeMessage')).''; echo ''.Display::return_icon('outbox.png',api_xml_http_response_encode(get_lang('Outbox'))).api_xml_http_response_encode(get_lang('Outbox')).''; - echo '
'; -} + echo ''; */ + + + echo '
'; + if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') { + echo ''.Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).' '.get_lang('ViewSharedProfile').''; + } + if (api_get_setting('allow_message_tool') == 'true') { + echo ''.Display::return_icon('inbox.png').' '.get_lang('Messages').''; + } + $show = isset($_GET['show']) ? '&show='.Security::remove_XSS($_GET['show']) : ''; + + //echo ''; + + if (isset($_GET['type']) && $_GET['type'] == 'extended') { + echo ''.Display::return_icon('edit.gif', get_lang('EditNormalProfile')).' '.get_lang('EditNormalProfile').''; + } else { + echo ''.Display::return_icon('edit.gif', get_lang('EditExtendProfile')).' '.get_lang('EditExtendProfile').''; + } + //echo ''; -if (!isset($_GET['del_msg'])) { - inbox_display(); -} else { - $num_msg = intval($_POST['total']); - for ($i=0;$i<$num_msg;$i++) { - if($_POST[$i]) { - //the user_id was necesarry to delete a message?? - MessageManager::delete_message_by_user_receiver(api_get_user_id(), $_POST['_'.$i]); + echo '
'; + + +} + + +echo '
'; + //LEFT CONTENT + echo '
'; + echo ''; + echo '
'; + + echo '
'; + //MAIN CONTENT + if (!isset($_GET['del_msg'])) { + inbox_display(); + } else { + $num_msg = intval($_POST['total']); + for ($i=0;$i<$num_msg;$i++) { + if($_POST[$i]) { + //the user_id was necesarry to delete a message?? + MessageManager::delete_message_by_user_receiver(api_get_user_id(), $_POST['_'.$i]); + } } + inbox_display(); } - inbox_display(); -} + echo '
'; + +echo '
'; /* ============================================================================== FOOTER ============================================================================== */ -if ($request===false) { - Display::display_footer(); -} + +Display::display_footer(); + ?> diff --git a/main/messages/new_message.php b/main/messages/new_message.php index 984d3af642..179e14ccad 100755 --- a/main/messages/new_message.php +++ b/main/messages/new_message.php @@ -14,7 +14,7 @@ ============================================================================== */ // name of the language file that needs to be included -$language_file= 'messages'; +$language_file= array('messages','userInfo'); $cidReset=true; require_once '../inc/global.inc.php'; @@ -29,7 +29,6 @@ require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'; require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php'; require_once api_get_path(LIBRARY_PATH).'message.lib.php'; -$request=api_is_xml_http_request(); $nameTools = api_xml_http_response_encode(get_lang('Messages')); /* ----------------------------------------------------------- @@ -123,7 +122,7 @@ function show_compose_reply_to_message ($message_id, $receiver_id) { $row = Database::fetch_array($result); if (!isset($row[1])) { - echo api_xml_http_response_encode(get_lang('InvalidMessageId')); + echo get_lang('InvalidMessageId'); die(); } echo api_xml_http_response_encode(get_lang('To').': '. GetFullUserName($row[1]).''); @@ -143,22 +142,21 @@ function show_compose_to_user ($receiver_id) { function manage_form ($default, $select_from_user_list = null) { global $charset; $table_message = Database::get_main_table(TABLE_MESSAGE); - $request=api_is_xml_http_request(); - + $group_id = intval($_REQUEST['group_id']); $message_id = intval($_GET['message_id']); $form = new FormValidator('compose_message',null,null,null,array('enctype'=>'multipart/form-data')); if (empty($group_id)) { if (isset($select_from_user_list)) { - $form->add_textfield('id_text_name', api_xml_http_response_encode(get_lang('SendMessageTo')),true,array('size' => 40,'id'=>'id_text_name','onkeyup'=>'send_request_and_search()','autocomplete'=>'off','style'=>'padding:0px')); - $form->addRule('id_text_name', api_xml_http_response_encode(get_lang('ThisFieldIsRequired')), 'required'); + $form->add_textfield('id_text_name', get_lang('SendMessageTo'),true,array('size' => 40,'id'=>'id_text_name','onkeyup'=>'send_request_and_search()','autocomplete'=>'off','style'=>'padding:0px')); + $form->addRule('id_text_name', get_lang('ThisFieldIsRequired'), 'required'); $form->addElement('html',''); $form->addElement('hidden','user_list',0,array('id'=>'user_list')); } else { if ($default['user_list']==0) { - $form->add_textfield('id_text_name', api_xml_http_response_encode(get_lang('SendMessageTo')),true,array('size' => 40,'id'=>'id_text_name','onkeyup'=>'send_request_and_search()','autocomplete'=>'off','style'=>'padding:0px')); - $form->addRule('id_text_name', api_xml_http_response_encode(get_lang('ThisFieldIsRequired')), 'required'); + $form->add_textfield('id_text_name', get_lang('SendMessageTo'),true,array('size' => 40,'id'=>'id_text_name','onkeyup'=>'send_request_and_search()','autocomplete'=>'off','style'=>'padding:0px')); + $form->addRule('id_text_name', get_lang('ThisFieldIsRequired'), 'required'); $form->addElement('html',''); } $form->addElement('hidden','user_list',0,array('id'=>'user_list')); @@ -186,7 +184,7 @@ function manage_form ($default, $select_from_user_list = null) { } $form->addElement('style_submit_button','compose',api_xml_http_response_encode(get_lang('SendMessage')),'class="save"'); - $form->setRequiredNote(api_xml_http_response_encode('* '.get_lang('ThisFieldIsRequired').'')); + $form->setRequiredNote('* '.get_lang('ThisFieldIsRequired').''); if (!empty($group_id) && !empty($message_id)) { $message_info = MessageManager::get_message_by_id($message_id); $default['title']=get_lang('Re:').api_html_entity_decode($message_info['title'],ENT_QUOTES,$charset); @@ -212,86 +210,127 @@ function manage_form ($default, $select_from_user_list = null) { MAIN SECTION ============================================================================== */ -if (isset($_GET['rs'])) { - $interbreadcrumb[] = array ('url' => 'inbox.php', 'name' => get_lang('Messages')); - $interbreadcrumb[]= array ( - 'url' => '../social/'.$_SESSION['social_dest'], - 'name' => get_lang('SocialNetwork') - ); +if ($_GET['f']=='social') { + $this_section = SECTION_SOCIAL; + $interbreadcrumb[]= array ('url' => '#','name' => get_lang('Profile')); + $interbreadcrumb[]= array ('url' => 'outbox.php','name' => get_lang('Inbox')); } else { - $interbreadcrumb[] = array ('url' => 'main/auth/profile.php', 'name' => get_lang('Profile')); - $interbreadcrumb[]= array ( - 'url' => 'inbox.php', - 'name' => get_lang('Inbox') - ); + $this_section = SECTION_MYPROFILE; + $interbreadcrumb[]= array ('url' => '#','name' => get_lang('Profile')); + $interbreadcrumb[]= array ('url' => 'outbox.php','name' => get_lang('Inbox')); } - $interbreadcrumb[]= array ( - 'url' => '#', - 'name' => get_lang('ComposeMessage') - ); -$this_section = SECTION_MYPROFILE; Display::display_header(''); $group_id = intval($_REQUEST['group_id']); -echo '
'; + + if ($group_id != 0) { + echo '
'; echo ''.Display::return_icon('back.png',api_xml_http_response_encode(get_lang('ComposeMessage'))).api_xml_http_response_encode(get_lang('BackToGroup')).''; echo ''.Display::return_icon('message_new.png',api_xml_http_response_encode(get_lang('ComposeMessage'))).api_xml_http_response_encode(get_lang('ComposeMessage')).''; + echo '
'; } else { - echo ''.Display::return_icon('inbox.png',api_xml_http_response_encode(get_lang('Inbox'))).api_xml_http_response_encode(get_lang('Inbox')).''; - echo ''.Display::return_icon('message_new.png',api_xml_http_response_encode(get_lang('ComposeMessage'))).api_xml_http_response_encode(get_lang('ComposeMessage')).''; - echo ''.Display::return_icon('outbox.png',api_xml_http_response_encode(get_lang('Outbox'))).api_xml_http_response_encode(get_lang('Outbox')).''; -} -echo '
'; - - -if (!isset($_POST['compose'])) { - if(isset($_GET['re_id'])) { - $message_id = $_GET['re_id']; - $receiver_id = api_get_user_id(); - show_compose_reply_to_message($message_id, $receiver_id); - } elseif(isset($_GET['send_to_user'])) { - show_compose_to_user($_GET['send_to_user']); + if ($_GET['f']=='social') { + require_once api_get_path(LIBRARY_PATH).'social.lib.php'; + SocialManager::show_social_menu(); + echo '
'; + echo get_lang('Messages'); + echo '
'; + $social_parameter = '?f=social'; } else { - show_compose_to_any($_user['user_id']); - } -} else { + echo '
'; + if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') { + echo ''.Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).' '.get_lang('ViewSharedProfile').''; + } + if (api_get_setting('allow_message_tool') == 'true') { + echo ''.Display::return_icon('inbox.png').' '.get_lang('Messages').''; + } + $show = isset($_GET['show']) ? '&show='.Security::remove_XSS($_GET['show']) : ''; + + //echo ''; + + if (isset($_GET['type']) && $_GET['type'] == 'extended') { + echo ''.Display::return_icon('edit.gif', get_lang('EditNormalProfile')).' '.get_lang('EditNormalProfile').''; + } else { + echo ''.Display::return_icon('edit.gif', get_lang('EditExtendProfile')).' '.get_lang('EditExtendProfile').''; + } + //echo ''; + echo '
'; + } - $restrict = false; - if (isset($_POST['id_text_name'])) { - $restrict = $_POST['id_text_name']; - } else if (isset($_POST['group_id'])) { - $restrict = $_POST['group_id']; - } +} + - if (isset($_GET['re_id'])) { - $default['title'] = api_xml_http_response_encode($_POST['title']); - $default['content'] = api_xml_http_response_encode($_POST['content']); - //$default['user_list'] = $_POST['user_list']; - manage_form($default); - } else { - if ($restrict) { - $default['title'] = api_xml_http_response_encode($_POST['title']); - if (!isset($_POST['group_id'])) { - $default['id_text_name'] = api_xml_http_response_encode($_POST['id_text_name']); - $default['user_list'] = $_POST['user_list']; + + +echo '
'; + //LEFT COLUMN + echo '
'; + echo ''; + echo '
'; + + echo '
'; + + //MAIN CONTENT + + if (!isset($_POST['compose'])) { + + if(isset($_GET['re_id'])) { + $message_id = $_GET['re_id']; + $receiver_id = api_get_user_id(); + show_compose_reply_to_message($message_id, $receiver_id); + } elseif(isset($_GET['send_to_user'])) { + show_compose_to_user($_GET['send_to_user']); } else { - $default['group_id'] = $_POST['group_id']; - } - manage_form($default); + show_compose_to_any($_user['user_id']); + } + } else { - Display::display_error_message(api_xml_http_response_encode(get_lang('ErrorSendingMessage'))); + + $restrict = false; + + if (isset($_POST['id_text_name'])) { + $restrict = $_POST['id_text_name']; + } else if (isset($_POST['group_id'])) { + $restrict = $_POST['group_id']; + } + + if (isset($_GET['re_id'])) { + $default['title'] = api_xml_http_response_encode($_POST['title']); + $default['content'] = api_xml_http_response_encode($_POST['content']); + //$default['user_list'] = $_POST['user_list']; + manage_form($default); + } else { + var_dump($restrict); + if ($restrict) { + $default['title'] = api_xml_http_response_encode($_POST['title']); + if (!isset($_POST['group_id'])) { + $default['id_text_name'] = api_xml_http_response_encode($_POST['id_text_name']); + $default['user_list'] = $_POST['user_list']; + } else { + $default['group_id'] = $_POST['group_id']; + } + manage_form($default); + } else { + Display::display_error_message(get_lang('ErrorSendingMessage')); + } + } } - } -} + echo '
'; + +echo '
'; + /* ============================================================================== FOOTER ============================================================================== */ -if ($request===false) { - Display::display_footer(); -} +Display::display_footer(); + ?> diff --git a/main/messages/outbox.php b/main/messages/outbox.php index db97ab1621..2aba8e2562 100755 --- a/main/messages/outbox.php +++ b/main/messages/outbox.php @@ -6,7 +6,7 @@ ============================================================================== */ // name of the language file that needs to be included -$language_file = array('registration','messages','userInfo','admin'); +$language_file = array('registration','messages','userInfo'); $cidReset=true; require_once '../inc/global.inc.php'; require_once api_get_path(LIBRARY_PATH).'message.lib.php'; @@ -69,11 +69,38 @@ if ($_GET['f']=='social') { Display::display_header(''); -echo '
'; - echo ''.Display::return_icon('inbox.png',api_xml_http_response_encode(get_lang('Inbox'))).api_xml_http_response_encode(get_lang('Inbox')).''; - echo ''.Display::return_icon('message_new.png',api_xml_http_response_encode(get_lang('ComposeMessage'))).api_xml_http_response_encode(get_lang('ComposeMessage')).''; - echo ''.Display::return_icon('outbox.png',api_xml_http_response_encode(get_lang('Outbox'))).api_xml_http_response_encode(get_lang('Outbox')).''; -echo '
'; +if ($_GET['f']=='social') { + require_once api_get_path(LIBRARY_PATH).'social.lib.php'; + SocialManager::show_social_menu(); + echo '
'; + echo get_lang('Messages'); + echo '
'; + $social_parameter = '?f=social'; +} else { + + if (api_get_setting('extended_profile') == 'true') { + echo '
'; + + if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') { + echo ''.Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).' '.get_lang('ViewSharedProfile').''; + } + if (api_get_setting('allow_message_tool') == 'true') { + echo ''.Display::return_icon('inbox.png').' '.get_lang('Messages').''; + } + $show = isset($_GET['show']) ? '&show='.Security::remove_XSS($_GET['show']) : ''; + + //echo ''; + + if (isset($_GET['type']) && $_GET['type'] == 'extended') { + echo ''.Display::return_icon('edit.gif', get_lang('EditNormalProfile')).' '.get_lang('EditNormalProfile').''; + } else { + echo ''.Display::return_icon('edit.gif', get_lang('EditExtendProfile')).' '.get_lang('EditExtendProfile').''; + } + //echo ''; + + echo '
'; + } +} /**************************************************************/ $info_delete_outbox=array(); @@ -96,28 +123,47 @@ if( trim($info_delete_outbox[0])=='delete' ) { $table_message = Database::get_main_table(TABLE_MESSAGE); $user_sender_id=api_get_user_id(); -if ($_REQUEST['action']=='delete') { - $delete_list_id=array(); - if (isset($_POST['out'])) { - $delete_list_id=$_POST['out']; - } - if (isset($_POST['id'])) { - $delete_list_id=$_POST['id']; - } - for ($i=0;$i'; + //LEFT COLUMN + echo '
'; + echo ''; + echo '
'; + + echo '
'; + //MAIN CONTENT + if ($_REQUEST['action']=='delete') { + $delete_list_id=array(); + if (isset($_POST['out'])) { + $delete_list_id=$_POST['out']; + } + if (isset($_POST['id'])) { + $delete_list_id=$_POST['id']; + } + for ($i=0;$i'; + +echo '
'; + + + /* ============================================================================== FOOTER diff --git a/main/messages/view_message.php b/main/messages/view_message.php index b237af4d23..05efd8dff7 100755 --- a/main/messages/view_message.php +++ b/main/messages/view_message.php @@ -18,23 +18,75 @@ $interbreadcrumb[]= array ('url' => '#','name' => get_lang('View')); HEADER ============================================================================== */ -$this_section = SECTION_MYPROFILE; +if ($_GET['f']=='social') { + $this_section = SECTION_SOCIAL; + $interbreadcrumb[]= array ('url' => '#','name' => get_lang('Profile')); + $interbreadcrumb[]= array ('url' => 'outbox.php','name' => get_lang('Inbox')); +} else { + $this_section = SECTION_MYPROFILE; + $interbreadcrumb[]= array ('url' => '#','name' => get_lang('Profile')); + $interbreadcrumb[]= array ('url' => 'outbox.php','name' => get_lang('Inbox')); +} Display::display_header(''); +if ($_GET['f']=='social') { + require_once api_get_path(LIBRARY_PATH).'social.lib.php'; + SocialManager::show_social_menu(); + echo '
'; + echo get_lang('Messages'); + echo '
'; + $social_parameter = '?f=social'; +} else { + + + if (api_get_setting('extended_profile') == 'true') { + echo '
'; + + if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') { + echo ''.Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).' '.get_lang('ViewSharedProfile').''; + } + if (api_get_setting('allow_message_tool') == 'true') { + echo ''.Display::return_icon('inbox.png').' '.get_lang('Messages').''; + } + $show = isset($_GET['show']) ? '&show='.Security::remove_XSS($_GET['show']) : ''; + + //echo ''; + + if (isset($_GET['type']) && $_GET['type'] == 'extended') { + echo ''.Display::return_icon('edit.gif', get_lang('EditNormalProfile')).' '.get_lang('EditNormalProfile').''; + } else { + echo ''.Display::return_icon('edit.gif', get_lang('EditExtendProfile')).' '.get_lang('EditExtendProfile').''; + } + //echo ''; + + echo '
'; + } +} + +echo '
'; + //LEFT COLUMN + echo ''; -echo '
'; + echo '
'; + //MAIN CONTENT + $message = MessageManager::show_message_box($_GET['id']); + if (!empty($message)) { + echo $message; + + + } else { + api_not_allowed(); + } + echo '
'; -$message = MessageManager::show_message_box(); -if (!empty($message)) { - echo $message; -} else { - api_not_allowed(); -} +echo '
'; /* ============================================================================== diff --git a/main/social/group_invitation.php b/main/social/group_invitation.php index 36a7b9316c..7711f2c1c3 100755 --- a/main/social/group_invitation.php +++ b/main/social/group_invitation.php @@ -323,7 +323,7 @@ if ($add_type == 'multiple') { ?>
-  |  +  | 
'.$tool_name.' ('.$session_info['name'].')

'; ?> @@ -559,8 +559,10 @@ function makepost(select){ //current group members $members = GroupPortalManager::get_users_by_group($group_id,true,array(GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER)); -echo get_lang('UsersAlreadyInvited'); -Display::display_sortable_grid('search_users', array(), $members, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, false, true)); +if (is_array($members) && count($members)>0) { + echo get_lang('UsersAlreadyInvited'); + Display::display_sortable_grid('search_users', array(), $members, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, false, true)); +} /* diff --git a/main/social/groups.php b/main/social/groups.php index 85bb87690f..85cd299aa8 100755 --- a/main/social/groups.php +++ b/main/social/groups.php @@ -83,7 +83,6 @@ echo ''; // getting group information $group_id = intval($_GET['id']); $group_info = GroupPortalManager::get_group_data($group_id); - if ($group_id != 0 ) { //Loading group information @@ -112,6 +111,7 @@ if ($group_id != 0 ) { } } + echo GroupPortalManager::show_group_column_information($group_id); $picture = GroupPortalManager::get_picture_group($group_id, $group_info['picture_uri'],160,'medium_'); $big_image = GroupPortalManager::get_picture_group($group_id, $group_info['picture_uri'],'','big_'); @@ -139,16 +139,16 @@ if ($group_id != 0 ) { #group_members { width:233px; height:300px; overflow-x:none; overflow-y: auto;} .group_member_item { width:98px; height:86px; float:left; margin:5px 5px 15px 5px; } .group_member_picture { display:block; -height:92px; -margin:0; -overflow:hidden; }; + height:92px; + margin:0; + overflow:hidden; }; '; echo '
'; //Group's title echo '

'.$group_info['name'].'

'; - //image + //Group's image echo '
'; if (basename($picture['file']) != 'unknown_group.png') { @@ -159,11 +159,17 @@ overflow:hidden; }; echo '
'; - //description + //Group's description echo '
'; echo $group_info['description']; echo '
'; + //Group's description + echo '
'; + echo $group_info['url']; + echo '
'; + + //Privacy echo '
'; echo get_lang('Privacy').' : '; @@ -174,20 +180,22 @@ overflow:hidden; }; } echo '
'; - //group tags + //Group's tags if (!empty($tags)) { echo '
'; echo get_lang('Tags').' : '.$tags; echo '
'; } + //Compose message link if (in_array($my_group_role, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_READER,GROUP_USER_PERMISSION_MODERATOR))) { echo ''; } + //Members echo get_lang('Members').' : '; echo '
'; foreach($users as $user) { @@ -206,7 +214,8 @@ overflow:hidden; }; } echo '
'; - + //loading group permission + echo '
'; switch ($my_group_role) { case GROUP_USER_PERMISSION_READER: @@ -238,6 +247,9 @@ overflow:hidden; }; echo '
'; // end layout left + + //-- Show message groups + echo '
'; echo '
'; MessageManager::display_messages_for_group($group_id); @@ -270,11 +282,18 @@ overflow:hidden; }; $id = $result['id']; $url_open = ''; $url_close = ''; - $groups[]= array($url_open.$result['picture_uri'].$url_close, $url_open.$result['name'].$url_close,$result['count']); + + if ($result['count'] == 1 ) { + $result['count'] = $result['count'].' '.get_lang('Member'); + } else { + $result['count'] = $result['count'].' '.get_lang('Members'); + } + + $groups[]= array($url_open.$result['picture_uri'].$url_close, $url_open.$result['name'].$url_close,$result['count'],$result['description']); } if (count($groups) > 0) { echo '

'.get_lang('Popular').'

'; - Display::display_sortable_grid('search_users', array(), $groups, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, true, true,true)); + Display::display_sortable_grid('search_users', array(), $groups, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, true, true,true,true)); } diff --git a/main/social/message_for_group_form.inc.php b/main/social/message_for_group_form.inc.php index 37c8257cd3..860c7e1394 100755 --- a/main/social/message_for_group_form.inc.php +++ b/main/social/message_for_group_form.inc.php @@ -48,36 +48,29 @@ if (!empty($group_id)) { - diff --git a/main/social/profile.php b/main/social/profile.php index 218c69178c..765fcb726b 100755 --- a/main/social/profile.php +++ b/main/social/profile.php @@ -436,6 +436,10 @@ echo '
'; echo '
'; } echo '
'; + + //Load right plugin's + echo SocialManager::get_plugins(SOCIAL_RIGHT_PLUGIN); + } else { echo '

'; } @@ -610,6 +614,12 @@ echo '
'; echo $announcement_content.'
'; echo '
'; } + + + //Load left plugin + echo SocialManager::get_plugins(SOCIAL_LEFT_PLUGIN); + + } echo ''; @@ -698,6 +708,13 @@ echo '
'; echo '
'; } } + + //Load plugin center + echo SocialManager::get_plugins(SOCIAL_CENTER_PLUGIN); + + + //-------------------------- + echo ''; echo ''; echo ''; diff --git a/main/social/register_friend.php b/main/social/register_friend.php index add85ff7a1..81e418082d 100755 --- a/main/social/register_friend.php +++ b/main/social/register_friend.php @@ -28,6 +28,7 @@ if (isset($_POST['friend_id'])) { SocialManager::register_friend($the_current_user_id,$my_current_friend,$relation_type); SocialManager::register_friend($my_current_friend,$the_current_user_id,$relation_type); + SocialManager::invitation_accepted($my_current_friend,$the_current_user_id); if (isset($_POST['is_my_friend'])) { diff --git a/main/social/search.php b/main/social/search.php index ce00aac83f..05e9793de9 100755 --- a/main/social/search.php +++ b/main/social/search.php @@ -12,6 +12,8 @@ require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php'; require_once api_get_path(LIBRARY_PATH).'social.lib.php'; require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php'; +api_block_anonymous_users(); + $this_section = SECTION_SOCIAL; $tool_name = get_lang('Search'); $interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social')); diff --git a/main/tracking/courseLog.php b/main/tracking/courseLog.php index db322d5304..8e4aa40b5e 100755 --- a/main/tracking/courseLog.php +++ b/main/tracking/courseLog.php @@ -60,6 +60,9 @@ require api_get_path(SYS_CODE_PATH).'resourcelinker/resourcelinker.inc.php'; // starting the output buffering when we are exporting the information $export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false; if ($export_csv) { + if (isset($_REQUEST['id_session']) && $_REQUEST['id_session'] != 0 ) { + $_SESSION['id_session'] = intval($_REQUEST['id_session']); + } ob_start(); } $csv_content = array(); @@ -303,13 +306,13 @@ if ($_GET['studentlist'] == 'false') { } echo ' '.Display::return_icon('printmgr.gif',get_lang('Print')).get_lang('Print').''; if($_GET['studentlist'] == 'false') { - echo ' '.get_lang('ExportAsCSV').''; + echo ' '.get_lang('ExportAsCSV').''; } elseif ($_GET['studentlist'] == '' || $_GET['studentlist'] == 'true') { $addional_param = ''; if (isset($_GET['additional_profile_field'])) { $addional_param ='additional_profile_field='.intval($_GET['additional_profile_field']); } - echo ''.Display::return_icon('csv.gif',get_lang('ExportAsCSV')).get_lang('ExportAsCSV').''; + echo ''.Display::return_icon('csv.gif',get_lang('ExportAsCSV')).get_lang('ExportAsCSV').''; } if($_GET['studentlist'] == 'true' || empty($_GET['studentlist'])) { echo display_additional_profile_fields(); diff --git a/whoisonline.php b/whoisonline.php index dd2d1c0dc0..393390e938 100755 --- a/whoisonline.php +++ b/whoisonline.php @@ -1,5 +1,5 @@ 0) { - $extra_params['cidReq'] = Security::remove_XSS($_GET['cidReq']); - $course_url = '&cidReq='.Security::remove_XSS($_GET['cidReq']); - } - - foreach ($user_list as $user) { - $uid = $user[0]; - $user_info = api_get_user_info($uid); - $table_row = array(); - if (api_get_setting('allow_social_tool')=='true') { - $url = api_get_path(WEB_PATH).'main/social/profile.php?u='.$uid.$course_url; - } else { - $url = '?id='.$uid.$course_url; - } - $image_array = UserManager::get_user_picture_path_by_id($uid, 'system', false, true); - - $friends_profile = SocialManager::get_picture_user($uid, $image_array['file'], 92, 'medium_', ' width="90" height="90" '); - // reduce image - $name = api_get_person_name($user_info['firstName'], $user_info['lastName']); - $table_row[] = ''.$name.''; - $table_row[] = ''.api_get_person_name($user_info['firstName'], $user_info['lastName']).''; - - //$table_row[] = ''.$user_info['lastName'].''; - - if (api_get_setting('show_email_addresses') == 'true') { - $table_row[] = Display::encrypted_mailto_link($user_info['mail']); - } - $user_anonymous = api_get_anonymous_id(); - $table_data[] = $table_row; - } - $table_header[] = array(get_lang('UserPicture'), false, 'width="90"'); - ///$table_header[] = array(get_lang('Name'), true); - //$table_header[] = array(get_lang('LastName'), true); - - if (api_get_setting('show_email_addresses') == 'true') { - $table_header[] = array(get_lang('Email'), true); - } - Display::display_sortable_table($table_header, $table_data, array(), array('per_page' => 30), $extra_params,array(),'grid'); - } -} -/** - * Displays the information of an individual user - * @param int $user_id - */ -function display_individual_user($user_id) { - global $interbreadcrumb; - $safe_user_id = Database::escape_string($user_id); - - // to prevent a hacking attempt: http://www.dokeos.com/forum/viewtopic.php?t=5363 - $user_table = Database::get_main_table(TABLE_MAIN_USER); - $sql = "SELECT * FROM $user_table WHERE user_id='".$safe_user_id."'"; - $result = Database::query($sql, __FILE__, __LINE__); - if (Database::num_rows($result) == 1) { - $user_object = Database::fetch_object($result); - $name = GetFullUserName($user_id).($_SESSION['_uid'] == $user_id ? ' ('.get_lang('Me').')' : '' ); - $alt = GetFullUserName($user_id).($_SESSION['_uid'] == $user_id ? ' ('.get_lang('Me').')' : ''); - $status = ($user_object->status == COURSEMANAGER ? get_lang('Teacher') : get_lang('Student')); - $interbreadcrumb[] = array('url' => 'whoisonline.php', 'name' => get_lang('UsersOnLineList')); - Display::display_header($alt); - echo '
'; - echo $alt; - echo '

'; - echo '
'; - if (strlen(trim($user_object->picture_uri)) > 0) { - $sysdir_array = UserManager::get_user_picture_path_by_id($safe_user_id, 'system'); - $sysdir = $sysdir_array['dir']; - $webdir_array = UserManager::get_user_picture_path_by_id($safe_user_id, 'web'); - $webdir = $webdir_array['dir']; - $fullurl = $webdir.$user_object->picture_uri; - $system_image_path = $sysdir.$user_object->picture_uri; - list($width, $height, $type, $attr) = @getimagesize($system_image_path); - $resizing = (($height > 200) ? 'height="200"' : ''); - $height += 30; - $width += 30; - $window_name = 'window'.uniqid(''); - // get the path,width and height from original picture - $big_image = $webdir.'big_'.$user_object->picture_uri; - $big_image_size = api_getimagesize($big_image); - $big_image_width = $big_image_size[0]; - $big_image_height = $big_image_size[1]; - $url_big_image = $big_image.'?rnd='.time(); - echo '
'; - } else { - echo Display::return_icon('unknown.jpg', get_lang('Unknown')); - echo '
'; - } - - echo '
'.$status.'
'; - - global $user_anonymous; - if (api_get_setting('allow_social_tool') == 'true' && api_get_user_id() <> $user_anonymous && api_get_user_id() <> 0) { - echo '
'; - echo ''.get_lang('ViewSharedProfile').''; - echo '
'; - - $user_anonymous = api_get_anonymous_id(); - - if ($safe_user_id != api_get_user_id() && !api_is_anonymous($safe_user_id)) { - $user_relation = SocialManager::get_relation_between_contacts(api_get_user_id(), $safe_user_id); - if ($user_relation == 0 || $user_relation == 6) { - echo ''.Display :: return_icon('add_multiple_users.gif', get_lang('SocialInvitationToFriends')).' '.get_lang('SendInvitation').'
- '.Display :: return_icon('mail_send.png', get_lang('SendAMessage')).' '.get_lang('SendAMessage').''; - } else { - echo ''.Display :: return_icon('mail_send.png', get_lang('SendAMessage')).' '.get_lang('SendAMessage').''; - } - } - } - - if (api_get_setting('show_email_addresses') == 'true') { - echo Display::encrypted_mailto_link($user_object->email,$user_object->email).'
'; - } - - echo '
'; - if ($user_object->competences) { - echo '
'.get_lang('MyCompetences').'
'; - echo '
'.$user_object->competences.'
'; - } - if ($user_object->diplomas) { - echo '
'.get_lang('MyDiplomas').'
'; - echo '
'.$user_object->diplomas.'
'; - } - if ($user_object->teach) { - echo '
'.get_lang('MyTeach').'
'; - echo '
'.$user_object->teach.'
';; - } - display_productions($user_object->user_id); - if ($user_object->openarea) { - echo '
'.get_lang('MyPersonalOpenArea').'
'; - echo '
'.$user_object->openarea.'
'; - } - } - else - { - Display::display_header(get_lang('UsersOnLineList')); - echo '
'; - echo get_lang('UsersOnLineList'); - echo '
'; - } -} -/** - * Display productions in whoisonline - * @param int $user_id User id - * @todo use the correct api_get_path instead of $clarolineRepositoryWeb - */ -function display_productions($user_id) { - $sysdir_array = UserManager::get_user_picture_path_by_id($user_id, 'system', true); - $sysdir = $sysdir_array['dir'].$user_id.'/'; - $webdir_array = UserManager::get_user_picture_path_by_id($user_id, 'web', true); - $webdir = $webdir_array['dir'].$user_id.'/'; - if (!is_dir($sysdir)) { - mkpath($sysdir); - } - /* - $handle = opendir($sysdir); - $productions = array(); - while ($file = readdir($handle)) { - if ($file == '.' || $file == '..' || $file == '.htaccess') { - continue; // Skip current and parent directories - } - if (preg_match('/('.$user_id.'|[0-9a-f]{13}|saved)_.+\.(png|jpg|jpeg|gif)$/i', $file)) { - // User's photos should not be listed as productions. - continue; - } - $productions[] = $file; - } - */ - $productions = UserManager::get_user_productions($user_id); - - if (count($productions) > 0) { - echo '
'.get_lang('Productions').'
'; - echo '
    '; - foreach ($productions as $index => $file) { - // Only display direct file links to avoid browsing an empty directory - if (is_file($sysdir.$file) && $file != $webdir_array['file']) { - echo '
  • '.$file.'
  • '; - } - // Real productions are under a subdirectory by the User's id - if (is_dir($sysdir.$file)) { - $subs = scandir($sysdir.$file); - foreach ($subs as $my => $sub) { - if (substr($sub, 0, 1) != '.' && is_file($sysdir.$file.'/'.$sub)) { - echo '
  • '.$sub.'
  • '; - } - } - } - } - echo '
'; - } -} // This if statement prevents users accessing the who's online feature when it has been disabled. if ((api_get_setting('showonline', 'world') == 'true' && !$_user['user_id']) || ((api_get_setting('showonline', 'users') == 'true' || api_get_setting('showonline', 'course') == 'true') && $_user['user_id'])) { @@ -323,6 +126,10 @@ if ((api_get_setting('showonline', 'world') == 'true' && !$_user['user_id']) || $total = count($user_list); if (!isset($_GET['id'])) { Display::display_header(get_lang('UsersOnLineList')); + + if (!api_is_anonymous()) + echo SocialManager::show_social_menu(); + echo '
'; echo get_lang('UsersOnLineList'); echo '
'; @@ -339,15 +146,17 @@ if ((api_get_setting('showonline', 'world') == 'true' && !$_user['user_id']) || if ($user_list) { if (!isset($_GET['id'])) { - echo UserManager::get_search_form($_GET['q']); - display_user_list($user_list, $_plugins); + if (!api_is_anonymous()) + echo UserManager::get_search_form($_GET['q']); + + SocialManager::display_user_list($user_list, $_plugins); } else { //individual user information - also displays header info - display_individual_user(Security::remove_XSS($_GET['id'])); + SocialManager::display_individual_user(Security::remove_XSS($_GET['id'])); } - } - elseif (isset($_GET['id'])) { + } elseif (isset($_GET['id'])) { Display::display_header(get_lang('UsersOnLineList')); + echo '
'; echo get_lang('UsersOnLineList'); echo '
'; @@ -359,23 +168,9 @@ if ((api_get_setting('showonline', 'world') == 'true' && !$_user['user_id']) || $referer = empty($_GET['referer']) ? 'index.php' : api_htmlentities(strip_tags($_GET['referer']), ENT_QUOTES); -/* -if (isset($_GET['id'])) { - - if ($_GET['origin'] == 'user_list') { - echo ''.get_lang('Back').''; - } else { - echo ''.get_lang('Back').''; - } - -} else { - echo ''.get_lang('BackHome').''; -} -*/ /* ============================================================================== FOOTER ============================================================================== */ -/*echo '
hola
';*/ -Display::display_footer(); +Display::display_footer(); \ No newline at end of file
-
- -
'.api_xml_http_response_encode(api_get_person_name($info_user_friend['firstName'], $info_user_friend['lastName'])).'
'; - } - ?> -
-
+
- :     -
-
:

-
:

-
:
- -
- - -
- - + :     +
+
:
+
+
:
+
+
:
+ +
+ + +
+ +
-
+