user_information.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. use Chamilo\CoreBundle\Entity\UserRelUser;
  4. use Chamilo\UserBundle\Entity\User;
  5. /**
  6. * Script showing information about a user (name, e-mail, courses and sessions).
  7. *
  8. * @author Bart Mollet
  9. *
  10. * @package chamilo.admin
  11. */
  12. $cidReset = true;
  13. require_once __DIR__.'/../inc/global.inc.php';
  14. $this_section = SECTION_PLATFORM_ADMIN;
  15. require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
  16. require_once api_get_path(SYS_CODE_PATH).'work/work.lib.php';
  17. $userId = isset($_GET['user_id']) ? (int) $_GET['user_id'] : 0;
  18. if (empty($userId)) {
  19. api_not_allowed(true);
  20. }
  21. $user = api_get_user_info($userId, true);
  22. if (empty($user)) {
  23. api_not_allowed(true);
  24. }
  25. /** @var User $userEntity */
  26. $userEntity = api_get_user_entity($user['user_id']);
  27. $myUserId = api_get_user_id();
  28. if (!api_is_student_boss()) {
  29. api_protect_admin_script();
  30. } else {
  31. $isBoss = UserManager::userIsBossOfStudent($myUserId, $user['user_id']);
  32. if (!$isBoss) {
  33. api_not_allowed(true);
  34. }
  35. }
  36. $interbreadcrumb[] = ["url" => 'index.php', 'name' => get_lang('PlatformAdmin')];
  37. $interbreadcrumb[] = ["url" => 'user_list.php', 'name' => get_lang('UserList')];
  38. $userId = $user['user_id'];
  39. $currentUrl = api_get_self().'?user_id='.$userId;
  40. $tool_name = UserManager::formatUserFullName($userEntity);
  41. $table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
  42. $table_course = Database::get_main_table(TABLE_MAIN_COURSE);
  43. $csvContent = [];
  44. // only allow platform admins to login_as, or session admins only for students (not teachers nor other admins)
  45. $actions = [
  46. Display::url(
  47. Display::return_icon(
  48. 'statistics.png',
  49. get_lang('Reporting'),
  50. [],
  51. ICON_SIZE_MEDIUM
  52. ),
  53. api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?'.http_build_query([
  54. 'student' => $userId,
  55. ]),
  56. ['title' => get_lang('Reporting')]
  57. ),
  58. ];
  59. if (api_can_login_as($userId)) {
  60. $actions[] = Display::url(
  61. Display::return_icon(
  62. 'login_as.png',
  63. get_lang('LoginAs'),
  64. [],
  65. ICON_SIZE_MEDIUM
  66. ),
  67. api_get_path(WEB_CODE_PATH).'admin/user_list.php?action=login_as&user_id='.$userId.'&sec_token='.Security::getTokenFromSession()
  68. );
  69. }
  70. if (api_is_platform_admin()) {
  71. $actions[] = Display::url(
  72. Display::return_icon(
  73. 'edit.png',
  74. get_lang('Edit'),
  75. [],
  76. ICON_SIZE_MEDIUM
  77. ),
  78. api_get_path(WEB_CODE_PATH).'admin/user_edit.php?user_id='.$userId
  79. );
  80. $actions[] = Display::url(
  81. Display::return_icon(
  82. 'export_csv.png',
  83. get_lang('ExportAsCSV'),
  84. [],
  85. ICON_SIZE_MEDIUM
  86. ),
  87. api_get_self().'?user_id='.$userId.'&action=export'
  88. );
  89. $actions[] = Display::url(
  90. Display::return_icon(
  91. 'vcard.png',
  92. get_lang('UserInfo'),
  93. [],
  94. ICON_SIZE_MEDIUM
  95. ),
  96. api_get_path(WEB_PATH).'main/social/vcard_export.php?userId='.$userId
  97. );
  98. $actions[] = Display::url(
  99. Display::return_icon('new_group.png', get_lang('AddHrmToUser'), [], ICON_SIZE_MEDIUM),
  100. api_get_path(WEB_CODE_PATH).'admin/add_drh_to_user.php?u='.$userId
  101. );
  102. if (Skill::isAllowed($userId, false)) {
  103. $actions[] = Display::url(
  104. Display::return_icon(
  105. 'skill-badges.png',
  106. get_lang('AddSkill'),
  107. [],
  108. ICON_SIZE_MEDIUM,
  109. false
  110. ),
  111. api_get_path(WEB_CODE_PATH).'badge/assign.php?user='.$userId
  112. );
  113. }
  114. }
  115. $studentBossList = UserManager::getStudentBossList($userId);
  116. $studentBossListToString = '';
  117. if (!empty($studentBossList)) {
  118. $table = new HTML_Table(['class' => 'data_table']);
  119. $table->setHeaderContents(0, 0, get_lang('User'));
  120. $csvContent[] = [get_lang('StudentBoss')];
  121. $row = 1;
  122. foreach ($studentBossList as $studentBossId) {
  123. $studentBoss = api_get_user_info($studentBossId['boss_id']);
  124. $table->setCellContents($row, 0, $studentBoss['complete_name_with_message_link']);
  125. $csvContent[] = [$studentBoss['complete_name_with_username']];
  126. $row++;
  127. }
  128. $studentBossListToString = $table->toHtml();
  129. }
  130. $registrationDate = $user['registration_date'];
  131. $table = new HTML_Table(['class' => 'data_table']);
  132. $table->setHeaderContents(0, 0, get_lang('Information'));
  133. $csvContent[] = [get_lang('Information')];
  134. $data = [
  135. get_lang('Name') => $user['complete_name'],
  136. get_lang('Email') => $user['email'],
  137. get_lang('Phone') => $user['phone'],
  138. get_lang('OfficialCode') => $user['official_code'],
  139. get_lang('Online') => !empty($user['user_is_online']) ? Display::return_icon('online.png') : Display::return_icon('offline.png'),
  140. get_lang('Status') => $user['status'] == 1 ? get_lang('Teacher') : get_lang('Student'),
  141. ];
  142. // Show info about who created this user and when
  143. $creatorId = $user['creator_id'];
  144. $creatorInfo = api_get_user_info($creatorId);
  145. if (!empty($creatorId) && !empty($creatorInfo)) {
  146. $data[null] = sprintf(
  147. get_lang('CreatedByXYOnZ'),
  148. 'user_information.php?user_id='.$creatorId,
  149. $creatorInfo['username'],
  150. api_get_utc_datetime($registrationDate)
  151. );
  152. }
  153. $row = 1;
  154. foreach ($data as $label => $item) {
  155. if (!empty($label)) {
  156. $label = $label.': ';
  157. }
  158. $table->setCellContents($row, 0, $label.$item);
  159. $csvContent[] = [$label, strip_tags($item)];
  160. $row++;
  161. }
  162. $userInformation = $table->toHtml();
  163. $table = new HTML_Table(['class' => 'data_table']);
  164. $table->setHeaderContents(0, 0, get_lang('Tracking'));
  165. $csvContent[] = [get_lang('Tracking')];
  166. $data = [
  167. get_lang('FirstLogin') => Tracking::get_first_connection_date($userId),
  168. get_lang('LatestLogin') => Tracking::get_last_connection_date($userId, true),
  169. ];
  170. if (api_get_setting('allow_terms_conditions') === 'true') {
  171. $extraFieldValue = new ExtraFieldValue('user');
  172. $value = $extraFieldValue->get_values_by_handler_and_field_variable(
  173. $userId,
  174. 'legal_accept'
  175. );
  176. $icon = Display::return_icon('accept_na.png');
  177. if (!empty($value['value'])) {
  178. list($legalId, $legalLanguageId, $legalTime) = explode(':', $value['value']);
  179. $icon = Display::return_icon('accept.png').' '.api_get_local_time($legalTime);
  180. $icon .= ' '.Display::url(
  181. get_lang('DeleteLegal'),
  182. api_get_self().'?action=delete_legal&user_id='.$userId,
  183. ['class' => 'btn btn-danger btn-xs']
  184. );
  185. } else {
  186. $icon .= ' '.Display::url(
  187. get_lang('SendLegal'),
  188. api_get_self().'?action=send_legal&user_id='.$userId,
  189. ['class' => 'btn btn-primary btn-xs']
  190. );
  191. }
  192. $data[get_lang('LegalAccepted')] = $icon;
  193. }
  194. $row = 1;
  195. foreach ($data as $label => $item) {
  196. if (!empty($label)) {
  197. $label = $label.': ';
  198. }
  199. $table->setCellContents($row, 0, $label.$item);
  200. $csvContent[] = [$label, strip_tags($item)];
  201. $row++;
  202. }
  203. $trackingInformation = $table->toHtml();
  204. $socialInformation = '';
  205. /**
  206. * Show social activity.
  207. */
  208. if (api_get_setting('allow_social_tool') === 'true') {
  209. $userObject = api_get_user_entity($user['user_id']);
  210. $data = [];
  211. // Calculate values
  212. if (api_get_setting('allow_message_tool') === 'true') {
  213. $messagesSent = SocialManager::getCountMessagesSent($user['user_id']);
  214. $data[] = [get_lang('MessagesSent'), $messagesSent];
  215. $messagesReceived = SocialManager::getCountMessagesReceived($user['user_id']);
  216. $data[] = [get_lang('MessagesReceived'), $messagesReceived];
  217. }
  218. $wallMessagesPosted = SocialManager::getCountWallPostedMessages($user['user_id']);
  219. $data[] = [get_lang('WallMessagesPosted'), $wallMessagesPosted];
  220. $friends = SocialManager::getCountFriends($user['user_id']);
  221. $data[] = [get_lang('Friends'), $friends];
  222. $count = SocialManager::getCountInvitationSent($user['user_id']);
  223. $data[] = [get_lang('InvitationSent'), $count];
  224. $count = SocialManager::get_message_number_invitation_by_user_id($user['user_id']);
  225. $data[] = [get_lang('InvitationReceived'), $count];
  226. $socialInformation = Display::return_sortable_table('', $data);
  227. }
  228. /**
  229. * Show the sessions in which this user is subscribed.
  230. */
  231. $sessions = SessionManager::get_sessions_by_user($userId, true);
  232. $personal_course_list = [];
  233. $courseToolInformationTotal = null;
  234. $sessionInformation = '';
  235. if (count($sessions) > 0) {
  236. $header = [
  237. [get_lang('Code'), true],
  238. [get_lang('Title'), true],
  239. [get_lang('Status'), true],
  240. [get_lang('TimeSpentInTheCourse'), true],
  241. [get_lang('TotalPostsInAllForums'), true],
  242. ['', false],
  243. ];
  244. $headerList = [];
  245. foreach ($header as $item) {
  246. $headerList[] = $item[0];
  247. }
  248. $csvContent[] = [];
  249. $csvContent[] = [get_lang('Sessions')];
  250. foreach ($sessions as $session_item) {
  251. $data = [];
  252. $personal_course_list = [];
  253. $id_session = $session_item['session_id'];
  254. $csvContent[] = [$session_item['session_name']];
  255. $csvContent[] = $headerList;
  256. foreach ($session_item['courses'] as $my_course) {
  257. $courseInfo = api_get_course_info_by_id($my_course['real_id']);
  258. $sessionStatus = SessionManager::get_user_status_in_course_session(
  259. $userId,
  260. $courseInfo['real_id'],
  261. $id_session
  262. );
  263. $status = null;
  264. switch ($sessionStatus) {
  265. case 0:
  266. case STUDENT:
  267. $status = get_lang('Student');
  268. break;
  269. case 2:
  270. $status = get_lang('CourseCoach');
  271. break;
  272. }
  273. $tools = Display::url(
  274. Display::return_icon('statistics.png', get_lang('Stats')),
  275. api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?details=true&student='.$userId.'&id_session='.$id_session.'&course='.$courseInfo['code']
  276. );
  277. $tools .= '&nbsp;<a href="course_information.php?code='.$courseInfo['code'].'&id_session='.$id_session.'">'.
  278. Display::return_icon('info2.png', get_lang('Overview')).'</a>'.
  279. '<a href="'.$courseInfo['course_public_url'].'?id_session='.$id_session.'">'.
  280. Display::return_icon('course_home.png', get_lang('CourseHomepage')).'</a>';
  281. if (!empty($my_course['status']) && $my_course['status'] == STUDENT) {
  282. $tools .= '<a href="user_information.php?action=unsubscribe_session_course&course_id='.$courseInfo['real_id'].'&user_id='.$userId.'&id_session='.$id_session.'">'.
  283. Display::return_icon('delete.png', get_lang('Delete')).'</a>';
  284. }
  285. $timeSpent = api_time_to_hms(
  286. Tracking :: get_time_spent_on_the_course(
  287. $userId,
  288. $courseInfo['real_id'],
  289. $id_session
  290. )
  291. );
  292. $totalForumMessages = CourseManager::getCountPostInForumPerUser(
  293. $userId,
  294. $courseInfo['real_id'],
  295. $id_session
  296. );
  297. $row = [
  298. Display::url(
  299. $courseInfo['code'],
  300. $courseInfo['course_public_url'].'?id_session='.$id_session
  301. ),
  302. $courseInfo['title'],
  303. $status,
  304. $timeSpent,
  305. $totalForumMessages,
  306. $tools,
  307. ];
  308. $csvContent[] = array_map('strip_tags', $row);
  309. $data[] = $row;
  310. $result = Tracking::getToolInformation(
  311. $userId,
  312. $courseInfo,
  313. $id_session
  314. );
  315. if (!empty($result['html'])) {
  316. $courseToolInformationTotal .= $result['html'];
  317. $csvContent = array_merge($csvContent, $result['array']);
  318. }
  319. }
  320. $dates = array_filter(
  321. [$session_item['access_start_date'], $session_item['access_end_date']]
  322. );
  323. $sessionInformation .= Display::page_subheader(
  324. '<a href="'.api_get_path(WEB_CODE_PATH).'session/resume_session.php?id_session='.$id_session.'">'.
  325. $session_item['session_name'].'</a>',
  326. ' '.implode(' - ', $dates)
  327. );
  328. $sessionInformation .= Display::return_sortable_table(
  329. $header,
  330. $data,
  331. [],
  332. [],
  333. ['user_id' => $userId]
  334. );
  335. $sessionInformation .= $courseToolInformationTotal;
  336. }
  337. } else {
  338. $sessionInformation = '<p>'.get_lang('NoSessionsForThisUser').'</p>';
  339. }
  340. $courseToolInformationTotal = '';
  341. /**
  342. * Show the courses in which this user is subscribed.
  343. */
  344. $sql = 'SELECT * FROM '.$table_course_user.' cu, '.$table_course.' c
  345. WHERE
  346. cu.user_id = '.$userId.' AND
  347. cu.c_id = c.id AND
  348. cu.relation_type <> '.COURSE_RELATION_TYPE_RRHH.' ';
  349. $res = Database::query($sql);
  350. if (Database::num_rows($res) > 0) {
  351. $header = [
  352. [get_lang('Code')],
  353. [get_lang('Title')],
  354. [get_lang('Status')],
  355. [get_lang('TimeSpentInTheCourse')],
  356. [get_lang('TotalPostsInAllForums')],
  357. [''],
  358. ];
  359. $headerList = [];
  360. foreach ($header as $item) {
  361. $headerList[] = $item[0];
  362. }
  363. $csvContent[] = [];
  364. $csvContent[] = [get_lang('Courses')];
  365. $csvContent[] = $headerList;
  366. $data = [];
  367. $courseToolInformationTotal = null;
  368. while ($course = Database::fetch_object($res)) {
  369. $courseInfo = api_get_course_info_by_id($course->c_id);
  370. $courseCode = $courseInfo['code'];
  371. $courseToolInformation = null;
  372. $tools = Display::url(
  373. Display::return_icon('statistics.png', get_lang('Stats')),
  374. api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?details=true&student='.$userId.'&id_session=0&course='.$courseCode
  375. );
  376. $tools .= '&nbsp;<a href="course_information.php?code='.$courseCode.'">'.
  377. Display::return_icon('info2.png', get_lang('Overview')).'</a>'.
  378. '<a href="'.$courseInfo['course_public_url'].'">'.
  379. Display::return_icon('course_home.png', get_lang('CourseHomepage')).'</a>'.
  380. '<a href="course_edit.php?id='.$course->c_id.'">'.
  381. Display::return_icon('edit.png', get_lang('Edit')).'</a>';
  382. if ($course->status == STUDENT) {
  383. $tools .= '<a href="user_information.php?action=unsubscribe&course_id='.$courseInfo['real_id'].'&user_id='.$userId.'">'.
  384. Display::return_icon('delete.png', get_lang('Delete')).'</a>';
  385. }
  386. $timeSpent = api_time_to_hms(
  387. Tracking::get_time_spent_on_the_course(
  388. $userId,
  389. $courseInfo['real_id']
  390. )
  391. );
  392. $totalForumMessages = CourseManager::getCountPostInForumPerUser(
  393. $userId,
  394. $course->id,
  395. 0
  396. );
  397. $row = [
  398. Display::url($courseCode, $courseInfo['course_public_url']),
  399. $course->title,
  400. $course->status == STUDENT ? get_lang('Student') : get_lang('Teacher'),
  401. $timeSpent,
  402. $totalForumMessages,
  403. $tools,
  404. ];
  405. $csvContent[] = array_map('strip_tags', $row);
  406. $data[] = $row;
  407. $result = Tracking::getToolInformation(
  408. $userId,
  409. $courseInfo,
  410. 0
  411. );
  412. $courseToolInformationTotal .= $result['html'];
  413. $csvContent = array_merge($csvContent, $result['array']);
  414. }
  415. $courseInformation = Display::return_sortable_table(
  416. $header,
  417. $data,
  418. [],
  419. [],
  420. ['user_id' => $userId]
  421. );
  422. $courseInformation .= $courseToolInformationTotal;
  423. } else {
  424. $courseInformation = '<p>'.get_lang('NoCoursesForThisUser').'</p>';
  425. }
  426. /**
  427. * Show the URL in which this user is subscribed.
  428. */
  429. $urlInformation = '';
  430. if (api_is_multiple_url_enabled()) {
  431. $urlList = UrlManager::get_access_url_from_user($userId);
  432. if (count($urlList) > 0) {
  433. $header = [];
  434. $header[] = ['URL', true];
  435. $data = [];
  436. $csvContent[] = [];
  437. $csvContent[] = ['Url'];
  438. foreach ($urlList as $url) {
  439. $row = [];
  440. $row[] = Display::url($url['url'], $url['url']);
  441. $csvContent[] = array_map('strip_tags', $row);
  442. $data[] = $row;
  443. }
  444. $urlInformation = Display::page_subheader(get_lang('URLList'));
  445. $urlInformation .= Display::return_sortable_table(
  446. $header,
  447. $data,
  448. [],
  449. [],
  450. ['user_id' => $userId]
  451. );
  452. } else {
  453. $urlInformation = '<p>'.get_lang('NoUrlForThisUser').'</p>';
  454. }
  455. }
  456. if (isset($_GET['action'])) {
  457. switch ($_GET['action']) {
  458. case 'send_legal':
  459. /*$subject = get_lang('SendLegalSubject');
  460. $content = sprintf(
  461. get_lang('SendLegalDescriptionToUrlX'),
  462. api_get_path(WEB_PATH)
  463. );
  464. MessageManager::send_message_simple($userId, $subject, $content);
  465. Display::addFlash(Display::return_message(get_lang('Sent')));*/
  466. // ofaj
  467. LegalManager::sendLegal($userId);
  468. break;
  469. case 'delete_legal':
  470. // ofaj
  471. LegalManager::deleteLegal($userId);
  472. /*$extraFieldValue = new ExtraFieldValue('user');
  473. $value = $extraFieldValue->get_values_by_handler_and_field_variable(
  474. $userId,
  475. 'legal_accept'
  476. );
  477. $result = $extraFieldValue->delete($value['id']);
  478. if ($result) {
  479. Display::addFlash(Display::return_message(get_lang('Deleted')));
  480. }*/
  481. break;
  482. case 'unsubscribe':
  483. $courseId = !empty($_GET['course_id']) ? (int) $_GET['course_id'] : 0;
  484. $sessionId = !empty($_GET['id_session']) ? (int) $_GET['id_session'] : 0;
  485. $courseInfo = api_get_course_info_by_id($courseId);
  486. if (empty($courseInfo)) {
  487. break;
  488. }
  489. if (CourseManager::getUserInCourseStatus($userId, $courseInfo['real_id']) == STUDENT) {
  490. CourseManager::unsubscribe_user($userId, $courseInfo['code'], $sessionId);
  491. Display::addFlash(Display::return_message(get_lang('UserUnsubscribed')));
  492. } else {
  493. Display::addFlash(Display::return_message(
  494. get_lang('CannotUnsubscribeUserFromCourse'),
  495. 'error',
  496. false
  497. ));
  498. }
  499. header('Location: '.$currentUrl);
  500. exit;
  501. break;
  502. case 'unsubscribe_session_course':
  503. $courseId = !empty($_GET['course_id']) ? (int) $_GET['course_id'] : 0;
  504. $sessionId = !empty($_GET['id_session']) ? (int) $_GET['id_session'] : 0;
  505. SessionManager::removeUsersFromCourseSession(
  506. [$userId],
  507. $sessionId,
  508. api_get_course_info_by_id($courseId)
  509. );
  510. Display::addFlash(Display::return_message(get_lang('UserUnsubscribed')));
  511. header('Location: '.$currentUrl);
  512. exit;
  513. break;
  514. case 'export':
  515. Export::arrayToCsv(
  516. $csvContent,
  517. 'user_information_'.$user['user_id']
  518. );
  519. exit;
  520. break;
  521. }
  522. }
  523. Display::display_header($tool_name);
  524. echo Display::toolbarAction('toolbar-user-information', [implode(PHP_EOL, $actions)]);
  525. echo Display::page_header($tool_name);
  526. $fullUrlBig = UserManager::getUserPicture(
  527. $userId,
  528. USER_IMAGE_SIZE_BIG
  529. );
  530. $fullUrl = UserManager::getUserPicture(
  531. $userId,
  532. USER_IMAGE_SIZE_ORIGINAL
  533. );
  534. echo '<div class="row">';
  535. echo '<div class="col-md-2">';
  536. echo '<a class="thumbnail expand-image" href="'.$fullUrlBig.'">'
  537. .'<img src="'.$fullUrl.'" /></a><br />';
  538. echo '</div>';
  539. echo '<div class="col-md-5">';
  540. echo $userInformation;
  541. echo '</div>';
  542. echo '<div class="col-md-5">';
  543. echo $trackingInformation;
  544. echo '</div>';
  545. echo '</div>';
  546. if ($studentBossList) {
  547. echo Display::page_subheader(get_lang('StudentBossList'));
  548. echo $studentBossListToString;
  549. }
  550. $em = Database::getManager();
  551. $userRepository = UserManager::getRepository();
  552. $hrmList = $userRepository->getAssignedHrmUserList(
  553. $userEntity->getId(),
  554. api_get_current_access_url_id()
  555. );
  556. if ($hrmList) {
  557. echo Display::page_subheader(get_lang('HrmList'));
  558. echo '<div class="row">';
  559. /** @var UserRelUser $hrm */
  560. foreach ($hrmList as $hrm) {
  561. $hrmInfo = api_get_user_info($hrm->getFriendUserId());
  562. $userPicture = isset($hrmInfo['avatar_medium']) ? $hrmInfo['avatar_medium'] : $hrmInfo['avatar'];
  563. echo '<div class="col-sm-4 col-md-3">';
  564. echo '<div class="media">';
  565. echo '<div class="media-left">';
  566. echo Display::img($userPicture, $hrmInfo['complete_name'], ['class' => 'media-object'], false);
  567. echo '</div>';
  568. echo '<div class="media-body">';
  569. echo '<h4 class="media-heading">'.$hrmInfo['complete_name_with_message_link'].'</h4>';
  570. echo $hrmInfo['username'];
  571. echo '</div>';
  572. echo '</div>';
  573. echo '</div>';
  574. }
  575. echo '</div>';
  576. }
  577. if ($user['status'] == DRH) {
  578. $usersAssigned = UserManager::get_users_followed_by_drh($userId);
  579. if ($usersAssigned) {
  580. echo Display::page_subheader(get_lang('AssignedUsersListToHumanResourcesManager'));
  581. echo '<div class="row">';
  582. foreach ($usersAssigned as $userAssigned) {
  583. $userAssigned = api_get_user_info($userAssigned['user_id']);
  584. $userPicture = isset($userAssigned['avatar_medium']) ? $userAssigned['avatar_medium'] : $userAssigned['avatar'];
  585. echo '<div class="col-sm-4 col-md-3">';
  586. echo '<div class="media">';
  587. echo '<div class="media-left">';
  588. echo Display::img($userPicture, $userAssigned['complete_name'], ['class' => 'media-object'], false);
  589. echo '</div>';
  590. echo '<div class="media-body">';
  591. echo '<h4 class="media-heading">'.$userAssigned['complete_name_with_message_link'].'</h4>';
  592. echo $userAssigned['official_code'];
  593. echo '</div>';
  594. echo '</div>';
  595. echo '</div>';
  596. }
  597. echo '</div>';
  598. }
  599. }
  600. if (api_get_setting('allow_social_tool') === 'true') {
  601. echo Display::page_subheader(get_lang('SocialData'));
  602. echo $socialInformation;
  603. }
  604. echo Display::page_subheader(get_lang('SessionList'));
  605. echo $sessionInformation;
  606. echo Display::page_subheader(get_lang('CourseList'));
  607. echo $courseInformation;
  608. echo $urlInformation;
  609. echo Tracking::displayUserSkills(
  610. $user['user_id'],
  611. 0,
  612. 0
  613. );
  614. Display::display_footer();