attendance_add.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * View (MVC patter) for adding a attendance
  5. * @author Christian Fasanando <christian1827@gmail.com>
  6. * @package chamilo.attendance
  7. */
  8. // protect a course script
  9. api_protect_course_script(true);
  10. // error messages
  11. if (isset($error)) {
  12. Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false);
  13. }
  14. if (!isset($error)) {
  15. $token = Security::get_token();
  16. }
  17. // display form
  18. $form = new FormValidator(
  19. 'attendance_add',
  20. 'POST',
  21. 'index.php?action=attendance_add&'.api_get_cidreq()
  22. );
  23. $form->addElement('header', '', get_lang('CreateANewAttendance'));
  24. $form->addElement('hidden', 'sec_token', $token);
  25. $form->addText('title', get_lang('Title'), true);
  26. $form->applyFilter('title','html_filter');
  27. $form->addHtmlEditor(
  28. 'description',
  29. get_lang('Description'),
  30. false,
  31. false,
  32. array('ToolbarSet' => 'TrainingDescription', 'Width' => '100%', 'Height' => '150')
  33. );
  34. // Adavanced Parameters
  35. if ((api_get_session_id() != 0 && Gradebook::is_active()) || api_get_session_id() == 0) {
  36. $form->addButtonAdvancedSettings('id_qualify');
  37. $form->addElement('html','<div id="id_qualify_options" style="display:none">');
  38. // Qualify Attendance for gradebook option
  39. $form->addElement(
  40. 'checkbox',
  41. 'attendance_qualify_gradebook',
  42. '',
  43. get_lang('QualifyAttendanceGradebook'),
  44. 'onclick="javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"'
  45. );
  46. $form->addElement('html','<div id="options_field" style="display:none">');
  47. GradebookUtils::load_gradebook_select_in_tool($form);
  48. $form->addElement('text', 'attendance_qualify_title', get_lang('TitleColumnGradebook'));
  49. $form->applyFilter('attendance_qualify_title', 'html_filter');
  50. $form->addElement(
  51. 'text',
  52. 'attendance_weight',
  53. get_lang('QualifyWeight'),
  54. 'value="0.00" Style="width:40px" onfocus="javascript: this.select();"'
  55. );
  56. $form->applyFilter('attendance_weight', 'html_filter');
  57. $form->addElement('html','</div>');
  58. $form->addElement('html','</div>');
  59. }
  60. $form->addButtonCreate(get_lang('Save'));
  61. $form->display();