profile.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * This is the profile social main page
  5. * @author Julio Montoya <gugli100@gmail.com>
  6. * @author Isaac Flores Paz <florespaz_isaac@hotmail.com>
  7. * @todo use Display::panel()
  8. * @package chamilo.social
  9. */
  10. $cidReset = true;
  11. require_once '../inc/global.inc.php';
  12. // Include OpenGraph NOT AVAILABLE
  13. require_once api_get_path(LIBRARY_PATH).'opengraph/OpenGraph.php';
  14. if (api_get_setting('allow_social_tool') !='true') {
  15. $url = api_get_path(WEB_PATH).'whoisonline.php?id='.intval($_GET['u']);
  16. header('Location: '.$url);
  17. exit;
  18. }
  19. $user_id = api_get_user_id();
  20. $friendId = isset($_GET['u']) ? intval($_GET['u']) : api_get_user_id();
  21. $isAdmin = api_is_platform_admin($user_id);
  22. $userGroup = new UserGroup();
  23. $show_full_profile = true;
  24. //social tab
  25. $this_section = SECTION_SOCIAL;
  26. //Initialize blocks
  27. $social_extra_info_block = null;
  28. $social_course_block = null;
  29. $social_group_info_block = null;
  30. $social_rss_block = null;
  31. $social_session_block = null;
  32. if (!empty($_POST['social_wall_new_msg_main']) || !empty($_FILES['picture']['tmp_name'])) {
  33. $messageId = 0;
  34. $idMessage = SocialManager::sendWallMessage(
  35. api_get_user_id(),
  36. $friendId,
  37. $_POST['social_wall_new_msg_main'],
  38. $messageId,
  39. MESSAGE_STATUS_WALL_POST
  40. );
  41. if (!empty($_FILES['picture']['tmp_name']) && $idMessage > 0) {
  42. $error = SocialManager::sendWallMessageAttachmentFile(
  43. api_get_user_id(),
  44. $_FILES['picture'],
  45. $idMessage,
  46. $fileComment = ''
  47. );
  48. }
  49. $url = api_get_path(WEB_CODE_PATH) . 'social/profile.php';
  50. $url .= empty($_SERVER['QUERY_STRING']) ? '' : '?'.Security::remove_XSS($_SERVER['QUERY_STRING']);
  51. header('Location: ' . $url);
  52. exit;
  53. } else if (!empty($_POST['social_wall_new_msg']) && !empty($_POST['messageId'])) {
  54. $messageId = intval($_POST['messageId']);
  55. $res = SocialManager::sendWallMessage(
  56. api_get_user_id(),
  57. $friendId,
  58. $_POST['social_wall_new_msg'],
  59. $messageId,
  60. MESSAGE_STATUS_WALL
  61. );
  62. $url = api_get_path(WEB_CODE_PATH) . 'social/profile.php';
  63. $url .= empty($_SERVER['QUERY_STRING']) ? '' : '?'.Security::remove_XSS($_SERVER['QUERY_STRING']);
  64. header('Location: ' . $url);
  65. exit;
  66. } else if (isset($_GET['messageId'])) {
  67. $messageId = Security::remove_XSS($_GET['messageId']);
  68. $status = SocialManager::deleteMessage($messageId);
  69. header('Location: ' . api_get_path(WEB_CODE_PATH) . 'social/profile.php');
  70. exit;
  71. } else if (isset($_GET['u'])) { //I'm your friend? I can see your profile?
  72. $user_id = intval($_GET['u']);
  73. if (api_is_anonymous($user_id, true)) {
  74. api_not_allowed(true);
  75. }
  76. // It's me!
  77. if (api_get_user_id() != $user_id) {
  78. $user_info = api_get_user_info($user_id);
  79. $show_full_profile = false;
  80. if (!$user_info) {
  81. // user does no exist !!
  82. api_not_allowed(true);
  83. } else {
  84. //checking the relationship between me and my friend
  85. $my_status = SocialManager::get_relation_between_contacts(
  86. api_get_user_id(),
  87. $user_id
  88. );
  89. if (in_array($my_status, array(
  90. USER_RELATION_TYPE_PARENT,
  91. USER_RELATION_TYPE_FRIEND,
  92. USER_RELATION_TYPE_GOODFRIEND
  93. ))) {
  94. $show_full_profile = true;
  95. }
  96. //checking the relationship between my friend and me
  97. $my_friend_status = SocialManager::get_relation_between_contacts(
  98. $user_id,
  99. api_get_user_id()
  100. );
  101. if (in_array($my_friend_status, array(
  102. USER_RELATION_TYPE_PARENT,
  103. USER_RELATION_TYPE_FRIEND,
  104. USER_RELATION_TYPE_GOODFRIEND
  105. ))) {
  106. $show_full_profile = true;
  107. } else {
  108. // im probably not a good friend
  109. $show_full_profile = false;
  110. }
  111. }
  112. } else {
  113. $user_info = api_get_user_info($user_id);
  114. }
  115. } else {
  116. $user_info = api_get_user_info($user_id);
  117. }
  118. if ($user_info['user_id'] == api_get_user_id()) {
  119. $isSelfUser = true;
  120. } else {
  121. $isSelfUser = false;
  122. }
  123. $userIsOnline = user_is_online($user_id);
  124. $libpath = api_get_path(LIBRARY_PATH);
  125. require_once $libpath.'magpierss/rss_fetch.inc';
  126. $ajax_url = api_get_path(WEB_AJAX_PATH).'message.ajax.php';
  127. $socialAjaxUrl = api_get_path(WEB_AJAX_PATH).'social.ajax.php';
  128. $javascriptDir = api_get_path(LIBRARY_PATH) . 'javascript/';
  129. api_block_anonymous_users();
  130. $locale = api_get_language_isocode();
  131. // Add Jquery scroll pagination plugin
  132. $htmlHeadXtra[] = api_get_js('jscroll/jquery.jscroll.js');
  133. // Add Jquery Time ago plugin
  134. $htmlHeadXtra[] = api_get_asset('jquery-timeago/jquery.timeago.js');
  135. $timeAgoLocaleDir = $javascriptDir . 'jquery-timeago/locales/jquery.timeago.' . $locale . '.js';
  136. if (file_exists($timeAgoLocaleDir)) {
  137. $htmlHeadXtra[] = api_get_js('jquery-timeago/locales/jquery.timeago.' . $locale . '.js');
  138. }
  139. $htmlHeadXtra[] = '<script>
  140. $(document).ready(function (){
  141. var container = $("#wallMessages");
  142. container.jscroll({
  143. loadingHtml: "<div class=\"well_border\">' . get_lang('Loading') . ' </div>",
  144. nextSelector: "a.nextPage:last",
  145. contentSelector: "",
  146. callback: timeAgo
  147. });
  148. timeAgo()
  149. });
  150. function timeAgo() {
  151. $(".timeago").timeago();
  152. }
  153. function register_friend(element_input) {
  154. if (confirm("'.get_lang('AddToFriends').'")) {
  155. name_button=$(element_input).attr("id");
  156. name_div_id="id_"+name_button.substring(13);
  157. user_id=name_div_id.split("_");
  158. user_friend_id=user_id[1];
  159. $.ajax({
  160. contentType: "application/x-www-form-urlencoded",
  161. beforeSend: function(objeto) {
  162. $("div#dpending_"+user_friend_id).html("<img src=\'../inc/lib/javascript/indicator.gif\' />");
  163. },
  164. type: "POST",
  165. url: "'.api_get_path(WEB_AJAX_PATH).'social.ajax.php?a=add_friend",
  166. data: "friend_id="+user_friend_id+"&is_my_friend="+"friend",
  167. success: function(datos) {
  168. $("#dpending_" + user_friend_id).html(datos);
  169. }
  170. });
  171. }
  172. }
  173. </script>';
  174. $link_shared = '';
  175. $nametool = get_lang('ViewMySharedProfile');
  176. if (isset($_GET['shared'])) {
  177. $my_link = '../social/profile.php';
  178. $link_shared = 'shared='.Security::remove_XSS($_GET['shared']);
  179. } else {
  180. $my_link = '../social/profile.php';
  181. $link_shared = '';
  182. }
  183. $interbreadcrumb[] = array(
  184. 'url' => 'home.php',
  185. 'name' => get_lang('SocialNetwork'),
  186. );
  187. if (isset($_GET['u']) && is_numeric($_GET['u']) && $_GET['u'] != api_get_user_id()) {
  188. $info_user = api_get_user_info($_GET['u']);
  189. $interbreadcrumb[]= array(
  190. 'url' => '#',
  191. 'name' => $info_user['complete_name']
  192. );
  193. $nametool = '';
  194. }
  195. if (isset($_GET['u'])) {
  196. $param_user = 'u='.Security::remove_XSS($_GET['u']);
  197. } else {
  198. $info_user = api_get_user_info(api_get_user_id());
  199. $param_user = '';
  200. }
  201. $_SESSION['social_user_id'] = intval($user_id);
  202. // Setting some course info
  203. $my_user_id = isset($_GET['u']) ? intval($_GET['u']) : api_get_user_id();
  204. $personal_course_list = UserManager::get_personal_session_course_list($my_user_id);
  205. $course_list_code = array();
  206. $i = 1;
  207. $list = [];
  208. if (is_array($personal_course_list)) {
  209. foreach ($personal_course_list as $my_course) {
  210. if ($i<=10) {
  211. $list[] = SocialManager::get_logged_user_course_html($my_course, $i);
  212. $course_list_code[] = array('code' => $my_course['code']);
  213. } else {
  214. break;
  215. }
  216. $i++;
  217. }
  218. //to avoid repeted courses
  219. $course_list_code = array_unique_dimensional($course_list_code);
  220. }
  221. //Social Block Menu
  222. $social_menu_block = SocialManager::show_social_menu(
  223. 'shared_profile',
  224. null,
  225. $user_id,
  226. $show_full_profile
  227. );
  228. //Setting some session info
  229. $user_info = api_get_user_info($my_user_id);
  230. $sessionList = SessionManager::getSessionsFollowedByUser(
  231. $my_user_id,
  232. $user_info['status']
  233. );
  234. // My friends
  235. $friend_html = SocialManager::listMyFriendsBlock(
  236. $user_id,
  237. $link_shared,
  238. $show_full_profile
  239. );
  240. $wallSocialAddPost = SocialManager::getWallForm();
  241. $social_wall_block = $wallSocialAddPost;
  242. // Social Post Wall
  243. $posts = SocialManager::getWallMessagesByUser($my_user_id, $friendId) ;
  244. $posts = empty($posts) ? '<p>'.get_lang("NoPosts").'</p>' : $posts;
  245. $social_post_wall_block = Display::panel($posts, get_lang('Posts'));
  246. $socialAutoExtendLink = Display::url(
  247. get_lang('SeeMore'),
  248. $socialAjaxUrl . '?u='. $my_user_id . '&a=listWallMessage&start=10&length=5',
  249. array(
  250. 'class' => 'nextPage next',
  251. )
  252. );
  253. $socialRightInformation = null;
  254. $social_right_content = null;
  255. $show_full_profile = true;
  256. if ($show_full_profile) {
  257. $t_ufo = Database :: get_main_table(TABLE_EXTRA_FIELD_OPTIONS);
  258. $extra_user_data = UserManager::get_extra_user_data($user_id, false, true);
  259. $extra_information = '';
  260. if (is_array($extra_user_data) && count($extra_user_data)>0 ) {
  261. $extra_information_value = '';
  262. $extraField = new ExtraField('user');
  263. foreach ($extra_user_data as $key => $data) {
  264. // Avoiding parameters
  265. if (in_array(
  266. $key,
  267. array(
  268. 'mail_notify_invitation',
  269. 'mail_notify_message',
  270. 'mail_notify_group_message',
  271. )
  272. )) {
  273. continue;
  274. }
  275. // get display text, visibility and type from user_field table
  276. $field_variable = str_replace('extra_', '', $key);
  277. $extraFieldInfo = $extraField->get_handler_field_info_by_field_variable(
  278. $field_variable
  279. );
  280. if ($extraFieldInfo['visible'] != 1) {
  281. continue;
  282. }
  283. if (is_array($data)) {
  284. $extra_information_value .= '<dt>'.ucfirst($extraFieldInfo['display_text']).'</dt>'
  285. .'<dd> '.implode(',', $data).'</dd>';
  286. } else {
  287. switch ($extraFieldInfo['field_type']) {
  288. case ExtraField::FIELD_TYPE_DOUBLE_SELECT:
  289. $id_options = explode(';', $data);
  290. $value_options = array();
  291. // get option display text from user_field_options table
  292. foreach ($id_options as $id_option) {
  293. $sql = "SELECT display_text FROM $t_ufo WHERE id = '$id_option'";
  294. $res_options = Database::query($sql);
  295. $row_options = Database::fetch_row($res_options);
  296. $value_options[] = $row_options[0];
  297. }
  298. $extra_information_value .= '<dt>'.ucfirst($extraFieldInfo['display_text']).':</dt>'
  299. .'<dd>'.implode(' ', $value_options).'</dd>';
  300. break;
  301. case ExtraField::FIELD_TYPE_TAG:
  302. $user_tags = UserManager::get_user_tags($user_id, $extraFieldInfo['id']);
  303. $tag_tmp = array();
  304. foreach ($user_tags as $tags) {
  305. $tag_tmp[] = '<a class="label label_tag"'
  306. .' href="'.api_get_path(WEB_PATH).'main/social/search.php?q='.$tags['tag'].'">'
  307. .$tags['tag']
  308. .'</a>';
  309. }
  310. if (is_array($user_tags) && count($user_tags)>0) {
  311. $extra_information_value .= '<dt>'.ucfirst($extraFieldInfo['display_text']).':</dt>'
  312. .'<dd>'.implode('', $tag_tmp).'</dd>';
  313. }
  314. break;
  315. case ExtraField::FIELD_TYPE_SOCIAL_PROFILE:
  316. $icon_path = UserManager::get_favicon_from_url($data);
  317. $bottom = '0.2';
  318. //quick hack for hi5
  319. $domain = parse_url($icon_path, PHP_URL_HOST);
  320. if ($domain == 'www.hi5.com' or $domain == 'hi5.com') {
  321. $bottom = '-0.8';
  322. }
  323. $data = '<a href="'.$data.'">'
  324. .'<img src="'.$icon_path.'" alt="icon"'
  325. .' style="margin-right:0.5em;margin-bottom:'.$bottom.'em;" />'
  326. .$extraFieldInfo['display_text']
  327. .'</a>';
  328. $extra_information_value .= '<dd>'.$data.'</dd>';
  329. break;
  330. default:
  331. if (!empty($data)) {
  332. $extra_information_value .= '<dt>'.ucfirst($extraFieldInfo['display_text']).':</dt><dd>'.$data.'</dd>';
  333. }
  334. break;
  335. }
  336. }
  337. }
  338. // if there are information to show
  339. if (!empty($extra_information_value)) {
  340. $extra_information .= Display::panel(
  341. $extra_information_value,
  342. get_lang('ExtraInformation')
  343. );
  344. }
  345. }
  346. // If there are information to show Block Extra Information
  347. if (!empty($extra_information_value)) {
  348. $social_extra_info_block = $extra_information;
  349. }
  350. // MY GROUPS
  351. $results = $userGroup->get_groups_by_user($my_user_id, 0);
  352. $grid_my_groups = array();
  353. $max_numbers_of_group = 4;
  354. if (is_array($results) && count($results) > 0) {
  355. $i = 1;
  356. foreach ($results as $result) {
  357. if ($i > $max_numbers_of_group) {
  358. break;
  359. }
  360. $id = $result['id'];
  361. $url_open = '<a href="group_view.php?id='.$id.'">';
  362. $url_close = '</a>';
  363. $icon = '';
  364. $name = cut($result['name'], CUT_GROUP_NAME, true);
  365. if ($result['relation_type'] == GROUP_USER_PERMISSION_ADMIN) {
  366. $icon = Display::return_icon(
  367. 'social_group_admin.png',
  368. get_lang('Admin'),
  369. array('style'=>'vertical-align:middle;width:16px;height:16px;')
  370. );
  371. } elseif ($result['relation_type'] == GROUP_USER_PERMISSION_MODERATOR) {
  372. $icon = Display::return_icon(
  373. 'social_group_moderator.png',
  374. get_lang('Moderator'),
  375. array('style'=>'vertical-align:middle;width:16px;height:16px;')
  376. );
  377. }
  378. $count_users_group = count($userGroup->get_all_users_by_group($id));
  379. if ($count_users_group == 1 ) {
  380. $count_users_group = $count_users_group.' '.get_lang('Member');
  381. } else {
  382. $count_users_group = $count_users_group.' '.get_lang('Members');
  383. }
  384. $item_name = $url_open.$name.$icon.$url_close;
  385. $item_actions = '';
  386. $grid_my_groups[] = array(
  387. $item_name,
  388. $url_open.$result['picture'].$url_close,
  389. $item_actions,
  390. );
  391. $i++;
  392. }
  393. }
  394. // Block My Groups
  395. if (count($grid_my_groups) > 0) {
  396. $my_groups = '';
  397. $count_groups = 0;
  398. if (count($results) == 1 ) {
  399. $count_groups = count($results);
  400. } else {
  401. $count_groups = count($results);
  402. }
  403. $my_groups .= '<div class="panel panel-default">';
  404. $my_groups .= '<div class="panel-heading">'.get_lang('MyGroups').' ('.$count_groups.') </div>';
  405. if ($i > $max_numbers_of_group) {
  406. if (api_get_user_id() == $user_id) {
  407. $my_groups .= '<div class="box_shared_profile_group_actions">'
  408. .'<a href="groups.php?#tab_browse-1">'.get_lang('SeeAllMyGroups').'</a></div>';
  409. } else {
  410. $my_groups .= '<div class="box_shared_profile_group_actions">'
  411. .'<a href="'.api_get_path(WEB_CODE_PATH).'social/profile_friends_and_groups.inc.php'
  412. .'?view=mygroups&height=390&width=610&user_id='.$user_id.'"'
  413. .' class="ajax" title="'.get_lang('SeeAll').'" >'
  414. .get_lang('SeeAllMyGroups')
  415. .'</a></div>';
  416. }
  417. }
  418. $total = count($grid_my_groups);
  419. $i = 1;
  420. foreach ($grid_my_groups as $group) {
  421. $my_groups .= '<div class="panel-body">';
  422. $my_groups .= $group[0];
  423. $my_groups .= '</div>';
  424. $i++;
  425. }
  426. $my_groups .= '</div>';
  427. $social_group_info_block = $my_groups;
  428. }
  429. // Block Social Course
  430. $my_courses = null;
  431. // COURSES LIST
  432. if (is_array($list)) {
  433. // Courses without sessions
  434. $my_course = '';
  435. $i = 1;
  436. foreach ($list as $key => $value) {
  437. if ( empty($value[2]) ) { //if out of any session
  438. $my_courses .= $value[1];
  439. $i++;
  440. }
  441. }
  442. $social_course_block .= $my_courses;
  443. //$social_course_block = Display::panel($my_courses, get_lang('MyCourses'));
  444. }
  445. // Block Social Sessions
  446. if (count($sessionList) > 0) {
  447. //$social_session_block = $htmlSessionList;
  448. $social_session_block = $sessionList;
  449. }
  450. // Block Social User Feeds
  451. $user_feeds = SocialManager::get_user_feeds($user_id);
  452. if (!empty($user_feeds)) {
  453. $social_rss_block = Display::panel($user_feeds, get_lang('RSSFeeds'));
  454. }
  455. // Productions
  456. $production_list = UserManager::build_production_list($user_id);
  457. // Images uploaded by course
  458. $file_list = '';
  459. if (is_array($course_list_code) && count($course_list_code)>0) {
  460. foreach ($course_list_code as $course) {
  461. $file_list.= UserManager::get_user_upload_files_by_course($user_id,$course['code'],$resourcetype='images');
  462. }
  463. }
  464. $count_pending_invitations = 0;
  465. if (!isset($_GET['u']) ||
  466. (isset($_GET['u']) && $_GET['u']==api_get_user_id())
  467. ) {
  468. $pending_invitations = SocialManager::get_list_invitation_of_friends_by_user_id(api_get_user_id());
  469. $list_get_path_web = SocialManager::get_list_web_path_user_invitation_by_user_id(api_get_user_id());
  470. $count_pending_invitations = count($pending_invitations);
  471. }
  472. if (!empty($production_list) || !empty($file_list) || $count_pending_invitations > 0) {
  473. //Pending invitations
  474. if (!isset($_GET['u']) || (isset($_GET['u']) && $_GET['u']==api_get_user_id())) {
  475. if ($count_pending_invitations > 0) {
  476. $invitations = '<div><h3>'.get_lang('PendingInvitations').'</h3></div>';
  477. for ($i=0;$i<$count_pending_invitations;$i++) {
  478. $user_invitation_id = $pending_invitations[$i]['user_sender_id'];
  479. $invitations .= '<div id="dpending_'.$user_invitation_id.'" class="friend_invitations">';
  480. $invitations .= '<div style="float:left;width:60px;" >';
  481. $invitations .= '<img style="margin-bottom:5px;"'
  482. .' src="'.$list_get_path_web[$i]['dir'].'/'.$list_get_path_web[$i]['file'].'"'
  483. .' width="60px">';
  484. $invitations .= '</div>';
  485. $invitations .= '<div style="padding-left:70px;">';
  486. $user_invitation_info = api_get_user_info($user_invitation_id);
  487. $invitations .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php'
  488. .'?u='.$user_invitation_id.'">'
  489. .api_get_person_name(
  490. $user_invitation_info['firstname'],
  491. $user_invitation_info['lastname'])
  492. .'</a>';
  493. $invitations .= '<br />';
  494. $invitations .= Security::remove_XSS(
  495. cut($pending_invitations[$i]['content'], 50),
  496. STUDENT,
  497. true
  498. );
  499. $invitations .= '<br />';
  500. $invitations .= '<a id="btn_accepted_'.$user_invitation_id.'"'
  501. .' class="btn btn-default" onclick="register_friend(this)" href="javascript:void(0)">'
  502. .get_lang('SocialAddToFriends')
  503. .'</a>';
  504. $invitations .= '<div id="id_response"></div>';
  505. $invitations .= '</div>';
  506. $invitations .= '</div>';
  507. }
  508. $socialRightInformation .= SocialManager::social_wrapper_div($invitations, 4);
  509. }
  510. }
  511. // Productions
  512. $production_list = UserManager::build_production_list($user_id);
  513. $product_content = '';
  514. if (!empty($production_list)) {
  515. $product_content .= '<div><h3>'.get_lang('MyProductions').'</h3></div>';
  516. $product_content .= $production_list;
  517. $socialRightInformation .= SocialManager::social_wrapper_div($product_content, 4);
  518. }
  519. $images_uploaded = null;
  520. // Images uploaded by course
  521. if (!empty($file_list)) {
  522. $images_uploaded .= '<div><h3>'.get_lang('ImagesUploaded').'</h3></div>';
  523. $images_uploaded .= '<div class="social-content-information">';
  524. $images_uploaded .= $file_list;
  525. $images_uploaded .= '</div>';
  526. $socialRightInformation .= SocialManager::social_wrapper_div($images_uploaded, 4);
  527. }
  528. }
  529. if (!empty($user_info['competences']) || !empty($user_info['diplomas'])
  530. || !empty($user_info['openarea']) || !empty($user_info['teach']) ) {
  531. $more_info .= '<div><h3>'.get_lang('MoreInformation').'</h3></div>';
  532. if (!empty($user_info['competences'])) {
  533. $more_info .= '<br />';
  534. $more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyCompetences').'</strong></div>';
  535. $more_info .= '<div class="social-profile-extended">'.$user_info['competences'].'</div>';
  536. $more_info .= '<br />';
  537. }
  538. if (!empty($user_info['diplomas'])) {
  539. $more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyDiplomas').'</strong></div>';
  540. $more_info .= '<div class="social-profile-extended">'.$user_info['diplomas'].'</div>';
  541. $more_info .= '<br />';
  542. }
  543. if (!empty($user_info['openarea'])) {
  544. $more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyPersonalOpenArea').'</strong></div>';
  545. $more_info .= '<div class="social-profile-extended">'.$user_info['openarea'].'</div>';
  546. $more_info .= '<br />';
  547. }
  548. if (!empty($user_info['teach'])) {
  549. $more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyTeach').'</strong></div>';
  550. $more_info .= '<div class="social-profile-extended">'.$user_info['teach'].'</div>';
  551. $more_info .= '<br />';
  552. }
  553. $socialRightInformation .= SocialManager::social_wrapper_div($more_info, 4);
  554. }
  555. }
  556. $tpl = new Template(get_lang('Social'));
  557. // Block Avatar Social
  558. SocialManager::setSocialUserBlock($tpl, $user_id, 'shared_profile');
  559. $tpl->assign('social_friend_block', $friend_html);
  560. $tpl->assign('social_menu_block', $social_menu_block);
  561. $tpl->assign('social_wall_block', $social_wall_block);
  562. $tpl->assign('social_post_wall_block', $social_post_wall_block);
  563. $tpl->assign('social_extra_info_block', $social_extra_info_block);
  564. $tpl->assign('social_course_block', $social_course_block);
  565. $tpl->assign('social_group_info_block', $social_group_info_block);
  566. $tpl->assign('social_rss_block', $social_rss_block);
  567. $tpl->assign('social_skill_block', SocialManager::getSkillBlock($my_user_id));
  568. $tpl->assign('sessionList', $social_session_block);
  569. $tpl->assign('social_right_information', $socialRightInformation);
  570. $tpl->assign('social_auto_extend_link', $socialAutoExtendLink);
  571. $formModalTpl = new Template();
  572. $formModalTpl->assign('messageForm', MessageManager::generate_message_form('send_message'));
  573. $formModalTpl->assign('invitationForm', MessageManager::generate_invitation_form('send_invitation'));
  574. $formModals = $formModalTpl->fetch('default/social/form_modals.tpl');
  575. $tpl->assign('formModals', $formModals);
  576. $social_layout = $tpl->get_template('social/profile.tpl');
  577. $tpl->display($social_layout);