Explorar o código

[svn r10738] changes the menu of question types

Eric Marguin %!s(int64=18) %!d(string=hai) anos
pai
achega
20200ae69d

+ 5 - 2
main/exercice/exercice.php

@@ -434,7 +434,10 @@ if($show == 'test'){
       <td width="30" align="left"><img src="../img/test.gif"></td>
       <td width="15" valign="left" align="center"><?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()."&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id"; ?>&exerciseId=<?php echo $row['id']; ?>" <?php if(!$row['active']) echo 'class="invisible"'; ?>><?php echo $row['title']; ?></a></td>
+      <td>
+      	<a href="exercice_submit.php?<?php echo api_get_cidreq()."&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id"; ?>&exerciseId=<?php echo $row['id']; ?>" <?php if(!$row['active']) echo 'class="invisible"'; ?>><?php echo $row['title']; ?></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')); ?>" alt="<?php echo htmlentities(get_lang('Modify')); ?>" /></a>
+      </td>
     </tr>
   </table></td>
  <td width="8%" align="center"> <?php 
@@ -443,7 +446,7 @@ if($show == 'test'){
  $sqlresult =mysql_query($sqlquery);
  $rowi = mysql_result($sqlresult,0);
  echo $rowi.' Questions'; ?> </td>
-       <td width="12%" align="center"><a href="admin.php?exerciseId=<?php echo $row[id]; ?>"><img src="../img/wizard_small.gif" border="0" title="<?php echo htmlentities(get_lang('Build')); ?>" alt="<?php echo htmlentities(get_lang('Build')); ?>" /></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')); ?>" alt="<?php echo htmlentities(get_lang('Modify')); ?>" /></a> 
+       <td width="12%" align="center"><a href="admin.php?exerciseId=<?php echo $row[id]; ?>"><img src="../img/wizard_small.gif" border="0" title="<?php echo htmlentities(get_lang('Build')); ?>" alt="<?php echo htmlentities(get_lang('Build')); ?>" /></a> 
     <a href="exercice.php?choice=delete&exerciseId=<?php echo $row[id]; ?>" onclick="javascript:if(!confirm('<?php echo addslashes(htmlentities(get_lang('areYouSure'))); echo $row['title']; echo "?"; ?>')) return false;"> <img src="../img/delete.gif" border="0" alt="<?php echo htmlentities(get_lang('Delete')); ?>" /></a> 
     <?php
 				// if active

+ 3 - 0
main/exercice/fill_blanks.class.php

@@ -44,6 +44,9 @@ if(!class_exists('FillBlanks')):
  
 class FillBlanks extends Question {
 	
+	static $typePicture = 'fill_in_blanks.png';
+	static $explanationLangVar = 'FillBlanks';
+	
 	/**
 	 * Constructor
 	 */

+ 3 - 0
main/exercice/freeanswer.class.php

@@ -44,6 +44,9 @@ if(!class_exists('FreeAnswer')):
  
 class FreeAnswer extends Question {
 	
+	static $typePicture = 'open_answer.png';
+	static $explanationLangVar = 'freeAnswer';
+	
 	/**
 	 * Constructor
 	 */

+ 4 - 0
main/exercice/hotspot.class.php

@@ -43,6 +43,10 @@ if(!class_exists('HotSpot')):
  **/
 
 class HotSpot extends Question {
+	
+	static $typePicture = 'hotspot.png';
+	static $explanationLangVar = 'Hotspot';
+	
 
 	function HotSpot(){
 		parent::question();

+ 4 - 0
main/exercice/matching.class.php

@@ -44,6 +44,10 @@ if(!class_exists('Matching')):
  
 class Matching extends Question {
 	
+	
+	static $typePicture = 'matching.png';
+	static $explanationLangVar = 'Matching';
+	
 	/**
 	 * Constructor
 	 */

+ 3 - 0
main/exercice/multiple_answer.class.php

@@ -44,6 +44,9 @@ if(!class_exists('MultipleAnswer')):
  
 class MultipleAnswer extends Question {
 	
+	static $typePicture = 'mcma.png';
+	static $explanationLangVar = 'MultipleSelect';
+	
 	/**
 	 * Constructor
 	 */

+ 41 - 3
main/exercice/question.class.php

@@ -1,4 +1,4 @@
-<?php // $Id: question.class.php 10672 2007-01-11 10:40:16Z elixir_inter $
+<?php // $Id: question.class.php 10738 2007-01-15 16:53:22Z elixir_inter $
 /*
 ============================================================================== 
 	Dokeos - elearning and course management software
@@ -60,11 +60,13 @@ abstract class Question
 	var $weighting;
 	var $position;
 	var $type;
+	
 	var $picture;
 
 	var $exerciseList;  // array with the list of exercises which this question is in
 	
-	// list
+	static $typePicture = 'new_question.png';
+	static $explanationLangVar = '';
 	static $questionTypes = array(
 							UNIQUE_ANSWER => array('unique_answer.class.php' , 'UniqueAnswer'),
 							MULTIPLE_ANSWER => array('multiple_answer.class.php' , 'MultipleAnswer'),
@@ -73,7 +75,7 @@ abstract class Question
 							FREE_ANSWER => array('freeanswer.class.php' , 'FreeAnswer'),
 							HOT_SPOT => array('hotspot.class.php' , 'HotSpot')
 							);
-
+	
 	/**
 	 * constructor of the class
 	 *
@@ -789,6 +791,42 @@ abstract class Question
 	 * @param the formvalidator instance 
 	 */
 	abstract function processAnswersCreation ($form);
+	
+	
+	/**
+	 * Displays the menu of question types
+	 */
+	static function display_type_menu ()
+	{
+		?>
+		<script type="text/javascript">
+			function explain(explanation){
+				document.getElementById('answer_type_explanation').innerHTML = explanation;
+			}
+			function hideExplanation(){
+				document.getElementById('answer_type_explanation').innerHTML = '<?php echo get_lang('ChooseQuestionType') ?>';
+			}
+		</script>
+		<?php
+		echo '<div onmouseout="hideExplanation()">';
+		foreach(self::$questionTypes as $i=>$a_type)
+		{
+			include_once($a_type[0]);
+			eval('$img = '.$a_type[1].'::$typePicture;');
+			eval('$explanation = get_lang('.$a_type[1].'::$explanationLangVar);');
+			
+			echo '
+			<div id="answer_type_'.$i.'" style="display: inline">
+				<a href="admin.php?newQuestion=yes&answerType=1" onmouseover="explain(\''.$explanation.'\')"><img src="'.api_get_path(WEB_IMG_PATH).'/'.$img.'" /></a>
+			</div>';
+		}
+		echo '
+		<div id="answer_type_explanation" class="accordion_content" style="display:block">'.get_lang('ChooseQuestionType').' :</div></div>';
+		
+		
+		
+		
+	}
 }
 
 endif;

+ 3 - 11
main/exercice/question_list_admin.inc.php

@@ -1,4 +1,4 @@
-<?php // $Id: question_list_admin.inc.php 10691 2007-01-12 12:16:28Z elixir_inter $
+<?php // $Id: question_list_admin.inc.php 10738 2007-01-15 16:53:22Z elixir_inter $
 /*
 ============================================================================== 
 	Dokeos - elearning and course management software
@@ -73,19 +73,11 @@ if($deleteQuestion)
 	// destruction of the Question object
 	unset($objQuestionTmp);
 }
-?>
-
- <a href="question_pool.php?fromExercise=<?php echo $exerciseId; ?>"><?php echo get_lang('GetExistingQuestion'); ?></a> &nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp;  &nbsp; &nbsp;&nbsp; <!--<a href="exercice.php?<?php echo api_get_cidreq(); ?>"><?php echo get_lang('backtoTesthome'); ?></a>--><br />
-<br /><?php echo get_lang('NewQu').' : ';?><a href="admin.php?newQuestion=yes&answerType=1"><?php echo get_lang('UniqueSelect'); ?></a> | <a href="admin.php?newQuestion=yes&answerType=2"><?php echo get_lang('MultipleSelect'); ?></a> | <a href="admin.php?newQuestion=yes&answerType=3"><?php echo get_lang('FillBlanks'); ?></a> | <a href="admin.php?newQuestion=yes&answerType=4"><?php echo get_lang('Matching'); ?></a> | <a href="admin.php?newQuestion=yes&answerType=5"><?php echo get_lang('freeAnswer'); ?></a> | <a href="admin.php?newQuestion=yes&answerType=6"><?php echo get_lang('Hotspot'); ?></a>
-&nbsp;&nbsp;
-<br /><br />
 
+Question :: display_type_menu ();
+?>
 
-<!--<form method="get" action="exercice.php" style="margin:10px; margin-left:0px;">
-<input type="submit" value="<?php //echo htmlentities(get_lang('FinishTest')); ?>">
-</form>-->
 
-<?php //echo get_lang('QuestionList'); ?>
 <table border="0" align="center" cellpadding="2" cellspacing="2" width="100%">
 <tr  bgcolor='#e6e6e6'><td width="20%" align="center"><b><?php echo get_lang('Question'); ?></b></td>
 <td width="20%" align="center"><b><?php echo get_lang('Type');?></b></td>

+ 3 - 0
main/exercice/unique_answer.class.php

@@ -44,6 +44,9 @@ if(!class_exists('UniqueAnswer')):
  
 class UniqueAnswer extends Question {
 	
+	static $typePicture = 'mcua.png';
+	static $explanationLangVar = 'UniqueSelect';
+	
 	/**
 	 * Constructor
 	 */

BIN=BIN
main/img/fill_in_blanks.png


BIN=BIN
main/img/hotspot.png


BIN=BIN
main/img/matching.png


BIN=BIN
main/img/mcma.png


BIN=BIN
main/img/mcua.png


BIN=BIN
main/img/open_answer.png