attendance_list.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. //jqgrid will use this URL to do the selects
  20. //$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_careers';
  21. //The order is important you need to check the the $column variable in the model.ajax.php file
  22. $columns = array(get_lang('Name'), get_lang('Description'), get_lang('CountDoneAttendance'));
  23. //Column config
  24. $column_model = array(
  25. array('name'=>'name', 'index'=>'name', 'width'=>'300', 'align'=>'left'),
  26. array('name'=>'description', 'index'=>'description', 'width'=>'200', 'align'=>'left','sortable'=>'false'),
  27. array('name'=>'attendance_qualify_max', 'index'=>'attendance_qualify_max', 'width'=>'80', 'align'=>'left','sortable'=>'false')
  28. );
  29. if (api_is_allowed_to_edit(null, true)) {
  30. $columns[] = get_lang('Actions');
  31. $column_model[] = array('name'=>'actions', 'index'=>'actions', 'width'=>'100', 'align'=>'left','sortable'=>'false');
  32. }
  33. $extra_params = array();
  34. //Autowidth
  35. $extra_params['autowidth'] = 'true';
  36. //height auto
  37. $extra_params['height'] = 'auto';
  38. $data = Attendance::get_attendance_data();
  39. ?>
  40. <script>
  41. $(function() {
  42. <?php
  43. // grid definition see the $career->display() function
  44. echo Display::grid_js('attendance', 'false', $columns, $column_model, $extra_params, $data, null, true);
  45. ?>
  46. });
  47. </script>
  48. <?php
  49. echo Display::grid_html('attendance');