Remove ie6 fixes.

1.10.x
Julio Montoya 11 years ago
parent dc4fcd66b7
commit 10143792d7
  1. 10
      main/exercice/global_multiple_answer.class.php
  2. 57
      main/exercice/matching.class.php
  3. 34
      main/exercice/multiple_answer_combination.class.php
  4. 11
      main/exercice/multiple_answer_true_false.class.php
  5. 3
      main/exercice/result.php
  6. 24
      main/exercice/unique_answer.class.php
  7. 10
      main/exercice/unique_answer_no_option.class.php
  8. 8
      main/exercice/upload_exercise.php

@ -135,23 +135,15 @@ class GlobalMultipleAnswer extends Question
// Affiche un message si le score n'est pas renseign<EFBFBD> // Affiche un message si le score n'est pas renseign<EFBFBD>
$form->addRule('weighting[1]', get_lang('ThisFieldIsRequired'), 'required'); $form->addRule('weighting[1]', get_lang('ThisFieldIsRequired'), 'required');
$navigator_info = api_get_navigator();
global $text, $class; global $text, $class;
//ie6 fix
if ($obj_ex->edit_exercise_in_lp == true) { if ($obj_ex->edit_exercise_in_lp == true) {
if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
$form = new FormValidator();
$form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers');
$form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers');
$form->addButtonSave($text, 'submitQuestion');
} else {
$form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers'); $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers');
$form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers'); $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers');
$form->addButtonSave($text, 'submitQuestion'); $form->addButtonSave($text, 'submitQuestion');
// setting the save button here and not in the question class.php // setting the save button here and not in the question class.php
} }
}
$renderer->setElementTemplate('{element}&nbsp;', 'lessAnswers'); $renderer->setElementTemplate('{element}&nbsp;', 'lessAnswers');
$renderer->setElementTemplate('{element}&nbsp;', 'submitQuestion'); $renderer->setElementTemplate('{element}&nbsp;', 'submitQuestion');
$renderer->setElementTemplate('{element}', 'moreAnswers'); $renderer->setElementTemplate('{element}', 'moreAnswers');

@ -33,9 +33,8 @@ class Matching extends Question
public function createAnswersForm($form) public function createAnswersForm($form)
{ {
$defaults = array(); $defaults = array();
$navigator_info = api_get_navigator();
$nb_matches = $nb_options = 2; $nb_matches = $nb_options = 2;
if ($form->isSubmitted()) { if ($form->isSubmitted()) {
$nb_matches = $form->getSubmitValue('nb_matches'); $nb_matches = $form->getSubmitValue('nb_matches');
$nb_options = $form->getSubmitValue('nb_options'); $nb_options = $form->getSubmitValue('nb_options');
@ -129,16 +128,11 @@ class Matching extends Question
$form->addHtml('</tbody></table>'); $form->addHtml('</tbody></table>');
$group = array(); $group = array();
if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
$group[] = $form->createElement('submit', 'lessMatches', get_lang('DelElem'), 'class="btn btn-default"');
$group[] = $form->createElement('submit', 'moreMatches', get_lang('AddElem'), 'class="btn btn-default"');
} else {
$renderer->setElementTemplate('<div class="form-group"><div class="col-sm-offset-2">{element}', 'lessMatches'); $renderer->setElementTemplate('<div class="form-group"><div class="col-sm-offset-2">{element}', 'lessMatches');
$renderer->setElementTemplate('{element}</div></div>', 'moreMatches'); $renderer->setElementTemplate('{element}</div></div>', 'moreMatches');
$group[] = $form->addButtonDelete(get_lang('DelElem'), 'lessMatches', true); $group[] = $form->addButtonDelete(get_lang('DelElem'), 'lessMatches', true);
$group[] = $form->addButtonCreate(get_lang('AddElem'), 'moreMatches', true); $group[] = $form->addButtonCreate(get_lang('AddElem'), 'moreMatches', true);
}
$form->addGroup($group); $form->addGroup($group);
@ -179,17 +173,10 @@ class Matching extends Question
$group = array(); $group = array();
global $text, $class; global $text, $class;
if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
// setting the save button here and not in the question class.php
$group[] = $form->createElement('submit', 'submitQuestion', $text, 'class="' . $class . '"');
$group[] = $form->createElement('submit', 'lessOptions', get_lang('DelElem'), 'class="minus"');
$group[] = $form->createElement('submit', 'moreOptions', get_lang('AddElem'), 'class="plus"');
} else {
// setting the save button here and not in the question class.php // setting the save button here and not in the question class.php
$group[] = $form->addButtonDelete(get_lang('DelElem'), 'lessOptions', true); $group[] = $form->addButtonDelete(get_lang('DelElem'), 'lessOptions', true);
$group[] = $form->addButtonCreate(get_lang('AddElem'), 'moreOptions', true); $group[] = $form->addButtonCreate(get_lang('AddElem'), 'moreOptions', true);
$group[] = $form->addButtonSave($text, 'submitQuestion', true); $group[] = $form->addButtonSave($text, 'submitQuestion', true);
}
$form->addGroup($group); $form->addGroup($group);
@ -201,39 +188,50 @@ class Matching extends Question
} }
} }
$form->setConstants(array('nb_matches' => $nb_matches, 'nb_options' => $nb_options)); $form->setConstants(
array(
'nb_matches' => $nb_matches,
'nb_options' => $nb_options
)
);
} }
/** /**
* abstract function which creates the form to create / edit the answers of the question * abstract function which creates the form to create / edit the answers of the question
* @param FormValidator $form * @param FormValidator $form
*/ */
public function processAnswersCreation($form) public function processAnswersCreation($form)
{ {
$nb_matches = $form -> getSubmitValue('nb_matches'); $nb_matches = $form->getSubmitValue('nb_matches');
$nb_options = $form -> getSubmitValue('nb_options'); $nb_options = $form->getSubmitValue('nb_options');
$this -> weighting = 0; $this->weighting = 0;
$objAnswer = new Answer($this->id);
$position = 0; $position = 0;
$objAnswer = new Answer($this->id);
// insert the options // insert the options
for($i=1 ; $i<=$nb_options; ++$i) { for ($i = 1; $i <= $nb_options; ++$i) {
$position++; $position++;
$option = $form -> getSubmitValue('option['.$i.']'); $option = $form->getSubmitValue('option['.$i.']');
$objAnswer->createAnswer($option, 0, '', 0, $position); $objAnswer->createAnswer($option, 0, '', 0, $position);
} }
// insert the answers // insert the answers
for($i=1 ; $i<=$nb_matches ; ++$i) { for ($i = 1; $i <= $nb_matches; ++$i) {
$position++; $position++;
$answer = $form -> getSubmitValue('answer['.$i.']'); $answer = $form->getSubmitValue('answer['.$i.']');
$matches = $form -> getSubmitValue('matches['.$i.']'); $matches = $form->getSubmitValue('matches['.$i.']');
$weighting = $form -> getSubmitValue('weighting['.$i.']'); $weighting = $form->getSubmitValue('weighting['.$i.']');
$this -> weighting += $weighting; $this->weighting += $weighting;
$objAnswer->createAnswer($answer,$matches,'',$weighting,$position); $objAnswer->createAnswer(
$answer,
$matches,
'',
$weighting,
$position
);
} }
$objAnswer->save(); $objAnswer->save();
$this->save(); $this->save();
} }
@ -252,6 +250,7 @@ class Matching extends Question
<th>'.get_lang('ElementList').'</th> <th>'.get_lang('ElementList').'</th>
<th>'.get_lang('CorrespondsTo').'</th> <th>'.get_lang('CorrespondsTo').'</th>
</tr>'; </tr>';
return $header; return $header;
} }
} }

@ -148,38 +148,16 @@ class MultipleAnswerCombination extends Question
//only 1 answer the all deal ... //only 1 answer the all deal ...
$form->addText('weighting[1]', get_lang('Score'), false, ['value' => 10]); $form->addText('weighting[1]', get_lang('Score'), false, ['value' => 10]);
$navigator_info = api_get_navigator();
global $text, $class; global $text, $class;
//ie6 fix //ie6 fix
if ($obj_ex->edit_exercise_in_lp == true) { if ($obj_ex->edit_exercise_in_lp == true) {
$buttonGroup = [];
if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
$buttonGroup[] = $form->createElement(
'submit',
'lessAnswers',
'<i class="fa fa-minus"></i> '.get_lang('LessAnswer'),
'class="btn btn-default"'
);
$buttonGroup[] = $form->createElement(
'submit',
'moreAnswers',
'<i class="fa fa-plus"></i> '.get_lang('PlusAnswer'),
'class="btn btn-default"'
);
$buttonGroup[] = $form->createElement(
'submit',
'submitQuestion',
$text,
'class="' . $class . '"'
);
} else {
// setting the save button here and not in the question class.php // setting the save button here and not in the question class.php
$buttonGroup[] = $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers', true); $buttonGroup = [
$buttonGroup[] = $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers', true); $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers', true),
$buttonGroup[] = $form->addButtonSave($text, 'submitQuestion', true); $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers', true),
} $form->addButtonSave($text, 'submitQuestion', true)
];
$form->addGroup($buttonGroup); $form->addGroup($buttonGroup);
} }

@ -213,24 +213,13 @@ class MultipleAnswerTrueFalse extends Question
} }
} }
$navigator_info = api_get_navigator();
global $text, $class; global $text, $class;
if ($obj_ex->edit_exercise_in_lp == true) { if ($obj_ex->edit_exercise_in_lp == true) {
$buttonGroup = [];
//ie6 fix
if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
$buttonGroup[] = $form->addElement('submit', 'lessAnswers', '<i class="fa fa-plus"></i> '.get_lang('LessAnswer'), 'class="btn btn-default"');
$buttonGroup[] = $form->addElement('submit', 'moreAnswers', '<i class="fa fa-minus"></i> '.get_lang('PlusAnswer'), 'class="btn btn-default"');
$buttonGroup[] = $form->addElement('submit', 'submitQuestion', $text, 'class="' . $class . '"');
} else {
// setting the save button here and not in the question class.php // setting the save button here and not in the question class.php
$buttonGroup[] = $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers', true); $buttonGroup[] = $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers', true);
$buttonGroup[] = $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers', true); $buttonGroup[] = $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers', true);
$buttonGroup[] = $form->addButtonSave($text, 'submitQuestion', true); $buttonGroup[] = $form->addButtonSave($text, 'submitQuestion', true);
}
$form->addGroup($buttonGroup); $form->addGroup($buttonGroup);
} }

@ -1,5 +1,6 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* Shows the exercise results * Shows the exercise results
* *
@ -45,7 +46,7 @@ if (!empty($exercise_id)) {
$objExercise->read($exercise_id); $objExercise->read($exercise_id);
} }
//Only users can see their own results // Only users can see their own results
if (!$is_allowedToEdit) { if (!$is_allowedToEdit) {
if ($student_id != $current_user_id) { if ($student_id != $current_user_id) {
api_not_allowed($show_headers); api_not_allowed($show_headers);

@ -266,26 +266,11 @@ class UniqueAnswer extends Question
$buttonGroup = []; $buttonGroup = [];
//ie6 fix //ie6 fix
if ($obj_ex->edit_exercise_in_lp == true) { if ($obj_ex->edit_exercise_in_lp == true) {
if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
$buttonGroup[] = $form->createElement(
'submit',
'lessAnswers',
get_lang('LessAnswer'),
'class="btn btn-primary"'
);
$buttonGroup[] = $form->createElement(
'submit',
'moreAnswers',
get_lang('PlusAnswer'),
'class="btn btn-primary"'
);
$buttonGroup[] = $form->createElement('submit', 'submitQuestion', $text, 'class="' . $class . '"');
} else {
//setting the save button here and not in the question class.php //setting the save button here and not in the question class.php
$buttonGroup[] = $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers', true); $buttonGroup[] = $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers', true);
$buttonGroup[] = $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers', true); $buttonGroup[] = $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers', true);
$buttonGroup[] = $form->addButtonSave($text, 'submitQuestion', true); $buttonGroup[] = $form->addButtonSave($text, 'submitQuestion', true);
}
$form->addGroup($buttonGroup); $form->addGroup($buttonGroup);
} }
@ -484,6 +469,13 @@ class UniqueAnswer extends Question
'0@@0@@0@@0' '0@@0@@0@@0'
)"; )";
Database::query($sql); Database::query($sql);
$id = Database::insert_id();
if ($id) {
$sql = "UPDATE $tbl_quiz_answer SET id = iid WHERE iid = $id";
Database::query($sql);
}
if ($correct) { if ($correct) {
$sql = "UPDATE $tbl_quiz_question $sql = "UPDATE $tbl_quiz_question
SET ponderation = (ponderation + $score) SET ponderation = (ponderation + $score)

@ -244,8 +244,6 @@ class UniqueAnswerNoOption extends Question
$form->addElement('html_editor', 'answer[' . $i . ']', null, array(), $editor_config); $form->addElement('html_editor', 'answer[' . $i . ']', null, array(), $editor_config);
$form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required'); $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('html_editor', 'comment[' . $i . ']', null, array(), $editor_config); $form->addElement('html_editor', 'comment[' . $i . ']', null, array(), $editor_config);
//$form->addElement('select', 'destination'.$i, get_lang('SelectQuestion').' : ',$select_question,'multiple'); //$form->addElement('select', 'destination'.$i, get_lang('SelectQuestion').' : ',$select_question,'multiple');
@ -255,23 +253,15 @@ class UniqueAnswerNoOption extends Question
$form->addHTml('</tr>'); $form->addHTml('</tr>');
$form->addHtml('</tbody></table>'); $form->addHtml('</tbody></table>');
$navigator_info = api_get_navigator();
$buttonGroup = []; $buttonGroup = [];
global $text, $class; global $text, $class;
//ie6 fix //ie6 fix
if ($obj_ex->edit_exercise_in_lp == true) { if ($obj_ex->edit_exercise_in_lp == true) {
if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
$buttonGroup[] = $form->createElement('submit', 'moreAnswers','<i class="fa fa-plus"></i> '. get_lang('PlusAnswer'), 'class="btn btn-default"');
$buttonGroup[] = $form->createElement('submit', 'lessAnswers', '<i class="fa fa-minus"></i> '.get_lang('LessAnswer'), 'class="btn btn-default"');
$buttonGroup[] = $form->createElement('submit', 'submitQuestion', $text, 'class="' . $class . '"');
} else {
//setting the save button here and not in the question class.php //setting the save button here and not in the question class.php
$buttonGroup[] = $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers', true); $buttonGroup[] = $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers', true);
$buttonGroup[] = $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers', true); $buttonGroup[] = $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers', true);
$buttonGroup[] = $form->addButtonSave($text, 'submitQuestion', true); $buttonGroup[] = $form->addButtonSave($text, 'submitQuestion', true);
}
$form->addGroup($buttonGroup); $form->addGroup($buttonGroup);
} }

@ -346,9 +346,6 @@ function lp_upload_quiz_action_handling() {
} }
} }
//var_dump($answerValue);
if ($useCustomScore) { if ($useCustomScore) {
if ($correct) { if ($correct) {
$score = $correctScore; $score = $correctScore;
@ -381,8 +378,6 @@ function lp_upload_quiz_action_handling() {
$total += $score; $total += $score;
$id++; $id++;
//var_dump($score);
} }
$objAnswer->save(); $objAnswer->save();
@ -399,7 +394,6 @@ function lp_upload_quiz_action_handling() {
$questionObj->updateWeighting($total); $questionObj->updateWeighting($total);
break; break;
} }
//var_dump($total);
$questionObj->save(); $questionObj->save();
} else if ($detectQuestionType === FREE_ANSWER) { } else if ($detectQuestionType === FREE_ANSWER) {
@ -410,7 +404,7 @@ function lp_upload_quiz_action_handling() {
} }
} }
} }
// exit;
if (isset($_SESSION['lpobject'])) { if (isset($_SESSION['lpobject'])) {
if ($debug > 0) { if ($debug > 0) {
error_log('New LP - SESSION[lpobject] is defined', 0); error_log('New LP - SESSION[lpobject] is defined', 0);

Loading…
Cancel
Save