2column.php 3.9 KB

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