2column.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. /* Work with data post askable by admin of course (franglais, clean this) */
  15. $id = isset($_GET['id']) ? intval($_GET['id']) : null;
  16. $course_id = api_get_course_int_id();
  17. if (api_is_allowed_to_edit(null, true)) {
  18. /* Processing request */
  19. /* Modify home page */
  20. /*
  21. * Display message to confirm that a tool must be hidden from the list of available tools (visibility 0,1->2)
  22. */
  23. if ($_GET['remove']) {
  24. $msgDestroy = get_lang('DelLk').'<br />';
  25. $msgDestroy .= '<a href="'.api_get_self().'">'.get_lang('No').'</a>&nbsp;|&nbsp;';
  26. $msgDestroy .= '<a href="'.api_get_self().'?destroy=yes&amp;id='.$id.'">'.get_lang('Yes').'</a>';
  27. $show_message .= Display :: return_message($msgDestroy, 'confirmation',false);
  28. }
  29. /*
  30. * Process hiding a tools from available tools.
  31. * visibility=2 are only view by Dokeos Administrator (visibility 0,1->2)
  32. */
  33. elseif ($_GET['destroy']) {
  34. Database::query("UPDATE $tool_table SET visibility='2' WHERE c_id = $course_id AND id='".$id."'");
  35. }
  36. /* HIDE */
  37. elseif ($_GET['hide']) { // visibility 1 -> 0
  38. Database::query("UPDATE $tool_table SET visibility=0 WHERE c_id = $course_id AND id='".$id."'");
  39. $show_message .= Display::return_message(get_lang('ToolIsNowHidden'), 'confirmation');
  40. }
  41. /* REACTIVATE */
  42. elseif ($_GET["restore"]) { // visibility 0,2 -> 1
  43. Database::query("UPDATE $tool_table SET visibility=1 WHERE c_id = $course_id AND id='".$id."'");
  44. $show_message .= Display::return_message(get_lang('ToolIsNowVisible'), 'confirmation');
  45. }
  46. }
  47. // Work with data post askable by admin of course
  48. // Work with data post askable by admin of course
  49. if (api_is_platform_admin()) {
  50. // Show message to confirm that a tool it to be hidden from available tools
  51. // visibility 0,1->2
  52. if (!empty($_GET['askDelete'])) {
  53. $content .='<div id="toolhide">'.get_lang('DelLk').'<br />&nbsp;&nbsp;&nbsp;
  54. <a href="'.api_get_self().'">'.get_lang('No').'</a>&nbsp;|&nbsp;
  55. <a href="'.api_get_self().'?delete=yes&id='.intval($_GET['id']).'">'.get_lang('Yes').'</a>
  56. </div>';
  57. } elseif (isset($_GET['delete']) && $_GET['delete']) {
  58. /*
  59. * Process hiding a tools from available tools.
  60. */
  61. //where $id is set?
  62. $id = intval($id);
  63. Database::query("DELETE FROM $tool_table WHERE c_id = $course_id AND id='$id' AND added_tool=1");
  64. }
  65. }
  66. /* TOOLS VISIBLE FOR EVERYBODY */
  67. $content .= '<div class="everybodyview">';
  68. $content .= '<table width="100%">';
  69. $content .= CourseHome::show_tool_2column(TOOL_PUBLIC);
  70. $content .= '</table>';
  71. $content .= '</div>';
  72. /* COURSE ADMIN ONLY VIEW */
  73. // Start of tools for CourseAdmins (teachers/tutors)
  74. if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
  75. $content .= "<div class=\"courseadminview\">";
  76. $content .= "<span class=\"viewcaption\">";
  77. $content .= get_lang('CourseAdminOnly');
  78. $content .= "</span>";
  79. $content .= "<table width=\"100%\">";
  80. $content .= CourseHome::show_tool_2column(TOOL_COURSE_ADMIN);
  81. /* INACTIVE TOOLS - HIDDEN (GREY) LINKS */
  82. $content .= "<tr><td colspan=\"4\"><hr style='color:\"#4171B5\"' noshade=\"noshade\" size=\"1\" /></td></tr>\n".
  83. "<tr>\n".
  84. "<td colspan=\"4\">\n".
  85. "<div style=\"margin-bottom: 10px;\"><font color=\"#808080\">\n".get_lang('InLnk')."</font></div>".
  86. "</td>\n".
  87. "</tr>";
  88. $content .= CourseHome::show_tool_2column(TOOL_PUBLIC_BUT_HIDDEN);
  89. $content .= "</table>";
  90. $content .= "</div> ";
  91. }
  92. /* Tools for platform admin only */
  93. if (api_is_platform_admin() && api_is_allowed_to_edit(null, true) && !api_is_coach()) {
  94. $content .='<div class="platformadminview">
  95. <span class="viewcaption">'.get_lang('PlatformAdminOnly').'</span>
  96. <table width="100%">
  97. '.CourseHome::show_tool_2column(TOOL_PLATFORM_ADMIN).'
  98. </table>
  99. </div>';
  100. }