2column.php 4.1 KB

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