[svn r19404] Changes in exercises see FS#3918

skala
Carlos Vargas 17 years ago
parent 59e09db164
commit 0907bb8b8a
  1. 8
      main/exercice/admin.php
  2. 155
      main/exercice/exercice.php
  3. 46
      main/exercice/exercice_submit.php
  4. 61
      main/exercice/exercise.class.php
  5. 8
      main/exercice/exercise_admin.php
  6. 8
      main/exercice/question_list_admin.inc.php
  7. 2
      main/exercice/unique_answer.class.php

@ -1,4 +1,4 @@
<?php // $Id: admin.php 18712 2009-02-26 21:16:53Z cvargas1 $
<?php // $Id: admin.php 19404 2009-03-28 01:24:38Z cvargas1 $
/*
==============================================================================
@ -67,7 +67,7 @@
*
* @package dokeos.exercise
* @author Olivier Brouckaert
* @version $Id: admin.php 18712 2009-02-26 21:16:53Z cvargas1 $
* @version $Id: admin.php 19404 2009-03-28 01:24:38Z cvargas1 $
*/
@ -451,6 +451,8 @@ Display::display_header($nameTools,'Exercise');
echo '<div class="actions">';
echo Display::return_icon('preview.gif', get_lang('Preview')).'<a href="exercice_submit.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'">'.get_lang('Preview').'</a>';
echo Display::return_icon('lp_quiz.png', get_lang('ModifyExercise')).'<a href="exercise_admin.php?modifyExercise=yes&exerciseId='.$objExercise->id.'">'.get_lang('ModifyExercise').'</a>';
echo '</div>';
if(isset($_GET['message']))
@ -488,7 +490,7 @@ if(!$newQuestion && !$modifyQuestion && !$editQuestion && !isset($_GET['hotspota
include_once(api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
$form = new FormValidator('exercise_admin', 'post', api_get_self().'?exerciseId='.$_GET['exerciseId']);
$form -> addElement ('hidden','edit','true');
$objExercise -> createForm ($form,'simple');
//$objExercise -> createForm ($form,'simple');
if($form -> validate()) {
$objExercise -> processCreation($form,'simple');

@ -1,4 +1,4 @@
<?php // $Id: exercice.php 18925 2009-03-10 14:09:33Z ndieschburg $
<?php // $Id: exercice.php 19404 2009-03-28 01:24:38Z cvargas1 $
/*
==============================================================================
@ -583,67 +583,24 @@ echo '<div class="actions">';
echo '</span>';
}
if (($is_allowedToEdit) and ($origin != 'learnpath'))
{
echo '<a href="exercise_admin.php?'.api_get_cidreq().'">'.Display::return_icon('new_test.gif',get_lang('NewEx')).get_lang('NewEx').'</a>';
echo '<a href="hotpotatoes.php">'.Display::return_icon('jqz.gif',get_lang('ImportHotPotatoesQuiz')).get_lang('ImportHotPotatoesQuiz').'</a>';
echo '<a href="'.api_add_url_param($_SERVER['REQUEST_URI'],'show=result').'">'.Display::return_icon('show_test_results.gif',get_lang('Results')).get_lang('Results').'</a>';
// the actions for the statistics
if($show == 'result') {
// the form
if(api_is_platform_admin() || api_is_course_admin() || api_is_course_tutor() || api_is_course_coach()) {
if($_SESSION['export_user_fields']==false) {
$alt = get_lang('ExportWithUserFields');
$extra_user_fields = '<input type="hidden" name="export_user_fields" value="export_user_fields">';
} else {
$alt = get_lang('ExportWithoutUserFields');
$extra_user_fields = '<input type="hidden" name="export_user_fields" value="do_not_export_user_fields">';
}
echo '<a href="#" onclick="document.form1a.submit();">'.Display::return_icon('excel.gif',get_lang('ExportAsCSV')).get_lang('ExportAsCSV').'</a>';
echo '<a href="#" onclick="document.form1b.submit();">'.Display::return_icon('excel.gif',get_lang('ExportAsXLS')).get_lang('ExportAsXLS').'</a>';
echo '<a href="#" onclick="document.form1c.submit();">'.Display::return_icon('synthese_view.gif',$alt).$alt.'</a>';
echo '<a href="'.api_add_url_param($_SERVER['REQUEST_URI'],'show=test').'">'.Display::return_icon('quiz.gif',get_lang('BackToExercisesList')).get_lang('BackToExercisesList').'</a>';
echo '<form id="form1a" name="form1a" method="post" action="'.api_get_self().'?show='.Security::remove_XSS($_GET['show']).'">';
echo '<input type="hidden" name="export_report" value="export_report">';
echo '<input type="hidden" name="export_format" value="csv">';
echo '</form>';
echo '<form id="form1b" name="form1b" method="post" action="'.api_get_self().'?show='.Security::remove_XSS($_GET['show']).'">';
echo '<input type="hidden" name="export_report" value="export_report">';
echo '<input type="hidden" name="export_format" value="xls">';
echo '</form>';
echo '<form id="form1c" name="form1c" method="post" action="'.api_get_self().'?show='.Security::remove_XSS($_GET['show']).'">';
echo $extra_user_fields;
echo '</form>';
}
}
} else {
//the student view
echo '<a href="'.api_add_url_param($_SERVER['REQUEST_URI'],'show=result').'">'.Display::return_icon('show_test_results.gif',get_lang('Results')).get_lang('Results').'</a>';
if($show == 'result') {
echo '<a href="'.api_add_url_param($_SERVER['REQUEST_URI'],'show=test').'">'.Display::return_icon('quiz.gif',get_lang('BackToExercisesList')).get_lang('BackToExercisesList').'</a>';
}
}
if ($_configuration['tracking_enabled'])
{
if ($show == 'result')
{
if (!function_exists('make_select'))
if ($_configuration['tracking_enabled']) {
if ($show == 'result') {
/*if (!function_exists('make_select'))
{
function make_select($name,$values,$checked='')
{
$output .= '<select name="'.$name.'" >';
foreach($values as $key => $value)
{
$output .= '<option value="'.$key.'" '.(($checked==$key)?'selected="selected"':'').'>'.$value.'</option>';
//$output .= '<option value="'.$key.'" '.(($checked==$key)?'selected="selected"':'').'>'.$value.'</option>';
}
$output .= '</select>';
return $output;
}
}
}*/
if (!function_exists('make_select_users'))
/*if (!function_exists('make_select_users'))
{
function make_select_users($name,$values,$checked='')
{
@ -656,20 +613,16 @@ echo '<div class="actions">';
$output .= '</select>';
return $output;
}
}
}*/
if (api_is_allowed_to_edit())
{
if (!$_REQUEST['filter'])
{
if (api_is_allowed_to_edit()) {
if (!$_REQUEST['filter']) {
$filter_by_not_revised = true;
$filter=1;
}
$filter = (int)$_REQUEST['filter'];
switch($filter)
{
switch($filter) {
case 1:
$filter_by_not_revised = true;
break;
@ -679,14 +632,18 @@ echo '<div class="actions">';
default:
null;
}
$form_filter = '<form method="post" action="'.api_get_self().'?cidReq='.api_get_course_id().'&show=result">';
$form_filter .= make_select('filter',array(1=>get_lang('FilterByNotRevised'),2=>get_lang('FilterByRevised')),$filter);
$form_filter .= '<button class="save" type="submit">'.get_lang('FilterExercices').'</button></form>';
echo $form_filter;
if($_REQUEST['filter']=='1' or !isset($_REQUEST['filter'])) {
$view_result = '<a href="'.api_get_self().'?cidReq='.api_get_course_id().'&show=result&filter=2'.'" >'.Display::display_icon('checkbox_on.gif', get_lang('ShowCorrectedOnly')).get_lang('ShowCorrectedOnly').'</a>';
} else {
$view_result = '<a href="'.api_get_self().'?cidReq='.api_get_course_id().'&show=result&filter=1'.'" >'.Display::display_icon('checkbox_off.gif', get_lang('ShowUnCorrectedOnly')).get_lang('ShowUnCorrectedOnly').'</a>';
}
//$form_filter = '<form method="post" action="'.api_get_self().'?cidReq='.api_get_course_id().'&show=result">';
//$form_filter .= make_select('filter',array(1=>get_lang('FilterByNotRevised'),2=>get_lang('FilterByRevised')),$filter);
//$form_filter .= '<button class="save" type="submit">'.get_lang('FilterExercices').'</button></form>';
echo $view_result;
}
}
if (api_is_allowed_to_edit())
/*if (api_is_allowed_to_edit())
{
$user_count = count($user_list_name);
if ($user_count >0 ) {
@ -700,9 +657,57 @@ echo '<div class="actions">';
$form_filter .= '<input type="submit" value="'.get_lang('FilterExercicesByUsers').'"></form>';
echo $form_filter;
}
}
} */
}
if (($is_allowedToEdit) and ($origin != 'learnpath'))
{
if ($_GET['show']!='result') {
echo '<a href="exercise_admin.php?'.api_get_cidreq().'">'.Display::return_icon('new_test.gif',get_lang('NewEx')).get_lang('NewEx').'</a>';
echo '<a href="hotpotatoes.php">'.Display::return_icon('jqz.gif',get_lang('ImportHotPotatoesQuiz')).get_lang('ImportHotPotatoesQuiz').'</a>';
echo '<a href="'.api_add_url_param($_SERVER['REQUEST_URI'],'show=result').'">'.Display::return_icon('show_test_results.gif',get_lang('Results')).get_lang('Results').'</a>';
}
// the actions for the statistics
if($show == 'result') {
// the form
if(api_is_platform_admin() || api_is_course_admin() || api_is_course_tutor() || api_is_course_coach()) {
if($_SESSION['export_user_fields']==true) {
$alt = get_lang('ExportWithUserFields');
$extra_user_fields = '<input type="hidden" name="export_user_fields" value="export_user_fields">';
} else {
$alt = get_lang('ExportWithoutUserFields');
$extra_user_fields = '<input type="hidden" name="export_user_fields" value="do_not_export_user_fields">';
}
//echo '<a href="#" onclick="document.form1a.submit();">'.Display::return_icon('excel.gif',get_lang('ExportAsCSV')).get_lang('ExportAsCSV').'</a>';
echo '<a href="#" onclick="document.form1b.submit();">'.Display::return_icon('excel.gif',get_lang('ExportAsXLS')).get_lang('ExportAsXLS').'</a>';
//echo '<a href="#" onclick="document.form1c.submit();">'.Display::return_icon('synthese_view.gif',$alt).$alt.'</a>';
echo '<a href="'.api_add_url_param($_SERVER['REQUEST_URI'],'show=test').'">'.Display::return_icon('quiz.gif',get_lang('BackToExercisesList')).get_lang('BackToExercisesList').'</a>';
echo '<form id="form1a" name="form1a" method="post" action="'.api_get_self().'?show='.Security::remove_XSS($_GET['show']).'">';
echo '<input type="hidden" name="export_report" value="export_report">';
echo '<input type="hidden" name="export_format" value="csv">';
echo '</form>';
echo '<form id="form1b" name="form1b" method="post" action="'.api_get_self().'?show='.Security::remove_XSS($_GET['show']).'">';
echo '<input type="hidden" name="export_report" value="export_report">';
echo '<input type="hidden" name="export_format" value="xls">';
echo '</form>';
//echo '<form id="form1c" name="form1c" method="post" action="'.api_get_self().'?show='.Security::remove_XSS($_GET['show']).'">';
//echo $extra_user_fields;
//echo '</form>';
}
}
} else {
//the student view
if($show == 'result') {
echo '<a href="'.api_add_url_param($_SERVER['REQUEST_URI'],'show=test').'">'.Display::return_icon('quiz.gif',get_lang('BackToExercisesList')).get_lang('BackToExercisesList').'</a>';
} else {
echo '<a href="'.api_add_url_param($_SERVER['REQUEST_URI'],'show=result').'">'.Display::return_icon('show_test_results.gif',get_lang('Results')).get_lang('Results').'</a>';
}
}
echo '</div>'; // closing the actions div
@ -716,7 +721,7 @@ if ($show == 'test') {
<tr class="row_odd">
<th colspan="3"><?php echo get_lang('ExerciseName');?></th>
<th><?php echo get_lang('QuantityQuestions');?></th>
<th><?php echo get_lang('Export');?></th>
<!--<th>--><?php //echo get_lang('Export');?><!--</th>-->
<th><?php echo get_lang('Modify');?></th>
</tr>
@ -764,19 +769,19 @@ if ($origin != 'learnpath') {
$sqlquery = "SELECT count(*) FROM $TBL_EXERCICE_QUESTION WHERE exercice_id = '".Database::escape_string($exid)."'";
$sqlresult =api_sql_query($sqlquery);
$rowi = Database::result($sqlresult,0);
echo $rowi.' '.strtolower(get_lang(($rowi>1?'Questions':'Question'))).'</td>';
echo '<td><a href="exercice.php?choice=exportqti2&exerciseId='.$row['id'].'"><img src="../img/export.png" border="0" title="IMS/QTI" /></a></td>';
//echo $rowi.' '.strtolower(get_lang(($rowi>1?'Questions':'Question'))).'</td>';
//echo '<td><a href="exercice.php?choice=exportqti2&exerciseId='.$row['id'].'"><img src="../img/export.png" border="0" title="IMS/QTI" /></a></td>';
?>
<td>
<a href="admin.php?exerciseId=<?php echo $row['id']; ?>"><img src="../img/wizard_small.gif" border="0" title="<?php echo htmlentities(get_lang('Build'),ENT_QUOTES,$charset); ?>" alt="<?php echo htmlentities(get_lang('Build'),ENT_QUOTES,$charset); ?>" /></a>
<a href="admin.php?exerciseId=<?php echo $row['id']; ?>"><img src="../img/wizard_small.gif" border="0" title="<?php echo htmlentities(get_lang('Edit'),ENT_QUOTES,$charset); ?>" alt="<?php echo htmlentities(get_lang('Edit'),ENT_QUOTES,$charset); ?>" /></a>
<?php
if($row['results_disabled']) {
echo '<a href="exercice.php?choice=enable_results&page='.$page.'&exerciseId='.$row['id'].'" title="'.get_lang('EnableResults').'" alt="'.get_lang('EnableResults').'"><img src="../img/lp_quiz_na.gif" border="0" alt="'.htmlentities(get_lang('EnableResults'),ENT_QUOTES,$charset).'" /></a>';
//echo '<a href="exercice.php?choice=enable_results&page='.$page.'&exerciseId='.$row['id'].'" title="'.get_lang('EnableResults').'" alt="'.get_lang('EnableResults').'"><img src="../img/lp_quiz_na.gif" border="0" alt="'.htmlentities(get_lang('EnableResults'),ENT_QUOTES,$charset).'" /></a>';
} else {
echo '<a href="exercice.php?choice=disable_results&page='.$page.'&exerciseId='.$row['id'].'" title="'.get_lang('DisableResults').'" alt="'.get_lang('DisableResults').'"><img src="../img/lp_quiz.gif" border="0" alt="'.htmlentities(get_lang('DisableResults'),ENT_QUOTES,$charset).'" /></a>';
//echo '<a href="exercice.php?choice=disable_results&page='.$page.'&exerciseId='.$row['id'].'" title="'.get_lang('DisableResults').'" alt="'.get_lang('DisableResults').'"><img src="../img/lp_quiz.gif" border="0" alt="'.htmlentities(get_lang('DisableResults'),ENT_QUOTES,$charset).'" /></a>';
}
?>
<a href="exercise_admin.php?modifyExercise=yes&exerciseId=<?php echo $row['id']; ?>"> <img src="../img/edit.gif" border="0" title="<?php echo htmlentities(get_lang('Modify'),ENT_QUOTES,$charset); ?>" alt="<?php echo htmlentities(get_lang('Modify'),ENT_QUOTES,$charset); ?>" /></a>
<!--<a href="exercise_admin.php?modifyExercise=yes&exerciseId=--><?php// echo $row['id']; ?><!--"> <img src="../img/edit.gif" border="0" title="--><?php //echo htmlentities(get_lang('Modify'),ENT_QUOTES,$charset); ?><!--" alt="--><?php //echo htmlentities(get_lang('Modify'),ENT_QUOTES,$charset); ?><!--" /></a>-->
<a href="exercice.php?choice=delete&exerciseId=<?php echo $row['id']; ?>" onclick="javascript:if(!confirm('<?php echo addslashes(htmlentities(get_lang('AreYouSureToDelete'),ENT_QUOTES,$charset)); echo " ".$row['title']; echo "?"; ?>')) return false;"> <img src="../img/delete.gif" border="0" alt="<?php echo htmlentities(get_lang('Delete'),ENT_QUOTES,$charset); ?>" /></a>
<?php
//if active
@ -904,7 +909,7 @@ $i++;
<td><a href="showinframes.php?file=<?php echo $path?>&cid=<?php echo $_course['official_code'];?>&uid=<?php echo $_user['user_id'];?>" <?php if(!$active) echo 'class="invisible"'; ?>><?php echo $title?></a></td>
<td></td><td></td>
<td><a href="adminhp.php?hotpotatoesName=<?php echo $path; ?>"> <img src="../img/edit.gif" border="0" alt="<?php echo htmlentities(get_lang('Modify'),ENT_QUOTES,$charset); ?>" /></a>
<img src="../img/wizard_gray_small.gif" border="0" title="<?php echo htmlentities(get_lang('Build'),ENT_QUOTES,$charset); ?>" alt="<?php echo htmlentities(get_lang('Build'),ENT_QUOTES,$charset); ?>" />
<img src="../img/wizard_gray_small.gif" border="0" title="<?php echo htmlentities(get_lang('Edit'),ENT_QUOTES,$charset); ?>" alt="<?php echo htmlentities(get_lang('Edit'),ENT_QUOTES,$charset); ?>" />
<a href="<?php echo $exercicePath; ?>?hpchoice=delete&amp;file=<?php echo $path; ?>" onclick="javascript:if(!confirm('<?php echo addslashes(htmlentities(get_lang('AreYouSure'),ENT_QUOTES,$charset).$title."?"); ?>')) return false;"><img src="../img/delete.gif" border="0" alt="<?php echo htmlentities(get_lang('Delete'),ENT_QUOTES,$charset); ?>" /></a>
<?php
// if active

@ -1,4 +1,4 @@
<?php // $Id: exercice_submit.php 18623 2009-02-20 17:49:23Z cfasanando $
<?php // $Id: exercice_submit.php 19404 2009-03-28 01:24:38Z cvargas1 $
/*
==============================================================================
@ -42,7 +42,7 @@
* @package dokeos.exercise
* @author Olivier Brouckaert
* @author Julio Montoya multiple fill in blank option added
* @version $Id: exercice_submit.php 18623 2009-02-20 17:49:23Z cfasanando $
* @version $Id: exercice_submit.php 19404 2009-03-28 01:24:38Z cvargas1 $
*/
@ -900,18 +900,27 @@ else
$number_of_hotspot_questions = 0;
$onsubmit = '';
$i=0;
foreach($questionList as $questionId)
{
$i++;
$objQuestionTmp = Question :: read($questionId);
// for sequential exercises
if($exerciseType == 2) {
// if it is not the right question, goes to the next loop iteration
if($questionNum != $i)
{
continue;
//i have a doubt in this line cvargas
var_dump($questionList);
if (!strcmp($questionList[0],'')===0) {
foreach($questionList as $questionId) {
$i++;
$objQuestionTmp = Question :: read($questionId);
// for sequential exercises
if($exerciseType == 2) {
// if it is not the right question, goes to the next loop iteration
if($questionNum != $i) {
continue;
}
else
{
if ($objQuestionTmp->selectType() == HOT_SPOT)
{
$number_of_hotspot_questions++;
}
break;
}
}
else
{
@ -919,18 +928,9 @@ else
{
$number_of_hotspot_questions++;
}
break;
}
}
else
{
if ($objQuestionTmp->selectType() == HOT_SPOT)
{
$number_of_hotspot_questions++;
}
}
}
if($number_of_hotspot_questions > 0)
{
$onsubmit = "onsubmit=\"return validateFlashVar('".$number_of_hotspot_questions."', '".get_lang('HotspotValidateError1')."', '".get_lang('HotspotValidateError2')."');\"";

@ -25,7 +25,7 @@
* Exercise class: This class allows to instantiate an object of type Exercise
* @package dokeos.exercise
* @author Olivier Brouckaert
* @version $Id: exercise.class.php 19314 2009-03-25 17:25:18Z cvargas1 $
* @version $Id: exercise.class.php 19404 2009-03-28 01:24:38Z cvargas1 $
*/
@ -45,8 +45,8 @@ class Exercise
var $feedbacktype;
var $end_time;
var $start_time;
var $questionList; // array with the list of this exercise's questions
var $results_disabled;
/**
* constructor of the class
@ -66,6 +66,7 @@ class Exercise
$this->timeLimit = 0;
$this->end_time = '0000-00-00 00:00:00';
$this->start_time = '0000-00-00 00:00:00';
$this->results_disabled =1;
}
/**
@ -222,6 +223,17 @@ class Exercise
return $this->type;
}
/**
* tells if questions are selected randomly, and if so returns the draws
*
* @author - Carlos Vargas
* @return - integer - results disabled exercise
*/
function selectResultsDisabled()
{
return $this->results_disabled;
}
/**
* tells if questions are selected randomly, and if so returns the draws
*
@ -480,6 +492,15 @@ class Exercise
{
$this->results_disabled = false;
}
function updateResultsDisabled($results_disabled)
{
if ($results_disabled==1){
$this->results_disabled = true;
} else {
$this->results_disabled = false;
}
}
/**
* updates the exercise in the data base
@ -836,19 +857,24 @@ class Exercise
$form -> addElement ('html_editor', 'exerciseDescription', get_lang('ExerciseDescription'));
if($type=='full') {
// feedback type
// feedback type
$radios_feedback = array();
$radios_feedback[] = FormValidator :: createElement ('radio', 'exerciseFeedbackType', null, get_lang('Feedback'),'0');
$radios_feedback[] = FormValidator :: createElement ('radio', 'exerciseFeedbackType', null, get_lang('NoFeedback'),'2');
$form -> addGroup($radios_feedback, null, get_lang('Evaluation'));
$feedback_option[0]=get_lang('Feedback');
$feedback_option[1]=get_lang('DirectFeedback');
$feedback_option[2]=get_lang('NoFeedback');
//Can't modify a DirectFeedback question
if ($this->selectFeedbackType() != 1 ) {
$form -> addElement('select', 'exerciseFeedbackType',get_lang('FeedbackType'),$feedback_option,'onchange="javascript:feedbackselection()"');
// $form -> addElement('select', 'exerciseFeedbackType',get_lang('FeedbackType'),$feedback_option,'onchange="javascript:feedbackselection()"');
// test type
$radios = array();
$radios[] = FormValidator :: createElement ('radio', 'exerciseType', null, get_lang('SimpleExercise'),'1');
$radios[] = FormValidator :: createElement ('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2');
$form -> addGroup($radios, null, get_lang('ExerciseType'), '<br />');
$form -> addGroup($radios, null, get_lang('ExerciseType'));
} else {
// if is Directfeedback but has not questions we can allow to modify the question type
if ($this->selectNbrQuestions()== 0) {
@ -857,18 +883,23 @@ class Exercise
$radios = array();
$radios[] = FormValidator :: createElement ('radio', 'exerciseType', null, get_lang('SimpleExercise'),'1');
$radios[] = FormValidator :: createElement ('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2');
$form -> addGroup($radios, null, get_lang('ExerciseType'), '<br />');
$form -> addGroup($radios, null, get_lang('ExerciseType'));
} else {
//we force the options to the DirectFeedback exercisetype
$form -> addElement('hidden', 'exerciseFeedbackType','1');
$form -> addElement('hidden', 'exerciseType','2');
}
}
$radios_results_disabled = array();
$radios_results_disabled[] = FormValidator :: createElement ('radio', 'results_disabled', null, get_lang('ShowResultsToStudents'),'0');
$radios_results_disabled[] = FormValidator :: createElement ('radio', 'results_disabled', null, get_lang('HideResultsToStudents'),'1');
$form -> addGroup($radios_results_disabled, null, get_lang('Results'));
$form -> addElement('html','<div class="row">
<div class="label">&nbsp;</div>
<div class="formw">
<a href="javascript://" onclick=" return advanced_parameters()"><span id="img_plus_and_minus"><img src="../img/nolines_plus.gif" alt="" />'.get_lang('AdvancedParameters').'</span></a>
<a href="javascript://" onclick=" return advanced_parameters()"><span id="img_plus_and_minus"><img src="../img/div_show.gif" alt="" />&nbsp;'.get_lang('AdvancedParameters').'</span></a>
</div>
</div>');
@ -882,9 +913,7 @@ class Exercise
$option[0]=get_lang('DoNotRandomize');
$random[] = FormValidator :: createElement ('select', 'randomQuestions',null,$option);
$random[] = FormValidator :: createElement ('static', 'help','help','<span style="font-style: italic;">'.get_lang('RandomQuestionsHelp').'</span>');
$random[] = FormValidator :: createElement ('static', 'help','help','<span style="font-style: italic;">'.get_lang('RandomQuestionsHelp').'</span>');
//$random[] = FormValidator :: createElement ('text', 'randomQuestions', null,null,'0');
$form -> addGroup($random,null,get_lang('RandomQuestions'),'<br />');
@ -892,12 +921,12 @@ class Exercise
$attempt_option[0]=get_lang('Infinite');
$form -> addElement('select', 'exerciseAttempts',get_lang('ExerciseAttempts'),$attempt_option);
$form -> addElement('html','</div>');
$form -> addElement('checkbox', 'enabletimelimit',get_lang('EnableTimeLimits'),null,'onclick = " return timelimit() "');
$form -> addElement('checkbox', 'enabletimelimit',get_lang('EnableTimeLimits'),null,'onclick = " return timelimit() "');
$var= Exercise::selectTimeLimit();
$form -> addElement('html','</div>');
if(($this -> start_time!='0000-00-00 00:00:00')||($this -> end_time!='0000-00-00 00:00:00'))
$form -> addElement('html','<div id="options2" style="display:block;">');
@ -941,7 +970,8 @@ class Exercise
}
// submit
isset($_GET['exerciseId'])?$text=get_lang('ModifyExercise'):$text=get_lang('CreateExercise');
isset($_GET['exerciseId'])?$text=get_lang('ModifyExercise'):$text=get_lang('ProcedToQuestions');
$form -> addElement('html', '<br /><br />');
$form -> addElement('style_submit_button', 'submitExercise', $text, 'class="save"');
$form -> addRule ('exerciseTitle', get_lang('GiveExerciseName'), 'required');
@ -967,6 +997,7 @@ class Exercise
$defaults['exerciseDescription'] = $this -> selectDescription();
$defaults['exerciseAttempts'] = $this->selectAttempts();
$defaults['exerciseFeedbackType'] = $this->selectFeedbackType();
$defaults['results_disabled'] = $this->selectResultsDisabled();
if(($this -> start_time!='0000-00-00 00:00:00')||($this -> end_time!='0000-00-00 00:00:00'))
$defaults['enabletimelimit'] = 1;
@ -980,6 +1011,7 @@ class Exercise
$defaults['randomQuestions'] = 0;
$defaults['exerciseDescription'] = '';
$defaults['exerciseFeedbackType'] = 0;
$defaults['results_disabled'] = 0;
$defaults['start_time'] = date('Y-m-d 12:00:00');
$defaults['end_time'] = date('Y-m-d 12:00:00');
@ -1009,6 +1041,7 @@ class Exercise
$this -> updateFeedbackType($form -> getSubmitValue('exerciseFeedbackType'));
$this -> updateType($form -> getSubmitValue('exerciseType'));
$this -> setRandom($form -> getSubmitValue('randomQuestions'));
$this -> updateResultsDisabled($form -> getSubmitValue('results_disabled'));
if($form -> getSubmitValue('enabletimelimit')==1)
{

@ -48,20 +48,20 @@ $htmlHeadXtra[] = '<script>
function advanced_parameters() {
if(document.getElementById(\'options\').style.display == \'none\') {
document.getElementById(\'options\').style.display = \'block\';
document.getElementById(\'img_plus_and_minus\').innerHTML=\'&nbsp;<img src="../img/nolines_minus.gif" alt="" />&nbsp;'.get_lang('AdvancedParameters').'\';
document.getElementById(\'img_plus_and_minus\').innerHTML=\'&nbsp;<img src="../img/div_hide.gif" alt="" />&nbsp;'.get_lang('AdvancedParameters').'\';
} else {
document.getElementById(\'options\').style.display = \'none\';
document.getElementById(\'img_plus_and_minus\').innerHTML=\'&nbsp;<img src="../img/nolines_plus.gif" alt="" />&nbsp;'.get_lang('AdvancedParameters').'\';
document.getElementById(\'img_plus_and_minus\').innerHTML=\'&nbsp;<img src="../img/div_show.gif" alt="" />&nbsp;'.get_lang('AdvancedParameters').'\';
}
}
function timelimit() {
if(document.getElementById(\'options2\').style.display == \'none\') {
document.getElementById(\'options2\').style.display = \'block\';
document.getElementById(\'img_plus_and_minus2\').innerHTML=\'&nbsp;<img src="../img/nolines_minus.gif" alt="" />&nbsp;'.get_lang('AdvancedParameters').'\';
document.getElementById(\'img_plus_and_minus2\').innerHTML=\'&nbsp;<img src="../img/div_hide.gif" alt="" />&nbsp;'.get_lang('AdvancedParameters').'\';
} else {
document.getElementById(\'options2\').style.display = \'none\';
document.getElementById(\'img_plus_and_minus2\').innerHTML=\'&nbsp;<img src="../img/nolines_plus.gif" alt="" />&nbsp;'.get_lang('AdvancedParameters').'\';
document.getElementById(\'img_plus_and_minus2\').innerHTML=\'&nbsp;<img src="../img/div_show.gif.gif" alt="" />&nbsp;'.get_lang('AdvancedParameters').'\';
}
}

@ -1,4 +1,4 @@
<?php // $Id: question_list_admin.inc.php 18522 2009-02-16 20:20:29Z juliomontoya $
<?php // $Id: question_list_admin.inc.php 19404 2009-03-28 01:24:38Z cvargas1 $
/*
==============================================================================
@ -28,7 +28,7 @@
* Code library for HotPotatoes integration.
* @package dokeos.exercise
* @author
* @version $Id: question_list_admin.inc.php 18522 2009-02-16 20:20:29Z juliomontoya $
* @version $Id: question_list_admin.inc.php 19404 2009-03-28 01:24:38Z cvargas1 $
*/
@ -94,7 +94,7 @@ echo '</div>';
<th><?php echo get_lang('Question'); ?></th>
<th><?php echo get_lang('Type');?></th>
<th><?php echo get_lang('Difficulty'); ?></th>
<th><?php echo get_lang('Export'); ?></th>
<!--<th><?php //echo get_lang('Export'); ?></th>-->
<th><?php echo get_lang('Modify'); ?></th>
</tr>
@ -111,7 +111,7 @@ if($nbrQuestions) {
<td><?php echo "$i. ".$objQuestionTmp->selectTitle(); ?></td>
<td><?php eval('echo get_lang('.get_class($objQuestionTmp).'::$explanationLangVar);'); ?></td>
<td align="center"><?php echo $objQuestionTmp->selectLevel(); ?></td>
<td align="center"><a href="<?php echo api_get_self(); ?>?action=exportqti2&questionId=<?php echo $id; ?>"><img src="../img/export.png" border="0" align="absmiddle" alt="IMS/QTI" /></a></td>
<!--<td align="center"><a href="<?php echo api_get_self(); ?>?action=exportqti2&questionId=<?php echo $id; ?>"><img src="../img/export.png" border="0" align="absmiddle" alt="IMS/QTI" /></a></td>-->
<td> <a href="<?php echo api_get_self(); ?>?myid=1&ed
itQuestion=<?php echo $id; ?>"><img src="../img/edit.gif" border="0" align="absmiddle" alt="<?php echo get_lang('Modify'); ?>" /></a> <a href="<?php echo api_get_self(); ?>?deleteQuestion=<?php echo $id; ?>" onclick="javascript:if(!confirm('<?php echo addslashes(htmlentities(get_lang('ConfirmYourChoice'))); ?>')) return false;"><img src="../img/delete.gif" border="0" align="absmiddle" alt="<?php echo get_lang('Delete'); ?>" /></a>
<?php

@ -74,7 +74,7 @@ class UniqueAnswer extends Question {
$fck_attribute['Config']['ToolbarStartExpanded']='false';
//this line define how many question by default appear when creating a choice question
$nb_answers = isset($_POST['nb_answers']) ? (int) $_POST['nb_answers'] : 4;
$nb_answers = isset($_POST['nb_answers']) ? (int) $_POST['nb_answers'] : 2;
$nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0));
/*

Loading…
Cancel
Save