Moving Classes from Social Network in a div in userportal.php also cleaning a little bit the divs in user_portal

skala
Julio Montoya 14 years ago
parent 61e45c71d7
commit b0ed308b2e
  1. 53
      main/inc/lib/display.lib.php
  2. 3
      main/inc/lib/social.lib.php
  3. 71
      main/social/usergroups.php
  4. 177
      user_portal.php

@ -984,35 +984,30 @@ class Display {
}
}); */
}
/**
* Display create course link
*
*/
function display_create_course_link() {
echo '<li><a href="main/create_course/add_course.php">'.(api_get_setting('course_validation') == 'true' ? get_lang('CreateCourseRequest') : get_lang('CourseCreate')).'</a></li>';
}
/**
* Display dashboard link
*
*/
function display_dashboard_link() {
/*function display_dashboard_link() {
echo '<li><a href="main/dashboard/index.php">'.get_lang('Dashboard').'</a></li>';
}
}*/
/**
* Display edit course list links
*
*/
function display_edit_course_list_links() {
/*function display_edit_course_list_links() {
echo '<li><a href="main/auth/courses.php">'.get_lang('CourseManagement').'</a></li>';
}
}*/
/**
* Show history sessions
*
*/
/*
function display_history_course_session() {
if (api_get_setting('use_session_mode') == 'true') {
if (isset($_GET['history']) && intval($_GET['history']) == 1) {
@ -1021,7 +1016,7 @@ class Display {
echo '<li><a href="user_portal.php?history=1">'.get_lang('HistoryTrainingSessions').'</a></li>';
}
}
}
}*/
/**
* Returns the "what's new" icon notifications
*
@ -1153,41 +1148,42 @@ class Display {
* @version 1.0
*/
function display_digest($toolsList, $digest, $orderKey, $courses) {
$html = '';
if (is_array($digest) && (CONFVAL_showExtractInfo == SCRIPTVAL_UnderCourseList || CONFVAL_showExtractInfo == SCRIPTVAL_Both)) {
// // // LEVEL 1 // // //
reset($digest);
echo "<br /><br />\n";
$html .= "<br /><br />\n";
while (list($key1) = each($digest)) {
if (is_array($digest[$key1])) {
// // // Title of LEVEL 1 // // //
echo "<strong>\n";
$html .= "<strong>\n";
if ($orderKey[0] == 'keyTools') {
$tools = $key1;
echo $toolsList[$key1]['name'];
$html .= $toolsList[$key1]['name'];
} elseif ($orderKey[0] == 'keyCourse') {
$courseSysCode = $key1;
echo "<a href=\"", api_get_path(WEB_COURSE_PATH), $courses[$key1]['coursePath'], "\">", $courses[$key1]['courseCode'], "</a>\n";
$html .= "<a href=\"".api_get_path(WEB_COURSE_PATH). $courses[$key1]['coursePath']. "\">".$courses[$key1]['courseCode']. "</a>\n";
} elseif ($orderKey[0] == 'keyTime') {
echo api_convert_and_format_date($digest[$key1], DATE_FORMAT_LONG, date_default_timezone_get());
$html .= api_convert_and_format_date($digest[$key1], DATE_FORMAT_LONG, date_default_timezone_get());
}
echo "</strong>\n";
$html .= "</strong>\n";
// // // End Of Title of LEVEL 1 // // //
// // // LEVEL 2 // // //
reset($digest[$key1]);
while (list ($key2) = each($digest[$key1])) {
// // // Title of LEVEL 2 // // //
echo "<p>\n", "\n";
$html .= "<p>\n". "\n";
if ($orderKey[1] == 'keyTools') {
$tools = $key2;
echo $toolsList[$key2][name];
$html .= $toolsList[$key2][name];
} elseif ($orderKey[1] == 'keyCourse') {
$courseSysCode = $key2;
echo "<a href=\"", api_get_path(WEB_COURSE_PATH), $courses[$key2]['coursePath'], "\">", $courses[$key2]['courseCode'], "</a>\n";
$html .= "<a href=\"". api_get_path(WEB_COURSE_PATH). $courses[$key2]['coursePath']. "\">". $courses[$key2]['courseCode']. "</a>\n";
} elseif ($orderKey[1] == 'keyTime') {
echo api_convert_and_format_date($key2, DATE_FORMAT_LONG, date_default_timezone_get());
$html .= api_convert_and_format_date($key2, DATE_FORMAT_LONG, date_default_timezone_get());
}
echo "\n";
echo "</p>";
$html .= "\n";
$html .= "</p>";
// // // End Of Title of LEVEL 2 // // //
// // // LEVEL 3 // // //
reset($digest[$key1][$key2]);
@ -1204,17 +1200,18 @@ class Display {
// // // LEVEL 4 (data) // // //
reset($digest[$key1][$key2][$key3]);
while (list ($key4, $dataFromCourse) = each($digest[$key1][$key2][$key3])) {
echo $level3title, ' &ndash; ', api_substr(strip_tags($dataFromCourse), 0, CONFVAL_NB_CHAR_FROM_CONTENT);
$html .= $level3title. ' &ndash; '. api_substr(strip_tags($dataFromCourse), 0, CONFVAL_NB_CHAR_FROM_CONTENT);
//adding ... (three dots) if the texts are too large and they are shortened
if (api_strlen($dataFromCourse) >= CONFVAL_NB_CHAR_FROM_CONTENT) {
echo '...';
$html .= '...';
}
}
echo "<br />\n";
$html .= "<br />\n";
}
}
}
}
return $html;
}
} // End function display_digest
/**

@ -639,6 +639,7 @@ class SocialManager extends UserManager {
}*/
//Groups
/*
if (api_get_setting('show_groups_to_users') == 'true') {
$group_class = 'social-menu-text4';
if ($show == 'classes') {
@ -646,7 +647,7 @@ class SocialManager extends UserManager {
}
echo Display::tag('li', Display::return_icon('group.png',get_lang('MyGroups'),array('hspace'=>'6')).Display::url(Display::tag('span',get_lang('MyGroups'),array('class'=>$group_class)),api_get_path(WEB_PATH).'main/social/usergroups.php'));
}
*/
//Search users and groups
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>';

@ -1,71 +0,0 @@
<?php
/* For licensing terms, see /chamilo_license.txt */
/**
* @package chamilo.social
* @author Julio Montoya <gugli100@gmail.com>
*/
$language_file = array('userInfo');
$cidReset=true;
require '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'social.lib.php';
require_once api_get_path(LIBRARY_PATH).'usergroup.lib.php';
api_block_anonymous_users();
if (api_get_setting('show_groups_to_users') == 'false') {
header('Location: index.php');
exit;
}
$this_section = SECTION_SOCIAL;
//jquery thickbox already called from main/inc/header.inc.php
$htmlHeadXtra[] = '<script type="text/javascript">
</script>';
$interbreadcrumb[]= array ('url' =>'profile.php','name' => get_lang('Social'));
$interbreadcrumb[]= array ('url' =>'#','name' => get_lang('Groups'));
Display :: display_header($tool_name, 'Groups');
echo '<div id="social-content">';
echo '<div id="social-content-left">';
//this include the social menu div
SocialManager::show_social_menu('classes');
echo '</div>';
echo '<div id="social-content-right">';
$language_variable = api_xml_http_response_encode(get_lang('Groups'));
$user_id = api_get_user_id();
$list_path_friends = array();
$user_id = api_get_user_id();
$name_search= Security::remove_XSS($_POST['search_name_q']);
$number_friends = 0;
if (isset($name_search) && $name_search!='undefined') {
$friends = SocialManager::get_friends($user_id,null,$name_search);
} else {
$friends = SocialManager::get_friends($user_id);
}
$usergroup = new Usergroup();
$usergroup_list = $usergroup->get_usergroup_by_user(api_get_user_id());
if (!empty($usergroup_list)) {
echo Display::tag('h2',get_lang('MyGroup'));
foreach($usergroup_list as $group_id) {
$data = $usergroup->get($group_id);
echo Display::tag('div',$data['name']);
}
} else {
if (api_is_platform_admin()) {
Display::display_normal_message(Display::url(get_lang('CreateAgroup') ,api_get_path(WEB_CODE_PATH).'admin/usergroups.php?action=add'), false);
}
}
echo '</div>';
echo '</div>';
Display :: display_footer();

@ -31,7 +31,7 @@ define('SCRIPTVAL_NoTimeLimit', 6);
// End 'don't change' section
// Language files that should be included.
$language_file = array('courses', 'index');
$language_file = array('courses', 'index','admin');
$cidReset = true; /* Flag forcing the 'current course' reset,
as we're not inside a course anymore */
@ -470,16 +470,13 @@ if (is_array($courses_tree)) {
}
echo '</div>'; // End of content section.
// Register whether full admin or null admin course
// by course through an array dbname x user status.
api_session_register('status');
/* RIGHT MENU */
echo ' <div id="menu-wrapper">';
echo ' <div id="menu" class="menu">';
// api_display_language_form(); // Moved to the profile page.
$show_menu = false;
$show_create_link = false;
$show_course_link = false;
@ -506,34 +503,27 @@ if (isset($toolsList) && is_array($toolsList) && isset($digest)) {
$show_menu = true;
}
echo '<div class="menusection">';
echo '<span class="menusectioncaption">'.get_lang('Profile').'</span>';
//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" ');
echo '<div class="clear"></div>';
echo '<div id="social_widget">';
$profile_content ='<div class="clear"></div>';
$profile_content .='<div id="social_widget">';
echo ' <div id="social_widget_image">';
$profile_content .= ' <div id="social_widget_image">';
if (api_get_setting('allow_social_tool') == 'true') {
if (!$no_image) {
echo '<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 {
echo '<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 .='<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 {
echo '<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 .='<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>';
}
echo '</div>';
$profile_content .= ' </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') {
@ -556,57 +546,56 @@ if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_mes
if ($number_of_new_messages > 0) {
$cant_msg = ' ('.$number_of_new_messages.')';
}
//<h2 class="message-title">'.get_lang('Messages').'</h2>
echo '<div class="clear"></div>';
echo '<div class="message-content"><ul class="menulist">';
$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';
}
echo '<li><a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php'.$link.'" class="message-body">'.get_lang('Inbox').$cant_msg.' </a></li>';
echo '<li><a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php'.$link.'" class="message-body">'.get_lang('Compose').' </a></li>';
//echo '<a href="'.api_get_path(WEB_PATH).'main/auth/profile.php" class="message-body">'.get_lang('EditMyProfile').' </a><br />';
//if ($total_invitations > 0) {
echo '<li><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php" class="message-body">'.get_lang('PendingInvitations').' ('.$total_invitations.') </a></li>';
//}
$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>';
echo '</ul>';
echo '</div>';
$profile_content .= '</ul>';
$profile_content .= '</div>';
}
echo '</div>'; // End
echo '</div>';
echo '</div>'; // End of menu
echo ' <div id="menu" class="menu">';
echo '<div class="menusection">';
echo '<span class="menusectioncaption">'.get_lang('MenuUser').'</span>';
//Profile content
echo show_right_block(get_lang('Profile'), $profile_content);
// My account section.
if ($show_menu) {
echo '<ul class="menulist">';
$my_account_content .= '<ul class="menulist">';
if ($show_create_link) {
Display :: display_create_course_link();
$my_account_content .= '<li><a href="main/create_course/add_course.php">'.(api_get_setting('course_validation') == 'true' ? get_lang('CreateCourseRequest') : get_lang('CourseCreate')).'</a></li>';
}
if ($show_course_link) {
if (!api_is_drh()) {
Display :: display_edit_course_list_links();
Display :: display_history_course_session();
$my_account_content .= '<li><a href="main/auth/courses.php">'.get_lang('CourseManagement').'</a></li>';
if (api_get_setting('use_session_mode') == 'true') {
if (isset($_GET['history']) && intval($_GET['history']) == 1) {
$my_account_content .= '<li><a href="user_portal.php">'.get_lang('DisplayTrainingList').'</a></li>';
} else {
$my_account_content .= '<li><a href="user_portal.php?history=1">'.get_lang('HistoryTrainingSessions').'</a></li>';
}
}
} else {
Display :: display_dashboard_link();
$my_account_content .= '<li><a href="main/dashboard/index.php">'.get_lang('Dashboard').'</a></li>';
}
}
if ($show_digest_link) {
Display :: display_digest($toolsList, $digest, $orderKey, $courses);
if ($show_digest_link) {
$my_account_content .= Display :: display_digest($toolsList, $digest, $orderKey, $courses);
}
echo '</ul>';
$my_account_content .= '</ul>';
}
echo '</div>'; // Close menusection.
echo show_right_block(get_lang('MenuUser'), $my_account_content);
// Deleting the myprofile link.
if (api_get_setting('allow_social_tool') == 'true') {
@ -615,35 +604,32 @@ if (api_get_setting('allow_social_tool') == 'true') {
// Main navigation section.
// Tabs that are deactivated are added here.
if (!empty($menu_navigation)) {
echo '<div class="menusection">';
echo '<span class="menusectioncaption">'.get_lang('MainNavigation').'</span>';
echo '<ul class="menulist">';
if (!empty($menu_navigation)) {
$main_navigation_content .= '<ul class="menulist">';
foreach ($menu_navigation as $section => $navigation_info) {
$current = $section == $GLOBALS['this_section'] ? ' id="current"' : '';
echo '<li'.$current.'>';
echo '<a href="'.$navigation_info['url'].'" target="_self">'.$navigation_info['title'].'</a>';
echo '</li>';
$main_navigation_content .= '<li'.$current.'>';
$main_navigation_content .= '<a href="'.$navigation_info['url'].'" target="_self">'.$navigation_info['title'].'</a>';
$main_navigation_content .= '</li>';
}
echo '</ul>';
echo '</div>';
$main_navigation_content .= '</ul>';
echo show_right_block(get_lang('MainNavigation'), $main_navigation_content);
}
// Plugins for the my courses menu.
if (isset($_plugins['mycourses_menu']) && is_array($_plugins['mycourses_menu'])) {
echo '<div class="note">';
echo '<div id="plugin-mycourses_menu">';
if (isset($_plugins['mycourses_menu']) && is_array($_plugins['mycourses_menu'])) {
ob_start();
api_plugin('mycourses_menu');
echo '</div>';
$plugin_content = ob_get_contents();
ob_end_clean();
echo show_right_block(get_lang(''), $plugin_content);
}
if (api_get_setting('allow_reservation') == 'true' && api_is_allowed_to_create_course()) {
echo '<div class="menusection">';
echo '<span class="menusectioncaption">'.get_lang('Booking').'</span>';
echo '<ul class="menulist">';
echo '<a href="main/reservation/reservation.php">'.get_lang('ManageReservations').'</a><br />';
echo '</ul>';
echo '</div>';
$booking_content .='<ul class="menulist">';
$booking_content .='<a href="main/reservation/reservation.php">'.get_lang('ManageReservations').'</a><br />';
$booking_content .='</ul>';
echo show_right_block(get_lang('Booking'), $booking_content);
}
// Deleting the session_id.
@ -654,20 +640,49 @@ if (api_get_setting('search_enabled') == 'true') {
echo '<div class="searchbox">';
$search_btn = get_lang('Search');
$search_text_default = get_lang('YourTextHere');
echo <<<EOD
<br />
<form action="main/search/" method="post">
&nbsp;&nbsp;<input type="text" id="query" size="15" name="query" value="" />
&nbsp;&nbsp;<button class="save" type="submit" name="submit" value="$search_btn"/>$search_btn </button>
</form>
EOD;
echo '</div>';
$search_content = '<br />
<form action="main/search/" method="post">
<input type="text" id="query" size="15" name="query" value="" />
<button class="save" type="submit" name="submit" value="'.$search_btn.'" />'.$search_btn.' </button>
</form></div>';
echo show_right_block(get_lang('Search'), $search_content);
}
echo '<div class="clear"></div>';
echo '</div>'; // End of menu
if (api_get_setting('show_groups_to_users') == 'true') {
require_once api_get_path(LIBRARY_PATH).'usergroup.lib.php';
$usergroup = new Usergroup();
$usergroup_list = $usergroup->get_usergroup_by_user(api_get_user_id());
$classes = '';
if (!empty($usergroup_list)) {
foreach($usergroup_list as $group_id) {
$data = $usergroup->get($group_id);
$data['name'] = Display::url($data['name'], api_get_path(WEB_PATH).'classes.php?id='.$data['id']);
$classes .= Display::tag('li', $data['name']);
}
}
if (api_is_platform_admin()) {
$classes .= Display::tag('li', Display::url(get_lang('AddClasses') ,api_get_path(WEB_CODE_PATH).'admin/usergroups.php?action=add'));
}
if (!empty($classes)) {
$classes = Display::tag('ul', $classes, array('class'=>'menulist'));
echo show_right_block(get_lang('Classes'), $classes);
}
}
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 class="menusection">';
$html.= '<span class="menusectioncaption">'.$title.'</span>';
$html.= $content;
$html.= '</div>';
$html.= '</div>';
$html.= '</div>';
return $html;
}
// Footer
Display :: display_footer();
Display :: display_footer();
Loading…
Cancel
Save