attendance_add.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 ($error) {
  12. Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false);
  13. }
  14. $param_gradebook = '';
  15. if (isset($_SESSION['gradebook'])) {
  16. $param_gradebook = '&gradebook='.Security::remove_XSS($_SESSION['gradebook']);
  17. }
  18. if (!$error) {
  19. $token = Security::get_token();
  20. }
  21. // display form
  22. $form = new FormValidator('attendance_add','POST','index.php?action=attendance_add&'.api_get_cidreq().$param_gradebook);
  23. $form->addElement('header', '', get_lang('CreateANewAttendance'));
  24. $form->addElement('hidden', 'sec_token', $token);
  25. $form->add_textfield('title', get_lang('Title'), true, array('size'=>'50'));
  26. $form->applyFilter('title','html_filter');
  27. $form->add_html_editor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'TrainingDescription', 'Width' => '100%', 'Height' => '150'));
  28. // Adavanced Parameters
  29. $advanced = '<a href="javascript://" class = "advanced_parameters" ><span id="img_plus_and_minus">&nbsp;'.Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedParameters').'</span></a>';
  30. if ((api_get_session_id() != 0 && Gradebook::is_active()) || api_get_session_id() == 0) {
  31. $form -> addElement('advanced_settings',$advanced);
  32. $form->addElement('html','<div id="id_qualify" 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();