Minor - cosmetic changes.

skala
Julio Montoya 12 years ago
parent d86c230d7b
commit fc27a500de
  1. 7
      main/exercice/exercise.class.php
  2. 80
      main/exercice/question_list_admin.inc.php
  3. 14
      main/inc/ajax/exercise.ajax.php
  4. 3
      main/inc/lib/events.lib.inc.php
  5. 63
      main/inc/lib/exercise_show_functions.lib.php

@ -799,9 +799,6 @@ class Exercise
// Order/random categories // Order/random categories
$cat = new Testcategory(); $cat = new Testcategory();
// var_dump($questionSelectionType);
// Setting category order. // Setting category order.
switch ($questionSelectionType) { switch ($questionSelectionType) {
case EX_Q_SELECTION_ORDERED: // 1 case EX_Q_SELECTION_ORDERED: // 1
@ -3269,7 +3266,7 @@ class Exercise
error_log("studentChoice: $studentChoice"); error_log("studentChoice: $studentChoice");
} }
break; break;
case GLOBAL_MULTIPLE_ANSWER : case GLOBAL_MULTIPLE_ANSWER:
if ($from_database) { if ($from_database) {
$choice = array(); $choice = array();
$queryans = "SELECT answer FROM $TBL_TRACK_ATTEMPT WHERE exe_id = '".$exeId."' AND question_id= '".$questionId."'"; $queryans = "SELECT answer FROM $TBL_TRACK_ATTEMPT WHERE exe_id = '".$exeId."' AND question_id= '".$questionId."'";
@ -3367,7 +3364,7 @@ class Exercise
} }
break; break;
// for fill in the blanks // for fill in the blanks
case FILL_IN_BLANKS : case FILL_IN_BLANKS:
// the question is encoded like this // the question is encoded like this
// [A] B [C] D [E] F::10,10,10@1 // [A] B [C] D [E] F::10,10,10@1
// number 1 before the "@" means that is a switchable fill in blank question // number 1 before the "@" means that is a switchable fill in blank question

@ -13,17 +13,17 @@
// deletes a question from the exercise (not from the data base) // deletes a question from the exercise (not from the data base)
if ($deleteQuestion) { if ($deleteQuestion) {
// if the question exists // if the question exists
if ($objQuestionTmp = Question::read($deleteQuestion)) { if ($objQuestionTmp = Question::read($deleteQuestion)) {
$objQuestionTmp->delete($exerciseId); $objQuestionTmp->delete($exerciseId);
// if the question has been removed from the exercise // if the question has been removed from the exercise
if ($objExercise->removeFromList($deleteQuestion)) { if ($objExercise->removeFromList($deleteQuestion)) {
$nbrQuestions--; $nbrQuestions--;
} }
} }
// destruction of the Question object // destruction of the Question object
unset($objQuestionTmp); unset($objQuestionTmp);
} }
$ajax_url = api_get_path(WEB_AJAX_PATH)."exercise.ajax.php?".api_get_cidreq()."&exercise_id=".intval($exerciseId); $ajax_url = api_get_path(WEB_AJAX_PATH)."exercise.ajax.php?".api_get_cidreq()."&exercise_id=".intval($exerciseId);
?> ?>
@ -98,6 +98,9 @@ $(function() {
// Filters the type of questions we can add. // Filters the type of questions we can add.
Question::display_type_menu($objExercise); Question::display_type_menu($objExercise);
// Re sets the question list
$objExercise->setQuestionList();
echo '<div style="clear:both;"></div>'; echo '<div style="clear:both;"></div>';
echo '<div id="message"></div>'; echo '<div id="message"></div>';
$token = Security::get_token(); $token = Security::get_token();
@ -111,7 +114,7 @@ echo Question::getMediaLabels();
$inATest = isset($exerciseId) && $exerciseId > 0; $inATest = isset($exerciseId) && $exerciseId > 0;
if (!$inATest) { if (!$inATest) {
echo "<p class='warning-message'>".get_lang("ChoiceQuestionType")."</p>"; echo "<p class='warning-message'>".get_lang("ChoiceQuestionType")."</p>";
} else { } else {
// Title line // Title line
echo "<div>"; echo "<div>";
@ -142,31 +145,32 @@ if (!$inATest) {
if (is_array($questionList)) { if (is_array($questionList)) {
foreach ($questionList as $id) { foreach ($questionList as $id) {
// To avoid warning messages. // To avoid warning messages.
if (!is_numeric($id)) { if (!is_numeric($id)) {
continue; continue;
} }
$objQuestionTmp = Question :: read($id); /** @var Question $objQuestionTmp */
$question_class = get_class($objQuestionTmp); $objQuestionTmp = Question::read($id);
$question_class = get_class($objQuestionTmp);
$clone_link = '<a href="'.api_get_self().'?'.api_get_cidreq().'&clone_question='.$id.'">'.Display::return_icon('cd.gif',get_lang('Copy'), array(), ICON_SIZE_SMALL).'</a>';
$edit_link = '<a href="'.api_get_self().'?'.api_get_cidreq().'&type='.$objQuestionTmp->selectType().'&myid=1&editQuestion='.$id.'">'.Display::return_icon('edit.png',get_lang('Modify'), array(), ICON_SIZE_SMALL).'</a>'; $clone_link = '<a href="'.api_get_self().'?'.api_get_cidreq().'&clone_question='.$id.'">'.Display::return_icon('cd.gif',get_lang('Copy'), array(), ICON_SIZE_SMALL).'</a>';
if ($objExercise->edit_exercise_in_lp == true) { $edit_link = '<a href="'.api_get_self().'?'.api_get_cidreq().'&type='.$objQuestionTmp->selectType().'&myid=1&editQuestion='.$id.'">'.Display::return_icon('edit.png',get_lang('Modify'), array(), ICON_SIZE_SMALL).'</a>';
$delete_link = '<a id="delete_'.$id.'" class="opener" href="'.api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId.'&deleteQuestion='.$id.'" >'.Display::return_icon('delete.png',get_lang('RemoveFromTest'), array(), ICON_SIZE_SMALL).'</a>'; if ($objExercise->edit_exercise_in_lp == true) {
} $delete_link = '<a id="delete_'.$id.'" class="opener" href="'.api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId.'&deleteQuestion='.$id.'" >'.Display::return_icon('delete.png',get_lang('RemoveFromTest'), array(), ICON_SIZE_SMALL).'</a>';
$edit_link = Display::tag('div', $edit_link, array('style'=>'float:left; padding:0px; margin:0px')); }
$clone_link = Display::tag('div', $clone_link, array('style'=>'float:left; padding:0px; margin:0px')); $edit_link = Display::tag('div', $edit_link, array('style'=>'float:left; padding:0px; margin:0px'));
$delete_link = Display::tag('div', $delete_link, array('style'=>'float:left; padding:0px; margin:0px')); $clone_link = Display::tag('div', $clone_link, array('style'=>'float:left; padding:0px; margin:0px'));
$actions = Display::tag('div', $edit_link.$clone_link.$delete_link, array('class'=>'edition','style'=>'width:100px; right:10px; margin-top: 0px; position: absolute; top: 10%;')); $delete_link = Display::tag('div', $delete_link, array('style'=>'float:left; padding:0px; margin:0px'));
$actions = Display::tag('div', $edit_link.$clone_link.$delete_link, array('class'=>'edition','style'=>'width:100px; right:10px; margin-top: 0px; position: absolute; top: 10%;'));
$title = Security::remove_XSS($objQuestionTmp->selectTitle()); $title = Security::remove_XSS($objQuestionTmp->selectTitle());
$move = Display::return_icon('all_directions.png',get_lang('Move'), array('class'=>'moved', 'style'=>'margin-bottom:-0.5em;')); $move = Display::return_icon('all_directions.png',get_lang('Move'), array('class'=>'moved', 'style'=>'margin-bottom:-0.5em;'));
// Question name // Question name
$questionName = Display::tag('div', '<a href="#" title = "'.$title.'">'.$move.' '.Text::cut($title, 42).'</a>', array('style'=>$styleQuestion)); $questionName = Display::tag('div', '<a href="#" title = "'.$title.'">'.$move.' '.Text::cut($title, 42).'</a>', array('style'=>$styleQuestion));
// Question type. // Question type.
list($typeImg, $typeExpl) = $objQuestionTmp->get_type_icon_html(); list($typeImg, $typeExpl) = $objQuestionTmp->get_type_icon_html();
$question_media = null; $question_media = null;
if (!empty($objQuestionTmp->parent_id)) { if (!empty($objQuestionTmp->parent_id)) {
@ -174,18 +178,18 @@ if (!$inATest) {
$question_media = ' '.Question::getMediaLabel($objQuestionMedia->question); $question_media = ' '.Question::getMediaLabel($objQuestionMedia->question);
} }
$questionType = Display::tag('div', Display::return_icon($typeImg, $typeExpl, array(), ICON_SIZE_MEDIUM), array('style' => $styleType)); $questionType = Display::tag('div', Display::return_icon($typeImg, $typeExpl, array(), ICON_SIZE_MEDIUM), array('style' => $styleType));
// Question category. // Question category.
$category_labels = Testcategory::return_category_labels($objQuestionTmp->category_list, $category_list); $category_labels = Testcategory::return_category_labels($objQuestionTmp->category_list, $category_list);
if (empty($category_labels)) { if (empty($category_labels)) {
$category_labels = ""; $category_labels = "";
} }
$questionCategory = Display::tag('div', '<a href="#" style="padding:0px; margin:0px;">'.$category_labels.$question_media.'</a>', array('style'=>$styleCat)); $questionCategory = Display::tag('div', '<a href="#" style="padding:0px; margin:0px;">'.$category_labels.$question_media.'</a>', array('style'=>$styleCat));
// Question level. // Question level.
$txtQuestionLevel = $objQuestionTmp->level; $txtQuestionLevel = $objQuestionTmp->level;
if (empty($objQuestionTmp->level)) { if (empty($objQuestionTmp->level)) {
$txtQuestionLevel = '-'; $txtQuestionLevel = '-';
} }

@ -306,20 +306,20 @@ switch ($action) {
if (api_is_allowed_to_session_edit()) { if (api_is_allowed_to_session_edit()) {
// "all" or "simple" strings means that there's one or all questions exercise type // "all" or "simple" strings means that there's one or all questions exercise type
$type = isset($_REQUEST['type']) ? $_REQUEST['type'] : null; $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : null;
// Questions choices // Questions choices
$choice = isset($_REQUEST['choice']) ? $_REQUEST['choice'] : null; $choice = isset($_REQUEST['choice']) ? $_REQUEST['choice'] : null;
// Hotspot coordinates from all questions // Hotspot coordinates from all questions
$hot_spot_coordinates = isset($_REQUEST['hotspot']) ? $_REQUEST['hotspot'] : null; $hot_spot_coordinates = isset($_REQUEST['hotspot']) ? $_REQUEST['hotspot'] : null;
// There is a reminder? // There is a reminder?
$remind_list = isset($_REQUEST['remind_list']) && !empty($_REQUEST['remind_list'])? array_keys($_REQUEST['remind_list']) : null; $remind_list = isset($_REQUEST['remind_list']) && !empty($_REQUEST['remind_list'])? array_keys($_REQUEST['remind_list']) : null;
// Needed in manage_answer // Needed in manage_answer
$learnpath_id = isset($_REQUEST['learnpath_id']) ? intval($_REQUEST['learnpath_id']) : 0; $learnpath_id = isset($_REQUEST['learnpath_id']) ? intval($_REQUEST['learnpath_id']) : 0;
$learnpath_item_id = isset($_REQUEST['learnpath_item_id']) ? intval($_REQUEST['learnpath_item_id']) : 0; $learnpath_item_id = isset($_REQUEST['learnpath_item_id']) ? intval($_REQUEST['learnpath_item_id']) : 0;
// Attempt id // Attempt id
$exe_id = $_REQUEST['exe_id']; $exe_id = $_REQUEST['exe_id'];
@ -494,7 +494,7 @@ switch ($action) {
} }
} }
// We're inside *one* question. Go through each possible answer for this question // We're inside *one* question. Go through each possible answer for this question
$result = $objExercise->manageAnswers( $result = $objExercise->manageAnswers(
$exe_id, $exe_id,

@ -491,7 +491,6 @@ function saveQuestionAttempt(
} }
$TBL_TRACK_ATTEMPT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $TBL_TRACK_ATTEMPT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
if ($debug) { if ($debug) {
error_log("----- entering saveQuestionAttempt() function ------"); error_log("----- entering saveQuestionAttempt() function ------");
error_log("answer: $answer"); error_log("answer: $answer");
@ -527,6 +526,8 @@ function saveQuestionAttempt(
); );
// Check if attempt exists. // Check if attempt exists.
$sql = "SELECT exe_id FROM $TBL_TRACK_ATTEMPT $sql = "SELECT exe_id FROM $TBL_TRACK_ATTEMPT

@ -76,40 +76,41 @@ class ExerciseShowFunctions {
} }
} }
static function display_oral_expression_answer($answer, $id, $questionId, $nano = null) { static function display_oral_expression_answer($answer, $id, $questionId, $nano = null)
global $feedback_type; {
global $feedback_type;
if (isset($nano)) { if (isset($nano)) {
echo $nano->show_audio_file(); echo $nano->show_audio_file();
} }
if (empty($id)) { if (empty($id)) {
echo '<tr>'; echo '<tr>';
echo Display::tag('td',nl2br(Security::remove_XSS($answer,COURSEMANAGERLOWSECURITY)), array('width'=>'55%')); echo Display::tag('td',nl2br(Security::remove_XSS($answer,COURSEMANAGERLOWSECURITY)), array('width'=>'55%'));
echo '</tr>'; echo '</tr>';
if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
echo '<tr>'; echo '<tr>';
echo Display::tag('td',get_lang('notCorrectedYet'), array('width'=>'45%')); echo Display::tag('td',get_lang('notCorrectedYet'), array('width'=>'45%'));
echo '</tr>'; echo '</tr>';
} else { } else {
echo '<tr><td>&nbsp;</td></tr>'; echo '<tr><td>&nbsp;</td></tr>';
} }
} else { } else {
echo '<tr>'; echo '<tr>';
echo '<td>'; echo '<td>';
if (!empty($answer)) { if (!empty($answer)) {
echo nl2br(Security::remove_XSS($answer,COURSEMANAGERLOWSECURITY)); echo nl2br(Security::remove_XSS($answer,COURSEMANAGERLOWSECURITY));
} }
echo '</td>'; echo '</td>';
if (!api_is_allowed_to_edit(null,true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { if (!api_is_allowed_to_edit(null,true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
echo '<td>'; echo '<td>';
$comm = get_comments($id,$questionId); $comm = get_comments($id,$questionId);
echo '</td>'; echo '</td>';
} }
echo '</tr>'; echo '</tr>';
} }
} }
/** /**
* Displays the answer to a hotspot question * Displays the answer to a hotspot question

Loading…
Cancel
Save