attendance_add.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 = isset($error) ? $error : null;
  11. // error messages
  12. if ($error) {
  13. Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false);
  14. }
  15. $param_gradebook = '';
  16. if (isset($_SESSION['gradebook'])) {
  17. $param_gradebook = '&gradebook='.Security::remove_XSS($_SESSION['gradebook']);
  18. }
  19. if (!$error) {
  20. $token = Security::get_token();
  21. }
  22. // display form
  23. $form = new FormValidator('attendance_add','POST','index.php?action=attendance_add&'.api_get_cidreq().$param_gradebook);
  24. $form->addElement('header', '', get_lang('CreateANewAttendance'));
  25. $form->addElement('hidden', 'sec_token', $token);
  26. $form->add_textfield('title', get_lang('Title'), true, array('size'=>'50'));
  27. $form->applyFilter('title','html_filter');
  28. $form->add_html_editor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'TrainingDescription', 'Width' => '100%', 'Height' => '150'));
  29. // Adavanced Parameters
  30. if (Gradebook::is_active()) {
  31. $form->addElement('advanced_settings', 'id_qualify', get_lang('AdvancedParameters'));
  32. $form->addElement('html','<div id="id_qualify_options" style="display:none">');
  33. // Qualify Attendance for gradebook option
  34. $form->addElement('checkbox', 'attendance_qualify_gradebook', '', get_lang('QualifyAttendanceGradebook'),'onclick="javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"');
  35. $form->addElement('html','<div id="options_field" style="display:none">');
  36. load_gradebook_select_in_tool($form);
  37. $form->addElement('text', 'attendance_qualify_title', get_lang('TitleColumnGradebook'));
  38. $form->applyFilter('attendance_qualify_title', 'html_filter');
  39. $form->addElement('text', 'attendance_weight', get_lang('QualifyWeight'),'value="0.00" Style="width:40px" onfocus="javascript: this.select();"');
  40. $form->applyFilter('attendance_weight', 'html_filter');
  41. $form->addElement('html','</div>');
  42. $form->addElement('html','</div>');
  43. }
  44. $form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
  45. $form->display();