2column.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <?php
  2. /* For licensing terms, see /chamilo_license.txt */
  3. /**
  4. ==============================================================================
  5. * HOME PAGE FOR EACH COURSE
  6. *
  7. * This page, included in every course's index.php is the home
  8. * page. To make administration simple, the teacher edits his
  9. * course from the home page. Only the login detects that the
  10. * visitor is allowed to activate, deactivate home page links,
  11. * access to the teachers tools (statistics, edit forums...).
  12. *
  13. * @package dokeos.course_home
  14. ==============================================================================
  15. */
  16. require_once api_get_path(LIBRARY_PATH).'course_home.lib.php';
  17. /*
  18. ==============================================================================
  19. MAIN CODE
  20. ==============================================================================
  21. */
  22. /*
  23. -----------------------------------------------------------
  24. Work with data post askable by admin of course (franglais, clean this)
  25. -----------------------------------------------------------
  26. */
  27. if (api_is_allowed_to_edit(null,true)) {
  28. /* Work request */
  29. /*
  30. -----------------------------------------------------------
  31. Modify home page
  32. -----------------------------------------------------------
  33. */
  34. /*
  35. * display message to confirm that a tool must be hidden from the list of available tools
  36. * (visibility 0,1->2)
  37. */
  38. if($_GET["remove"])
  39. {
  40. $msgDestroy=get_lang('DelLk').'<br />';
  41. $msgDestroy.='<a href="'.api_get_self().'">'.get_lang('No').'</a>&nbsp;|&nbsp;';
  42. $msgDestroy.='<a href="'.api_get_self().'?destroy=yes&amp;id='.$_GET["id"].'">'.get_lang('Yes').'</a>';
  43. Display :: display_confirmation_message($msgDestroy,false);
  44. }
  45. /*
  46. * Process hiding a tools from available tools.
  47. * visibility=2 are only view by Dokeos Administrator (visibility 0,1->2)
  48. */
  49. elseif ($_GET["destroy"])
  50. {
  51. Database::query("UPDATE $tool_table SET visibility='2' WHERE id='".$_GET["id"]."'",__FILE__,__LINE__);
  52. }
  53. /*
  54. -----------------------------------------------------------
  55. HIDE
  56. -----------------------------------------------------------
  57. */
  58. elseif ($_GET["hide"]) // visibility 1 -> 0
  59. {
  60. Database::query("UPDATE $tool_table SET visibility=0 WHERE id='".$_GET["id"]."'",__FILE__,__LINE__);
  61. Display::display_confirmation_message(get_lang('ToolIsNowHidden'));
  62. }
  63. /*
  64. -----------------------------------------------------------
  65. REACTIVATE
  66. -----------------------------------------------------------
  67. */
  68. elseif ($_GET["restore"]) // visibility 0,2 -> 1
  69. {
  70. Database::query("UPDATE $tool_table SET visibility=1 WHERE id='".$_GET["id"]."'",__FILE__,__LINE__);
  71. Display::display_confirmation_message(get_lang('ToolIsNowVisible'));
  72. }
  73. }
  74. // work with data post askable by admin of course
  75. if (api_is_platform_admin())
  76. {
  77. // Show message to confirm that a tools must be hide from available tools
  78. // visibility 0,1->2
  79. if($_GET["askDelete"])
  80. {
  81. ?>
  82. <div id="toolhide">
  83. <?php echo get_lang("DelLk"); ?>
  84. <br />&nbsp;&nbsp;&nbsp;
  85. <a href="<?php echo api_get_self(); ?>"><?php echo get_lang("No"); ?></a>&nbsp;|&nbsp;
  86. <a href="<?php echo api_get_self(); ?>?delete=yes&id=<?php echo $_GET["id"]; ?>"><?php echo get_lang("Yes"); ?></a>
  87. </div>
  88. <?php
  89. }
  90. /*
  91. * Process hiding a tools from available tools.
  92. * visibility=2 are only view by Dokeos Administrator visibility 0,1->2
  93. */
  94. elseif (isset($_GET["delete"]) && $_GET["delete"])
  95. {
  96. Database::query("DELETE FROM $tool_table WHERE id='$id' AND added_tool=1",__FILE__,__LINE__);
  97. }
  98. }
  99. /*
  100. ==============================================================================
  101. TOOLS VISIBLE FOR EVERYBODY
  102. ==============================================================================
  103. */
  104. echo "<div class=\"everybodyview\">";
  105. echo "<table width=\"100%\">";
  106. CourseHome::show_tool_2column(TOOL_PUBLIC);
  107. echo "</table>";
  108. echo "</div>";
  109. /*
  110. ==============================================================================
  111. COURSE ADMIN ONLY VIEW
  112. ==============================================================================
  113. */
  114. // start of tools for CourseAdmins (teachers/tutors)
  115. if (api_is_allowed_to_edit(null,true) && !api_is_coach()) {
  116. echo "<div class=\"courseadminview\">";
  117. echo "<span class=\"viewcaption\">";
  118. echo get_lang("CourseAdminOnly");
  119. echo "</span>";
  120. echo "<table width=\"100%\">";
  121. CourseHome::show_tool_2column(TOOL_COURSE_ADMIN);
  122. /*
  123. -----------------------------------------------------------
  124. INACTIVE TOOLS - HIDDEN (GREY) LINKS
  125. -----------------------------------------------------------
  126. */
  127. echo "<tr><td colspan=\"4\"><hr style='color:\"#4171B5\"' noshade=\"noshade\" size=\"1\" /></td></tr>\n",
  128. "<tr>\n",
  129. "<td colspan=\"4\">\n",
  130. "<div style=\"margin-bottom: 10px;\"><font color=\"#808080\">\n",get_lang("InLnk"),"</font></div>",
  131. "</td>\n",
  132. "</tr>\n";
  133. CourseHome::show_tool_2column(TOOL_PUBLIC_BUT_HIDDEN);
  134. echo "</table>";
  135. echo "</div> ";
  136. }
  137. /*
  138. -----------------------------------------------------------
  139. Tools for platform admin only
  140. -----------------------------------------------------------
  141. */
  142. if (api_is_platform_admin() && api_is_allowed_to_edit(null,true) && !api_is_coach()) {
  143. ?>
  144. <div class="platformadminview">
  145. <span class="viewcaption"><?php echo get_lang("PlatformAdminOnly"); ?></span>
  146. <table width="100%">
  147. <?php
  148. CourseHome::show_tool_2column(TOOL_PLATFORM_ADMIN);
  149. ?>
  150. </table>
  151. </div>
  152. <?php
  153. }
  154. ?>