diff --git a/main/exercise/admin.php b/main/exercise/admin.php index 3d381e0f55..36bb373932 100755 --- a/main/exercise/admin.php +++ b/main/exercise/admin.php @@ -4,46 +4,46 @@ use ChamiloSession as Session; /** - * Exercise administration - * This script allows to manage (create, modify) an exercise and its questions + * Exercise administration + * This script allows to manage (create, modify) an exercise and its questions * - * Following scripts are includes for a best code understanding : + * Following scripts are includes for a best code understanding : * - * - exercise.class.php : for the creation of an Exercise object - * - question.class.php : for the creation of a Question object - * - answer.class.php : for the creation of an Answer object - * - exercise.lib.php : functions used in the exercise tool - * - exercise_admin.inc.php : management of the exercise - * - question_admin.inc.php : management of a question (statement & answers) - * - statement_admin.inc.php : management of a statement - * - question_list_admin.inc.php : management of the question list + * - exercise.class.php : for the creation of an Exercise object + * - question.class.php : for the creation of a Question object + * - answer.class.php : for the creation of an Answer object + * - exercise.lib.php : functions used in the exercise tool + * - exercise_admin.inc.php : management of the exercise + * - question_admin.inc.php : management of a question (statement & answers) + * - statement_admin.inc.php : management of a statement + * - question_list_admin.inc.php : management of the question list * - * Main variables used in this script : + * Main variables used in this script : * - * - $is_allowedToEdit : set to 1 if the user is allowed to manage the exercise - * - $objExercise : exercise object - * - $objQuestion : question object - * - $objAnswer : answer object - * - $aType : array with answer types - * - $exerciseId : the exercise ID - * - $picturePath : the path of question pictures - * - $newQuestion : ask to create a new question - * - $modifyQuestion : ID of the question to modify - * - $editQuestion : ID of the question to edit - * - $submitQuestion : ask to save question modifications - * - $cancelQuestion : ask to cancel question modifications - * - $deleteQuestion : ID of the question to delete - * - $moveUp : ID of the question to move up - * - $moveDown : ID of the question to move down - * - $modifyExercise : ID of the exercise to modify - * - $submitExercise : ask to save exercise modifications - * - $cancelExercise : ask to cancel exercise modifications - * - $modifyAnswers : ID of the question which we want to modify answers for - * - $cancelAnswers : ask to cancel answer modifications - * - $buttonBack : ask to go back to the previous page in answers of type "Fill in blanks" + * - $is_allowedToEdit : set to 1 if the user is allowed to manage the exercise + * - $objExercise : exercise object + * - $objQuestion : question object + * - $objAnswer : answer object + * - $aType : array with answer types + * - $exerciseId : the exercise ID + * - $picturePath : the path of question pictures + * - $newQuestion : ask to create a new question + * - $modifyQuestion : ID of the question to modify + * - $editQuestion : ID of the question to edit + * - $submitQuestion : ask to save question modifications + * - $cancelQuestion : ask to cancel question modifications + * - $deleteQuestion : ID of the question to delete + * - $moveUp : ID of the question to move up + * - $moveDown : ID of the question to move down + * - $modifyExercise : ID of the exercise to modify + * - $submitExercise : ask to save exercise modifications + * - $cancelExercise : ask to cancel exercise modifications + * - $modifyAnswers : ID of the question which we want to modify answers for + * - $cancelAnswers : ask to cancel answer modifications + * - $buttonBack : ask to go back to the previous page in answers of type "Fill in blanks" * - * @package chamilo.exercise - * @author Olivier Brouckaert + * @package chamilo.exercise + * @author Olivier Brouckaert * Modified by Hubert Borderiou 21-10-2011 Question by category */ @@ -56,7 +56,6 @@ api_protect_course_script(true); $is_allowedToEdit = api_is_allowed_to_edit(null, true, false, false); $sessionId = api_get_session_id(); - $studentViewActive = api_is_student_view_active(); if (!$is_allowedToEdit) { api_not_allowed(true); @@ -64,15 +63,15 @@ if (!$is_allowedToEdit) { /* stripslashes POST data */ if ($_SERVER['REQUEST_METHOD'] == 'POST') { - foreach($_POST as $key=>$val) { - if(is_string($val)) { - $_POST[$key]=stripslashes($val); - } elseif(is_array($val)) { - foreach($val as $key2=>$val2) { - $_POST[$key][$key2]=stripslashes($val2); + foreach ($_POST as $key => $val) { + if (is_string($val)) { + $_POST[$key] = stripslashes($val); + } elseif (is_array($val)) { + foreach ($val as $key2 => $val2) { + $_POST[$key][$key2] = stripslashes($val2); } } - $GLOBALS[$key]=$_POST[$key]; + $GLOBALS[$key] = $_POST[$key]; } } @@ -110,7 +109,6 @@ $cancelQuestion = isset($cancelQuestion) ? $cancelQuestion : null; /* Cleaning all incomplete attempts of the admin/teacher to avoid weird problems when changing the exercise settings, number of questions, etc */ - Event::delete_all_incomplete_attempts( api_get_user_id(), $exerciseId, @@ -281,8 +279,8 @@ if ($editQuestion || $modifyQuestion || $newQuestion || $modifyAnswers) { $nameTools = get_lang('QuestionManagement'); } -if (isset($_SESSION['gradebook'])){ - $gradebook= $_SESSION['gradebook']; +if (isset($_SESSION['gradebook'])) { + $gradebook = $_SESSION['gradebook']; } if (!empty($gradebook) && $gradebook=='view') { @@ -309,10 +307,10 @@ if (!$exerciseId && $nameTools != get_lang('ExerciseManagement')) { // if the question is duplicated, disable the link of tool name if ($modifyIn == 'thisExercise') { - if ($buttonBack) { - $modifyIn='allExercises'; + if ($buttonBack) { + $modifyIn = 'allExercises'; } else { - $noPHP_SELF=true; + $noPHP_SELF = true; } } $htmlHeadXtra[] = ''; -Display::display_header($nameTools,'Exercise'); +Display::display_header($nameTools, 'Exercise'); /* if ($objExercise->exercise_was_added_in_lp) { if ($objExercise->force_edit_exercise_in_lp == true) { diff --git a/main/exercise/matching.class.php b/main/exercise/matching.class.php index 088e07df5e..db6be626a9 100755 --- a/main/exercise/matching.class.php +++ b/main/exercise/matching.class.php @@ -143,27 +143,22 @@ class Matching extends Question $form->addHtml('