user_information.php 23 KB

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