[svn r18005] Adding some UI improvements Quiz Tool - see FS#3515

skala
Julio Montoya 16 years ago
parent f7112da0b4
commit a37bfb6f9b
  1. 32
      main/exercice/admin.php
  2. 83
      main/exercice/exercice.php
  3. 249
      main/exercice/exercise.class.php
  4. 11
      main/exercice/multiple_answer.class.php
  5. 8
      main/exercice/question.class.php
  6. 23
      main/exercice/question_list_admin.inc.php
  7. 26
      main/exercice/question_pool.php
  8. 30
      main/exercice/unique_answer.class.php
  9. 12
      main/inc/lib/fckeditor/myconfig_afm.js
  10. 43
      main/inc/lib/formvalidator/Element/html_editor.php

@ -1,4 +1,4 @@
<?php // $Id: admin.php 16865 2008-11-21 23:24:21Z herodoto $
<?php // $Id: admin.php 18005 2009-01-26 18:00:46Z juliomontoya $
/*
==============================================================================
@ -67,7 +67,7 @@
*
* @package dokeos.exercise
* @author Olivier Brouckaert
* @version $Id: admin.php 16865 2008-11-21 23:24:21Z herodoto $
* @version $Id: admin.php 18005 2009-01-26 18:00:46Z juliomontoya $
*/
@ -447,7 +447,11 @@ function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
}
// -->
</script>";
Display::display_header($nameTools,"Exercise");
Display::display_header($nameTools,'Exercise');
echo '<div class="actions">';
echo Display::return_icon('search.gif', get_lang('Preview')).'<a href="exercice_submit.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'">'.get_lang('Preview').'</a>';
echo '</div>';
if(isset($_GET['message']))
{
@ -457,17 +461,14 @@ if(isset($_GET['message']))
}
}
/*
$description = $objExercise->selectDescription();
echo '<div class="sectiontitle">'.$objExercise->selectTitle().'</div>';
if(!empty($description))
{
echo '<div class="sectioncomment">'.stripslashes($description).'</div>';
}
echo '<div class="actions">';
echo Display::return_icon('search.gif', get_lang('Preview')).'<a href="exercice_submit.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'">'.get_lang('Preview').'</a>';
echo '</div>';
*/
if($newQuestion || $editQuestion)
{
@ -484,14 +485,25 @@ if(isset($_GET['hotspotadmin']))
}
if(!$newQuestion && !$modifyQuestion && !$editQuestion && !isset($_GET['hotspotadmin']))
{
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');
if($form -> validate()) {
$objExercise -> processCreation($form);
if($form -> getSubmitValue('edit') == 'true')
Display::display_confirmation_message(get_lang('ExerciseEdited'));
}
$form -> display ();
echo '<br />';
// question list management
include('question_list_admin.inc.php');
}
api_session_register('objExercise');
api_session_register('objQuestion');
api_session_register('objAnswer');
Display::display_footer();
?>
?>

@ -1,4 +1,4 @@
<?php // $Id: exercice.php 17976 2009-01-23 21:21:13Z juliomontoya $
<?php // $Id: exercice.php 18005 2009-01-26 18:00:46Z juliomontoya $
/*
==============================================================================
@ -750,46 +750,51 @@ $myorigin = (empty($origin)?'':'&origin='.$origin);
$mylpid = (empty($learnpath_id)?'':'&learnpath_id='.$learnpath_id);
$mylpitemid = (empty($learnpath_item_id)?'':'&learnpath_item_id='.$learnpath_item_id);
while($row=Database::fetch_array($result)) {
if($i%2==0) $s_class="row_odd"; else $s_class="row_even";
if($i%2==0)
$s_class="row_odd";
else
$s_class="row_even";
// prof only
if ($is_allowedToEdit) {
echo '<tr class="'.$s_class.'">'."\n";
?>
<td width="30" align="left"><?php Display::display_icon('quiz.gif', get_lang('Exercice'))?></td>
<td width="15" valign="left"><?php echo ($i+($page*$limitExPage)).'.'; ?></td>
<?php $row['title']=api_parse_tex($row['title']); ?>
<td><a href="exercice_submit.php?<?php echo api_get_cidreq().$myorigin.$mylpid.$mylpitemid; ?>&amp;exerciseId=<?php echo $row['id']; ?>" <?php if(!$row['active']) echo 'class="invisible"'; ?>><?php echo $row['title']; ?></a></td>
<td> <?php
$exid = $row['id'];
$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>';
?>
<td>
<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="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="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
if ($row['active']) {
?>
<a href="exercice.php?choice=disable&page=<?php echo $page; ?>&exerciseId=<?php echo $row['id']; ?>"> <img src="../img/visible.gif" border="0" alt="<?php echo htmlentities(get_lang('Deactivate'),ENT_QUOTES,$charset); ?>" /></a>
<?php
} else {// else if not active
?>
<a href="exercice.php?choice=enable&page=<?php echo $page; ?>&exerciseId=<?php echo $row['id']; ?>"> <img src="../img/invisible.gif" border="0" alt="<?php echo htmlentities(get_lang('Activate'),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>';
} 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 "</td>";
echo "</tr>\n";
echo '<tr class="'.$s_class.'">'."\n";
?>
<td width="30" align="left"><?php Display::display_icon('quiz.gif', get_lang('Exercice'))?></td>
<td width="15" valign="left"><?php echo ($i+($page*$limitExPage)).'.'; ?></td>
<?php $row['title']=api_parse_tex($row['title']); ?>
<td><a href="exercice_submit.php?<?php echo api_get_cidreq().$myorigin.$mylpid.$mylpitemid; ?>&amp;exerciseId=<?php echo $row['id']; ?>" <?php if(!$row['active']) echo 'class="invisible"'; ?>><?php echo $row['title']; ?></a></td>
<td> <?php
$exid = $row['id'];
$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>';
?>
<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>
<?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>';
} 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>';
}
?>
<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
if ($row['active']) {
?>
<a href="exercice.php?choice=disable&page=<?php echo $page; ?>&exerciseId=<?php echo $row['id']; ?>"> <img src="../img/visible.gif" border="0" alt="<?php echo htmlentities(get_lang('Deactivate'),ENT_QUOTES,$charset); ?>" /></a>
<?php
} else {
// else if not active
?>
<a href="exercice.php?choice=enable&page=<?php echo $page; ?>&exerciseId=<?php echo $row['id']; ?>"> <img src="../img/invisible.gif" border="0" alt="<?php echo htmlentities(get_lang('Activate'),ENT_QUOTES,$charset); ?>" /></a>
<?php
}
echo "</td>";
echo "</tr>\n";
} else {// student only
?>
<tr>

@ -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 18002 2009-01-26 16:33:20Z juliomontoya $
* @version $Id: exercise.class.php 18005 2009-01-26 18:00:46Z juliomontoya $
*/
@ -806,8 +806,12 @@ class Exercise
* Creates the form to create / edit an exercise
* @param FormValidator $form the formvalidator instance (by reference)
*/
function createForm ($form)
{
function createForm ($form, $type='full')
{
if(empty($type)){
$type='full';
}
// title
$form -> addElement('text', 'exerciseTitle', get_lang('ExerciseName'),'class="input_titles"');
// fck editor
@ -823,132 +827,139 @@ class Exercise
$form -> addElement ('html_editor', 'exerciseDescription', get_lang('ExerciseDescription'));
// feedback type
$feedback_option[0]=get_lang('Feedback');
$feedback_option[1]=get_lang('DirectFeedback');
$feedback_option[2]=get_lang('NoFeedback');
$form -> addElement('select', 'exerciseFeedbackType',get_lang('FeedbackType'),$feedback_option,'onchange="javascript:feedbackselection()"');
if($type=='full') {
// feedback type
$feedback_option[0]=get_lang('Feedback');
$feedback_option[1]=get_lang('DirectFeedback');
$feedback_option[2]=get_lang('NoFeedback');
$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 -> 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>
</div>
</div>');
// Random questions
$form -> addElement('html','<div id="options" style="display: none;">');
// 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 -> 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>
</div>
</div>');
$random = array();
$option=array();
$max = ($this->id > 0) ? $this->selectNbrQuestions() : 10 ;
$option = range(0,$max);
$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 ('text', 'randomQuestions', null,null,'0');
$form -> addGroup($random,null,get_lang('RandomQuestions'),'<br />');
// Random questions
$form -> addElement('html','<div id="options" style="display: none;">');
$attempt_option=range(0,10);
$attempt_option[0]=get_lang('Infinite');
$form -> addElement('select', 'exerciseAttempts',get_lang('ExerciseAttempts'),$attempt_option);
$random = array();
$option=array();
$max = ($this->id > 0) ? $this->selectNbrQuestions() : 10 ;
$option = range(0,$max);
$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 ('text', 'randomQuestions', null,null,'0');
$form -> addGroup($random,null,get_lang('RandomQuestions'),'<br />');
$attempt_option=range(0,10);
$attempt_option[0]=get_lang('Infinite');
$form -> addElement('select', 'exerciseAttempts',get_lang('ExerciseAttempts'),$attempt_option);
$form -> addElement('checkbox', 'enabletimelimit',null ,get_lang('EnableTimeLimits'));
//$form -> addElement('date', 'start_time', get_lang('ExeStartTime'), array('language'=>'es','format' => 'dMYHi'));
//$form -> addElement('date', 'end_time', get_lang('ExeEndTime'), array('language'=>'es','format' => 'dMYHi'));
$form->addElement('datepicker', 'start_time', get_lang('ExeStartTime'), array('form_name'=>'exercise_admin'));
$form->addElement('datepicker', 'end_time', get_lang('ExeEndTime'), array('form_name'=>'exercise_admin'));
// Exercise attempts
//$form -> addElement('text', 'exerciseAttempts', get_lang('ExerciseAttempts').' : ',array('size'=>'2'));
$form -> addElement('html','</div>');
$defaults = array();
if (api_get_setting('search_enabled') === 'true') {
require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php');
$form -> addElement ('checkbox', 'index_document','', get_lang('SearchFeatureDoIndexDocument'));
$form -> addElement ('html','<br /><div class="row">');
$form -> addElement ('html', '<div class="label">'. get_lang('SearchFeatureDocumentLanguage') .'</div>');
$form -> addElement ('html', '<div class="formw">'. api_get_languages_combo() .'</div>');
$form -> addElement ('html','</div><div class="sub-form">');
$specific_fields = get_specific_field_list();
foreach ($specific_fields as $specific_field) {
$form -> addElement ('text', $specific_field['code'], $specific_field['name']);
$filter = array('course_code'=> "'". api_get_course_id() ."'", 'field_id' => $specific_field['id'], 'ref_id' => $this->id, 'tool_id' => '\''. TOOL_QUIZ .'\'');
$values = get_specific_field_values_list($filter, array('value'));
if ( !empty($values) ) {
$arr_str_values = array();
foreach ($values as $value) {
$arr_str_values[] = $value['value'];
}
$defaults[$specific_field['code']] = implode(', ', $arr_str_values);
}
}
$form -> addElement ('html','</div>');
}
$form -> addElement('checkbox', 'enabletimelimit',null ,get_lang('EnableTimeLimits'));
//$form -> addElement('date', 'start_time', get_lang('ExeStartTime'), array('language'=>'es','format' => 'dMYHi'));
//$form -> addElement('date', 'end_time', get_lang('ExeEndTime'), array('language'=>'es','format' => 'dMYHi'));
$form->addElement('datepicker', 'start_time', get_lang('ExeStartTime'), array('form_name'=>'exercise_admin'));
$form->addElement('datepicker', 'end_time', get_lang('ExeEndTime'), array('form_name'=>'exercise_admin'));
// Exercise attempts
//$form -> addElement('text', 'exerciseAttempts', get_lang('ExerciseAttempts').' : ',array('size'=>'2'));
$form -> addElement('html','</div>');
$defaults = array();
if (api_get_setting('search_enabled') === 'true') {
require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php');
$form -> addElement ('checkbox', 'index_document','', get_lang('SearchFeatureDoIndexDocument'));
$form -> addElement ('html','<br /><div class="row">');
$form -> addElement ('html', '<div class="label">'. get_lang('SearchFeatureDocumentLanguage') .'</div>');
$form -> addElement ('html', '<div class="formw">'. api_get_languages_combo() .'</div>');
$form -> addElement ('html','</div><div class="sub-form">');
$specific_fields = get_specific_field_list();
foreach ($specific_fields as $specific_field) {
$form -> addElement ('text', $specific_field['code'], $specific_field['name']);
$filter = array('course_code'=> "'". api_get_course_id() ."'", 'field_id' => $specific_field['id'], 'ref_id' => $this->id, 'tool_id' => '\''. TOOL_QUIZ .'\'');
$values = get_specific_field_values_list($filter, array('value'));
if ( !empty($values) ) {
$arr_str_values = array();
foreach ($values as $value) {
$arr_str_values[] = $value['value'];
}
$defaults[$specific_field['code']] = implode(', ', $arr_str_values);
}
}
$form -> addElement ('html','</div>');
}
}
// submit
$form -> addElement('submit', 'submitExercise', get_lang('Ok'));
// rules
$form -> addRule ('exerciseTitle', get_lang('GiveExerciseName'), 'required');
$form -> addRule ('exerciseAttempts', get_lang('Numeric'), 'numeric');
$form -> addRule ('start_time', get_lang('DateNotValid'), 'date');
$form -> addRule ('end_time', get_lang('DateNotValid'), 'date');
$form->addRule(array ('start_time', 'end_time'), get_lang('StartDateShouldBeBeforeEndDate'), 'date_compare', 'lte');
$form -> addRule ('exerciseTitle', get_lang('GiveExerciseName'), 'required');
if($type=='full') {
// rules
$form -> addRule ('exerciseAttempts', get_lang('Numeric'), 'numeric');
$form -> addRule ('start_time', get_lang('DateNotValid'), 'date');
$form -> addRule ('end_time', get_lang('DateNotValid'), 'date');
$form -> addRule(array ('start_time', 'end_time'), get_lang('StartDateShouldBeBeforeEndDate'), 'date_compare', 'lte');
}
// defaults
if($this -> id > 0) {
if ($this -> random > $this->selectNbrQuestions()) {
$defaults['randomQuestions'] = $this->selectNbrQuestions();
} else {
$defaults['randomQuestions'] = $this -> random;
if($type=='full') {
if($this -> id > 0) {
if ($this -> random > $this->selectNbrQuestions()) {
$defaults['randomQuestions'] = $this->selectNbrQuestions();
} else {
$defaults['randomQuestions'] = $this -> random;
}
$defaults['exerciseType'] = $this -> selectType();
$defaults['exerciseTitle'] = $this -> selectTitle();
$defaults['exerciseDescription'] = $this -> selectDescription();
$defaults['exerciseAttempts'] = $this->selectAttempts();
$defaults['exerciseFeedbackType'] = $this->selectFeedbackType();
if(($this -> start_time!='0000-00-00 00:00:00')||($this -> end_time!='0000-00-00 00:00:00'))
$defaults['enabletimelimit'] = 1;
$defaults['start_time'] = ($this->start_time!='0000-00-00 00:00:00')? $this -> start_time : date('Y-m-d 12:00:00');
$defaults['end_time'] = ($this->end_time!='0000-00-00 00:00:00')?$this -> end_time : date('Y-m-d 12:00:00');
if (api_get_setting('search_enabled') === 'true') {
$defaults['index_document'] = 'checked="checked"';
}
}
$defaults['exerciseType'] = $this -> selectType();
else
{
$defaults['exerciseType'] = 1;
$defaults['exerciseAttempts'] = 0;
$defaults['randomQuestions'] = 0;
$defaults['exerciseDescription'] = '';
$defaults['exerciseFeedbackType'] = 0;
$defaults['start_time'] = date('Y-m-d 12:00:00');
$defaults['end_time'] = date('Y-m-d 12:00:00');
}
} else {
$defaults['exerciseTitle'] = $this -> selectTitle();
$defaults['exerciseDescription'] = $this -> selectDescription();
$defaults['exerciseAttempts'] = $this->selectAttempts();
$defaults['exerciseFeedbackType'] = $this->selectFeedbackType();
if(($this -> start_time!='0000-00-00 00:00:00')||($this -> end_time!='0000-00-00 00:00:00'))
$defaults['enabletimelimit'] = 1;
$defaults['start_time'] = ($this->start_time!='0000-00-00 00:00:00')? $this -> start_time : date('Y-m-d 12:00:00');
$defaults['end_time'] = ($this->end_time!='0000-00-00 00:00:00')?$this -> end_time : date('Y-m-d 12:00:00');
}
else
{
$defaults['exerciseType'] = 1;
$defaults['exerciseAttempts'] = 0;
$defaults['randomQuestions'] = 0;
$defaults['exerciseDescription'] = '';
$defaults['exerciseFeedbackType'] = 0;
$defaults['start_time'] = date('Y-m-d 12:00:00');
$defaults['end_time'] = date('Y-m-d 12:00:00');
}
if (api_get_setting('search_enabled') === 'true') {
$defaults['index_document'] = 'checked="checked"';
}
$defaults['exerciseDescription'] = $this -> selectDescription();
}
$form -> setDefaults($defaults);
}

@ -75,7 +75,8 @@ class MultipleAnswer extends Question {
$fck_attribute['Config']['InDocument'] = false;
$fck_attribute['Config']['CreateDocumentDir'] = '../../courses/'.api_get_course_path().'/document/';
$fck_attribute['Config']['ToolbarStartExpanded']='false';
$nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 2;
$nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0));
@ -119,13 +120,11 @@ class MultipleAnswer extends Question {
}
}
$form -> addElement('hidden', 'nb_answers');
$form -> addElement('hidden', 'nb_answers');
$boxes_names = array();
for($i = 1 ; $i <= $nb_answers ; ++$i)
{
{
if(is_object($answer))
{
$defaults['answer['.$i.']'] = $answer -> answer[$i];
@ -138,7 +137,7 @@ class MultipleAnswer extends Question {
$renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>');
$answer_number=$form->addElement('text', null,null,'value="'.$i.'"');
$answer_number->freeze();
$answer_number->freeze();
$form->addElement('checkbox', 'correct['.$i.']', null, null, 'class="checkbox" style="margin-left: 0em;"');
$boxes_names[] = 'correct['.$i.']';

@ -1,4 +1,4 @@
<?php // $Id: question.class.php 18002 2009-01-26 16:33:20Z juliomontoya $
<?php // $Id: question.class.php 18005 2009-01-26 18:00:46Z juliomontoya $
/*
==============================================================================
@ -28,7 +28,7 @@
* File containing the Question class.
* @package dokeos.exercise
* @author Olivier Brouckaert
* @version $Id: question.class.php 18002 2009-01-26 16:33:20Z juliomontoya $
* @version $Id: question.class.php 18005 2009-01-26 18:00:46Z juliomontoya $
*/
@ -1008,9 +1008,7 @@ abstract class Question
$fck_attribute['Config']['InDocument'] = false;
$fck_attribute['Config']['CreateDocumentDir'] = '../../courses/'.api_get_course_path().'/document/';
if(is_array($fck_config)){
$fck_attribute = array_merge($fck_attribute,$fck_config);

@ -1,4 +1,4 @@
<?php // $Id: question_list_admin.inc.php 18002 2009-01-26 16:33:20Z juliomontoya $
<?php // $Id: question_list_admin.inc.php 18005 2009-01-26 18:00:46Z juliomontoya $
/*
==============================================================================
@ -28,7 +28,7 @@
* Code library for HotPotatoes integration.
* @package dokeos.exercise
* @author
* @version $Id: question_list_admin.inc.php 18002 2009-01-26 16:33:20Z juliomontoya $
* @version $Id: question_list_admin.inc.php 18005 2009-01-26 18:00:46Z juliomontoya $
*/
@ -50,7 +50,6 @@ if(!defined('ALLOWED_TO_INCLUDE'))
exit();
}
// moves a question up in the list
if(isset($_GET['moveUp']))
{
@ -107,8 +106,7 @@ if($nbrQuestions) {
foreach($questionList as $id) {
$objQuestionTmp = Question :: read($id);
//showQuestion($id);
?>
?>
<tr <?php if($i%2==0) echo 'class="row_odd"'; else echo 'class="row_even"'; ?>>
<td><?php echo "$i. ".$objQuestionTmp->selectTitle(); ?></td>
<td><?php eval('echo get_lang('.get_class($objQuestionTmp).'::$explanationLangVar);'); ?></td>
@ -147,18 +145,13 @@ if($nbrQuestions) {
?>
</table>
<table border="0" align="center" cellpadding="2" cellspacing="2" width="100%">
<?php
if(!$i)
{
?>
<tr>
<td><?php echo get_lang('NoQuestion'); ?></td>
</tr>
if(!$i) {
?>
<tr>
<td><?php echo get_lang('NoQuestion'); ?></td>
</tr>
<?php
}
?>
</table>

@ -1,4 +1,4 @@
<?php // $Id: question_pool.php 18002 2009-01-26 16:33:20Z juliomontoya $
<?php // $Id: question_pool.php 18005 2009-01-26 18:00:46Z juliomontoya $
/*
==============================================================================
@ -30,7 +30,7 @@
* One question can be in several exercises
* @package dokeos.exercise
* @author Olivier Brouckaert
* @version $Id: question_pool.php 18002 2009-01-26 16:33:20Z juliomontoya $
* @version $Id: question_pool.php 18005 2009-01-26 18:00:46Z juliomontoya $
*/
// name of the language file that needs to be included
@ -184,21 +184,17 @@ if($is_allowedToEdit)
<?php echo get_lang('Difficulty'); ?> : <select name="exerciseLevel">
<option value="-1">-- <?php echo get_lang('AllExercises'); ?> --</option>
<?php
$sqlMaxLevel = "SELECT MAX(level) FROM $TBL_QUESTIONS";
$resultMaxLevel = api_sql_query($sqlMaxLevel,__FILE__,__LINE__);
if ($result0MaxLevel = Database::fetch_array($resultMaxLevel))
{
$maxLevel = $result0MaxLevel[0];
}
else
{
$sql = "SELECT MAX(level) FROM $TBL_QUESTIONS";
$result = api_sql_query($sql,__FILE__,__LINE__);
if ($row = Database::fetch_array($result)) {
$maxLevel = $row[0];
} else {
$maxLevel = -1;
}
for ($level = 0; $level <= $maxLevel; $level++)
{
?>
<option value="<?php echo $level; ?>" <?php if($exerciseLevel == $level) echo 'selected="selected"'; ?>><?php echo $level; ?></option>
<?php
for ($level = 0; $level <= $maxLevel; $level++) {
?>
<option value="<?php echo $level; ?>" <?php if($exerciseLevel == $level) echo 'selected="selected"'; ?>><?php echo $level; ?></option>
<?php
}
?>

@ -63,7 +63,6 @@ class UniqueAnswer extends Question {
// multiple
global $fck_attribute;
$fck_attribute = array();
$fck_attribute['Width'] = '50%';
$fck_attribute['Height'] = '125px';
@ -73,6 +72,8 @@ class UniqueAnswer extends Question {
$fck_attribute['Config']['FlashUploadPath'] = 'upload/test/';
$fck_attribute['Config']['InDocument'] = false;
$fck_attribute['Config']['CreateDocumentDir'] = '../../courses/'.api_get_course_path().'/document/';
// we collapse the fckeditor toolbar
$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;
@ -88,10 +89,9 @@ class UniqueAnswer extends Question {
$feedback_title='';
$comment_title='';
if ($obj_ex->selectFeedbackType()==0)
$comment_title = '<th>'.get_lang('Comment').'</th>';
elseif ($obj_ex->selectFeedbackType()==1)
{
if ($obj_ex->selectFeedbackType()==0) {
$comment_title = '<th>'.get_lang('Comment').'</th>';
} elseif ($obj_ex->selectFeedbackType()==1) {
$fck_attribute['Width'] = '250px';
$fck_attribute['Height'] = '110px';
$comment_title = '<th width="'.$fck_attribute['Width'].'" >'.get_lang('Comment').'</th>';
@ -126,8 +126,7 @@ class UniqueAnswer extends Question {
$defaults = array();
$correct = 0;
if(!empty($this -> id))
{
if(!empty($this -> id)) {
$answer = new Answer($this -> id);
$answer -> read();
if(count($answer->nbrAnswers)>0 && !$form->isSubmitted())
@ -239,18 +238,13 @@ class UniqueAnswer extends Question {
{
$form->addElement('html_editor', 'comment['.$i.']',null, 'style="vertical-align:middle"');
//Adding extra feedback fields
$group = array();
$group['try'.$i] =&$form->createElement('checkbox', 'try'.$i,get_lang('TryAgain').': ' );
$group['lp'.$i] =&$form->createElement('select', 'lp'.$i,get_lang('SeeTheory').': ',$select_lp_id);
$group['destination'.$i]=&$form->createElement('select', 'destination'.$i, get_lang('GoToQuestion').': ' ,$select_question);
$group = array();
$group['try'.$i] =&$form->createElement('checkbox', 'try'.$i,get_lang('TryAgain').': ' );
$group['lp'.$i] =&$form->createElement('select', 'lp'.$i,get_lang('SeeTheory').': ',$select_lp_id);
$group['destination'.$i]=&$form->createElement('select', 'destination'.$i, get_lang('GoToQuestion').': ' ,$select_question);
$group['url'.$i] =&$form->createElement('text', 'url'.$i,get_lang('Other').': ',array('size'=>'25px'));
$form -> addGroup($group, 'scenario', 'scenario');
$form -> addGroup($group, 'scenario', 'scenario');
$renderer->setGroupElementTemplate('<div class="exercise_scenario_label">{label}</div><div class="exercise_scenario_element">{element}</div>','scenario');
}

@ -19,7 +19,7 @@ FCKConfig.ToolbarSets["Question"] = [
] ;
FCKConfig.ToolbarSets["Middle"] = [
['Source','FontSize','Bold','Italic','Underline','StrikeThrough','TextColor','-','OrderedList','UnorderedList','-','Rule','Link','Unlink','Table','-','Image','Flash']
['FontSize','Bold','Italic','Underline','StrikeThrough','TextColor','-','OrderedList','UnorderedList','-','Rule','Link','Unlink','Table','-','Image','Flash','Source']
] ;
FCKConfig.ToolbarSets["Agenda"] = [
@ -57,11 +57,11 @@ FCKConfig.ToolbarSets["ForumLight"] = [
] ;
FCKConfig.ToolbarSets["NewTest"] = [
['Source','Bold','Italic','Underline','StrikeThrough','Link','Unlink','Image','Flash','MP3','OrderedList','UnorderedList','Table']
['Bold','Italic','Underline','StrikeThrough','Link','Unlink','Image','Flash','MP3','OrderedList','UnorderedList','Table','Source']
] ;
FCKConfig.ToolbarSets["TestComment"] = [
['Source','FontName','FontSize','TextColor','BGColor'],['Bold','Italic','Underline','StrikeThrough','Subscript', 'Superscript','Link','Unlink','Image','Flash','MP3','OrderedList','UnorderedList','Table']
['FontName','FontSize','TextColor','BGColor'],['Bold','Italic','Underline','StrikeThrough','Subscript', 'Superscript','Link','Unlink','Image','Flash','MP3','OrderedList','UnorderedList','Table','Source']
] ;
FCKConfig.ToolbarSets["Test"] = [
@ -103,7 +103,7 @@ FCKConfig.Plugins.Add('flvPlayer','en') ;
//FCKConfig.Plugins.Add("Flash", "en");
FCKConfig.Plugins.Add('fckEmbedMovies');
// added by Juan Carlos Raña
// added by Juan Carlos Ra<EFBFBD>a
FCKConfig.Plugins.Add("mimetex", "en", sOtherPluginPath ) ;
FCKConfig.Plugins.Add("wikilink", "en,es", sOtherPluginPath ) ; // support to english, spanish
FCKConfig.Plugins.Add("imgmap", "en,es", sOtherPluginPath );
@ -120,7 +120,7 @@ FCKConfig.Plugins.Add( 'youtube', 'en' ) ;
FCKConfig.FontFormats = 'p;h1;h2;h3;h4;h5' ;
//////////////////////////////////////////////moved from fckconfig.js
// added by Juan Carlos Raña
// added by Juan Carlos Ra<EFBFBD>a
FCKConfig.LinkBrowser = true ;
FCKConfig.LinkBrowserURL =FCKConfig.PluginsPath +'ajaxfilemanager/ajaxfilemanager.php';
@ -154,4 +154,4 @@ FCKConfig.MP3BrowserWindowHeight = 490;
FCKConfig.LinkUpload = false ;
FCKConfig.ImageUpload = false ;
//FCKConfig.FlashUpload = false ; //See plugin
FCKConfig.MP3Upload = false ;
FCKConfig.MP3Upload = false ;

@ -1,5 +1,5 @@
<?php
// $Id: html_editor.php 17581 2009-01-08 09:53:36Z ivantcholakov $
// $Id: html_editor.php 18005 2009-01-26 18:00:46Z juliomontoya $
/*
==============================================================================
Dokeos - elearning and course management software
@ -46,8 +46,7 @@ class HTML_QuickForm_html_editor extends HTML_QuickForm_textarea
$this->_persistantFreeze = true;
$this->_type = 'html_editor';
$this->fullPage = false;
@ $editor_lang = Database :: get_language_isocode($language_interface);
$language_file = api_get_path(SYS_PATH).'main/inc/lib/fckeditor/editor/lang/'.$editor_lang.'.js';
if (empty ($editor_lang) || !file_exists($language_file))
@ -65,46 +64,39 @@ class HTML_QuickForm_html_editor extends HTML_QuickForm_textarea
//We get the optionnals config parameters in $fck_attribute array
$this -> fck_editor->Config = !empty($fck_attribute['Config']) ? $fck_attribute['Config'] : array();
// we should set the $fck_attribute['ToolbarStartExpanded']= false to hide the toolbar by default we show the toolbar
if($fck_attribute['ToolbarStartExpanded']=='false'){
$this ->fck_editor->Config['ToolbarStartExpanded']=false;
}
$TBL_LANGUAGES = Database::get_main_table(TABLE_MAIN_LANGUAGE);
//We are in a course
if(isset($_SESSION["_course"]["language"]))
{
if(isset($_SESSION["_course"]["language"])) {
$sql="SELECT isocode FROM ".$TBL_LANGUAGES." WHERE english_name='".$_SESSION["_course"]["language"]."'";
}
//Else, we get the current session language
elseif(isset($_SESSION["_user"]["language"]))
{
} elseif(isset($_SESSION["_user"]["language"])) {
//Else, we get the current session language
$sql="SELECT isocode FROM ".$TBL_LANGUAGES." WHERE english_name='".$_SESSION["_user"]["language"]."'";
}
//Else we get the default platform language
else
{
} else {
//Else we get the default platform language
$platform_language=api_get_setting("platformLanguage");
$sql="SELECT isocode FROM ".$TBL_LANGUAGES." WHERE english_name='$platform_language'";
}
$result_sql=api_sql_query($sql);
$isocode_language=mysql_result($result_sql,0,0);
$this -> fck_editor->Config['DefaultLanguage'] = $isocode_language;
$this -> fck_editor->Config['DefaultLanguage'] = $isocode_language;
$this -> fck_editor->ToolbarSet = $fck_attribute['ToolbarSet'] ;
// css should be dokeos ones
$this -> fck_editor->Config['EditorAreaCSS'] = $this -> fck_editor->Config['ToolbarComboPreviewCSS'] = api_get_path(REL_PATH).'main/css/'.api_get_setting('stylesheets').'/default.css';
// FCKeditor Configuration for documents
// If we don't find the CreateDocumentWebDir set we change it with the absolute path http://www.dok..
if (empty($this -> fck_editor->Config['CreateDocumentWebDir'])) {
$this -> fck_editor->Config['CreateDocumentWebDir']=api_get_path('WEB_COURSE_PATH').api_get_course_path().'/document/';
};
if (api_get_setting('advanced_filemanager') == 'true')
{
if (api_get_setting('advanced_filemanager') == 'true') {
// Let javascripts "know" which file manager has been chosen.
$this -> fck_editor->Config['AdvancedFileManager'] = true;
@ -112,7 +104,7 @@ class HTML_QuickForm_html_editor extends HTML_QuickForm_textarea
$this -> fck_editor->Config['CustomConfigurationsPath'] = api_get_path(REL_PATH)."main/inc/lib/fckeditor/myconfig_afm.js";
// For images
$this -> fck_editor->Config['ImageBrowserURL'] = $this -> fck_editor->BasePath.'/editor/plugins/ajaxfilemanager/ajaxfilemanager.php';
$this -> fck_editor->Config['ImageBrowserURL'] = $this -> fck_editor->BasePath.'/editor/plugins/ajaxfilemanager/ajaxfilemanager.php';
// For flash
$this -> fck_editor->Config['FlashBrowserURL'] = $this -> fck_editor->BasePath.'/editor/plugins/ajaxfilemanager/ajaxfilemanager.php';
@ -128,9 +120,7 @@ class HTML_QuickForm_html_editor extends HTML_QuickForm_textarea
// For flv Player (Videos)
$this -> fck_editor->Config['MediaBrowserURL'] = $this -> fck_editor->BasePath.'/editor/plugins/ajaxfilemanager/ajaxfilemanager.php';
}
else
{
} else {
// Passing the file manager setting to javascripts too.
$this -> fck_editor->Config['AdvancedFileManager'] = false;
@ -167,6 +157,7 @@ class HTML_QuickForm_html_editor extends HTML_QuickForm_textarea
$this -> fck_editor->Config['MediaBrowserURL'] = $this -> fck_editor->BasePath . "editor/filemanager/browser/default/browser.html?Type=Video/flv&Connector=connectors/php/connector.php&ServerPath=$upload_path";
$this -> fck_editor->Config['MediaUploadURL'] = $this -> fck_editor->BasePath . "editor/filemanager/upload/php/upload.php?Type=Video/flv&ServerPath=$upload_path" ;
}
}
/**

Loading…
Cancel
Save