2column.php 4.4 KB

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