activity.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * HOME PAGE FOR EACH COURSE
  5. *
  6. * This page, included in every course's index.php is the home
  7. * page. To make administration simple, the teacher edits his
  8. * course from the home page. Only the login detects that the
  9. * visitor is allowed to activate, deactivate home page links,
  10. * access to the teachers tools (statistics, edit forums...).
  11. *
  12. * @package chamilo.course_home
  13. */
  14. function return_block($title, $content)
  15. {
  16. $html = '<div class="page-header">
  17. <h3>'.$title.'</h3>
  18. </div>
  19. '.$content.'</div>';
  20. return $html;
  21. }
  22. $session_id = api_get_session_id();
  23. global $app;
  24. $urlGenerator = $app['url_generator'];
  25. $content = null;
  26. // Start of tools for CourseAdmins (teachers/tutors)
  27. $totalList = array();
  28. if ($session_id == 0 && api_is_course_admin() && api_is_allowed_to_edit(null, true)) {
  29. $list = CourseHome::get_tools_category(TOOL_AUTHORING);
  30. $result = CourseHome::show_tools_category($urlGenerator, $list);
  31. $content .= return_block(get_lang('Authoring'), $result['content']);
  32. $totalList = $result['tool_list'];
  33. $list = CourseHome::get_tools_category(TOOL_INTERACTION);
  34. $list2 = CourseHome::get_tools_category(TOOL_COURSE_PLUGIN);
  35. $list = array_merge($list, $list2);
  36. $result = CourseHome::show_tools_category($urlGenerator, $list);
  37. $totalList = array_merge($totalList, $result['tool_list']);
  38. $content .= return_block(get_lang('Interaction'), $result['content']);
  39. $list = CourseHome::get_tools_category(TOOL_ADMIN_PLATFORM);
  40. $totalList = array_merge($totalList, $list);
  41. $result = CourseHome::show_tools_category($urlGenerator, $list);
  42. $totalList = array_merge($totalList, $result['tool_list']);
  43. $content .= return_block(get_lang('Administration'), $result['content']);
  44. } elseif (api_is_coach()) {
  45. $content .= '<div class="row">';
  46. $list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
  47. $content .= CourseHome::show_tools_category($urlGenerator, $result['content']);
  48. $totalList = array_merge($totalList, $result['tool_list']);
  49. $content .= '</div>';
  50. } else {
  51. $list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
  52. if (count($list) > 0) {
  53. $content .= '<div class="row">';
  54. $result = CourseHome::show_tools_category($urlGenerator, $list);
  55. $content .= $result['content'];
  56. $totalList = array_merge($totalList, $result['tool_list']);
  57. $content .= '</div>';
  58. }
  59. }
  60. return array(
  61. 'content' => $content,
  62. 'tool_list' => $totalList
  63. );