Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chamilo-lms/main/gradebook/gradebook_add_result.php

57 lines
1.9 KiB

10 years ago
<?php
/* For licensing terms, see /license.txt */
10 years ago
/**
* Script
* @package chamilo.gradebook
*/
//$cidReset = true;
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_GRADEBOOK;
10 years ago
api_protect_course_script(true);
api_block_anonymous_users();
GradebookUtils::block_students();
$resultadd = new Result();
$resultadd->set_evaluation_id($_GET['selecteval']);
$evaluation = Evaluation :: load($_GET['selecteval']);
$category = !empty($_GET['selectcat']) ? $_GET['selectcat'] : "";
$add_result_form = new EvalForm(
EvalForm :: TYPE_RESULT_ADD,
$evaluation[0],
$resultadd,
'add_result_form',
null,
api_get_self() . '?selectcat=' . Security::remove_XSS($category) . '&selecteval=' . Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq()
);
$table = $add_result_form->toHtml();
if ($add_result_form->validate()) {
10 years ago
$values = $add_result_form->exportValues();
$nr_users = $values['nr_users'];
if ($nr_users == '0') {
header('Location: gradebook_view_result.php?addresultnostudents=&selecteval=' . Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq());
10 years ago
exit;
}
$scores = ($values['score']);
foreach ($scores as $row) {
$res = new Result();
$res->set_evaluation_id($values['evaluation_id']);
$res->set_user_id(key($scores));
//if no scores are given, don't set the score
if ((!empty ($row)) || ($row == '0')) $res->set_score($row);
$res->add();
next($scores);
}
header('Location: gradebook_view_result.php?addresult=&selecteval=' . Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq());
10 years ago
exit;
}
$interbreadcrumb[] = array(
'url' => Security::remove_XSS($_SESSION['gradebook_dest']),
'name' => get_lang('Gradebook')
);
Display :: display_header(get_lang('AddResult'));
10 years ago
DisplayGradebook :: display_header_result ($evaluation[0], null, 0,0);
echo $table;
10 years ago
Display :: display_footer();