attendance_list.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * View (MVC patter) for listing attendances
  5. * @author Christian Fasanando <christian1827@gmail.com>
  6. * @package chamilo.attendance
  7. */
  8. // protect a course script
  9. api_protect_course_script(true);
  10. if (api_is_allowed_to_edit(null, true)) {
  11. $param_gradebook = '';
  12. if (isset($_SESSION['gradebook'])) {
  13. $param_gradebook = '&gradebook='.Security::remove_XSS($_SESSION['gradebook']);
  14. }
  15. echo '<div class="actions">';
  16. echo '<a href="index.php?'.api_get_cidreq().$param_gradebook.'&action=attendance_add">'.Display::return_icon('new_attendance_list.png',get_lang('CreateANewAttendance'),'',ICON_SIZE_MEDIUM).'</a>';
  17. echo '</div>';
  18. }
  19. $attendance = new Attendance();
  20. if ($attendance->get_number_of_attendances() == 0) {
  21. $attendance->set_name(get_lang('Attendances'));
  22. $attendance->set_description(get_lang('Attendances'));
  23. $attendance->attendance_add();
  24. }
  25. $table = new SortableTable('attendance_list', array('Attendance', 'get_number_of_attendances'), array('Attendance', 'get_attendance_data'), $default_column);
  26. $table->set_additional_parameters($parameters);
  27. $table->set_header(0, '', false, array('style'=>'width:20px;'));
  28. $table->set_header(1, get_lang('Name'), true );
  29. $table->set_header(2, get_lang('Description'), true);
  30. $table->set_header(3, get_lang('CountDoneAttendance'), true, array('style'=>'width:90px;'));
  31. if (api_is_allowed_to_edit(null, true)) {
  32. $table->set_header(4, get_lang('Actions'), false, array('style'=>'text-align:center'));
  33. $table->set_form_actions(array ('attendance_delete_select' => get_lang('DeleteAllSelectedAttendances')));
  34. }
  35. if ($table->get_total_number_of_items() > 0) {
  36. $table->display();
  37. }