attendance_add.php 2.3 KB

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