gradebook_edit_result.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Script
  5. * @package chamilo.gradebook
  6. */
  7. require_once '../inc/global.inc.php';
  8. api_block_anonymous_users();
  9. GradebookUtils::block_students();
  10. $select_eval=Security::remove_XSS($_GET['selecteval']);
  11. if (empty($select_eval)) {
  12. api_not_allowed();
  13. }
  14. $resultedit = Result :: load (null,null,$select_eval);
  15. $evaluation = Evaluation :: load ($select_eval);
  16. $evaluation[0]->check_lock_permissions();
  17. $edit_result_form = new EvalForm(EvalForm :: TYPE_ALL_RESULTS_EDIT, $evaluation[0], $resultedit, 'edit_result_form', null, api_get_self() . '?&selecteval='.$select_eval);
  18. $table = $edit_result_form->toHtml();
  19. if ($edit_result_form->validate()) {
  20. $values = $edit_result_form->exportValues();
  21. $scores = ($values['score']);
  22. foreach ($scores as $row) {
  23. $resultedit = Result :: load (key($scores));
  24. $row_value = $row;
  25. if ($row_value != '' ) {
  26. $resultedit[0]->set_score(floatval(number_format($row_value, api_get_setting('gradebook_number_decimals'))));
  27. $resultedit[0]->save();
  28. }
  29. next($scores);
  30. }
  31. header('Location: gradebook_view_result.php?selecteval='.$select_eval.'&editallresults=&'.api_get_cidreq());
  32. exit;
  33. }
  34. $interbreadcrumb[] = array (
  35. 'url' => $_SESSION['gradebook_dest'],
  36. 'name' => get_lang('Gradebook')
  37. );
  38. $interbreadcrumb[]= array (
  39. 'url' => 'gradebook_view_result.php?selecteval='.$select_eval.'&'.api_get_cidreq(),
  40. 'name' => get_lang('ViewResult')
  41. );
  42. Display :: display_header(get_lang('EditResult'));
  43. DisplayGradebook :: display_header_result ($evaluation[0],null,0,0);
  44. echo $table;
  45. Display :: display_footer();