attendance_list.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. /*
  20. $table = new SortableTable('attendance_list', array('Attendance', 'get_number_of_attendances'), array('Attendance', 'get_attendance_data'), $default_column);
  21. $table->set_additional_parameters($parameters);
  22. $table->set_header(0, '', false, array('style'=>'width:20px;'));
  23. $table->set_header(1, get_lang('Name'), true );
  24. $table->set_header(2, get_lang('Description'), true);
  25. $table->set_header(3, get_lang('CountDoneAttendance'), true, array('style'=>'width:90px;'));
  26. if (api_is_allowed_to_edit(null, true)) {
  27. $table->set_header(4, get_lang('Actions'), false,array('style'=>'text-align:center'));
  28. $table->set_form_actions(array ('attendance_delete_select' => get_lang('DeleteAllAttendances')));
  29. }
  30. if ($table->get_total_number_of_items() > 0) {
  31. $table->display();
  32. }*/
  33. //jqgrid will use this URL to do the selects
  34. //$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_careers';
  35. //The order is important you need to check the the $column variable in the model.ajax.php file
  36. $columns = array(get_lang('Name'), get_lang('Description'), get_lang('CountDoneAttendance'));
  37. //Column config
  38. $column_model = array(
  39. array('name'=>'name', 'index'=>'name', 'width'=>'300', 'align'=>'left'),
  40. array('name'=>'description', 'index'=>'description', 'width'=>'200', 'align'=>'left','sortable'=>'false'),
  41. array('name'=>'attendance_qualify_max', 'index'=>'attendance_qualify_max', 'width'=>'80', 'align'=>'left','sortable'=>'false')
  42. );
  43. if (api_is_allowed_to_edit(null, true)) {
  44. $columns[] = get_lang('Actions');
  45. $column_model[] = array('name'=>'actions', 'index'=>'actions', 'width'=>'100', 'align'=>'left','sortable'=>'false');
  46. }
  47. $extra_params = array();
  48. //Autowidth
  49. $extra_params['autowidth'] = 'true';
  50. //height auto
  51. $extra_params['height'] = 'auto';
  52. $data = Attendance::get_attendance_data();
  53. ?>
  54. <script>
  55. $(function() {
  56. <?php
  57. // grid definition see the $career->display() function
  58. echo Display::grid_js('attendance', 'false', $columns, $column_model, $extra_params, $data, null, true);
  59. ?>
  60. });
  61. </script>
  62. <?php
  63. echo Display::grid_html('attendance');