diff --git a/main/exercice/exercise.lib.php b/main/exercice/exercise.lib.php index 15421481d5..7f88a69dbb 100644 --- a/main/exercice/exercise.lib.php +++ b/main/exercice/exercise.lib.php @@ -1,30 +1,30 @@ -selectType(); $pictureName=$objQuestionTmp->selectPicture(); - + if ($answerType != HOT_SPOT) // Question is not of type hotspot { - + if(!$onlyAnswers) { $questionName=$objQuestionTmp->selectTitle(); $questionDescription=$objQuestionTmp->selectDescription(); - + $s=" "; $questionName=api_parse_tex($questionName); @@ -74,7 +74,7 @@ function showQuestion($questionId, $onlyAnswers=false, $origin=false) $s.=" "; - + if(!empty($pictureName)) { $s.=" @@ -82,14 +82,14 @@ function showQuestion($questionId, $onlyAnswers=false, $origin=false) "; } - + } // end if(!$onlyAnswers) // construction of the Answer object $objAnswerTmp=new Answer($questionId); - + $nbrAnswers=$objAnswerTmp->selectNbrAnswers(); - + // only used for the answer type "Matching" if($answerType == MATCHING) { @@ -106,75 +106,75 @@ function showQuestion($questionId, $onlyAnswers=false, $origin=false) $oFCKeditor->BasePath = api_get_path(WEB_LIBRARY_PATH)."fckeditor/"; //$oFCKeditor->Config['CustomConfigurationsPath'] = api_get_path(WEB_PATH)."claroline/inc/lib/fckeditor_new/myconfig.js?".time(); //to clear cache we use time() but always clear history manually /* - $oFCKeditor->Config['ImageBrowserURL'] = $oFCKeditor->BasePath . "editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/php/connector.php&ServerPath=/$upload_path/"; - + $oFCKeditor->Config['ImageBrowserURL'] = $oFCKeditor->BasePath . "editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/php/connector.php&ServerPath=/$upload_path/"; + $oFCKeditor->Config['ImageUploadURL'] = $oFCKeditor->BasePath . "editor/filemanager/upload/php/upload.php?Type=Image&ServerPath=/$upload_path/" ; - + //for Link/File - $oFCKeditor->Config['LinkBrowserURL'] = $oFCKeditor->BasePath . "editor/filemanager/browser/default/browser.html?Connector=connectors/php/connector.php&ServerPath=$upload_path"; - + $oFCKeditor->Config['LinkBrowserURL'] = $oFCKeditor->BasePath . "editor/filemanager/browser/default/browser.html?Connector=connectors/php/connector.php&ServerPath=$upload_path"; + $oFCKeditor->Config['LinkUploadURL'] = $oFCKeditor->BasePath . "editor/filemanager/upload/php/upload.php?ServerPath=$upload_path" ; - + //for image - $oFCKeditor->Config['ImageBrowserURL'] = $oFCKeditor->BasePath . "editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/php/connector.php&ServerPath=$upload_path"; - + $oFCKeditor->Config['ImageBrowserURL'] = $oFCKeditor->BasePath . "editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/php/connector.php&ServerPath=$upload_path"; + $oFCKeditor->Config['ImageUploadURL'] = $oFCKeditor->BasePath . "editor/filemanager/upload/php/upload.php?Type=Image&ServerPath=$upload_path" ; - + //for flash $oFCKeditor->Config['FlashBrowserURL'] = $oFCKeditor->BasePath . "editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/php/connector.php&ServerPath=$upload_path"; - + $oFCKeditor->Config['FlashUploadURL'] = $oFCKeditor->BasePath . "editor/filemanager/upload/php/upload.php?Type=Flash&ServerPath=$upload_path" ; - + //for MP3 $oFCKeditor->Config['MP3BrowserURL'] = $oFCKeditor->BasePath . "editor/filemanager/browser/default/browser.html?Type=MP3&Connector=connectors/php/connector.php&ServerPath=$upload_path"; - + $oFCKeditor->Config['MP3UploadURL'] = $oFCKeditor->BasePath . "editor/filemanager/upload/php/upload.php?Type=MP3&ServerPath=$upload_path" ; - + //for other media $oFCKeditor->Config['VideoBrowserURL'] = $oFCKeditor->BasePath . "editor/filemanager/browser/default/browser.html?Type=Video&Connector=connectors/php/connector.php&ServerPath=$upload_path"; - + $oFCKeditor->Config['VideoUploadURL'] = $oFCKeditor->BasePath . "editor/filemanager/upload/php/upload.php?Type=Video&ServerPath=$upload_path" ; - + $oFCKeditor->ToolbarSet = 'Comment' ;*/ $oFCKeditor->Width = '70%'; $oFCKeditor->Height = '150'; $oFCKeditor->Value = '' ; $s .= "".$oFCKeditor->CreateHtml().""; //$s.=""; - + } - + for($answerId=1;$answerId <= $nbrAnswers;$answerId++) { $answer=$objAnswerTmp->selectAnswer($answerId); $answerCorrect=$objAnswerTmp->isCorrect($answerId); - + if($answerType == FILL_IN_BLANKS) { // splits text and weightings that are joined with the character '::' list($answer)=explode('::',$answer); - + // because [] is parsed here we follow this procedure: // 1. find everything between the [tex] and [/tex] tags $startlocations=strpos($answer,'[tex]'); $endlocations=strpos($answer,'[/tex]'); - + if($startlocations !== false && $endlocations !== false) { $texstring=substr($answer,$startlocations,$endlocations-$startlocations+6); // 2. replace this by {texcode} $answer=str_replace($texstring,'{texcode}',$answer); } - + // 3. do the normal matching parsing - + // replaces [blank] by an input field $answer=ereg_replace('\[[^]]+\]','',nl2br($answer)); // 4. replace the {texcode by the api_pare_tex parsed code} $texstring = api_parse_tex($texstring); $answer=str_replace("{texcode}",$texstring,$answer); } - + // unique answer if($answerType == UNIQUE_ANSWER) { @@ -187,7 +187,7 @@ function showQuestion($questionId, $onlyAnswers=false, $origin=false) $answer=api_parse_tex($answer); $s.=$answer; $s.=""; - + } // multiple answers elseif($answerType == MULTIPLE_ANSWER) @@ -200,16 +200,16 @@ function showQuestion($questionId, $onlyAnswers=false, $origin=false) $answer = api_parse_tex($answer); $s.=$answer; $s.=""; - + } // fill in blanks elseif($answerType == FILL_IN_BLANKS) { $s.="$answer"; - + } // free answer - + // matching else { @@ -229,18 +229,18 @@ function showQuestion($questionId, $onlyAnswers=false, $origin=false) "; $answer=api_parse_tex($answer); - $s.=" + $s.="
".$cpt2.". ".$answer."".$cpt2.". ".$answer."      "; if(isset($Select[$cpt2])) $s.=''.$Select[$cpt2]['Lettre'].'. '.$Select[$cpt2]['Reponse']; @@ -251,17 +251,17 @@ function showQuestion($questionId, $onlyAnswers=false, $origin=false)
"; - + $cpt2++; - + // if the left side of the "matching" has been completely shown if($answerId == $nbrAnswers) { // if it remains answers to shown at the right side while(isset($Select[$cpt2])) { - - + + $s.=" @@ -274,21 +274,21 @@ function showQuestion($questionId, $onlyAnswers=false, $origin=false)
"; - - + + $cpt2++; } // end while() } // end if() } } } // end for() - + // destruction of the Answer object unset($objAnswerTmp); - + // destruction of the Question object unset($objQuestionTmp); - + if ($origin != 'export') { echo $s; @@ -302,11 +302,11 @@ function showQuestion($questionId, $onlyAnswers=false, $origin=false) { $questionName=$objQuestionTmp->selectTitle(); $questionDescription=$objQuestionTmp->selectDescription(); - + // Get the answers, make a list $objAnswerTmp=new Answer($questionId); $nbrAnswers=$objAnswerTmp->selectNbrAnswers(); - + $answer_list = '
'.get_lang('langHotspotZones').'
    '; for($answerId=1;$answerId <= $nbrAnswers;$answerId++) { @@ -331,17 +331,17 @@ function showQuestion($questionId, $onlyAnswers=false, $origin=false) "; } - + $canClick = isset($_GET['editQuestion']) ? '0' : (isset($_GET['modifyAnswers']) ? '0' : '1'); //$tes = isset($_GET['modifyAnswers']) ? '0' : '1'; //echo $tes; $s .= '
    '."