skala
rrodriguez 16 years ago
commit ecbd9bac05
  1. 28
      main/exercice/exercise_result.php
  2. 59
      main/exercice/exercise_show.php
  3. 40
      main/exercice/hotspot_admin.inc.php
  4. 4
      main/exercice/matching.class.php
  5. 27
      main/exercice/multiple_answer.class.php
  6. 11
      main/exercice/unique_answer.class.php
  7. BIN
      tests/procedures/spanish/tests.xls

@ -332,6 +332,7 @@ FUNCTIONS
function display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect)
{
global $feedback_type;
?>
<tr>
<td width="5%" align="center">
@ -348,6 +349,7 @@ function display_unique_or_multiple_answer($answerType, $studentChoice, $answer,
echo $answer;
?>
</td>
<?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
<td width="45%" style="border-bottom: 1px solid #4171B5;">
<?php
$answerComment=api_parse_tex($answerComment);
@ -367,6 +369,9 @@ function display_unique_or_multiple_answer($answerType, $studentChoice, $answer,
}
?>
</td>
<?php } else { ?>
<td>&nbsp;</td>
<?php } ?>
</tr>
<?php
}
@ -384,22 +389,27 @@ function display_fill_in_blanks_answer($answer)
function display_free_answer($answer)
{
global $feedback_type;
?>
<tr>
<td width="55%">
<?php echo nl2br(Security::remove_XSS($answer,COURSEMANAGERLOWSECURITY)); ?>
</td>
<?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
<td width="45%">
<?php echo get_lang('notCorrectedYet');?>
</td>
<?php } else { ?>
<td>&nbsp;</td>
<?php } ?>
</tr>
<?php
}
function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComment)
{
//global $hotspot_colors;
global $feedback_type;
$hotspot_colors = array("", // $i starts from 1 on next loop (ugly fix)
"#4271B5",
"#FE8E16",
@ -430,6 +440,7 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
<td valign="top">
<?php $my_choice = ($studentChoice)?get_lang('Correct'):get_lang('Fault'); echo $my_choice; ?>
</td>
<?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
<td valign="top">
<?php
if ($studentChoice) {
@ -441,6 +452,9 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
echo '</span>';
?>
</td>
<?php } else { ?>
<td>&nbsp;</td>
<?php } ?>
</tr>
<?php
}
@ -537,9 +551,13 @@ foreach ($questionList as $questionId) {
<td width="45%" valign="top">
<i><?php echo get_lang("Answer"); ?></i>
</td>
<?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
<td width="45%" valign="top">
<i><?php echo get_lang("Comment"); ?></i>
</td>
<?php } else { ?>
<td>&nbsp;</td>
<?php } ?>
</tr>
<?php
} elseif ($answerType == FILL_IN_BLANKS) {
@ -556,9 +574,13 @@ foreach ($questionList as $questionId) {
<td width="55%">
<i><?php echo get_lang("Answer"); ?></i>
</td>
<?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
<td width="45%" valign="top">
<i><?php echo get_lang("Comment"); ?></i>
</td>
<?php } else { ?>
<td>&nbsp;</td>
<?php } ?>
</tr>
<?php
} elseif ($answerType == HOT_SPOT) {
@ -574,9 +596,13 @@ foreach ($questionList as $questionId) {
<td width="100" valign="top">
<i><?php echo get_lang('HotspotHit'); ?></i><br /><br />
</td>
<?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
<td width="300" valign="top">
<i><?php echo get_lang("Comment"); ?></i><br /><br />
</td>
<?php } else { ?>
<td>&nbsp;</td>
<?php } ?>
</tr>
<?php
} else { //matching type

@ -15,13 +15,13 @@
$language_file=array('exercice','tracking');
// including the global dokeos file
include_once '../inc/global.inc.php';
include_once '../inc/lib/course.lib.php';
require_once '../inc/global.inc.php';
require_once '../inc/lib/course.lib.php';
// including additional libraries
include_once 'exercise.class.php';
include_once 'question.class.php'; //also defines answer type constants
include_once 'answer.class.php';
include_once(api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
require_once 'exercise.class.php';
require_once 'question.class.php'; //also defines answer type constants
require_once 'answer.class.php';
require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
if ( empty ( $origin ) ) {
$origin = $_REQUEST['origin'];
@ -251,6 +251,7 @@ function get_comments($id,$question_id)
*/
function display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect, $id, $questionId, $ans)
{
global $feedback_type;
?>
<tr>
<td width="5%" align="center">
@ -267,6 +268,8 @@ function display_unique_or_multiple_answer($answerType, $studentChoice, $answer,
echo $answer;
?>
</td>
<?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
<td width="20%" style="border-bottom: 1px solid #4171B5;">
<?php
$answerComment=api_parse_tex($answerComment);
@ -287,10 +290,13 @@ function display_unique_or_multiple_answer($answerType, $studentChoice, $answer,
?>
</td>
<?php
if ($ans==1) {
if ($ans==1) {
$comm = get_comments($id,$questionId);
}
?>
<?php } else { ?>
<td>&nbsp;</td>
<?php } ?>
</tr>
<?php
}
@ -303,20 +309,24 @@ function display_unique_or_multiple_answer($answerType, $studentChoice, $answer,
*/
function display_fill_in_blanks_answer($answer,$id,$questionId)
{
{ global $feedback_type;
?>
<tr>
<td>
<?php echo nl2br(Security::remove_XSS($answer,COURSEMANAGERLOWSECURITY)); ?>
</td><?php
if(!api_is_allowed_to_edit(null,true)) {?>
</td>
<?php
if(!api_is_allowed_to_edit(null,true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {?>
<td>
<?php
$comm = get_comments($id,$questionId);
?>
</td>
<?php } ?>
</tr>
<?php }
<?php
}
/**
* Shows the answer to a free-answer question, as HTML
@ -326,17 +336,22 @@ function display_fill_in_blanks_answer($answer,$id,$questionId)
* @return void
*/
function display_free_answer($answer,$id,$questionId) {
global $feedback_type;
?>
<tr>
<td>
<?php if (!empty($answer)) {echo nl2br(Security::remove_XSS($answer,COURSEMANAGERLOWSECURITY));} ?>
</td> <?php if(!api_is_allowed_to_edit(null,true)) {?>
</td>
<?php if(!api_is_allowed_to_edit(null,true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {?>
<td>
<?php
$comm = get_comments($id,$questionId);
?>
</td>
<?php }?>
<?php }?>
</tr>
<?php
}
@ -349,7 +364,7 @@ function display_free_answer($answer,$id,$questionId) {
* @param string $answerComment
*/
function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComment) {
//global $hotspot_colors;
global $feedback_type;
$hotspot_colors = array("", // $i starts from 1 on next loop (ugly fix)
"#4271B5",
"#FE8E16",
@ -380,6 +395,8 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
$my_choice = ($studentChoice)?get_lang('Correct'):get_lang('Fault'); echo $my_choice; ?>
</td>
<?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
<td valign="top" align="left" >
<?php
$answerComment=api_parse_tex($answerComment);
@ -390,6 +407,10 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
}
?>
</td>
<?php } else { ?>
<td>&nbsp;</td>
<?php } ?>
</tr>
<?php
}
@ -556,7 +577,11 @@ if ($show_results) {
<td><i><?php echo get_lang("Choice"); ?></i> </td>
<td><i><?php echo get_lang("ExpectedChoice"); ?></i></td>
<td><i><?php echo get_lang("Answer"); ?></i></td>
<?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
<td><i><?php echo get_lang("Comment"); ?></i></td>
<?php } else { ?>
<td>&nbsp;</td>
<?php } ?>
</tr>
<tr>
<td>&nbsp;</td>
@ -606,7 +631,11 @@ if ($show_results) {
<td><i><?php echo get_lang("Choice"); ?></i> </td>
<td><i><?php echo get_lang("ExpectedChoice"); ?></i></td>
<td><i><?php echo get_lang("Answer"); ?></i></td>
<?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
<td><i><?php echo get_lang("Comment"); ?></i></td>
<?php } else { ?>
<td>&nbsp;</td>
<?php } ?>
</tr>
<tr>
<td>&nbsp;</td>
@ -1008,7 +1037,7 @@ if ($show_results) {
}
echo '</select>';
echo '</form><br/ ></div>';
if ($questionScore==-1) {
if ($questionScore==-1 ) {
$questionScore=0;
echo '<br />'.get_lang('notCorrectedYet');
}

@ -172,7 +172,9 @@ if($modifyAnswers)
for($i=1;$i <= $nbrAnswers;$i++)
{
$reponse[$i]=$objAnswer->selectAnswer($i);
$comment[$i]=$objAnswer->selectComment($i);
if ($objExercise->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) {
$comment[$i]=$objAnswer->selectComment($i);
}
$weighting[$i]=$objAnswer->selectWeighting($i);
$hotspot_coordinates[$i]=$objAnswer->selectHotspotCoordinates($i);
$hotspot_type[$i]=$objAnswer->selectHotspotType($i);
@ -183,7 +185,9 @@ if($modifyAnswers)
$_SESSION['tmp_answers'] = array();
$_SESSION['tmp_answers']['answer'] = $reponse;
$_SESSION['tmp_answers']['comment'] = $comment;
if ($objExercise->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) {
$_SESSION['tmp_answers']['comment'] = $comment;
}
$_SESSION['tmp_answers']['weighting'] = $weighting;
$_SESSION['tmp_answers']['hotspot_coordinates'] = $hotspot_coordinates;
$_SESSION['tmp_answers']['hotspot_type'] = $hotspot_type;
@ -195,7 +199,9 @@ if($modifyAnswers)
$nbrAnswers--;
// Remove the last answer
$tmp = array_pop($_SESSION['tmp_answers']['answer']);
$tmp = array_pop($_SESSION['tmp_answers']['comment']);
if ($objExercise->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) {
$tmp = array_pop($_SESSION['tmp_answers']['comment']);
}
$tmp = array_pop($_SESSION['tmp_answers']['weighting']);
$tmp = array_pop($_SESSION['tmp_answers']['hotspot_coordinates']);
$tmp = array_pop($_SESSION['tmp_answers']['hotspot_type']);
@ -212,7 +218,9 @@ if($modifyAnswers)
// Add a new answer
$_SESSION['tmp_answers']['answer'][]='';
$_SESSION['tmp_answers']['comment'][]='';
if ($objExercise->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) {
$_SESSION['tmp_answers']['comment'][]='';
}
$_SESSION['tmp_answers']['weighting'][]='1';
$_SESSION['tmp_answers']['hotspot_coordinates'][]='0;0|0|0';
$_SESSION['tmp_answers']['hotspot_type'][]='square';
@ -293,9 +301,16 @@ if($modifyAnswers)
</tr>
-->
<tr>
<th width="5">&nbsp;<?php /* echo get_lang('Hotspot'); */ ?></th>
<th ><?php echo get_lang('HotspotDescription'); ?>*</th>
<th ><?php echo get_lang('Comment'); ?></th>
<th width="5" >&nbsp;<?php /* echo get_lang('Hotspot'); */ ?></th>
<?php if ($objExercise->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
<th><?php echo get_lang('HotspotDescription'); ?>*</th>
<th><?php echo get_lang('Comment'); ?></th>
<?php } else { ?>
<th colspan="2"><?php echo get_lang('HotspotDescription'); ?>*</th>
<?php } ?>
<th><?php echo get_lang('QuestionWeighting'); ?>*</th>
</tr>
@ -303,8 +318,9 @@ if($modifyAnswers)
for($i=1;$i <= $nbrAnswers;$i++) {
?>
<tr>
<td valign="top"><div style="height: 15px; width: 15px; background-color: <?php echo $hotspot_colors[$i]; ?>"> </div></td>
<td valign="top" align="left"><input type="text" name="reponse[<?php echo $i; ?>]" value="<?php echo api_htmlentities($reponse[$i], ENT_QUOTES, api_get_system_encoding()); ?>" size="45" /></td>
<td valign="top"><div style="height: 15px; width: 15px; background-color: <?php echo $hotspot_colors[$i]; ?>"> </div></td>
<?php if ($objExercise->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
<td valign="top" align="left"><input type="text" name="reponse[<?php echo $i; ?>]" value="<?php echo api_htmlentities($reponse[$i], ENT_QUOTES, api_get_system_encoding()); ?>" size="45" /></td>
<?php
require_once(api_get_path(LIBRARY_PATH) . "/fckeditor/fckeditor.php");
$oFCKeditor = new FCKeditor("comment[$i]") ;
@ -317,7 +333,11 @@ if($modifyAnswers)
$return = $oFCKeditor->CreateHtml();
/*<td align="left"><textarea wrap="virtual" rows="1" cols="25" name="comment[<?php echo $i; ?>]" style="width: 100%"><?php echo api_htmlentities($comment[$i], ENT_QUOTES, api_get_system_encoding()); ?></textarea></td>*/
?>
<td align="left"><?php echo $return; ?></td>
<td align="left"><?php echo $return; ?></td>
<?php } else { ?>
<td valign="top" align="left" colspan="2"><input type="text" name="reponse[<?php echo $i; ?>]" value="<?php echo api_htmlentities($reponse[$i], ENT_QUOTES, api_get_system_encoding()); ?>" size="45" /></td>
<?php } ?>
<td valign="top"><input type="text" name="weighting[<?php echo $i; ?>]" size="5" value="<?php echo (isset($weighting[$i]) ? float_format($weighting[$i],1) : 10); ?>" />
<input type="hidden" name="hotspot_coordinates[<?php echo $i; ?>]" value="<?php echo (empty($hotspot_coordinates[$i]) ? '0;0|0|0' : $hotspot_coordinates[$i]); ?>" />
<input type="hidden" name="hotspot_type[<?php echo $i; ?>]" value="<?php echo (empty($hotspot_type[$i]) ? 'square' : $hotspot_type[$i]); ?>" /></td>

@ -142,7 +142,7 @@ class Matching extends Question {
if ($nb_matches < 1) {
$nb_matches = 1;
Display::display_normal_message(get_lang('YouHaveToCreateAlLeastOneAnswer'));
Display::display_normal_message(get_lang('YouHaveToCreateAtLeastOneAnswer'));
}
for($i = 1 ; $i <= $nb_matches ; ++$i) {
@ -195,7 +195,7 @@ class Matching extends Question {
if ($nb_options < 1) {
$nb_options = 1;
Display::display_normal_message(get_lang('YouHaveToCreateAlLeastOneAnswer'));
Display::display_normal_message(get_lang('YouHaveToCreateAtLeastOneAnswer'));
}
for($i = 1 ; $i <= $nb_options ; ++$i) {

@ -66,6 +66,8 @@ class MultipleAnswer extends Question {
$nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 2;
$nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0));
$obj_ex = $_SESSION['objExercise'];
$html='
<div class="row">
<div class="label">
@ -82,11 +84,15 @@ class MultipleAnswer extends Question {
</th>
<th>
'.get_lang('Answer').'
</th>
<th>
</th>';
// show column comment when feedback is enable
if ($obj_ex->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM ) {
$html .='<th>
'.get_lang('Comment').'
</th>
<th>
</th>';
}
$html .= '<th>
'.get_lang('Weighting').'
</th>
</tr>';
@ -107,7 +113,7 @@ class MultipleAnswer extends Question {
if ($nb_answers < 1) {
$nb_answers = 1;
Display::display_normal_message(get_lang('YouHaveToCreateAlLeastOneAnswer'));
Display::display_normal_message(get_lang('YouHaveToCreateAtLeastOneAnswer'));
}
for($i = 1 ; $i <= $nb_answers ; ++$i) {
@ -135,10 +141,15 @@ class MultipleAnswer extends Question {
$form->addElement('checkbox', 'correct['.$i.']', null, null, 'class="checkbox" style="margin-left: 0em;"');
$boxes_names[] = 'correct['.$i.']';
$form->addElement('html_editor', 'answer['.$i.']',null, 'style="vertical-align:middle"', array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
$form->addElement('html_editor', 'answer['.$i.']',null, 'style="vertical-align:middle"', array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
$form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('html_editor', 'comment['.$i.']',null, 'style="vertical-align:middle"', array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
// show comment when feedback is enable
if ($obj_ex->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) {
$form->addElement('html_editor', 'comment['.$i.']',null, 'style="vertical-align:middle"', array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
}
$form->addElement('text', 'weighting['.$i.']',null, 'style="vertical-align:middle;margin-left: 0em;" size="5" value="10"');
$form -> addElement ('html', '</tr>');
}

@ -159,7 +159,7 @@ class UniqueAnswer extends Question {
if ($nb_answers < 1) {
$nb_answers = 1;
Display::display_normal_message(get_lang('YouHaveToCreateAlLeastOneAnswer'));
Display::display_normal_message(get_lang('YouHaveToCreateAtLeastOneAnswer'));
}
for($i = 1 ; $i <= $nb_answers ; ++$i)
@ -230,11 +230,12 @@ class UniqueAnswer extends Question {
$form->addElement('radio', 'correct', null, null, $i, 'class="checkbox" style="margin-left: 0em;"');
$form->addElement('html_editor', 'answer['.$i.']', null, 'style="vertical-align:middle"', $editor_config);
$form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required');
if ($obj_ex->selectFeedbackType()==0) // feedback
if ($obj_ex->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_END) {
// feedback
$form->addElement('html_editor', 'comment['.$i.']', null, 'style="vertical-align:middle"', $editor_config);
elseif ($obj_ex->selectFeedbackType()==1) // direct feedback
{
} elseif ($obj_ex->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) {
// direct feedback
$form->addElement('html_editor', 'comment['.$i.']', null, 'style="vertical-align:middle"', $editor_config);
//Adding extra feedback fields
$group = array();

Loading…
Cancel
Save