vertical_activity.php 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. $id = isset($_GET['id']) ? intval($_GET['id']) : null;
  16. $course_id = api_get_course_int_id();
  17. $session_id = api_get_session_id();
  18. if (api_is_allowed_to_edit(null, true)) {
  19. // HIDE
  20. if (!empty($_GET['hide'])) { // visibility 1 -> 0
  21. $sql = "UPDATE $tool_table SET visibility=0 WHERE c_id = $course_id AND id='".$id."'";
  22. Database::query($sql);
  23. $show_message = Display::return_message(get_lang('ToolIsNowHidden'), 'confirmation');
  24. } elseif (!empty($_GET['restore'])) {
  25. // visibility 0,2 -> 1
  26. // REACTIVATE
  27. $sql = "UPDATE $tool_table SET visibility=1 WHERE c_id = $course_id AND id='".$id."'";
  28. Database::query($sql);
  29. $show_message = Display::return_message(get_lang('ToolIsNowVisible'), 'confirmation');
  30. }
  31. }
  32. // Work with data post askable by admin of course
  33. if (api_is_platform_admin()) {
  34. // Show message to confirm that a tool it to be hidden from available tools
  35. // visibility 0,1->2
  36. if (!empty($_GET['askDelete'])) {
  37. $content .= '<div id="toolhide">'.get_lang('DelLk').'<br />&nbsp;&nbsp;&nbsp;
  38. <a href="'.api_get_self().'">'.get_lang('No').'</a>&nbsp;|&nbsp;
  39. <a href="'.api_get_self().'?delete=yes&id='.$id.'">'.get_lang('Yes').'</a>
  40. </div>';
  41. } elseif (isset($_GET['delete']) && $_GET['delete']) {
  42. /*
  43. * Process hiding a tools from available tools.
  44. */
  45. //where $id is set?
  46. $id = intval($id);
  47. Database::query("DELETE FROM $tool_table WHERE c_id = $course_id AND id='$id' AND added_tool=1");
  48. }
  49. }
  50. // COURSE ADMIN ONLY VIEW
  51. // Start of tools for CourseAdmins (teachers/tutors)
  52. if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
  53. <<<<<<< HEAD
  54. $content .= '<div class="courseadminview" style="border:0px; margin-top: 0px;padding:5px;">
  55. =======
  56. $content .= '<div class="courseadminview" style="border:0px; margin-top: 0px;padding:5px;">
  57. >>>>>>> master
  58. <div class="normal-message" id="id_normal_message" style="display:none">';
  59. $content .= '<img src="'.api_get_path(WEB_PATH).'main/inc/lib/javascript/indicator.gif"/>&nbsp;&nbsp;';
  60. $content .= get_lang('PleaseStandBy');
  61. $content .= '</div>
  62. <div class="confirmation-message" id="id_confirmation_message" style="display:none"></div></div>';
  63. $content .= '<div id="activity-3col">';
  64. if (api_get_setting('show_session_data') == 'true' && $session_id > 0) {
  65. $content .= '<div class="courseadminview-activity-3col"><span class="viewcaption">'.get_lang('SessionData').'</span>
  66. <table width="100%">'.CourseHome::show_session_data($session_id).'</table>
  67. </div>';
  68. }
  69. $content .= '<div class="courseadminview-activity-3col"><span class="viewcaption">'.get_lang('Authoring').'</span>';
  70. $my_list = CourseHome::get_tools_category(TOOL_AUTHORING);
  71. $content .= CourseHome::show_tools_category($my_list);
  72. $content .= '</div>';
  73. $content .= '<div class="courseadminview-activity-3col"><span class="viewcaption">'.get_lang('Interaction').'</span>';
  74. $my_list = CourseHome::get_tools_category(TOOL_INTERACTION);
  75. $content .= CourseHome::show_tools_category($my_list);
  76. $content .= '</div>';
  77. $content .= '<div class="courseadminview-activity-3col"><span class="viewcaption">'.get_lang('Administration').'</span>';
  78. $my_list = CourseHome::get_tools_category(TOOL_ADMIN_PLATFORM);
  79. $content .= CourseHome::show_tools_category($my_list);
  80. $content .= '</div>';
  81. } elseif (api_is_coach()) {
  82. if (api_get_setting('show_session_data') == 'true' && $session_id > 0) {
  83. $content .= '<div class="courseadminview-activity-3col"><span class="viewcaption">'.get_lang('SessionData').'</span>
  84. <table width="100%">';
  85. $content .= CourseHome::show_session_data($session_id);
  86. $content .= '</table></div>';
  87. }
  88. $content .= '<div class="Authoringview">';
  89. $my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
  90. $content .= CourseHome::show_tools_category($my_list);
  91. $content .= '</div>';
  92. // TOOLS AUTHORING
  93. } else {
  94. $my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
  95. if (count($my_list) > 0) {
  96. $content .= '<div class="course-student-view-activity-3col">';
  97. <<<<<<< HEAD
  98. //ordering by get_lang name
  99. $order_tool_list = array();
  100. foreach($my_list as $key=>$new_tool) {
  101. $tool_name = CourseHome::translate_tool_name($new_tool);
  102. $order_tool_list [$key]= $tool_name;
  103. }
  104. natsort($order_tool_list);
  105. $my_temp_tool_array = array();
  106. foreach($order_tool_list as $key=>$new_tool) {
  107. $my_temp_tool_array[] = $my_list[$key];
  108. }
  109. $my_list = $my_temp_tool_array;
  110. =======
  111. //ordering by get_lang name
  112. $order_tool_list = array();
  113. foreach ($my_list as $key => $new_tool) {
  114. $tool_name = CourseHome::translate_tool_name($new_tool);
  115. $order_tool_list [$key] = $tool_name;
  116. }
  117. natsort($order_tool_list);
  118. $my_temp_tool_array = array();
  119. foreach ($order_tool_list as $key => $new_tool) {
  120. $my_temp_tool_array[] = $my_list[$key];
  121. }
  122. $my_list = $my_temp_tool_array;
  123. >>>>>>> master
  124. $i = 0;
  125. foreach ($my_list as $new_tool) {
  126. if ($i >= 10) {
  127. $my_list2[] = $new_tool;
  128. } else {
  129. $my_list1[] = $new_tool;
  130. }
  131. $i++;
  132. }
  133. $content .= CourseHome::show_tools_category($my_list1);
  134. $content .= CourseHome::show_tools_category($my_list2);
  135. $content .= '</div>';
  136. }
  137. }
  138. $content .= '</div>';