Feature #747 - Replacement of the function api_parse_tex() with the function text_filter() which has generic purpose. The function text_filter is dummy yet, it may be developed in the future.

skala
Ivan Tcholakov 15 years ago
parent 5553a4799d
commit 6388bd2f00
  1. 4
      main/exercice/exercice.php
  2. 2
      main/exercice/exercice_submit.php
  3. 14
      main/exercice/exercise.lib.php
  4. 8
      main/exercice/exercise_result.php
  5. 2
      main/exercice/exercise_show.php
  6. 10
      main/exercice/export/scorm/scorm_classes.php
  7. 4
      main/exercice/question.class.php
  8. 6
      main/inc/lib/exercise_show_functions.lib.php
  9. 10
      main/newscorm/learnpath_functions.inc.php

@ -869,7 +869,7 @@ if ($show == 'test') {
echo '<td width="15" valign="left">'.($i+($page*$limitExPage)).'.'.'</td>';
//Showing exercise title
$row['title']=api_parse_tex($row['title']);
$row['title']=text_filter($row['title']);
echo '<td>';
$class_invisible = '';
@ -928,7 +928,7 @@ if ($show == 'test') {
?>
<tr>
<td><?php echo ($i+($page*$limitExPage)).'.'; ?></td>
<?php $row['title']=api_parse_tex($row['title']);?>
<?php $row['title']=text_filter($row['title']);?>
<td>
<?php

@ -1086,7 +1086,7 @@ if (api_is_course_admin() && $origin != 'learnpath') {
echo '</div>';
}
$exerciseTitle = api_parse_tex($exerciseTitle);
$exerciseTitle = text_filter($exerciseTitle);
echo "<h3>" . $exerciseTitle . "</h3>";
$show_clock = true;

@ -47,7 +47,7 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
$questionName=$objQuestionTmp->selectTitle();
$questionDescription=$objQuestionTmp->selectDescription();
$questionName=api_parse_tex($questionName);
$questionName=text_filter($questionName);
$s="<div id=\"question_title\" class=\"sectiontitle\">
".get_lang('Question').' ';
@ -63,7 +63,7 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
$s='';
$s.="<table class='exercise_questions' style='margin:4px;padding:2px;'>
<tr><td valign='top' colspan='2'>";
$questionDescription=api_parse_tex($questionDescription);
$questionDescription=text_filter($questionDescription);
$s.=$questionDescription;
$s.="</td></tr></table>";
@ -224,7 +224,7 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
$selected = 'checked="checked"';
}
}
$answer = api_parse_tex($answer);
$answer = text_filter($answer);
$answer = Security::remove_XSS($answer, STUDENT);
$s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'.
'<tr><td colspan="3"><div class="u-m-answer"><p style="float: '.($is_ltr_text_direction ? 'left' : 'right').'; padding-'.($is_ltr_text_direction ? 'right' : 'left').': 4px;">'.
@ -244,7 +244,7 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
$selected = 'checked="checked"';
}
}
$answer = api_parse_tex($answer);
$answer = text_filter($answer);
$answer = Security::remove_XSS($answer, STUDENT);
$s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'.
'<tr><td colspan="3"><div class="u-m-answer"><p style="float: '.($is_ltr_text_direction ? 'left' : 'right').'; padding-'.($is_ltr_text_direction ? 'right' : 'left').': 4px;">'.
@ -264,7 +264,7 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
$selected = 'checked="checked"';
}
}
$answer = api_parse_tex($answer);
$answer = text_filter($answer);
$answer = Security::remove_XSS($answer, STUDENT);
$s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'.
'<tr><td colspan="3"><div class="u-m-answer"><p style="float: '.($is_ltr_text_direction ? 'left' : 'right').'; padding-'.($is_ltr_text_direction ? 'right' : 'left').': 4px;">'.
@ -284,7 +284,7 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
// only show elements to be answered (not the contents of
// the select boxes, who are corrrect = 0)
$s .= '<tr><td width="45%" valign="top" >';
$parsed_answer = api_parse_tex($answer);
$parsed_answer = text_filter($answer);
//left part questions
$s .= ' <span style="float:left; width:8%;"><b>'.$lines_count.'</b>.&nbsp;</span>
<span style="float:left; width:92%;">'.$parsed_answer.'</span></td>';
@ -390,7 +390,7 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
echo '<table class="exercise_questions" >
<tr>
<td valign="top" colspan="2">';
echo $questionDescription=api_parse_tex($questionDescription);
echo $questionDescription=text_filter($questionDescription);
echo '</td></tr>';
}

@ -314,14 +314,14 @@ function display_unique_or_multiple_answer($answerType, $studentChoice, $answer,
</td>
<td width="45%" style="border-bottom: 1px solid #4171B5;">
<?php
$answer=api_parse_tex($answer);
$answer=text_filter($answer);
echo $answer;
?>
</td>
<?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
<td width="45%" style="border-bottom: 1px solid #4171B5;">
<?php
$answerComment=api_parse_tex($answerComment);
$answerComment=text_filter($answerComment);
if($studentChoice)
{
if(!$answerCorrect)
@ -440,7 +440,7 @@ if (api_is_course_admin() && $origin != 'learnpath') {
echo '</div>';
}
$exerciseTitle=api_parse_tex($exerciseTitle);
$exerciseTitle=text_filter($exerciseTitle);
//show exercise title
?>
@ -890,7 +890,7 @@ foreach ($questionList as $questionId) {
{
if ($origin != 'learnpath') {
echo '<tr>';
echo '<td>'.api_parse_tex($answer_matching[$answerId]).'</td><td>'.api_parse_tex($user_answer).' / <b><span style="color: #008000;">'.api_parse_tex($answer_matching[$answerCorrect]).'</span></b></td>';
echo '<td>'.text_filter($answer_matching[$answerId]).'</td><td>'.text_filter($user_answer).' / <b><span style="color: #008000;">'.text_filter($answer_matching[$answerCorrect]).'</span></b></td>';
echo '</tr>';
}
}

@ -269,7 +269,7 @@ $show_results = true;
// Avoiding the "Score 0/0" message when the exe_id is not set
if (Database::num_rows($result)>0 && isset($id)) {
$test=Database::result($result,0,0);
$exerciseTitle=api_parse_tex($test);
$exerciseTitle=text_filter($test);
$exerciseDescription=Database::result($result,0,1);
// if the results_disabled of the Quiz is 1 when block the script

@ -129,12 +129,12 @@ class ScormQuestion extends Question
$cols = 2;
$s='<tr>' .
'<td colspan="'.$cols.'" id="question_'.$this->id.'_title" valign="middle" style="background-color:#d6d6d6;">' . "\n" .
api_parse_tex($title).
text_filter($title).
'</td>' . "\n" .
'</tr>' . "\n" .
'<tr>' . "\n" .
'<td valign="top" colspan="'.$cols.'">' . "\n" .
'<i>'.api_parse_tex($description).'</i>' . "\n" .
'<i>'.text_filter($description).'</i>' . "\n" .
'</td>' . "\n" .
'</tr>' . "\n";
return $s;
@ -443,7 +443,7 @@ class ScormAnswerMatching extends Answer
// options (A, B, C, ...) that will be put into the list-box
$Select[$answerId]['Lettre']=$cpt1;
// answers that will be shown at the right side
$answer = api_parse_tex($answer);
$answer = text_filter($answer);
$Select[$answerId]['Reponse']=$answer;
$cpt1++;
}
@ -722,14 +722,14 @@ class ScormAnswerHotspot extends Answer
{
$s="<tr>
<td valign='top' colspan='2'>&nbsp;";
$questionName=api_parse_tex($questionName);
$questionName=text_filter($questionName);
$s.=$questionName;
$s.="</td>
</tr>
<tr>
<td valign='top' colspan='2'>
<i>";
$questionDescription=api_parse_tex($questionDescription);
$questionDescription=text_filter($questionDescription);
$s.=$questionDescription;
$s.="</i>
</td>

@ -142,7 +142,7 @@ abstract class Question
*/
function selectTitle()
{
$this->question=api_parse_tex($this->question);
$this->question=text_filter($this->question);
return $this->question;
}
@ -154,7 +154,7 @@ abstract class Question
*/
function selectDescription()
{
$this->description=api_parse_tex($this->description);
$this->description=text_filter($this->description);
return $this->description;
}

@ -124,7 +124,7 @@ class ExerciseShowFunctions {
<?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
<td valign="top" align="left" >
<?php
$answerComment=api_parse_tex($answerComment);
$answerComment=text_filter($answerComment);
if($studentChoice) {
echo '<span style="font-weight: bold; color: #008000;">'.nl2br(make_clickable($answerComment)).'</span>';
} else {
@ -169,7 +169,7 @@ class ExerciseShowFunctions {
</td>
<td width="40%" style="border-bottom: 1px solid #4171B5;">
<?php
$answer=api_parse_tex($answer);
$answer=text_filter($answer);
echo $answer;
?>
</td>
@ -177,7 +177,7 @@ class ExerciseShowFunctions {
<?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
<td width="20%" style="border-bottom: 1px solid #4171B5;">
<?php
$answerComment=api_parse_tex($answerComment);
$answerComment=text_filter($answerComment);
if($studentChoice)
{
if(!$answerCorrect)

@ -1473,7 +1473,7 @@ function export_exercise($item_id)
}
}
$exerciseTitle = api_parse_tex($exerciseTitle);
$exerciseTitle = text_filter($exerciseTitle);
$test .= "<h3>".$exerciseTitle."</h3>";
@ -1482,7 +1482,7 @@ function export_exercise($item_id)
$test .= "<a href=\"../document/download.php?doc_url=%2Faudio%2F".$exerciseSound."\"&SQMSESSID=36812c2dea7d8d6e708d5e6a2f09b0b9 target=\"_blank\"><img src=\"../img/sound.gif\" border=\"0\" align=\"absmiddle\" alt=".get_lang("Sound")."\" /></a>";
}
$exerciseDescription = api_parse_tex($exerciseDescription);
$exerciseDescription = text_filter($exerciseDescription);
// --------- writing the .js file with to check the correct answers begin -----------------------
$scriptfilename = "Exercice".$item_id.".js";
@ -1716,7 +1716,7 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
$content = $myrow["content"];
//3.2.7 Make clickable???
$content = make_clickable($content);
$content = api_parse_tex($content);
$content = text_filter($content);
//3.2.8 Write the prepared content to the export string
$expcontent .= "<tr><td class=\"text\" colspan='2'>";
$expcontent .= $content;
@ -1755,7 +1755,7 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
//$content = nl2br($content);
//3.2 Prepare the data for export
$content = make_clickable($content);
$content = api_parse_tex($content);
$content = text_filter($content);
//3.3 Get a UNIX(?<-mktime) Timestamp of the end_date for this announcement
$last_post_datetime = $myrow['end_date']; // post time format datetime de mysql
@ -1801,7 +1801,7 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
$expcontent .= "<h4>".$row['title']."</h4>";
//2.a.1.2 Prepare content
$content = make_clickable(nl2br($row['content']));
$content = api_parse_tex($content);
$content = text_filter($content);
//2.a.1.3 Write content to the export string
$expcontent .= $content;
}

Loading…
Cancel
Save