$friend_html .= '<div id="friend-container" class="social-friend-container">'; $friend_html .= '<div id="friend-header" >'; if ($number_friends == 1) { $friend_html .= '<div style="float:left;width:80%">' . $number_friends . ' ' . get_lang('Friend') . '</div>'; } else { $friend_html .= '<div style="float:left;width:80%">' . $number_friends . ' ' . get_lang('Friends') . '</div>'; } $friend_html .= '</div>'; // close div friend-header for ($k = 0; $k < $number_friends; $k++) { if (isset($friends[$k])) { $friend = $friends[$k]; $name_user = api_get_person_name($friend['firstName'], $friend['lastName']); $friend_html .= '<div id=div_' . $friend['friend_user_id'] . ' class="image_friend_network" ><span><center>'; // the height = 92 must be the sqme in the image_friend_network span style in default.css $friends_profile = SocialManager::get_picture_user($friend['friend_user_id'], $friend['image'], 92, USER_IMAGE_SIZE_MEDIUM, 'width="85" height="90" '); $friend_html .= '<a href="' . $friend['user_info']['profile_url'] . '">'; $friend_html .= '<img src="' . $friends_profile['file'] . '" ' . $friends_profile['style'] . ' id="imgfriend_' . $friend['friend_user_id'] . '" title="' . $name_user . '" />'; $friend_html .= '</center></span>'; $friend_html .= '<center class="friend">' . $name_user . '</a></center>'; $friend_html .= '</div>'; } } echo $friend_html; echo '</div>'; } else { $usergroup = new UserGroup(); // show all groups by user_id // MY GROUPS $results = $usergroup->get_groups_by_user($user_id, 0); $grid_my_groups = array();
/** * Set header parameters */ private function set_header_parameters() { global $httpHeadXtra, $_course, $interbreadcrumb, $language_file, $noPHP_SELF, $_configuration, $this_section; $help = $this->help; $nameTools = $this->title; $navigation = return_navigation_array(); $this->menu_navigation = $navigation['menu_navigation']; $this->assign('system_charset', api_get_system_encoding()); if (isset($httpHeadXtra) && $httpHeadXtra) { foreach ($httpHeadXtra as & $thisHttpHead) { header($thisHttpHead); } } $this->assign('online_button', Display::return_icon('online.png')); $this->assign('offline_button',Display::return_icon('offline.png')); // Get language iso-code for this page - ignore errors $this->assign('document_language', api_get_language_isocode()); $course_title = isset($_course['name']) ? $_course['name'] : null; $title_list = array(); $title_list[] = api_get_setting('Institution'); $title_list[] = api_get_setting('siteName'); if (!empty($course_title)) { $title_list[] = $course_title; } if ($nameTools != '') { $title_list[] = $nameTools; } $title_string = ''; for ($i = 0; $i < count($title_list); $i++) { $title_string .= $title_list[$i]; if (isset($title_list[$i + 1])) { $item = trim($title_list[$i + 1]); if (!empty($item)) { $title_string .= ' - '; } } } $this->assign('title_string', $title_string); //Setting the theme and CSS files $this->set_css_files(); $this->set_js_files(); //$this->set_js_files_post(); $browser = api_browser_support('check_browser'); if ($browser[0] == 'Internet Explorer' && $browser[1] >= '11') { $browser_head = '<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />'; $this->assign('browser_specific_head', $browser_head); } // Implementation of prefetch. // See http://cdn.chamilo.org/main/img/online.png for details $prefetch = ''; if (!empty($_configuration['cdn_enable'])) { $prefetch .= '<meta http-equiv="x-dns-prefetch-control" content="on">'; foreach ($_configuration['cdn'] as $host => $exts) { $prefetch .= '<link rel="dns-prefetch" href="'.$host.'">'; } } $this->assign('prefetch', $prefetch); $this->assign('text_direction', api_get_text_direction()); $this->assign('section_name', 'section-'.$this_section); $favico = '<link rel="shortcut icon" href="'.api_get_path(WEB_PATH).'favicon.ico" type="image/x-icon" />'; if (isset($_configuration['multiple_access_urls']) && $_configuration['multiple_access_urls']) { $access_url_id = api_get_current_access_url_id(); if ($access_url_id != -1) { $url_info = api_get_access_url($access_url_id); $url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $url_info['url'])); $clean_url = replace_dangerous_char($url); $clean_url = str_replace('/', '-', $clean_url); $clean_url .= '/'; $homep = api_get_path(REL_PATH).'home/'.$clean_url; //homep for Home Path $icon_real_homep = api_get_path(SYS_PATH).'home/'.$clean_url; //we create the new dir for the new sites if (is_file($icon_real_homep.'favicon.ico')) { $favico = '<link rel="shortcut icon" href="'.$homep.'favicon.ico" type="image/x-icon" />'; } } } $this->assign('favico', $favico); $this->set_help(); //@todo move this in the template $bug_notification_link = ''; if (api_get_setting('show_link_bug_notification') == 'true' && $this->user_is_logged_in) { $bug_notification_link = '<li class="report"> <a href="http://support.chamilo.org/projects/chamilo-18/wiki/How_to_report_bugs" target="_blank"> <img src="'.api_get_path(WEB_IMG_PATH).'bug.large.png" style="vertical-align: middle;" alt="'.get_lang('ReportABug').'" title="'.get_lang( 'ReportABug' ).'"/></a> </li>'; } $this->assign('bug_notification_link', $bug_notification_link); $notification = return_notification_menu(); $this->assign('notification_menu', $notification); //Preparing values for the menu //Logout link if (isset($_configuration['hide_logout_button']) && $_configuration['hide_logout_button'] == 'true') { $this->assign('logout_link', null); } else { $this->assign('logout_link', api_get_path(WEB_PATH).'index.php?logout=logout&uid='.api_get_user_id()); } //Profile link if (api_get_setting('allow_social_tool') == 'true') { $profile_url = api_get_path(WEB_CODE_PATH).'social/home.php'; $profile_link = Display::url(get_lang('Profile'), $profile_url); } else { $profile_url = api_get_path(WEB_CODE_PATH).'auth/profile.php'; $profile_link = Display::url(get_lang('Profile'), $profile_url); } $this->assign('profile_link', $profile_link); $this->assign('profile_url', $profile_url); //Message link $message_link = null; $message_url = null; if (api_get_setting('allow_message_tool') == 'true') { $message_url = api_get_path(WEB_CODE_PATH).'messages/inbox.php'; $message_link = '<a href="'.api_get_path(WEB_CODE_PATH).'messages/inbox.php">'.get_lang('Inbox').'</a>'; } $this->assign('message_link', $message_link); $this->assign('message_url', $message_url); $institution = api_get_setting('Institution'); $portal_name = empty($institution) ? api_get_setting('siteName') : $institution; $this->assign('portal_name', $portal_name); //Menu $menu = return_menu(); $this->assign('menu', $menu); //Setting notifications $count_unread_message = 0; if (api_get_setting('allow_message_tool') == 'true') { // get count unread message and total invitations $count_unread_message = MessageManager::get_number_of_messages(true); } $total_invitations = 0; if (api_get_setting('allow_social_tool') == 'true') { $number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id( api_get_user_id() ); $group_pending_invitations = GroupPortalManager::get_groups_by_user( api_get_user_id(), GROUP_USER_PERMISSION_PENDING_INVITATION, false ); $group_pending_invitations = 0; if (!empty($group_pending_invitations)) { $group_pending_invitations = count($group_pending_invitations); } $total_invitations = intval($number_of_new_messages_of_friend) + $group_pending_invitations + intval( $count_unread_message ); } $total_invitations = (!empty($total_invitations) ? Display::badge($total_invitations) : null); $this->assign('user_notifications', $total_invitations); //Breadcrumb $breadcrumb = return_breadcrumb($interbreadcrumb, $language_file, $nameTools); $this->assign('breadcrumb', $breadcrumb); //Extra content $extra_header = null; if (!api_is_platform_admin()) { $extra_header = trim(api_get_setting('header_extra_content')); } $this->assign('header_extra_content', $extra_header); //if ($this->show_header == 1) { header('Content-Type: text/html; charset='.api_get_system_encoding()); header( 'X-Powered-By: '.$_configuration['software_name'].' '.substr($_configuration['system_version'], 0, 1) ); //} }
if (!isset($_POST['group_id'])) { $default['users'] = isset($_POST['users']) ? $_POST['users'] : null; } 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'); } } } if (api_get_setting('social.allow_social_tool') == 'true') { $social_right_content .= '</div>'; $social_right_content .= '</div>'; } //$tpl = new Template(get_lang('ComposeMessage')); $tpl = \Chamilo\CoreBundle\Framework\Container::getTwig(); // Block Social Avatar SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'messages'); if (api_get_setting('social.allow_social_tool') == 'true') { $tpl->addGlobal('social_menu_block', $social_menu_block); $tpl->addGlobal('social_right_content', $social_right_content); echo $tpl->render('@template_style/social/inbox.html.twig'); } else { $content = $social_right_content; echo $actions; echo $content; }
$messageContent = isset($_REQUEST['content']) ? trim($_REQUEST['content']) : null; if (empty($subject) || empty($messageContent)) { echo Display::display_error_message(get_lang('ErrorSendingMessage')); exit; } $result = MessageManager::send_message($_REQUEST['user_id'], $subject, $messageContent); if ($result) { echo Display::display_confirmation_message(get_lang('MessageHasBeenSent')); } else { echo Display::display_error_message(get_lang('ErrorSendingMessage')); } break; case 'send_invitation': $subject = isset($_REQUEST['subject']) ? trim($_REQUEST['subject']) : null; $invitationContent = isset($_REQUEST['content']) ? trim($_REQUEST['content']) : null; SocialManager::send_invitation_friend_user($_REQUEST['user_id'], $subject, $invitationContent); break; case 'find_users': if (api_is_anonymous()) { echo ''; break; } $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); $tbl_my_user = Database::get_main_table(TABLE_MAIN_USER); $tbl_my_user_friend = Database::get_main_table(TABLE_MAIN_USER_REL_USER); $tbl_user = Database::get_main_table(TABLE_MAIN_USER); $tbl_access_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $search = Database::escape_string($_REQUEST['q']); $access_url_id = api_get_multiple_access_url() == 'true' ? api_get_current_access_url_id() : 1; $user_id = api_get_user_id(); $is_western_name_order = api_is_western_name_order();
if (!isset($_GET['id'])) { if (api_get_setting('allow_social_tool') == 'true') { if (!api_is_anonymous()) { $query = isset($_GET['q']) ? $_GET['q'] : null; $social_right_content .= '<div class="span9">' . UserManager::get_search_form($query) . '</div>'; } } $social_right_content .= SocialManager::display_user_list($user_list); } } if (isset($_GET['id'])) { if (api_get_setting('allow_social_tool') == 'true') { header("Location: " . api_get_path(WEB_CODE_PATH) . "social/profile.php?u=" . intval($_GET['id'])); exit; } else { SocialManager::display_individual_user($_GET['id']); } } } else { api_not_allowed(); exit; } $app['title'] = get_lang('UsersOnLineList'); $tpl = $app['template']; if (api_get_setting('allow_social_tool') == 'true' && !api_is_anonymous()) { $tpl->setHelp('Groups'); $tpl->assign('social_left_content', $social_left_content); $tpl->assign('social_right_content', $social_right_content); $social_layout = $tpl->get_template('layout/social_layout.tpl'); $tpl->display($social_layout); } else {
if (count($grid_newest_groups) > 0) { $newest_content = Display::return_sortable_grid('mygroups', array(), $grid_newest_groups, array('hide_navigation' => true, 'per_page' => 100), $query_vars, false, array(true, true, true, false)); } if (count($grid_pop_groups) > 0) { $popular_content = Display::return_sortable_grid('mygroups', array(), $grid_pop_groups, array('hide_navigation' => true, 'per_page' => 100), $query_vars, false, array(true, true, true, true, true)); } } if (!empty($create_group_item)) { $social_right_content .= Display::page_subheader($create_group_item); } $headers = array(get_lang('Newest'), get_lang('Popular'), get_lang('MyGroups')); $social_right_content .= Display::tabs($headers, array($newest_content, $popular_content, $my_group_content), 'tab_browse'); $show_message = null; if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'show_message' && isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'topic_deleted') { $show_message = Display::return_message(get_lang('Deleted'), 'success'); } $tpl = new Template(null); // Block Social Avatar SocialManager::setSocialUserBlock($tpl, $user_id, $show_menu); $show_menu = 'browse_groups'; if (isset($_GET['view']) && $_GET['view'] == 'mygroups') { $show_menu = $_GET['view']; } $social_menu_block = SocialManager::show_social_menu($show_menu); $templateName = 'social/groups.tpl'; $tpl->setHelp('Groups'); $tpl->assign('message', $show_message); $tpl->assign('social_menu_block', $social_menu_block); $tpl->assign('social_right_content', $social_right_content); $social_layout = $tpl->get_template($templateName); $tpl->display($social_layout);
/** * Delete a user from the platform, and all its belongings. This is a * very dangerous function that should only be accessible by * super-admins. Other roles should only be able to disable a user, * which removes access to the platform but doesn't delete anything. * @param int The ID of th user to be deleted * @return boolean true if user is successfully deleted, false otherwise * @assert (null) === false * @assert ('abc') === false */ public static function delete_user($user_id) { if ($user_id != strval(intval($user_id))) { return false; } if ($user_id === false) { return false; } if (!self::can_delete_user($user_id)) { return false; } $table_user = Database::get_main_table(TABLE_MAIN_USER); $usergroup_rel_user = Database::get_main_table(TABLE_USERGROUP_REL_USER); $table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER); $table_course = Database::get_main_table(TABLE_MAIN_COURSE); $table_session = Database::get_main_table(TABLE_MAIN_SESSION); $table_admin = Database::get_main_table(TABLE_MAIN_ADMIN); $table_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); $table_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); $table_group = Database::get_course_table(TABLE_GROUP_USER); $table_work = Database::get_course_table(TABLE_STUDENT_PUBLICATION); // Unsubscribe the user from all groups in all his courses $sql = "SELECT c.id FROM {$table_course} c, {$table_course_user} cu\n WHERE\n cu.user_id = '" . $user_id . "' AND\n relation_type<>" . COURSE_RELATION_TYPE_RRHH . " AND\n c.id = cu.c_id"; $res = Database::query($sql); while ($course = Database::fetch_object($res)) { $sql = "DELETE FROM {$table_group}\n WHERE c_id = {$course->id} AND user_id = {$user_id}"; Database::query($sql); } // Unsubscribe user from all classes //Classes are not longer supported /* $sql = "DELETE FROM $table_class_user WHERE user_id = '".$user_id."'"; Database::query($sql); */ // Unsubscribe user from usergroup_rel_user $sql = "DELETE FROM {$usergroup_rel_user} WHERE user_id = '" . $user_id . "'"; Database::query($sql); // Unsubscribe user from all courses $sql = "DELETE FROM {$table_course_user} WHERE user_id = '" . $user_id . "'"; Database::query($sql); // Unsubscribe user from all courses in sessions $sql = "DELETE FROM {$table_session_course_user} WHERE user_id = '" . $user_id . "'"; Database::query($sql); // If the user was added as a id_coach then set the current admin as coach see BT# $currentUserId = api_get_user_id(); $sql = "UPDATE {$table_session} SET id_coach = {$currentUserId} WHERE id_coach = '" . $user_id . "'"; Database::query($sql); $sql = "UPDATE {$table_session} SET id_coach = {$currentUserId} WHERE session_admin_id = '" . $user_id . "'"; Database::query($sql); // Unsubscribe user from all sessions $sql = "DELETE FROM {$table_session_user} WHERE user_id = '" . $user_id . "'"; Database::query($sql); // Delete user picture /* TODO: Logic about api_get_setting('split_users_upload_directory') == 'true' a user has 4 different sized photos to be deleted. */ $user_info = api_get_user_info($user_id); if (strlen($user_info['picture_uri']) > 0) { $path = self::getUserPathById($user_id, 'system'); $img_path = $path . $user_info['picture_uri']; if (file_exists($img_path)) { unlink($img_path); } } // Delete the personal course categories $course_cat_table = Database::get_main_table(TABLE_USER_COURSE_CATEGORY); $sql = "DELETE FROM {$course_cat_table} WHERE user_id = '" . $user_id . "'"; Database::query($sql); // Delete user from database $sql = "DELETE FROM {$table_user} WHERE id = '" . $user_id . "'"; Database::query($sql); // Delete user from the admin table $sql = "DELETE FROM {$table_admin} WHERE user_id = '" . $user_id . "'"; Database::query($sql); // Delete the personal agenda-items from this user $agenda_table = Database::get_main_table(TABLE_PERSONAL_AGENDA); $sql = "DELETE FROM {$agenda_table} WHERE user = '******'"; Database::query($sql); $gradebook_results_table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_RESULT); $sql = 'DELETE FROM ' . $gradebook_results_table . ' WHERE user_id = ' . $user_id; Database::query($sql); $extraFieldValue = new ExtraFieldValue('user'); $extraFieldValue->deleteValuesByItem($user_id); if (api_get_multiple_access_url()) { $url_id = api_get_current_access_url_id(); UrlManager::delete_url_rel_user($user_id, $url_id); } else { //we delete the user from the url_id =1 UrlManager::delete_url_rel_user($user_id, 1); } if (api_get_setting('allow_social_tool') == 'true') { $userGroup = new UserGroup(); //Delete user from portal groups $group_list = $userGroup->get_groups_by_user($user_id); if (!empty($group_list)) { foreach ($group_list as $group_id => $data) { $userGroup->delete_user_rel_group($user_id, $group_id); } } // Delete user from friend lists SocialManager::remove_user_rel_user($user_id, true); } // Removing survey invitation SurveyManager::delete_all_survey_invitations_by_user($user_id); // Delete students works $sql = "DELETE FROM {$table_work} WHERE user_id = {$user_id} AND c_id <> 0"; Database::query($sql); // Add event to system log $user_id_manager = api_get_user_id(); Event::addEvent(LOG_USER_DELETE, LOG_USER_ID, $user_id, api_get_utc_datetime(), $user_id_manager); Event::addEvent(LOG_USER_DELETE, LOG_USER_OBJECT, $user_info, api_get_utc_datetime(), $user_id_manager); return true; }
/* For licensing terms, see /license.txt */ //require_once '../global.inc.php'; $action = $_GET['a']; switch ($action) { case 'load_online_user': if (isset($_SESSION['who_is_online_counter'])) { $_SESSION['who_is_online_counter']++; } else { $_SESSION['who_is_online_counter'] = 2; } $images_to_show = 9; $page = intval($_REQUEST['online_page_nr']); $max_page = ceil(UserManager::whoIsOnlineCount() / $images_to_show); $page_rows = ($page - 1) * 9; if (!empty($max_page) && $page <= $max_page) { if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) { $user_list = who_is_online_in_this_course($page_rows, $images_to_show, api_get_user_id(), api_get_setting('display.time_limit_whosonline'), $_GET['cidReq']); } else { $user_list = UserManager::whoIsOnline($page_rows, $images_to_show); } if (!empty($user_list)) { echo SocialManager::display_user_list($user_list, false); exit; } } echo 'end'; break; default: break; }
} $show = isset($_GET['show']) ? '&show=' . Security::remove_XSS($_GET['show']) : ''; if (isset($_GET['type']) && $_GET['type'] == 'extended') { $actions .= '<a href="profile.php?type=reduced' . $show . '">' . Display::return_icon('edit.png', get_lang('EditNormalProfile'), '', 16) . '</a>'; } else { $actions .= '<a href="profile.php?type=extended' . $show . '">' . Display::return_icon('edit.png', get_lang('EditExtendProfile'), '', 16) . '</a>'; } $actions .= '</div>'; } } $show_delete_account_button = api_get_setting('platform_unsubscribe_allowed') == 'true' ? true : false; $tpl = new Template(get_lang('ModifyProfile')); $tpl->assign('actions', $actions); SocialManager::setSocialUserBlock($tpl, $user_id, 'messages'); if (api_get_setting('social.allow_social_tool') == 'true') { SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'home'); $menu = SocialManager::show_social_menu('home', null, api_get_user_id(), false, $show_delete_account_button); $tpl->assign('social_menu_block', $menu); $tpl->assign('social_right_content', $form->returnForm()); $social_layout = $tpl->get_template('social/edit_profile.tpl'); $tpl->display($social_layout); } else { $bigImage = UserManager::getUserPicture(api_get_user_id(), USER_IMAGE_SIZE_BIG); $normalImage = UserManager::getUserPicture(api_get_user_id(), USER_IMAGE_SIZE_ORIGINAL); $imageToShow = '<div id="image-message-container">'; $imageToShow .= '<a class="expand-image" href="' . $bigImage . '" /><img src="' . $normalImage . '"></a>'; $imageToShow .= '</div>'; $content = $imageToShow . $form->returnForm(); $tpl->assign('content', $content); $tpl->display_one_col_template(); }
<?php /* For licensing terms, see /license.txt */ require_once '../../../global.inc.php'; if (api_is_anonymous()) { api_not_allowed(true); } $roomName = isset($_GET['room']) ? $_GET['room'] : null; $room = VideoChat::getChatRoomByName($roomName); if ($room === false) { Header::location(api_get_path(WEB_PATH)); } $friend_html = SocialManager::listMyFriendsBlock($user_id, $link_shared, $show_full_profile); $isSender = $room['from_user'] == api_get_user_id(); $isReceiver = $room['to_user'] == api_get_user_id(); if (!$isSender && !$isReceiver) { Header::location(api_get_path(WEB_PATH)); } if ($isSender) { $chatUser = api_get_user_info($room['to_user']); } elseif ($isReceiver) { $chatUser = api_get_user_info($room['from_user']); } $idUserLocal = api_get_user_id(); $userLocal = api_get_user_info($idUserLocal, true); $htmlHeadXtra[] = '<script type="text/javascript" src="' . api_get_path(WEB_PATH) . 'web/assets/simplewebrtc/latest.js' . '"></script>' . "\n"; $template = new Template(); $template->assign('room', $room); $template->assign('chat_user', $chatUser); $template->assign('user_local', $userLocal); $template->assign('block_friends', $friend_html);
/** * @return null|string|void */ public function return_profile_block() { global $_configuration; $user_id = api_get_user_id(); if (empty($user_id)) { return; } $userGroup = new UserGroup(); $profile_content = '<ul class="nav nav-pills nav-stacked">'; // @todo Add a platform setting to add the user image. if (api_get_setting('message.allow_message_tool') == 'true') { // 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 = $userGroup->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 = Display::badge($number_of_new_messages); $link = ''; if (api_get_setting('social.allow_social_tool') == 'true') { $link = '?f=social'; } $profile_content .= '<li class="inbox-message-social"><a href="' . api_get_path(WEB_PATH) . 'main/messages/inbox.php' . $link . '">' . Display::return_icon('inbox.png', get_lang('Inbox'), null, ICON_SIZE_SMALL) . get_lang('Inbox') . $cant_msg . ' </a></li>'; $profile_content .= '<li class="new-message-social"><a href="' . api_get_path(WEB_PATH) . 'main/messages/new_message.php' . $link . '">' . Display::return_icon('new-message.png', get_lang('Compose'), null, ICON_SIZE_SMALL) . get_lang('Compose') . ' </a></li>'; if (api_get_setting('social.allow_social_tool') == 'true') { $total_invitations = Display::badge($total_invitations); $profile_content .= '<li class="invitations-social"><a href="' . api_get_path(WEB_PATH) . 'main/social/invitations.php">' . Display::return_icon('invitations.png', get_lang('PendingInvitations'), null, ICON_SIZE_SMALL) . get_lang('PendingInvitations') . $total_invitations . '</a></li>'; } if (isset($_configuration['allow_my_files_link_in_homepage']) && $_configuration['allow_my_files_link_in_homepage']) { $profile_content .= '<li class="myfiles-social"><a href="' . api_get_path(WEB_PATH) . 'main/social/myfiles.php">' . get_lang('MyFiles') . '</a></li>'; } } $editProfileUrl = Display::getProfileEditionLink($user_id); $profile_content .= '<li class="profile-social"><a href="' . $editProfileUrl . '">' . Display::return_icon('edit-profile.png', get_lang('EditProfile'), null, ICON_SIZE_SMALL) . get_lang('EditProfile') . '</a></li>'; $profile_content .= '</ul>'; $html = self::show_right_block(get_lang('Profile'), $profile_content, 'profile_block', null, 'profile', 'profileCollapse'); return $html; }
/** * @param int $userId * @param int $friendId * @return string */ public static function getWallMessagesByUser($userId, $friendId) { $messages = SocialManager::getWallMessagesPostHTML($userId, $friendId); $html = ''; foreach ($messages as $message) { $post = $message['html']; $comment = SocialManager::getWallMessagesHTML($userId, $friendId, $message['id']); $html .= $post . $comment; } return $html; }
echo '<div class="clear"></div><br />'; } break; case 'unload_course': break; default: break; } break; case 'listWallMessage': $start = isset($_REQUEST['start']) ? intval($_REQUEST['start']) - 1 : 0; $length = isset($_REQUEST['length']) ? intval($_REQUEST['length']) : 10; $userId = isset($_REQUEST['u']) ? intval($_REQUEST['u']) : api_get_user_id(); $friendId = $userId; $array = SocialManager::getWallMessagesPostHTML($userId, $friendId, null, $length, $start); if (!empty($array)) { ksort($array); $html = ''; for ($i = 0; $i < count($array); $i++) { $post = $array[$i]['html']; $comment = SocialManager::getWallMessagesHTML($userId, $friendId, $array[$i]['id']); $html .= '<div class="well_border">' . $post . $comment . '</div>'; } $html .= Display::div(Display::url(get_lang('SeeMore'), api_get_self() . '?u=' . $userId . '&a=listWallMessage&start=' . ($start + $length + 1) . '&length=' . $length, array('class' => 'nextPage')), array('class' => 'next')); echo $html; } break; default: echo ''; } exit;
} else { $id_message = $_GET['id']; $source = 'inbox'; $show_menu = 'messages_inbox'; } $message = ''; // LEFT COLUMN if (api_get_setting('social.allow_social_tool') == 'true') { //Block Social Menu $social_menu_block = SocialManager::show_social_menu($show_menu); } //MAIN CONTENT $message .= MessageManager::show_message_box($id_message, $source); if (!empty($message)) { $social_right_content .= $message; } else { api_not_allowed(); } //$tpl = new Template(get_lang('View')); $tpl = \Chamilo\CoreBundle\Framework\Container::getTwig(); // Block Social Avatar SocialManager::setSocialUserBlock($tpl, api_get_user_id(), $show_menu); if (api_get_setting('social.allow_social_tool') == 'true') { $tpl->addGlobal('social_menu_block', $social_menu_block); $tpl->addGlobal('social_right_content', $social_right_content); echo $tpl->render('@template_style/social/inbox.html.twig'); } else { $content = $social_right_content; echo $actions; echo $content; }
/** * Set header parameters * @param bool $sendHeaders send headers */ private function set_header_parameters($sendHeaders) { global $httpHeadXtra, $interbreadcrumb, $language_file, $_configuration, $this_section; $_course = api_get_course_info(); $help = $this->help; $nameTools = $this->title; $navigation = return_navigation_array(); $this->menu_navigation = $navigation['menu_navigation']; $this->assign('system_charset', api_get_system_encoding()); if (isset($httpHeadXtra) && $httpHeadXtra) { foreach ($httpHeadXtra as &$thisHttpHead) { header($thisHttpHead); } } $this->assign('online_button', Display::return_icon('statusonline.png', null, null, ICON_SIZE_ATOM)); $this->assign('offline_button', Display::return_icon('statusoffline.png', null, null, ICON_SIZE_ATOM)); // Get language iso-code for this page - ignore errors $this->assign('document_language', api_get_language_isocode()); $course_title = isset($_course['name']) ? $_course['name'] : null; $title_list = array(); $title_list[] = api_get_setting('platform.institution'); $title_list[] = api_get_setting('platform.site_name'); if (!empty($course_title)) { $title_list[] = $course_title; } if ($nameTools != '') { $title_list[] = $nameTools; } $title_string = ''; for ($i = 0; $i < count($title_list); $i++) { $title_string .= $title_list[$i]; if (isset($title_list[$i + 1])) { $item = trim($title_list[$i + 1]); if (!empty($item)) { $title_string .= ' - '; } } } $this->assign('title_string', $title_string); //Setting the theme and CSS files $css = $this->setCssFiles(); $this->set_js_files(); $this->setCssCustomFiles($css); //$this->set_js_files_post(); $browser = api_browser_support('check_browser'); if ($browser[0] == 'Internet Explorer' && $browser[1] >= '11') { $browser_head = '<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />'; $this->assign('browser_specific_head', $browser_head); } // Implementation of prefetch. // See http://cdn.chamilo.org/main/img/online.png for details $prefetch = ''; if (!empty($_configuration['cdn_enable'])) { $prefetch .= '<meta http-equiv="x-dns-prefetch-control" content="on">'; foreach ($_configuration['cdn'] as $host => $exts) { $prefetch .= '<link rel="dns-prefetch" href="' . $host . '">'; } } $this->assign('prefetch', $prefetch); $this->assign('text_direction', api_get_text_direction()); $this->assign('section_name', 'section-' . $this_section); //Defaul root chamilo favicon $favico = '<link rel="shortcut icon" href="' . api_get_path(WEB_PATH) . 'favicon.ico" type="image/x-icon" />'; //Added to verify if in the current Chamilo Theme exist a favicon $favicoThemeUrl = api_get_path(SYS_CSS_PATH) . 'themes/' . $this->theme . '/images/'; //If exist pick the current chamilo theme favicon if (is_file($favicoThemeUrl . 'favicon.ico')) { $favico = '<link rel="shortcut icon" href="' . api_get_path(WEB_CSS_PATH) . 'themes/' . $this->theme . '/images/favicon.ico" type="image/x-icon" />'; } if (api_is_multiple_url_enabled()) { $access_url_id = api_get_current_access_url_id(); if ($access_url_id != -1) { $url_info = api_get_access_url($access_url_id); $url = api_remove_trailing_slash(preg_replace('/https?:\\/\\//i', '', $url_info['url'])); $clean_url = api_replace_dangerous_char($url); $clean_url = str_replace('/', '-', $clean_url); $clean_url .= '/'; $homep = api_get_path(REL_PATH) . 'home/' . $clean_url; //homep for Home Path $icon_real_homep = api_get_path(SYS_APP_PATH) . 'home/' . $clean_url; //we create the new dir for the new sites if (is_file($icon_real_homep . 'favicon.ico')) { $favico = '<link rel="shortcut icon" href="' . $homep . 'favicon.ico" type="image/x-icon" />'; } } } $this->assign('favico', $favico); $this->setHelp(); //@todo move this in the template $bug_notification_link = ''; if (api_get_setting('show_link_bug_notification') == 'true' && $this->user_is_logged_in) { $bug_notification_link = '<li class="report"> <a href="http://support.chamilo.org/projects/chamilo-18/wiki/How_to_report_bugs" target="_blank"> <img src="' . api_get_path(WEB_IMG_PATH) . 'bug.large.png" style="vertical-align: middle;" alt="' . get_lang('ReportABug') . '" title="' . get_lang('ReportABug') . '"/></a> </li>'; } $this->assign('bug_notification_link', $bug_notification_link); $notification = return_notification_menu(); $this->assign('notification_menu', $notification); $resize = ''; if (api_get_setting('accessibility_font_resize') == 'true') { $resize .= '<div class="resize_font">'; $resize .= '<div class="btn-group">'; $resize .= '<a title="' . get_lang('DecreaseFontSize') . '" href="#" class="decrease_font btn btn-default"><em class="fa fa-font"></em></a>'; $resize .= '<a title="' . get_lang('ResetFontSize') . '" href="#" class="reset_font btn btn-default"><em class="fa fa-font"></em></a>'; $resize .= '<a title="' . get_lang('IncreaseFontSize') . '" href="#" class="increase_font btn btn-default"><em class="fa fa-font"></em></a>'; $resize .= '</div>'; $resize .= '</div>'; } $this->assign('accessibility', $resize); // Preparing values for the menu // Logout link $hideLogout = api_get_setting('hide_logout_button'); if ($hideLogout === 'true') { $this->assign('logout_link', null); } else { $this->assign('logout_link', api_get_path(WEB_PATH) . 'index.php?logout=logout&uid=' . api_get_user_id()); } //Profile link if (api_get_setting('social.allow_social_tool') == 'true') { $profile_url = api_get_path(WEB_CODE_PATH) . 'social/home.php'; $profile_link = Display::url(get_lang('Profile'), $profile_url); } else { $profile_url = api_get_path(WEB_CODE_PATH) . 'auth/profile.php'; $profile_link = Display::url(get_lang('Profile'), $profile_url); } $this->assign('profile_link', $profile_link); $this->assign('profile_url', $profile_url); //Message link $message_link = null; $message_url = null; if (api_get_setting('message.allow_message_tool') == 'true') { $message_url = api_get_path(WEB_CODE_PATH) . 'messages/inbox.php'; $message_link = '<a href="' . api_get_path(WEB_CODE_PATH) . 'messages/inbox.php">' . get_lang('Inbox') . '</a>'; } $this->assign('message_link', $message_link); $this->assign('message_url', $message_url); $institution = api_get_setting('platform.institution'); $portal_name = empty($institution) ? api_get_setting('platform.site_name') : $institution; $this->assign('portal_name', $portal_name); //Menu $menu = return_menu(); $this->assign('menu', $menu); // Setting notifications $count_unread_message = 0; if (api_get_setting('message.allow_message_tool') == 'true') { // get count unread message and total invitations $count_unread_message = MessageManager::get_number_of_messages(true); } $total_invitations = 0; if (api_get_setting('social.allow_social_tool') == 'true') { $number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id(api_get_user_id()); $usergroup = new UserGroup(); $group_pending_invitations = $usergroup->get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_PENDING_INVITATION, false); if (!empty($group_pending_invitations)) { $group_pending_invitations = count($group_pending_invitations); } else { $group_pending_invitations = 0; } $total_invitations = intval($number_of_new_messages_of_friend) + $group_pending_invitations + intval($count_unread_message); } $total_invitations = !empty($total_invitations) ? Display::badge($total_invitations) : null; $this->assign('user_notifications', $total_invitations); // Block Breadcrumb $breadcrumb = return_breadcrumb($interbreadcrumb, $language_file, $nameTools); $this->assign('breadcrumb', $breadcrumb); //Extra content $extra_header = null; if (!api_is_platform_admin()) { $extra_header = trim(api_get_setting('header_extra_content')); } $this->assign('header_extra_content', $extra_header); if ($sendHeaders) { header('Content-Type: text/html; charset=' . api_get_system_encoding()); header('X-Powered-By: ' . $_configuration['software_name'] . ' ' . substr($_configuration['system_version'], 0, 1)); } $socialMeta = ''; $metaTitle = api_get_setting('meta_title'); if (!empty($metaTitle)) { $socialMeta .= '<meta name="twitter:card" content="summary" />' . "\n"; $socialMeta .= '<meta property="og:title" content="' . $metaTitle . '" />' . "\n"; $socialMeta .= '<meta property="og:url" content="' . api_get_path(WEB_PATH) . '" />' . "\n"; $metaDescription = api_get_setting('meta_description'); if (!empty($metaDescription)) { $socialMeta .= '<meta property="og:description" content="' . $metaDescription . '" />' . "\n"; } $metaSite = api_get_setting('meta_twitter_site'); if (!empty($metaSite)) { $socialMeta .= '<meta name="twitter:site" content="' . $metaSite . '" />' . "\n"; $metaCreator = api_get_setting('meta_twitter_creator'); if (!empty($metaCreator)) { $socialMeta .= '<meta name="twitter:creator" content="' . $metaCreator . '" />' . "\n"; } } $metaImage = api_get_setting('meta_image_path'); if (!empty($metaImage)) { if (is_file(api_get_path(SYS_PATH) . $metaImage)) { $path = api_get_path(WEB_PATH) . $metaImage; $socialMeta .= '<meta property="og:image" content="' . $path . '" />' . "\n"; } } } $this->assign('social_meta', $socialMeta); }
api_not_allowed(); } $table_message = Database::get_main_table(TABLE_MESSAGE); $usergroup = new UserGroup(); $form = new FormValidator('add_group'); $usergroup->setGroupType($usergroup::SOCIAL_CLASS); $usergroup->setForm($form, 'add', array()); if ($form->validate()) { $values = $form->exportValues(); $values['group_type'] = UserGroup::SOCIAL_CLASS; $values['relation_type'] = GROUP_USER_PERMISSION_ADMIN; $groupId = $usergroup->save($values); Display::addFlash(DIsplay::return_message(get_lang('GroupAdded'))); header('Location: group_view.php?id=' . $groupId); exit; } $nameTools = get_lang('AddGroup'); $this_section = SECTION_SOCIAL; $interbreadcrumb[] = array('url' => 'home.php', 'name' => get_lang('Social')); $interbreadcrumb[] = array('url' => 'groups.php', 'name' => get_lang('Groups')); $interbreadcrumb[] = array('url' => '#', 'name' => $nameTools); $social_avatar_block = SocialManager::show_social_avatar_block('group_add'); $social_menu_block = SocialManager::show_social_menu('group_add'); $social_right_content = $form->returnForm(); $tpl = new Template(null); SocialManager::setSocialUserBlock($tpl, $user_id, null, null); $tpl->setHelp('Groups'); $tpl->assign('social_menu_block', $social_menu_block); $tpl->assign('social_right_content', $social_right_content); $social_layout = $tpl->get_template('social/add_groups.tpl'); $tpl->display($social_layout);
} break 2; case 'deny': // delete invitation GroupPortalManager::delete_user_rel_group( api_get_user_id(), $value ); $show_message = get_lang('GroupInvitationWasDeny'); break 2; } } } $social_avatar_block = SocialManager::show_social_avatar_block('myfiles'); $social_menu_block = SocialManager::show_social_menu('myfiles'); $actions = null; if (isset($_GET['cidReq'])) { $actions = '<a href="' . api_get_path( WEB_CODE_PATH ) . 'document/document.php?cidReq=' . Security::remove_XSS( $_GET['cidReq'] ) . '&id_session=' . Security::remove_XSS( $_GET['id_session'] ) . '&gidReq=' . Security::remove_XSS( $_GET['gidReq'] ) . '&id=' . Security::remove_XSS( $_GET['parent_id'] ) . '">' . Display::return_icon( 'back.png',
function return_profile_block() { global $_configuration; $user_id = api_get_user_id(); if (empty($user_id)) { return; } $profile_content = '<ul class="nav nav-list">'; // @todo Add a platform setting to add the user image. if (api_get_setting('allow_message_tool') == 'true') { 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 = Display::badge($number_of_new_messages); $link = ''; if (api_get_setting('allow_social_tool') == 'true') { $link = '?f=social'; } $profile_content .= '<li class="inbox-social"><a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php'.$link.'">'.get_lang('Inbox').$cant_msg.' </a></li>'; $profile_content .= '<li class="new-message-social"><a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php'.$link.'">'.get_lang('Compose').' </a></li>'; if (api_get_setting('allow_social_tool') == 'true') { $total_invitations = Display::badge($total_invitations); $profile_content .= '<li class="invitations-social"><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.get_lang('PendingInvitations').$total_invitations.'</a></li>'; } if (isset($_configuration['allow_my_files_link_in_homepage']) && $_configuration['allow_my_files_link_in_homepage']) { $profile_content .= '<li class="myfiles-social"><a href="'.api_get_path(WEB_PATH).'main/social/myfiles.php">'.get_lang('MyFiles').'</a></li>'; } } $editProfileUrl = api_get_path(WEB_CODE_PATH) . 'auth/profile.php'; if (api_get_setting('sso_authentication') === 'true') { $subSSOClass = api_get_setting('sso_authentication_subclass'); $objSSO = null; if (!empty($subSSOClass)) { require_once api_get_path(SYS_CODE_PATH) . 'auth/sso/sso.' . $subSSOClass . '.class.php'; $subSSOClass = 'sso' . $subSSOClass; $objSSO = new $subSSOClass(); } else { $objSSO = new sso(); } $editProfileUrl = $objSSO->generateProfileEditingURL(); } $profile_content .= '<li class="profile-social"><a href="' . $editProfileUrl . '">'.get_lang('EditProfile').'</a></li>'; $profile_content .= '</ul>'; $html = self::show_right_block(get_lang('Profile'), $profile_content, 'profile_block'); return $html; }
url, {}, function(responseText, textStatus, XMLHttpRequest) { dialog.dialog({ modal : true, width : 520, height : 400, }); }); //prevent the browser to follow the link return false; }); }); </script>'; $this_section = SECTION_SOCIAL; $interbreadcrumb[] = array('url' => 'groups.php', 'name' => get_lang('Groups')); $interbreadcrumb[] = array('url' => 'groups.php?id=' . $group_id, 'name' => Security::remove_XSS($group_info['name'])); //$interbreadcrumb[] = array('url' => 'groups.php?id='.$group_id.'#tabs_2', 'name' => get_lang('Discussions')); $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Discussions')); $social_left_content = SocialManager::show_social_menu('member_list', $group_id); $show_message = null; if (!empty($show_message)) { $social_right_content .= Display::return_message($show_message, 'confirmation'); } $social_right_content .= MessageManager::display_message_for_group($group_id, $topic_id, $is_member, $message_id); $social_right_content = '<div class="span9">' . $social_right_content . '</div>'; $app['title'] = get_lang('Social'); $tpl = $app['template']; $tpl->setHelp('Groups'); $tpl->assign('message', $show_message); $tpl->assign('content', $social_right_content);
<button class="btn btn-primary" name="btn_accepted" type="submit" id="btn_accepted_' . $sender_user_id . '" value="' . get_lang('Accept') . ' "onclick="javascript:register_friend(this)"> ' . get_lang('Accept') . '</button> <button class="btn btn-danger" name="btn_denied" type="submit" id="btn_deniedst_' . $sender_user_id . ' " value="' . get_lang('Deny') . ' " onclick="javascript:denied_friend(this)" > ' . get_lang('Deny') . '</button> </div> </div> </div>'; } } if (count($list_get_invitation_sent) > 0) { $social_right_content .= '<div class="span8">' . Display::page_subheader(get_lang('InvitationSent')) . '</div>'; foreach ($list_get_invitation_sent as $invitation) { $sender_user_id = $invitation['user_receiver_id']; $social_right_content .= '<div id="id_' . $sender_user_id . '" class="invitation_confirm span8">'; $picture = UserManager::get_user_picture_path_by_id($sender_user_id, 'web', false, true); $friends_profile = SocialManager::get_picture_user($sender_user_id, $picture['file'], 92); $userInfo = api_get_user_info($sender_user_id); $title = Security::remove_XSS($invitation['title'], STUDENT, true); $content = Security::remove_XSS($invitation['content'], STUDENT, true); $date = api_convert_and_format_date($invitation['send_date'], DATE_TIME_FORMAT_LONG); $social_right_content .= ' <div class="span2"> <a class="thumbnail" href="' . $userInfo['profile_url'] . '"> <img src="' . $friends_profile['file'] . '" /></a> </div> <div class="span3"> <a class="profile_link" href="' . $userInfo['profile_url'] . '">' . $userInfo['complete_name'] . '</a> <div>' . $title . ' : ' . $content . '</div> <div>' . get_lang('DateSend') . ' : ' . $date . '</div> </div> </div>';
dialog.dialog({ modal : true, width : 520, height : 400, }); }); //prevent the browser to follow the link return false; }); }); </script>'; $this_section = SECTION_SOCIAL; $interbreadcrumb[] = array('url' => 'groups.php', 'name' => get_lang('Groups')); $interbreadcrumb[] = array('url' => 'group_view.php?id=' . $group_id, 'name' => Security::remove_XSS($group_info['name'])); $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Discussions')); $social_left_content = SocialManager::show_social_menu('member_list', $group_id); $show_message = null; if (!empty($show_message)) { $social_right_content .= Display::return_message($show_message, 'confirmation'); } $social_right_content .= MessageManager::display_message_for_group($group_id, $topic_id, $is_member, $message_id); $social_menu_block = SocialManager::show_social_menu('member_list', $group_id); $tpl = new Template(null); $tpl->setHelp('Groups'); // Block Social Avatar SocialManager::setSocialUserBlock($tpl, $user_id, 'groups', $group_id); $tpl->assign('social_menu_block', $social_menu_block); $tpl->assign('social_right_content', $social_right_content); $tpl->assign('content', $content); $social_layout = $tpl->get_template('social/home.tpl'); $tpl->display($social_layout);
if ($group_id != 0) { $social_avatar_block = SocialManager::show_social_avatar_block( 'groups', $group_id ); $social_menu_block = SocialManager::show_social_menu('groups', $group_id); } else { $show_menu = 'browse_groups'; if (isset($_GET['view']) && $_GET['view'] == 'mygroups') { $show_menu = $_GET['view']; } $social_avatar_block = SocialManager::show_social_avatar_block( $show_menu, $group_id ); $social_menu_block = SocialManager::show_social_menu($show_menu, $group_id); } $social_right_content = null; if ($group_id != 0) { $group_info = GroupPortalManager::get_group_data($group_id); //Loading group information if (isset($_GET['status']) && $_GET['status'] == 'sent') { $social_right_content .= Display::return_message( get_lang('MessageHasBeenSent'), 'confirmation', false );
/** * Sends a message from one user to another user * @param int $from_user_id The ID of the user sending the message * @param int $to_user_id The ID of the user receiving the message * @param string $message Message * @param boolean $printResult Optional. Whether print the result * @param boolean $sanitize Optional. Whether sanitize the message * @return void Prints "1" */ public function send($from_user_id, $to_user_id, $message, $printResult = true, $sanitize = true) { $user_friend_relation = SocialManager::get_relation_between_contacts($from_user_id, $to_user_id); if ($user_friend_relation == USER_RELATION_TYPE_FRIEND) { $user_info = api_get_user_info($to_user_id, true); $this->save_window($to_user_id); $_SESSION['openChatBoxes'][$to_user_id] = api_get_utc_datetime(); if ($sanitize) { $messagesan = self::sanitize($message); } else { $messagesan = $message; } error_log(print_r($sanitize) . '----' . $messagesan); if (!isset($_SESSION['chatHistory'][$to_user_id])) { $_SESSION['chatHistory'][$to_user_id] = array(); } $item = array("s" => "1", "f" => $from_user_id, "m" => $messagesan, "username" => get_lang('Me')); $_SESSION['chatHistory'][$to_user_id]['items'][] = $item; $_SESSION['chatHistory'][$to_user_id]['user_info']['user_name'] = $user_info['complete_name']; $_SESSION['chatHistory'][$to_user_id]['user_info']['online'] = $user_info['user_is_online']; $_SESSION['chatHistory'][$to_user_id]['user_info']['avatar'] = $user_info['avatar_small']; unset($_SESSION['tsChatBoxes'][$to_user_id]); $params = array(); $params['from_user'] = intval($from_user_id); $params['to_user'] = intval($to_user_id); $params['message'] = $message; $params['sent'] = api_get_utc_datetime(); if (!empty($from_user_id) && !empty($to_user_id)) { $this->save($params); } if ($printResult) { echo "1"; exit; } } else { if ($printResult) { echo "0"; exit; } } }
<?php /* For licensing terms, see /license.txt */ require_once '../../../global.inc.php'; if (api_is_anonymous()) { api_not_allowed(true); } $roomId = isset($_GET['room']) ? $_GET['room'] : null; $entityManager = Database::getManager(); $chatVideo = $entityManager->find('ChamiloCoreBundle:ChatVideo', $roomId); if (!$chatVideo) { header('Location: ' . api_get_path(WEB_PATH)); exit; } $friend_html = SocialManager::listMyFriendsBlock($user_id, '', false); $isSender = $chatVideo->getFromUser() === api_get_user_id(); $isReceiver = $chatVideo->getToUser() === api_get_user_id(); if (!$isSender && !$isReceiver) { header('Location: ' . api_get_path(WEB_PATH)); exit; } if ($isSender) { $chatUser = api_get_user_info($chatVideo->getToUser()); } elseif ($isReceiver) { $chatUser = api_get_user_info($chatVideo->getFromUser()); } $idUserLocal = api_get_user_id(); $userLocal = api_get_user_info($idUserLocal, true); $htmlHeadXtra[] = '<script type="text/javascript" src="' . api_get_path(WEB_PATH) . 'web/assets/SimpleWebRTC/latest.js' . '"></script>' . "\n"; $template = new Template(); $template->assign('room_name', $chatVideo->getRoomName());
if (!$usergroup->is_group_admin($group_id)) { api_not_allowed(); } // Create the form $form = new FormValidator('group_edit', 'post', '', ''); $form->addElement('hidden', 'id', $group_id); $usergroup->setGroupType($usergroup::SOCIAL_CLASS); $usergroup->setForm($form, 'edit', $group_data); // Set default values $form->setDefaults($group_data); // Validate form if ($form->validate()) { $group = $form->exportValues(); $group['id'] = $group_id; $group['type'] = $usergroup::SOCIAL_CLASS; $usergroup->update($group); $tok = Security::get_token(); header('Location: groups.php?id=' . $group_id . '&action=show_message&message=' . urlencode(get_lang('GroupUpdated')) . '&sec_token=' . $tok); exit; } $social_left_content = SocialManager::show_social_menu('group_edit', $group_id); $social_right_content = '<div class="span9">'; $social_right_content .= $form->return_form(); $social_right_content .= '</div>'; $app['title'] = $tool_name; $tpl = $app['template']; $tpl->setHelp('Groups'); $tpl->assign('social_left_content', $social_left_content); $tpl->assign('social_right_content', $social_right_content); $social_layout = $tpl->get_template('layout/social_layout.tpl'); $tpl->display($social_layout);
} else { $social_right_content .= '<div class=actions>'; if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') { $social_right_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php">' . Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')) . '</a>'; } if (api_get_setting('allow_message_tool') == 'true') { $social_right_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/messages/new_message.php">' . Display::return_icon('message_new.png', get_lang('ComposeMessage')) . '</a>'; $social_right_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/messages/inbox.php">' . Display::return_icon('inbox.png', get_lang('Inbox')) . '</a>'; $social_right_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/messages/outbox.php">' . Display::return_icon('outbox.png', get_lang('Outbox')) . '</a>'; } $social_right_content .= '</div>'; } } //LEFT COLUMN if (api_get_setting('allow_social_tool') == 'true') { $social_left_content = SocialManager::show_social_menu('messages'); $social_right_content = '<div class="span9">'; $social_right_content .= '<div class="actions">'; $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>'; $social_right_content .= '</div>'; $social_right_content .= '</div>'; $social_right_content .= '<div class="span9">'; } //MAIN CONTENT if (!isset($_POST['compose'])) { if (isset($_GET['re_id'])) { $social_right_content .= show_compose_reply_to_message($_GET['re_id'], api_get_user_id()); } elseif (isset($_GET['send_to_user'])) { $social_right_content .= show_compose_to_user($_GET['send_to_user']); } else { $social_right_content .= show_compose_to_any($_user['user_id']);
<a href="groups.php?id=' . $group_id . '">' . Security::remove_XSS( $group_info['name'], STUDENT, true ) . '</a> <span class="divider">/</span> <a href="groups.php?id=' . $group_id . '#tabs_2">' . get_lang( 'Discussions' ) . '</a> </div> '; $social_avatar_block = SocialManager::show_social_avatar_block( 'member_list', $group_id ); $social_menu_block = SocialManager::show_social_menu('member_list', $group_id); if (!empty($show_message)) { $social_right_content .= Display::return_message( $show_message, 'confirmation' ); } $social_right_content .= MessageManager::display_message_for_group( $group_id, $topic_id, $is_member, $message_id );
* Initialization */ // name of the language file that needs to be included $language_file = array('registration', 'admin', 'userInfo'); $cidReset = true; //require_once '../inc/global.inc.php'; api_block_anonymous_users(); if (api_get_setting('allow_social_tool') != 'true') { api_not_allowed(); } $this_section = SECTION_SOCIAL; $tool_name = get_lang('Search'); $interbreadcrumb[] = array('url' => 'profile.php', 'name' => get_lang('SocialNetwork')); $query_vars = array(); $query = isset($_GET['q']) ? $_GET['q'] : null; $social_left_content = SocialManager::show_social_menu('search'); $social_right_content = '<div class="span9">' . UserManager::get_search_form($query) . '</div>'; $usergroup = new UserGroup(); //I'm searching something if ($query != '') { //get users from tags $users = UserManager::get_all_user_tags($_GET['q'], 0, 0, 5); $groups = $usergroup->get_all_group_tags($_GET['q']); if (empty($users) && empty($groups)) { $social_right_content .= get_lang('SorryNoResults'); } $results = '<div id="online_grid_container"><div class="col-md-12">'; if (is_array($users) && count($users) > 0) { $results .= Display::page_subheader(get_lang('Users')); $results .= '<ul class="thumbnails">'; foreach ($users as $user) {
} if (!empty($user_info['teach'])) { $more_info .= '<div class="social-actions-message"><strong>' . get_lang('MyTeach') . '</strong></div>'; $more_info .= '<div class="social-profile-extended">' . $user_info['teach'] . '</div>'; $more_info .= '<br />'; } $socialRightInformation .= SocialManager::social_wrapper_div($more_info, 4); } } $tpl = new Template(get_lang('Social')); // Block Avatar Social SocialManager::setSocialUserBlock($tpl, $user_id, 'shared_profile'); $tpl->assign('social_friend_block', $friend_html); $tpl->assign('social_menu_block', $social_menu_block); $tpl->assign('social_wall_block', $social_wall_block); $tpl->assign('social_post_wall_block', $social_post_wall_block); $tpl->assign('social_extra_info_block', $social_extra_info_block); $tpl->assign('social_course_block', $social_course_block); $tpl->assign('social_group_info_block', $social_group_info_block); $tpl->assign('social_rss_block', $social_rss_block); $tpl->assign('social_skill_block', SocialManager::getSkillBlock($my_user_id)); $tpl->assign('sessionList', $social_session_block); $tpl->assign('social_right_information', $socialRightInformation); $tpl->assign('social_auto_extend_link', $socialAutoExtendLink); $formModalTpl = new Template(); $formModalTpl->assign('messageForm', MessageManager::generate_message_form('send_message')); $formModalTpl->assign('invitationForm', MessageManager::generate_invitation_form('send_invitation')); $formModals = $formModalTpl->fetch('default/social/form_modals.tpl'); $tpl->assign('formModals', $formModals); $social_layout = $tpl->get_template('social/profile.tpl'); $tpl->display($social_layout);
/** * Displays the information of an individual user * @param int $user_id */ public static function display_individual_user($user_id, $returnContent = false) { global $interbreadcrumb; $safe_user_id = intval($user_id); $curretUserId = api_get_user_id(); $user_table = Database::get_main_table(TABLE_MAIN_USER); $sql = "SELECT * FROM {$user_table} WHERE user_id = " . $safe_user_id; $result = Database::query($sql); $userInfo = api_get_user_info($user_id); $content = null; if (Database::num_rows($result) == 1) { $user_object = Database::fetch_object($result); $alt = $userInfo['complete_name'] . ($curretUserId == $user_id ? ' (' . get_lang('Me') . ')' : ''); $status = api_get_status_from_code($user_object->status); $interbreadcrumb[] = array('url' => SocialManager::getUserOnlineLink(), 'name' => get_lang('UsersOnLineList')); if ($returnContent == false) { Display::display_header($alt, null, $alt); } $content = '<div class ="thumbnail">'; 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); $height += 30; $width += 30; // 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['width']; $big_image_height = $big_image_size['height']; $url_big_image = $big_image . '?rnd=' . time(); //echo '<a href="javascript:void()" onclick="javascript: return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');" >'; $content .= '<img src="' . $fullurl . '" alt="' . $alt . '" />'; } else { $content .= Display::return_icon('unknown.jpg', get_lang('Unknown')); } if (!empty($status)) { $content .= '<div class="caption">' . $status . '</div>'; } $content .= '</div>'; if (api_get_setting('show_email_addresses') == 'true') { $content .= Display::encrypted_mailto_link($user_object->email, $user_object->email) . '<br />'; } if ($user_object->competences) { $content .= Display::page_subheader(get_lang('MyCompetences')); $content .= '<p>' . $user_object->competences . '</p>'; } if ($user_object->diplomas) { $content .= Display::page_subheader(get_lang('MyDiplomas')); $content .= '<p>' . $user_object->diplomas . '</p>'; } if ($user_object->teach) { $content .= Display::page_subheader(get_lang('MyTeach')); $content .= '<p>' . $user_object->teach . '</p>'; } $content .= SocialManager::display_productions($user_object->user_id); if ($user_object->openarea) { $content .= Display::page_subheader(get_lang('MyPersonalOpenArea')); $content .= '<p>' . $user_object->openarea . '</p>'; } } else { if ($returnContent == false) { Display::display_header(get_lang('UsersOnLineList')); } $content .= '<div class="actions-title">'; $content .= get_lang('UsersOnLineList'); $content .= '</div>'; } if ($returnContent) { return $content; } else { echo $content; } }