parent
55ce4a434d
commit
83d4946d24
@ -1,160 +0,0 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
/** |
||||
* Adding limits |
||||
* @package chamilo.exercise |
||||
* @deprecated ? |
||||
*/ |
||||
require_once '../inc/global.inc.php'; |
||||
|
||||
$this_section = SECTION_COURSES; |
||||
|
||||
api_protect_course_script(); |
||||
|
||||
$dsp_percent = false; |
||||
$debug = 0; |
||||
if ($debug > 0) { |
||||
echo str_repeat(' ', 0).'Entered exercise_result.php'."<br />\n"; |
||||
} |
||||
// general parameters passed via POST/GET |
||||
if (empty ($origin)) { |
||||
$origin = $_REQUEST['origin']; |
||||
} |
||||
if (empty ($learnpath_id)) { |
||||
$learnpath_id = $_REQUEST['learnpath_id']; |
||||
} |
||||
if (empty ($learnpath_item_id)) { |
||||
$learnpath_item_id = $_REQUEST['learnpath_item_id']; |
||||
} |
||||
if (empty ($formSent)) { |
||||
$formSent = $_REQUEST['formSent']; |
||||
} |
||||
if (empty ($exerciseResult)) { |
||||
$exerciseResult = $_SESSION['exerciseResult']; |
||||
} |
||||
if (empty ($questionId)) { |
||||
$questionId = $_REQUEST['questionId']; |
||||
} |
||||
if (empty ($choice)) { |
||||
$choice = $_REQUEST['choice']; |
||||
} |
||||
if (empty ($questionNum)) { |
||||
$questionNum = $_REQUEST['questionNum']; |
||||
} |
||||
if (empty ($nbrQuestions)) { |
||||
$nbrQuestions = $_REQUEST['nbrQuestions']; |
||||
} |
||||
if (empty ($questionList)) { |
||||
$questionList = $_SESSION['questionList']; |
||||
} |
||||
if (empty ($objExercise)) { |
||||
$objExercise = $_SESSION['objExercise']; |
||||
} |
||||
$exercise_id = intval($_GET['exercise_id']); |
||||
$is_allowedToEdit=$is_courseAdmin; |
||||
|
||||
if (isset($_SESSION['gradebook'])){ |
||||
$gradebook= $_SESSION['gradebook']; |
||||
} |
||||
|
||||
if (!empty($gradebook) && $gradebook=='view') { |
||||
$interbreadcrumb[]= array ( |
||||
'url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']), |
||||
'name' => get_lang('ToolGradebook') |
||||
); |
||||
} |
||||
$nameTools=get_lang('Exercises'); |
||||
$interbreadcrumb[] = array( |
||||
"url" => "exercise.php", |
||||
"name" => get_lang('Exercises'), |
||||
); |
||||
Display::display_header($nameTools,"Exercises"); |
||||
|
||||
if (isset($_POST['ok'])) { |
||||
$message = get_lang('TestLimitsAdded'); |
||||
Display::display_normal_message($message); |
||||
} |
||||
?> |
||||
<script type="text/javascript"> |
||||
function selectlimited() { |
||||
document.getElementById('limited').checked="checked"; |
||||
} |
||||
function selectattempts() { |
||||
document.getElementById('attemptlimited').checked="checked"; |
||||
} |
||||
</script> |
||||
<h3><?php echo get_lang('AddLimits'); ?></h3>
|
||||
<br> |
||||
<form action="addlimits.php" name="frmlimit" method="post"> |
||||
<h4> |
||||
Time : |
||||
</h4> |
||||
<input type="hidden" name="exe_id" value="<?php echo $exercise_id; ?>" />
|
||||
<input type="radio" name="limit" checked="checked" value="0" id="unlimit"><?php echo get_lang('Unlimited'); ?> |
||||
<br> |
||||
<input type="radio" name="limit" value="1" id="limited"><?php echo get_lang('LimitedTime'); ?> |
||||
<select name="minutes" onfocus="selectlimited();" > |
||||
<option selected="selected">1</option> |
||||
<option>2</option> |
||||
<option>3</option> |
||||
<option>4</option> |
||||
<option>5</option> |
||||
<option>6</option> |
||||
<option>7</option> |
||||
<option>8</option> |
||||
<option>9</option> |
||||
<option>10</option> |
||||
<option>15</option> |
||||
<option>20</option> |
||||
<option>25</option> |
||||
<option>30</option> |
||||
<option>40</option> |
||||
<option>50</option> |
||||
<option>60</option> |
||||
</select><?php echo get_lang('Minutes'); ?>.
|
||||
<h4> |
||||
<?php echo get_lang('Attempts'); ?>:
|
||||
</h4> |
||||
<input type="radio" name="attempt" checked="checked" value="0" id="attemptunlimited"><?php echo get_lang('Unlimited'); ?> |
||||
<br> |
||||
<input type="radio" name="attempt" value="1" id="attemptlimited"><?php echo get_lang('LimitedAttempts'); ?> |
||||
<select name="attempts" onfocus="selectattempts();"> |
||||
<option selected="selected">1</option> |
||||
<option>2</option> |
||||
<option>3</option> |
||||
<option>4</option> |
||||
<option>5</option> |
||||
<option>6</option> |
||||
<option>7</option> |
||||
<option>8</option> |
||||
<option>9</option> |
||||
<option>10</option> |
||||
</select><?php echo get_lang('Times'); ?>.
|
||||
|
||||
<br> <br> |
||||
<input type="submit" name="ok" value="<?php echo get_lang('Ok'); ?>">
|
||||
</form> |
||||
<?php |
||||
/** |
||||
* @todo shouldn't this be moved to the part above (around line 111: action handling) |
||||
*/ |
||||
if (isset($_POST['ok'])) { |
||||
$exercise_id = intval($_POST['exe_id']); |
||||
if ($_POST['limit']==1) { |
||||
$minutes = intval($_POST['minutes']); |
||||
$query = "UPDATE ".$TBL_EXERCISES." SET ques_time_limit= $minutes WHERE id= $exercise_id"; |
||||
Database::query($query); |
||||
} else { |
||||
$query = "UPDATE ".$TBL_EXERCISES." SET ques_time_limit= 0 WHERE id= $exercise_id"; |
||||
Database::query($query); |
||||
} |
||||
|
||||
if ($_POST['attempt']==1) { |
||||
$attempts = intval($_POST['attempts']); |
||||
$query = "UPDATE ".$TBL_EXERCISES." SET num_attempts = $attempts WHERE id= $exercise_id"; |
||||
Database::query($query); |
||||
} else { |
||||
$query = "UPDATE ".$TBL_EXERCISES." SET num_attempts = 0 WHERE id= $exercise_id"; |
||||
Database::query($query); |
||||
} |
||||
} |
Loading…
Reference in new issue