diff --git a/main/exercice/admin.php b/main/exercice/admin.php index 420afc165e..c90bae8245 100644 --- a/main/exercice/admin.php +++ b/main/exercice/admin.php @@ -1,4 +1,4 @@ -'; echo Display::return_icon('preview.gif', get_lang('Preview')).''.get_lang('Preview').''; +echo Display::return_icon('lp_quiz.png', get_lang('ModifyExercise')).''.get_lang('ModifyExercise').''; + echo ''; 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'); diff --git a/main/exercice/exercice.php b/main/exercice/exercice.php index 43cc4b7d18..6326e3631c 100644 --- a/main/exercice/exercice.php +++ b/main/exercice/exercice.php @@ -1,4 +1,4 @@ -'; echo ''; } - if (($is_allowedToEdit) and ($origin != 'learnpath')) - { - echo ''.Display::return_icon('new_test.gif',get_lang('NewEx')).get_lang('NewEx').''; - echo ''.Display::return_icon('jqz.gif',get_lang('ImportHotPotatoesQuiz')).get_lang('ImportHotPotatoesQuiz').''; - echo ''.Display::return_icon('show_test_results.gif',get_lang('Results')).get_lang('Results').''; - // 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 = ''; - } else { - $alt = get_lang('ExportWithoutUserFields'); - $extra_user_fields = ''; - } - echo ''.Display::return_icon('excel.gif',get_lang('ExportAsCSV')).get_lang('ExportAsCSV').''; - echo ''.Display::return_icon('excel.gif',get_lang('ExportAsXLS')).get_lang('ExportAsXLS').''; - echo ''.Display::return_icon('synthese_view.gif',$alt).$alt.''; - echo ''.Display::return_icon('quiz.gif',get_lang('BackToExercisesList')).get_lang('BackToExercisesList').''; - echo '
'; - echo ''; - echo ''; - echo '
'; - echo '
'; - echo ''; - echo ''; - echo '
'; - echo '
'; - echo $extra_user_fields; - echo '
'; - } - } - } else { - //the student view - echo ''.Display::return_icon('show_test_results.gif',get_lang('Results')).get_lang('Results').''; - if($show == 'result') { - echo ''.Display::return_icon('quiz.gif',get_lang('BackToExercisesList')).get_lang('BackToExercisesList').''; - } - } - - 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 .= ''; 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 '
'; $output .= ''; 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 '
'; default: null; } - $form_filter = '
'; - $form_filter .= make_select('filter',array(1=>get_lang('FilterByNotRevised'),2=>get_lang('FilterByRevised')),$filter); - $form_filter .= '
'; - echo $form_filter; + if($_REQUEST['filter']=='1' or !isset($_REQUEST['filter'])) { + $view_result = ''.Display::display_icon('checkbox_on.gif', get_lang('ShowCorrectedOnly')).get_lang('ShowCorrectedOnly').''; + } else { + $view_result = ''.Display::display_icon('checkbox_off.gif', get_lang('ShowUnCorrectedOnly')).get_lang('ShowUnCorrectedOnly').''; + } + //$form_filter = '
'; + //$form_filter .= make_select('filter',array(1=>get_lang('FilterByNotRevised'),2=>get_lang('FilterByRevised')),$filter); + //$form_filter .= '
'; + 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 '
'; $form_filter .= ''; echo $form_filter; } - } - + } */ } + + + + if (($is_allowedToEdit) and ($origin != 'learnpath')) + { + if ($_GET['show']!='result') { + echo ''.Display::return_icon('new_test.gif',get_lang('NewEx')).get_lang('NewEx').''; + echo ''.Display::return_icon('jqz.gif',get_lang('ImportHotPotatoesQuiz')).get_lang('ImportHotPotatoesQuiz').''; + echo ''.Display::return_icon('show_test_results.gif',get_lang('Results')).get_lang('Results').''; + } + + // 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 = ''; + } else { + $alt = get_lang('ExportWithoutUserFields'); + $extra_user_fields = ''; + } + //echo ''.Display::return_icon('excel.gif',get_lang('ExportAsCSV')).get_lang('ExportAsCSV').''; + echo ''.Display::return_icon('excel.gif',get_lang('ExportAsXLS')).get_lang('ExportAsXLS').''; + //echo ''.Display::return_icon('synthese_view.gif',$alt).$alt.''; + echo ''.Display::return_icon('quiz.gif',get_lang('BackToExercisesList')).get_lang('BackToExercisesList').''; + echo '
'; + echo ''; + echo ''; + echo '
'; + echo '
'; + echo ''; + echo ''; + echo '
'; + //echo '
'; + //echo $extra_user_fields; + //echo '
'; + } + } + } else { + //the student view + if($show == 'result') { + echo ''.Display::return_icon('quiz.gif',get_lang('BackToExercisesList')).get_lang('BackToExercisesList').''; + } else { + echo ''.Display::return_icon('show_test_results.gif',get_lang('Results')).get_lang('Results').''; + } + } + + echo '
'; // closing the actions div @@ -716,7 +721,7 @@ if ($show == 'test') { - + @@ -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'))).''; - echo ''; + //echo $rowi.' '.strtolower(get_lang(($rowi>1?'Questions':'Question'))).''; + //echo ''; ?> - <?php echo htmlentities(get_lang('Build'),ENT_QUOTES,$charset); ?> + <?php echo htmlentities(get_lang('Edit'),ENT_QUOTES,$charset); ?> '.htmlentities(get_lang('EnableResults'),ENT_QUOTES,$charset).''; + //echo ''.htmlentities(get_lang('EnableResults'),ENT_QUOTES,$charset).''; } else { - echo ''.htmlentities(get_lang('DisableResults'),ENT_QUOTES,$charset).''; + //echo ''.htmlentities(get_lang('DisableResults'),ENT_QUOTES,$charset).''; } ?> - <?php echo htmlentities(get_lang('Modify'),ENT_QUOTES,$charset); ?> + ')) return false;"> <?php echo htmlentities(get_lang('Delete'),ENT_QUOTES,$charset); ?> > <?php echo htmlentities(get_lang('Modify'),ENT_QUOTES,$charset); ?> - <?php echo htmlentities(get_lang('Build'),ENT_QUOTES,$charset); ?> + <?php echo htmlentities(get_lang('Edit'),ENT_QUOTES,$charset); ?> ')) return false;"><?php echo htmlentities(get_lang('Delete'),ENT_QUOTES,$charset); ?> 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')."');\""; diff --git a/main/exercice/exercise.class.php b/main/exercice/exercise.class.php index 70c71e4146..5ca780c754 100644 --- a/main/exercice/exercise.class.php +++ b/main/exercice/exercise.class.php @@ -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'), '
'); + $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'), '
'); + $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',''); @@ -882,9 +913,7 @@ class Exercise $option[0]=get_lang('DoNotRandomize'); $random[] = FormValidator :: createElement ('select', 'randomQuestions',null,$option); - $random[] = FormValidator :: createElement ('static', 'help','help',''.get_lang('RandomQuestionsHelp').''); - - + $random[] = FormValidator :: createElement ('static', 'help','help',''.get_lang('RandomQuestionsHelp').''); //$random[] = FormValidator :: createElement ('text', 'randomQuestions', null,null,'0'); $form -> addGroup($random,null,get_lang('RandomQuestions'),'
'); @@ -892,12 +921,12 @@ class Exercise $attempt_option[0]=get_lang('Infinite'); $form -> addElement('select', 'exerciseAttempts',get_lang('ExerciseAttempts'),$attempt_option); - - $form -> addElement('html','
'); - $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','
'); if(($this -> start_time!='0000-00-00 00:00:00')||($this -> end_time!='0000-00-00 00:00:00')) $form -> addElement('html','
'); @@ -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', '

'); $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) { diff --git a/main/exercice/exercise_admin.php b/main/exercice/exercise_admin.php index 04e948e70a..7a746835bf 100644 --- a/main/exercice/exercise_admin.php +++ b/main/exercice/exercise_admin.php @@ -48,20 +48,20 @@ $htmlHeadXtra[] = '