activity.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. $id = isset($_GET['id']) ? (int) $_GET['id'] : null;
  15. $course_id = api_get_course_int_id();
  16. $session_id = api_get_session_id();
  17. // Work with data post askable by admin of course
  18. if (api_is_platform_admin()) {
  19. // Show message to confirm that a tool it to be hidden from available tools
  20. // visibility 0,1->2
  21. if (!empty($_GET['askDelete'])) {
  22. $content .= '<div id="toolhide">'.get_lang('Do you really want to delete this link?').'<br />&nbsp;&nbsp;&nbsp;
  23. <a href="'.api_get_self().'">'.get_lang('No').'</a>&nbsp;|&nbsp;
  24. <a href="'.api_get_self().'?delete=yes&id='.$id.'">'.get_lang('Yes').'</a>
  25. </div>';
  26. } elseif (isset($_GET['delete']) && $_GET['delete']) {
  27. /*
  28. * Process hiding a tools from available tools.
  29. */
  30. Database::query("DELETE FROM $tool_table WHERE c_id = $course_id AND id='$id' AND added_tool=1");
  31. }
  32. }
  33. // Course legal
  34. $enabled = api_get_plugin_setting('courselegal', 'tool_enable');
  35. $pluginExtra = null;
  36. if ($enabled === 'true') {
  37. require_once api_get_path(SYS_PLUGIN_PATH).'courselegal/config.php';
  38. $plugin = CourseLegalPlugin::create();
  39. $pluginExtra = $plugin->getTeacherLink();
  40. }
  41. // Start of tools for CourseAdmins (teachers/tutors)
  42. if ($session_id === 0 && api_is_course_admin() && api_is_allowed_to_edit(null, true)) {
  43. $content .= '<div class="alert alert-success" style="border:0px; margin-top: 0px;padding:0px;">
  44. <div class="normal-message" id="id_normal_message" style="display:none">';
  45. $content .= '<img src="'.api_get_path(WEB_PATH).'main/inc/lib/javascript/indicator.gif"/>&nbsp;&nbsp;';
  46. $content .= get_lang('Please stand by...');
  47. $content .= '</div>
  48. <div class="alert alert-success" id="id_confirmation_message" style="display:none"></div>
  49. </div>';
  50. $content .= $pluginExtra;
  51. } elseif (api_is_coach()) {
  52. $content .= $pluginExtra;
  53. if (api_get_setting('show_session_data') === 'true' && $session_id > 0) {
  54. $content .= '<div class="row">
  55. <div class="col-xs-12 col-md-12">
  56. <span class="viewcaption">'.get_lang('Session\'s data').'</span>
  57. <table class="course_activity_home">';
  58. $content .= CourseHome::show_session_data($session_id);
  59. $content .= '</table></div></div>';
  60. }
  61. }
  62. $blocks = CourseHome::getUserBlocks();
  63. $activityView = new Template('', false, false, false, false, false, false);
  64. $activityView->assign('blocks', $blocks);
  65. $content .= $activityView->fetch(
  66. $activityView->get_template('course_home/activity.tpl')
  67. );