user_information.php 23 KB

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