ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilAssSelfAssessmentQuestionFormatter Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilAssSelfAssessmentQuestionFormatter:
+ Collaboration diagram for ilAssSelfAssessmentQuestionFormatter:

Public Member Functions

 format ($string)
 Original code copied from ::formatSAQuestion (author: akill) More...
 
 migrateToLmContent ($string)
 

Static Public Member Functions

static prepareQuestionForLearningModule (assQuestion $question)
 
static getSelfAssessmentTags ()
 Get tags allowed in question tags in self assessment mode. More...
 

Protected Member Functions

 handleLineBreaks ($string)
 
 stripHtmlExceptSelfAssessmentTags ($string)
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilAssSelfAssessmentQuestionFormatter

Definition at line 22 of file class.ilAssSelfAssessmentQuestionFormatter.php.

Member Function Documentation

◆ format()

ilAssSelfAssessmentQuestionFormatter::format (   $string)

Original code copied from ::formatSAQuestion (author: akill)

Parameters
$htmlstring
Returns
string

Definition at line 29 of file class.ilAssSelfAssessmentQuestionFormatter.php.

References ilRTE\_replaceMediaObjectImageSrc(), handleLineBreaks(), and ilRTE\replaceLatexSpan().

29  : string
30  {
31  $string = $this->handleLineBreaks($string);
32  $string = ilRTE::_replaceMediaObjectImageSrc($string, 1);
33  $string = ilRTE::replaceLatexSpan($string);
34  $string = str_replace("</li><br />", "</li>", $string);
35  $string = str_replace("</li><br>", "</li>", $string);
36  $string = str_replace('{', '&#123;', $string);
37  $string = str_replace('}', '&#125;', $string);
38 
39  return $string;
40  }
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
static replaceLatexSpan(string $text)
Replace the latex delimiters used by the rich text editor Unfortunately these can&#39;t be processed by M...
+ Here is the call graph for this function:

◆ getSelfAssessmentTags()

static ilAssSelfAssessmentQuestionFormatter::getSelfAssessmentTags ( )
static

Get tags allowed in question tags in self assessment mode.

Returns
array array of tags

Definition at line 97 of file class.ilAssSelfAssessmentQuestionFormatter.php.

References ilUtil\getSecureTags().

Referenced by assQuestionGUI\addBasicQuestionFormProperties(), ilAssQuestionFeedback\buildFeedbackContentFormProperty(), assLongMenuGUI\populateQuestionSpecificFormPart(), and assClozeTestGUI\populateQuestionSpecificFormPart().

97  : array
98  {
99  // set tags we allow in self assessment mode
100  $st = ilUtil::getSecureTags();
101 
102  $not_supported = ['img'];
103  $tags = ['br', 'table', 'td', 'tr', 'th'] + array_diff($st, $not_supported);
104 
105  return $tags;
106  }
static getSecureTags()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleLineBreaks()

ilAssSelfAssessmentQuestionFormatter::handleLineBreaks (   $string)
protected
Parameters
string$string
Returns
string

Definition at line 46 of file class.ilAssSelfAssessmentQuestionFormatter.php.

References ilUtil\isHTML().

Referenced by format().

46  : string
47  {
48  if (!ilUtil::isHTML($string)) {
49  $string = nl2br($string);
50  }
51 
52  return $string;
53  }
static isHTML(string $a_text)
Checks if a given string contains HTML or not.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ migrateToLmContent()

ilAssSelfAssessmentQuestionFormatter::migrateToLmContent (   $string)
Parameters
string$string
Returns
string

Implements ilAssSelfAssessmentMigrator.

Definition at line 78 of file class.ilAssSelfAssessmentQuestionFormatter.php.

References ilRTE\replaceLatexSpan(), and stripHtmlExceptSelfAssessmentTags().

78  : string
79  {
80  $string = ilRTE::replaceLatexSpan($string);
81  $string = $this->stripHtmlExceptSelfAssessmentTags($string);
82  return $string;
83  }
static replaceLatexSpan(string $text)
Replace the latex delimiters used by the rich text editor Unfortunately these can&#39;t be processed by M...
+ Here is the call graph for this function:

◆ prepareQuestionForLearningModule()

static ilAssSelfAssessmentQuestionFormatter::prepareQuestionForLearningModule ( assQuestion  $question)
static
Parameters
assQuestion$question

Definition at line 88 of file class.ilAssSelfAssessmentQuestionFormatter.php.

References assQuestion\migrateContentForLearningModule().

Referenced by ilPCQuestion\copyPoolQuestionIntoPage().

88  : void
89  {
90  $question->migrateContentForLearningModule(new self());
91  }
migrateContentForLearningModule(ilAssSelfAssessmentMigrator $migrator)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stripHtmlExceptSelfAssessmentTags()

ilAssSelfAssessmentQuestionFormatter::stripHtmlExceptSelfAssessmentTags (   $string)
protected
Parameters
string$string
Returns
string

Definition at line 59 of file class.ilAssSelfAssessmentQuestionFormatter.php.

References ilUtil\secureString().

Referenced by migrateToLmContent().

59  : string
60  {
61  $tags = self::getSelfAssessmentTags();
62 
63  $tstr = "";
64 
65  foreach ($tags as $t) {
66  $tstr .= "<" . $t . ">";
67  }
68 
69  $string = ilUtil::secureString($string, true, $tstr);
70 
71  return $string;
72  }
static secureString(string $a_str, bool $a_strip_html=true, string $a_allow="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: