2column.php 4.5 KB

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