Adding profile block in the index.php for users

skala
Julio Montoya 15 years ago
parent d6a362e128
commit 213f327214
  1. 90
      index.php
  2. 1
      main/css/chamilo/default.css
  3. 1
      main/css/chamilo_electric_blue/default.css
  4. 1
      main/css/chamilo_green/default.css
  5. 1
      main/css/chamilo_orange/default.css
  6. 1
      main/css/chamilo_red/default.css
  7. 31
      user_portal.php

@ -219,11 +219,85 @@ if (!$page_included) {
}
echo '</div>';
echo '<div class="menu-wrapper">';
if (!api_is_anonymous()) {
// @todo move all this in a class/function
if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') {
//Always show the user image
$img_array = UserManager::get_user_picture_path_by_id(api_get_user_id(), 'web', true, true);
$no_image = false;
if ($img_array['file'] == 'unknown.jpg') {
$no_image = true;
}
$img_array = UserManager::get_picture_user(api_get_user_id(), $img_array['file'], 50, USER_IMAGE_SIZE_MEDIUM, ' width="90" height="90" ');
$profile_content .='<div id="social_widget">';
$profile_content .= '<div id="social_widget_image">';
if (api_get_setting('allow_social_tool') == 'true') {
if (!$no_image) {
$profile_content .='<a href="'.api_get_path(WEB_PATH).'main/social/home.php"><img src="'.$img_array['file'].'" '.$img_array['style'].' border="1"></a>';
} else {
$profile_content .='<a href="'.api_get_path(WEB_PATH).'main/auth/profile.php"><img title="'.get_lang('EditProfile').'" src="'.$img_array['file'].'" '.$img_array['style'].' border="1"></a>';
}
} else {
$profile_content .='<a href="'.api_get_path(WEB_PATH).'main/auth/profile.php"><img title="'.get_lang('EditProfile').'" src="'.$img_array['file'].'" '.$img_array['style'].' border="1"></a>';
}
$profile_content .= ' </div></div>';
require_once api_get_path(LIBRARY_PATH).'message.lib.php';
require_once api_get_path(LIBRARY_PATH).'social.lib.php';
require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';
// New messages.
$number_of_new_messages = MessageManager::get_new_messages();
// New contact invitations.
$number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id(api_get_user_id());
// New group invitations sent by a moderator.
$group_pending_invitations = GroupPortalManager::get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_PENDING_INVITATION, false);
$group_pending_invitations = count($group_pending_invitations);
$total_invitations = $number_of_new_messages_of_friend + $group_pending_invitations;
$cant_msg = '';
if ($number_of_new_messages > 0) {
$cant_msg = ' ('.$number_of_new_messages.')';
}
$profile_content .= '<div class="clear"></div>';
$profile_content .= '<div class="message-content"><ul class="menulist">';
$link = '';
if (api_get_setting('show_tabs', 'social') == 'true') {
$link = '?f=social';
}
$profile_content .= '<li><a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php'.$link.'" class="message-body">'.get_lang('Inbox').$cant_msg.' </a></li>';
$profile_content .= '<li><a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php'.$link.'" class="message-body">'.get_lang('Compose').' </a></li>';
if ($total_invitations == 0) {
$total_invitations = '';
} else {
$total_invitations = ' ('.$total_invitations.')';
}
$profile_content .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php" class="message-body">'.get_lang('PendingInvitations').' '.$total_invitations.' </a></li>';
$profile_content .= '</ul>';
$profile_content .= '</div>';
}
//Profile content
echo show_right_block(get_lang('Profile'), $profile_content);
}
// Display right menu: language form, login section + useful weblinks.
echo '<div class="menu" id="menu">';
display_anonymous_right_menu();
echo '</div>';
echo '</div>';
/* Footer */
Display :: display_footer();
@ -826,3 +900,19 @@ function get_courses_of_user($user_id) {
}
return $courses;
}
function show_right_block($title, $content) {
$html = '';
$html.= '<div id="menu" class="menu">';
$html.= '<div class="menusection">';
$html.= '<span class="menusectioncaption">'.$title.'</span>';
$html.= $content;
$html.= '</div>';
$html.= '</div>';
return $html;
}

@ -4027,7 +4027,6 @@ div.image-social-content center.friend {
/* border:1px dotted #ccc; */
float:left;
padding:1px;
padding-bottom:10px;
margin-bottom:10px;
margin-left:0px;
margin-right:0px;

@ -4007,7 +4007,6 @@ div.image-social-content center.friend {
/* border:1px dotted #ccc; */
float:left;
padding:1px;
padding-bottom:10px;
margin-bottom:10px;
margin-left:0px;
margin-right:0px;

@ -4022,7 +4022,6 @@ div.image-social-content center.friend {
/* border:1px dotted #ccc; */
float:left;
padding:1px;
padding-bottom:10px;
margin-bottom:10px;
margin-left:0px;
margin-right:0px;

@ -3996,7 +3996,6 @@ div.image-social-content center.friend {
/* border:1px dotted #ccc; */
float:left;
padding:1px;
padding-bottom:10px;
margin-bottom:10px;
margin-left:0px;
margin-right:0px;

@ -4006,7 +4006,6 @@ div.image-social-content center.friend {
/* border:1px dotted #ccc; */
float:left;
padding:1px;
padding-bottom:10px;
margin-bottom:10px;
margin-left:0px;
margin-right:0px;

@ -184,7 +184,7 @@ if ($maxCourse > 0) {
$toolsList['valvas']['path'] = api_get_path(WEB_CODE_PATH).'announcements/announcements.php?cidReq=';
}
echo ' <div class="maincontent" id="maincontent">'; // Start of content for logged in users.
echo '<div class="maincontent" id="maincontent">'; // Start of content for logged in users.
// Plugins for the my courses main area.
echo '<div id="plugin-mycourses_main">';
api_plugin('mycourses_main');
@ -384,9 +384,7 @@ if (is_array($courses_tree)) {
echo $html_courses_session;
}
echo '</ul></div>';
}
}
}
} else {
// All sessions included in.
@ -469,7 +467,10 @@ if (is_array($courses_tree)) {
}
}
echo '</div>'; // End of content section.
echo '</div>'; // End of content main-section
// Register whether full admin or null admin course
// by course through an array dbname x user status.
@ -477,7 +478,7 @@ api_session_register('status');
/* RIGHT MENU */
$show_menu = false;
$show_menu = false;
$show_create_link = false;
$show_course_link = false;
$show_digest_link = false;
@ -510,20 +511,20 @@ if ($img_array['file'] == 'unknown.jpg') {
$no_image = true;
}
$img_array = UserManager::get_picture_user(api_get_user_id(), $img_array['file'], 50, USER_IMAGE_SIZE_MEDIUM, ' width="90" height="90" ');
$profile_content ='<div class="clear"></div>';
$profile_content .='<div id="social_widget">';
$profile_content .= ' <div id="social_widget_image">';
$profile_content .= '<div id="social_widget_image">';
if (api_get_setting('allow_social_tool') == 'true') {
if (!$no_image) {
$profile_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/home.php"><img src="'.$img_array['file'].'" '.$img_array['style'].' border="1"></a>';
$profile_content .='<a href="'.api_get_path(WEB_PATH).'main/social/home.php"><img src="'.$img_array['file'].'" '.$img_array['style'].' border="1"></a>';
} else {
$profile_content .='<a href="'.api_get_path(WEB_PATH).'main/auth/profile.php"><img title="'.get_lang('EditProfile').'" src="'.$img_array['file'].'" '.$img_array['style'].' border="1"></a>';
}
} else {
$profile_content .='<a href="'.api_get_path(WEB_PATH).'main/auth/profile.php"><img title="'.get_lang('EditProfile').'" src="'.$img_array['file'].'" '.$img_array['style'].' border="1"></a>';
}
$profile_content .= ' </div>';
$profile_content .= ' </div></div>';
// @todo Add a platform setting to add the user image.
if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') {
@ -566,6 +567,7 @@ if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_mes
$profile_content .= '</div>';
}
echo '<div id="menu-wrapper">';
//Profile content
echo show_right_block(get_lang('Profile'), $profile_content);
@ -622,7 +624,7 @@ if (isset($_plugins['mycourses_menu']) && is_array($_plugins['mycourses_menu']))
api_plugin('mycourses_menu');
$plugin_content = ob_get_contents();
ob_end_clean();
echo show_right_block(get_lang(''), $plugin_content);
echo show_right_block('', $plugin_content);
}
if (api_get_setting('allow_reservation') == 'true' && api_is_allowed_to_create_course()) {
@ -671,15 +673,14 @@ if (api_get_setting('show_groups_to_users') == 'true') {
echo '</div>'; // End of menu wrapper
function show_right_block($title, $content) {
$html = '';
$html.= '<div id="menu-wrapper">';
$html.= '<div id="menu" class="menu">';
$html= '<div id="menu" class="menu">';
$html.= '<div class="menusection">';
$html.= '<span class="menusectioncaption">'.$title.'</span>';
$html.= $content;
$html.= '</div>';
$html.= '</div>';
$html.= '</div>';
return $html;
}
// Footer

Loading…
Cancel
Save