SQL fixes + changing exercise button position, fixing exercise list column

skala
Julio Montoya 14 years ago
parent f5ee76136d
commit 36f9632f23
  1. 7
      main/exercice/exercice.php
  2. 30
      main/exercice/exercise.lib.php
  3. 30
      main/exercice/mark_free_answer.php
  4. 30
      main/exercice/matching.class.php
  5. 16
      main/exercice/multiple_answer.class.php
  6. 10
      main/exercice/multiple_answer_combination.class.php
  7. 4
      main/exercice/multiple_answer_combination_true_false.class.php
  8. 24
      main/exercice/multiple_answer_true_false.class.php
  9. 15
      main/exercice/unique_answer.class.php
  10. 11
      main/exercice/unique_answer_no_option.class.php

@ -842,15 +842,16 @@ if ($show == 'test') {
$random_label = '';
if ($row['random'] > 0) {
$random_label = ' ('.get_lang('Random').') ';
$row['random'] . ' ' . api_strtolower(get_lang(($row['random'] > 1 ? 'Questions' : 'Question'))) .$random_label;
$number_of_questions = $row['random'] . ' ' . api_strtolower(get_lang(($row['random'] > 1 ? 'Questions' : 'Question'))) .$random_label;
} else {
$rowi . ' ' . api_strtolower(get_lang(($rowi > 1 ? 'Questions' : 'Question')));
$number_of_questions = $rowi . ' ' . api_strtolower(get_lang(($rowi > 1 ? 'Questions' : 'Question')));
}
//Attempts
$attempts = get_count_exam_results($row['id']).' '.get_lang('Attempts');
$item .= Display::tag('td',$attempts);
//$item .= Display::tag('td',$attempts);
$item .= Display::tag('td',$number_of_questions);
$item .= Display::tag('td',$actions);
//Special buttons

@ -786,13 +786,12 @@ function get_count_exam_results($exercise_id = null) {
FROM $TBL_EXERCICES AS ce INNER JOIN $TBL_TRACK_EXERCICES AS te ON (te.exe_exo_id = ce.id) INNER JOIN $TBL_USER AS user ON (user.user_id = exe_user_id)
WHERE te.status != 'incomplete' AND te.exe_cours_id='" . Database :: escape_string($_cid) . "' $user_id_and $session_id_and AND ce.active <>-1 AND orig_lp_id = 0 AND orig_lp_item_id = 0 $exercise_where ";
//Seems that the $TBL_TRACK_HOTPOTATOES does not have an exercise id that's weird ... we are removing $exercise_where
$hpsql="SELECT ".(api_is_western_name_order() ? "firstname as col0, lastname col1" : "lastname as col0, firstname as col1").", tth.exe_name, tth.exe_result , tth.exe_weighting, tth.exe_date
FROM $TBL_TRACK_HOTPOTATOES tth, $TBL_USER tu
WHERE tu.user_id=tth.exe_user_id AND tth.exe_cours_id = '" . Database :: escape_string($_cid) . "' $user_id_and $exercise_where
WHERE tu.user_id=tth.exe_user_id AND tth.exe_cours_id = '" . Database :: escape_string($_cid) . "' $user_id_and
ORDER BY tth.exe_cours_id ASC, tth.exe_date DESC";
} else {
// get only this user's results
$user_id_and = ' AND te.exe_user_id = ' . api_get_user_id() . ' ';
@ -811,10 +810,10 @@ function get_count_exam_results($exercise_id = null) {
WHERE te.status != 'incomplete' AND te.exe_cours_id='" . Database :: escape_string($_cid) . "' $user_id_and $session_id_and AND ce.active <>-1 AND" .
" orig_lp_id = 0 AND orig_lp_item_id = 0 ";
$hpsql = "SELECT '',exe_name, exe_result , exe_weighting, exe_date
FROM $TBL_TRACK_HOTPOTATOES
WHERE exe_user_id = '" . $_user['user_id'] . "' AND exe_cours_id = '" . Database :: escape_string($_cid) . "'
ORDER BY exe_cours_id ASC, exe_date DESC";
$hpsql = "SELECT '',exe_name, exe_result , exe_weighting, exe_date
FROM $TBL_TRACK_HOTPOTATOES
WHERE exe_user_id = '" . $_user['user_id'] . "' AND exe_cours_id = '" . Database :: escape_string($_cid) . "'
ORDER BY exe_cours_id ASC, exe_date DESC";
}
$resx = Database::query($sql);
@ -868,9 +867,9 @@ function get_exam_results_data($from, $number_of_items, $column, $direction) {
WHERE te.status != 'incomplete' AND te.exe_cours_id='" . Database :: escape_string($_cid) . "' $user_id_and $session_id_and AND ce.active <>-1 AND orig_lp_id = 0 AND orig_lp_item_id = 0 $exercise_where ";
$hpsql="SELECT ".(api_is_western_name_order() ? "firstname as col0, lastname col1" : "lastname as col0, firstname as col1").", tth.exe_name, tth.exe_result , tth.exe_weighting, tth.exe_date
FROM $TBL_TRACK_HOTPOTATOES tth, $TBL_USER tu
WHERE tu.user_id=tth.exe_user_id AND tth.exe_cours_id = '" . Database :: escape_string($_cid)."' $user_id_and $exercise_where
ORDER BY tth.exe_cours_id ASC, tth.exe_date DESC";
FROM $TBL_TRACK_HOTPOTATOES tth, $TBL_USER tu
WHERE tu.user_id=tth.exe_user_id AND tth.exe_cours_id = '" . Database :: escape_string($_cid)."' $user_id_and $exercise_where
ORDER BY tth.exe_cours_id ASC, tth.exe_date DESC";
@ -892,14 +891,13 @@ function get_exam_results_data($from, $number_of_items, $column, $direction) {
$sql="SELECT ".(api_is_western_name_order() ? "firstname as col0, lastname col1" : "lastname as col0, firstname as col1")." , ce.title as col2, te.exe_result as exresult, " .
"te.exe_weighting as exweight, te.exe_date as exdate, te.exe_id as exid, email as exemail, " .
"te.start_date as col4, steps_counter as exstep, exe_user_id as excruid, te.exe_duration as exduration, ce.results_disabled as exdisabled
FROM $TBL_EXERCICES AS ce INNER JOIN $TBL_TRACK_EXERCICES AS te ON (te.exe_exo_id = ce.id) INNER JOIN $TBL_USER AS user ON (user.user_id = exe_user_id)
WHERE te.status != 'incomplete' AND te.exe_cours_id='" . Database :: escape_string($_cid) . "' $user_id_and $session_id_and AND ce.active <>-1 AND" .
" orig_lp_id = 0 AND orig_lp_item_id = 0 ";
FROM $TBL_EXERCICES AS ce INNER JOIN $TBL_TRACK_EXERCICES AS te ON (te.exe_exo_id = ce.id) INNER JOIN $TBL_USER AS user ON (user.user_id = exe_user_id)
WHERE te.status != 'incomplete' AND te.exe_cours_id='" . Database :: escape_string($_cid) . "' $user_id_and $session_id_and AND ce.active <>-1 AND orig_lp_id = 0 AND orig_lp_item_id = 0 ";
$hpsql = "SELECT '',exe_name, exe_result , exe_weighting, exe_date
FROM $TBL_TRACK_HOTPOTATOES
WHERE exe_user_id = '" . $_user['user_id'] . "' AND exe_cours_id = '" . Database :: escape_string($_cid) . "'
ORDER BY exe_cours_id ASC, exe_date DESC";
FROM $TBL_TRACK_HOTPOTATOES
WHERE exe_user_id = '" . $_user['user_id'] . "' AND exe_cours_id = '" . Database :: escape_string($_cid) . "'
ORDER BY exe_cours_id ASC, exe_date DESC";
}

@ -1,22 +1,5 @@
<?php
/*
DOKEOS - elearning and course management software
For a full list of contributors, see documentation/credits.html
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See "documentation/licence.html" more details.
Contact:
Dokeos
Rue des Palais 44 Paleizenstraat
B-1030 Brussels - Belgium
Tel. +32 (2) 211 34 56
*/
/* For licensing terms, see /license.txt */
/**
* Free answer marking script
@ -29,9 +12,7 @@
*/
/*
==============================================================================
INIT SECTION
==============================================================================
*/
// name of the language file that needs to be included
$language_file='exercice';
@ -202,9 +183,7 @@ $objAnswerTmp->selectAnswer($answerId);
if($action == 'mark'){
echo $my_msg.'<br />
<a href="exercice.php?cidReq='.$cidReq.'">'.get_lang('Back').'</a>';
}else{
} else {
echo '<h2>'.$obj_question->question .':</h2>
'.$obj_question->selectTitle().'<br /><br />
'.get_lang('PleaseGiveAMark').
@ -221,7 +200,4 @@ if($action == 'mark'){
"<input type='submit' name='submit' value='".get_lang('Ok')."'>\n"
."</form>";
}
Display::display_footer();
?>
Display::display_footer();

@ -1,17 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* File containing the Matching class.
* @package chamilo.exercise
* @author Eric Marguin
* @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $
*/
if(!class_exists('Matching')):
/**
CLASS Matching
*
@ -19,7 +8,7 @@ if(!class_exists('Matching')):
* extending the class question
*
* @author Eric Marguin
* @package dokeos.exercise
* @package chamilo.exercise
**/
class Matching extends Question {
@ -96,10 +85,7 @@ class Matching extends Question {
$form -> addElement('hidden', 'nb_matches', $nb_matches);
$form -> addElement('hidden', 'nb_options', $nb_options);
////////////////////////
// DISPLAY MATCHES ////
//////////////////////
// DISPLAY MATCHES
$html='
<div class="row">
<div class="label">
@ -201,19 +187,17 @@ class Matching extends Question {
if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') {
// setting the save button here and not in the question class.php
$group[] = FormValidator :: createElement('submit','submitQuestion',$text, 'class="'.$class.'"');
$group[] = FormValidator :: createElement ('submit', 'lessOptions', get_lang('DelElem'),'class="minus"');
$group[] = FormValidator :: createElement ('submit', 'moreOptions',get_lang('AddElem'),'class="plus"');
$group[] = FormValidator :: createElement ('submit', 'lessOptions', get_lang('DelElem'),'class="minus"');
} else {
// setting the save button here and not in the question class.php
$group[] = FormValidator :: createElement('style_submit_button','submitQuestion',$text, 'class="'.$class.'"');
// setting the save button here and not in the question class.php
$group[] = FormValidator :: createElement ('style_submit_button', 'lessOptions', get_lang('DelElem'),'style="float:right;" class="minus"');
$group[] = FormValidator :: createElement ('style_submit_button', 'moreOptions',get_lang('AddElem'),'style="float:right;" class="plus"');
$group[] = FormValidator :: createElement('style_submit_button','submitQuestion',$text, 'class="'.$class.'"');
}
$form -> addGroup($group);

@ -16,7 +16,7 @@ if(!class_exists('MultipleAnswer')):
* extending the class question
*
* @author Eric Marguin
* @package dokeos.exercise
* @package chamilo.exercise
**/
class MultipleAnswer extends Question {
@ -142,16 +142,14 @@ class MultipleAnswer extends Question {
if ($show_quiz_edition) {
//ie6 fix
if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') {
$form->addElement('submit', 'lessAnswers', get_lang('LessAnswer'),'class="minus"');
$form->addElement('submit', 'moreAnswers', get_lang('PlusAnswer'),'class="plus"');
$form->addElement('submit','submitQuestion',$text, 'class="'.$class.'"');
$form->addElement('submit', 'moreAnswers', get_lang('PlusAnswer'),'class="plus"');
$form->addElement('submit', 'lessAnswers', get_lang('LessAnswer'),'class="minus"');
} else {
// setting the save button here and not in the question class.php
$form->addElement('style_submit_button','submitQuestion',$text, 'class="'.$class.'"');
$form->addElement('style_submit_button', 'lessAnswers', get_lang('LessAnswer'),'style="float:right"; class="minus"');
$form->addElement('style_submit_button', 'moreAnswers', get_lang('PlusAnswer'),'style="float:right"; class="plus"');
// setting the save button here and not in the question class.php
$form->addElement('style_submit_button', 'lessAnswers', get_lang('LessAnswer'),'class="minus"');
$form->addElement('style_submit_button', 'moreAnswers', get_lang('PlusAnswer'),'class="plus"');
$form->addElement('style_submit_button','submitQuestion',$text, 'class="'.$class.'"');
}

@ -148,15 +148,15 @@ class MultipleAnswerCombination extends Question {
//ie6 fix
if ($show_quiz_edition) {
if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') {
$form->addElement('submit','submitQuestion',$text, 'class="'.$class.'"');
$form->addElement('submit', 'lessAnswers', get_lang('LessAnswer'),'class="minus"');
$form->addElement('submit', 'moreAnswers', get_lang('PlusAnswer'),'class="plus"');
$form->addElement('submit', 'lessAnswers', get_lang('LessAnswer'),'class="minus"');
$form->addElement('submit','submitQuestion',$text, 'class="'.$class.'"');
} else {
$form->addElement('style_submit_button','submitQuestion',$text, 'class="'.$class.'"');
$form->addElement('style_submit_button', 'lessAnswers', get_lang('LessAnswer'),'style="float:right"; class="minus"');
$form->addElement('style_submit_button', 'moreAnswers', get_lang('PlusAnswer'),'style="float:right"; class="plus"');
$form->addElement('style_submit_button','submitQuestion',$text, 'class="'.$class.'"');
// setting the save button here and not in the question class.php

@ -37,6 +37,4 @@ class MultipleAnswerCombinationTrueFalse extends MultipleAnswerCombination {
$this->options = array('1'=>get_lang('True'),'0' =>get_lang('False'), '2' =>get_lang('DontKnow'));
}
}
endif;
?>
endif;

@ -1,12 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* File containing the MultipleAnswer class.
* @package dokeos.exercise
* @author Eric Marguin
*/
if(!class_exists('MultipleAnswerTrueFalse')):
/**
@ -15,8 +9,8 @@ if(!class_exists('MultipleAnswerTrueFalse')):
* This class allows to instantiate an object of type MULTIPLE_ANSWER (MULTIPLE CHOICE, MULTIPLE ANSWER),
* extending the class question
*
* @author Eric Marguin
* @package dokeos.exercise
* @author Julio Montoya
* @package chamilo.exercise
**/
class MultipleAnswerTrueFalse extends Question {
@ -184,14 +178,16 @@ class MultipleAnswerTrueFalse extends Question {
if ($show_quiz_edition) {
//ie6 fix
if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') {
$form->addElement('submit','submitQuestion',$text, 'class="'.$class.'"');
$form->addElement('submit', 'moreAnswers', get_lang('PlusAnswer'),'class="plus"');
$form->addElement('submit', 'lessAnswers', get_lang('LessAnswer'),'class="minus"');
$form->addElement('submit', 'lessAnswers', get_lang('LessAnswer'),'class="minus"');
$form->addElement('submit', 'moreAnswers', get_lang('PlusAnswer'),'class="plus"');
$form->addElement('submit', 'submitQuestion',$text, 'class="'.$class.'"');
} else {
// setting the save button here and not in the question class.php
$form->addElement('style_submit_button','submitQuestion',$text, 'class="'.$class.'"');
$form->addElement('style_submit_button', 'lessAnswers', get_lang('LessAnswer'),'style="float:right"; class="minus"');
$form->addElement('style_submit_button', 'moreAnswers', get_lang('PlusAnswer'),'style="float:right"; class="plus"');
$form->addElement('style_submit_button', 'lessAnswers', get_lang('LessAnswer'),'style="class="minus"');
$form->addElement('style_submit_button', 'moreAnswers', get_lang('PlusAnswer'),'style="class="plus"');
$form->addElement('style_submit_button', 'submitQuestion',$text, 'class="'.$class.'"');
}
}
$renderer->setElementTemplate('{element}&nbsp;','lessAnswers');

@ -241,17 +241,16 @@ class UniqueAnswer extends Question {
//ie6 fix
if ($show_quiz_edition) {
if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') {
$form->addElement('submit','submitQuestion',$text, 'class="'.$class.'"');
$form->addElement('submit', 'moreAnswers', get_lang('PlusAnswer'),'class="plus"');
$form->addElement('submit', 'lessAnswers', get_lang('LessAnswer'),'class="minus"');
$form->addElement('submit', 'lessAnswers', get_lang('LessAnswer'),'class="minus"');
$form->addElement('submit', 'moreAnswers', get_lang('PlusAnswer'),'class="plus"');
$form->addElement('submit','submitQuestion',$text, 'class="'.$class.'"');
} else {
//setting the save button here and not in the question class.php
$form->addElement('style_submit_button','submitQuestion',$text, 'class="'.$class.'"');
$form->addElement('style_submit_button', 'lessAnswers', get_lang('LessAnswer'),'style="float:right"; class="minus"');
$form->addElement('style_submit_button', 'moreAnswers', get_lang('PlusAnswer'),'style="float:right"; class="plus"');
//setting the save button here and not in the question class.php
$form->addElement('style_submit_button', 'lessAnswers', get_lang('LessAnswer'),'style="class="minus"');
$form->addElement('style_submit_button', 'moreAnswers', get_lang('PlusAnswer'),'style=" class="plus"');
$form->addElement('style_submit_button', 'submitQuestion',$text, 'class="'.$class.'"');
}
}
$renderer->setElementTemplate('{element}','submitQuestion');

@ -301,15 +301,16 @@ class UniqueAnswerNoOption extends Question {
global $text, $class, $show_quiz_edition;
//ie6 fix
if ($show_quiz_edition) {
if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') {
$form->addElement('submit','submitQuestion',$text, 'class="'.$class.'"');
if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') {
$form->addElement('submit', 'moreAnswers', get_lang('PlusAnswer'),'class="plus"');
$form->addElement('submit', 'lessAnswers', get_lang('LessAnswer'),'class="minus"');
$form->addElement('submit','submitQuestion',$text, 'class="'.$class.'"');
} else {
//setting the save button here and not in the question class.php
$form->addElement('style_submit_button','submitQuestion',$text, 'class="'.$class.'"');
$form->addElement('style_submit_button', 'lessAnswers', get_lang('LessAnswer'),'style="float:right"; class="minus"');
$form->addElement('style_submit_button', 'moreAnswers', get_lang('PlusAnswer'),'style="float:right"; class="plus"');
$form->addElement('style_submit_button', 'lessAnswers', get_lang('LessAnswer'),'style="class="minus"');
$form->addElement('style_submit_button', 'moreAnswers', get_lang('PlusAnswer'),'style="class="plus"');
$form->addElement('style_submit_button','submitQuestion',$text, 'class="'.$class.'"');
}
}
$renderer->setElementTemplate('{element}','submitQuestion');

Loading…
Cancel
Save