hrm_courses.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. require_once __DIR__.'/../inc/global.inc.php';
  4. api_block_anonymous_users();
  5. $isHrm = api_is_drh();
  6. if (!$isHrm) {
  7. api_not_allowed(true);
  8. }
  9. $hrm = api_get_user_entity(api_get_user_id());
  10. $assignedUsers = UserManager::get_users_followed_by_drh($hrm->getId());
  11. $users = [];
  12. $courseController = new IndexManager('');
  13. foreach ($assignedUsers as $assignedUserId => $assignedUserInfo) {
  14. $assignedUser = api_get_user_entity($assignedUserId);
  15. if (!$assignedUser) {
  16. continue;
  17. }
  18. $userInfo = [
  19. 'username' => $assignedUser->getUsername(),
  20. 'complete_name' => UserManager::formatUserFullName($assignedUser),
  21. 'picture_url' => UserManager::getUserPicture($assignedUserId),
  22. 'course_list' => $courseController->returnCoursesAndSessions($assignedUserId)['html'],
  23. ];
  24. $users[$assignedUser->getId()] = $userInfo;
  25. }
  26. $toolName = get_lang('Human Resources Manager assigned users course list');
  27. $view = new Template($toolName);
  28. $view->assign('users', $users);
  29. $content = $view->fetch(
  30. $view->get_template('auth/hrm_courses.tpl')
  31. );
  32. $view->assign('header', $toolName);
  33. $view->assign('content', $content);
  34. $view->display_one_col_template();