[svn r9944] bugfix:

Exercises: Fatal error when clicking addLimits
http://www.dokeos.com/forum/viewtopic.php?t=7757

and also
[DOUBLE POST] : course > result > view test &
http://www.dokeos.com/forum/viewtopic.php?t=7927

and some cleanup & commenting
skala
Patrick Cool 19 years ago
parent ee509a07e5
commit 6513566fda
  1. 65
      main/exercice/addlimits.php

@ -1,23 +1,54 @@
<?php <?php
/*
-----------------------------------------------------------
including the global file
-----------------------------------------------------------
*/
include('../inc/global.inc.php');
/*
-----------------------------------------------------------
Including necessary files
-----------------------------------------------------------
*/
include('exercise.class.php'); include('exercise.class.php');
include('question.class.php'); include('question.class.php');
include('answer.class.php'); include('answer.class.php');
include_once(api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
// answer types /*
-----------------------------------------------------------
Answer types
-----------------------------------------------------------
*/
define('UNIQUE_ANSWER', 1); define('UNIQUE_ANSWER', 1);
define('MULTIPLE_ANSWER', 2); define('MULTIPLE_ANSWER', 2);
define('FILL_IN_BLANKS', 3); define('FILL_IN_BLANKS', 3);
define('MATCHING', 4); define('MATCHING', 4);
define('FREE_ANSWER', 5); define('FREE_ANSWER', 5);
/*
-----------------------------------------------------------
Language
-----------------------------------------------------------
*/
$langFile='exercice'; $langFile='exercice';
include('../inc/global.inc.php'); /*
-----------------------------------------------------------
section (for the tabs)
-----------------------------------------------------------
*/
$this_section=SECTION_COURSES; $this_section=SECTION_COURSES;
api_protect_course_script(); api_protect_course_script();
include(api_get_path(LIBRARY_PATH).'text.lib.php');
include_once(api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'); /*
-----------------------------------------------------------
Table definitions
@todo: use the Database :: get_course_table functions
-----------------------------------------------------------
*/
$TBL_EXERCICE_QUESTION = $_course['dbNameGlu'].'quiz_rel_question'; $TBL_EXERCICE_QUESTION = $_course['dbNameGlu'].'quiz_rel_question';
$TBL_EXERCICES = $_course['dbNameGlu'].'quiz'; $TBL_EXERCICES = $_course['dbNameGlu'].'quiz';
$TBL_QUESTIONS = $_course['dbNameGlu'].'quiz_question'; $TBL_QUESTIONS = $_course['dbNameGlu'].'quiz_question';
@ -67,18 +98,29 @@ if ( empty ( $objExercise ) ) {
} }
$exercise_id = $_GET['exercise_id']; $exercise_id = $_GET['exercise_id'];
$is_allowedToEdit=$is_courseAdmin; $is_allowedToEdit=$is_courseAdmin;
$nameTools=get_lang('Exercice'); $nameTools=get_lang('Exercice');
$interbreadcrumb[]=array("url" => "exercice.php","name" => get_lang('Exercices')); $interbreadcrumb[]=array("url" => "exercice.php","name" => get_lang('Exercices'));
Display::display_header($nameTools,"Exercise"); Display::display_header($nameTools,"Exercise");
if (isset($_POST['ok']))
{
$message = "Test limits added"; /*
-----------------------------------------------------------
Action handling
-----------------------------------------------------------
*/
include('../inc/global.inc.php');
if (isset($_POST['ok']))
{
$message = "Test limits added";
Display::display_normal_message($message); Display::display_normal_message($message);
} }
?> ?>
<script type="text/javascript"> <script type="text/javascript">
function selectlimited() function selectlimited()
{ {
@ -144,6 +186,9 @@ Attempts :
<input type="submit" name="ok" value="Ok"> <input type="submit" name="ok" value="Ok">
</form> </form>
<?php <?php
/**
* @todo shouldn't this be moved to the part above (around line 111: action handling)
*/
if (isset($_POST['ok'])) if (isset($_POST['ok']))
{ {
$exercise_id = $_POST['exe_id']; $exercise_id = $_POST['exe_id'];

Loading…
Cancel
Save