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>
$form->addRule('weighting[1]', get_lang('ThisFieldIsRequired'), 'required');
$navigator_info = api_get_navigator();
global $text, $class;
//ie6 fix
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->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers');
$form->addButtonSave($text, 'submitQuestion');
// setting the save button here and not in the question class.php
}
}
$renderer->setElementTemplate('{element}&nbsp;', 'lessAnswers');
$renderer->setElementTemplate('{element}&nbsp;', 'submitQuestion');
$renderer->setElementTemplate('{element}', 'moreAnswers');

@ -33,9 +33,8 @@ class Matching extends Question
public function createAnswersForm($form)
{
$defaults = array();
$navigator_info = api_get_navigator();
$nb_matches = $nb_options = 2;
if ($form->isSubmitted()) {
$nb_matches = $form->getSubmitValue('nb_matches');
$nb_options = $form->getSubmitValue('nb_options');
@ -129,16 +128,11 @@ class Matching extends Question
$form->addHtml('</tbody></table>');
$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('{element}</div></div>', 'moreMatches');
$group[] = $form->addButtonDelete(get_lang('DelElem'), 'lessMatches', true);
$group[] = $form->addButtonCreate(get_lang('AddElem'), 'moreMatches', true);
}
$form->addGroup($group);
@ -179,17 +173,10 @@ class Matching extends Question
$group = array();
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
$group[] = $form->addButtonDelete(get_lang('DelElem'), 'lessOptions', true);
$group[] = $form->addButtonCreate(get_lang('AddElem'), 'moreOptions', true);
$group[] = $form->addButtonSave($text, 'submitQuestion', true);
}
$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
* @param FormValidator $form
*/
public function processAnswersCreation($form)
{
$nb_matches = $form -> getSubmitValue('nb_matches');
$nb_options = $form -> getSubmitValue('nb_options');
$this -> weighting = 0;
$objAnswer = new Answer($this->id);
$nb_matches = $form->getSubmitValue('nb_matches');
$nb_options = $form->getSubmitValue('nb_options');
$this->weighting = 0;
$position = 0;
$objAnswer = new Answer($this->id);
// insert the options
for($i=1 ; $i<=$nb_options; ++$i) {
for ($i = 1; $i <= $nb_options; ++$i) {
$position++;
$option = $form -> getSubmitValue('option['.$i.']');
$option = $form->getSubmitValue('option['.$i.']');
$objAnswer->createAnswer($option, 0, '', 0, $position);
}
// insert the answers
for($i=1 ; $i<=$nb_matches ; ++$i) {
for ($i = 1; $i <= $nb_matches; ++$i) {
$position++;
$answer = $form -> getSubmitValue('answer['.$i.']');
$matches = $form -> getSubmitValue('matches['.$i.']');
$weighting = $form -> getSubmitValue('weighting['.$i.']');
$this -> weighting += $weighting;
$objAnswer->createAnswer($answer,$matches,'',$weighting,$position);
$answer = $form->getSubmitValue('answer['.$i.']');
$matches = $form->getSubmitValue('matches['.$i.']');
$weighting = $form->getSubmitValue('weighting['.$i.']');
$this->weighting += $weighting;
$objAnswer->createAnswer(
$answer,
$matches,
'',
$weighting,
$position
);
}
$objAnswer->save();
$this->save();
}
@ -252,6 +250,7 @@ class Matching extends Question
<th>'.get_lang('ElementList').'</th>
<th>'.get_lang('CorrespondsTo').'</th>
</tr>';
return $header;
}
}

@ -148,38 +148,16 @@ class MultipleAnswerCombination extends Question
//only 1 answer the all deal ...
$form->addText('weighting[1]', get_lang('Score'), false, ['value' => 10]);
$navigator_info = api_get_navigator();
global $text, $class;
//ie6 fix
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
$buttonGroup[] = $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers', true);
$buttonGroup[] = $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers', true);
$buttonGroup[] = $form->addButtonSave($text, 'submitQuestion', true);
}
$buttonGroup = [
$form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers', true),
$form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers', true),
$form->addButtonSave($text, 'submitQuestion', true)
];
$form->addGroup($buttonGroup);
}

@ -213,24 +213,13 @@ class MultipleAnswerTrueFalse extends Question
}
}
$navigator_info = api_get_navigator();
global $text, $class;
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
$buttonGroup[] = $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers', true);
$buttonGroup[] = $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers', true);
$buttonGroup[] = $form->addButtonSave($text, 'submitQuestion', true);
}
$form->addGroup($buttonGroup);
}

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

@ -266,26 +266,11 @@ class UniqueAnswer extends Question
$buttonGroup = [];
//ie6 fix
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
$buttonGroup[] = $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers', true);
$buttonGroup[] = $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers', true);
$buttonGroup[] = $form->addButtonSave($text, 'submitQuestion', true);
}
$form->addGroup($buttonGroup);
}
@ -484,6 +469,13 @@ class UniqueAnswer extends Question
'0@@0@@0@@0'
)";
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) {
$sql = "UPDATE $tbl_quiz_question
SET ponderation = (ponderation + $score)

@ -244,8 +244,6 @@ class UniqueAnswerNoOption extends Question
$form->addElement('html_editor', 'answer[' . $i . ']', null, array(), $editor_config);
$form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('html_editor', 'comment[' . $i . ']', null, array(), $editor_config);
//$form->addElement('select', 'destination'.$i, get_lang('SelectQuestion').' : ',$select_question,'multiple');
@ -255,23 +253,15 @@ class UniqueAnswerNoOption extends Question
$form->addHTml('</tr>');
$form->addHtml('</tbody></table>');
$navigator_info = api_get_navigator();
$buttonGroup = [];
global $text, $class;
//ie6 fix
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
$buttonGroup[] = $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers', true);
$buttonGroup[] = $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers', true);
$buttonGroup[] = $form->addButtonSave($text, 'submitQuestion', true);
}
$form->addGroup($buttonGroup);
}

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

Loading…
Cancel
Save