ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilLegacyFormElementsUtil Class Reference

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

+ Collaboration diagram for ilLegacyFormElementsUtil:

Static Public Member Functions

static prepareFormOutput ($a_str, bool $a_strip=false)
 
static period2String (ilDateTime $a_from, $a_to=null)
 Return a string of time period. More...
 
static prepareTextareaOutput (string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=false)
 Prepares a string for a text area output where latex code may be in it If the text is HTML-free, CHR(13) will be converted to a line break. More...
 
static makeTimeSelect (string $prefix, bool $short=true, int $hour=0, int $minute=0, int $second=0, bool $a_use_default=true, array $a_further_options=[])
 Creates a combination of HTML selects for time inputs. More...
 
static formCheckbox (bool $checked, string $varname, string $value, bool $disabled=false)
 
static formSelect ( $selected, string $varname, array $options, bool $multiple=false, bool $direct_text=false, int $size=0, string $style_class="", array $attribs=[], bool $disabled=false)
 Builds a select form field with options and shows the selected option first. More...
 
static formRadioButton (bool $checked, string $varname, string $value, ?string $onclick=null, bool $disabled=false)
 

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 Util class various functions, usage as namespace

Author
Sascha Hofmann sasch.nosp@m.ahof.nosp@m.mann@.nosp@m.gmx..nosp@m.de
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e

grown helper class with many different UseCases and functions. The class is not under direct maintainership and the responsibilities are unclear. In this context, the class should no longer be used in the code and existing uses should be converted to their own service in the medium term. If you need ilUtil for the implementation of a new function in ILIAS > 7, please contact the Technical Board.

Definition at line 31 of file class.ilLegacyFormElementsUtil.php.

Member Function Documentation

◆ formCheckbox()

static ilLegacyFormElementsUtil::formCheckbox ( bool  $checked,
string  $varname,
string  $value,
bool  $disabled = false 
)
static
Deprecated:

Definition at line 255 of file class.ilLegacyFormElementsUtil.php.

260 : string {
261 $str = "<input type=\"checkbox\" name=\"" . $varname . "\"";
262
263 if ($checked === true) {
264 $str .= " checked=\"checked\"";
265 }
266
267 if ($disabled === true) {
268 $str .= " disabled=\"disabled\"";
269 }
270
271 $array_var = false;
272
273 if (substr($varname, -2) == "[]") {
274 $array_var = true;
275 }
276
277 // if varname ends with [], use varname[-2] + _ + value as id tag (e.g. "user_id[]" => "user_id_15")
278 if ($array_var) {
279 $varname_id = substr($varname, 0, -2) . "_" . $value;
280 } else {
281 $varname_id = $varname;
282 }
283
284 // dirty removal of other "[]" in string
285 $varname_id = str_replace("[", "_", $varname_id);
286 $varname_id = str_replace("]", "", $varname_id);
287
288 $str .= " value=\"" . $value . "\" id=\"" . $varname_id . "\" />\n";
289
290 return $str;
291 }

Referenced by ilLocalUserGUI\assignRoles(), ilECSNodeMappingCmsExplorer\buildFormItem(), ilECSNodeMappingLocalExplorer\buildFormItem(), ilPasteIntoMultipleItemsExplorer\buildFormItem(), ilPCImageMapTableGUI\fillRow(), ilImageMapTableGUI\fillRow(), ilTestPersonalDefaultSettingsTableGUI\fillRow(), ilWebResourceEditableLinkTableGUI\fillRow(), ilUnitCategoryTableGUI\fillRow(), ilAccessibilityDocumentTableGUI\formatCellValue(), and ilNestedListInputGUI\render().

+ Here is the caller graph for this function:

◆ formRadioButton()

static ilLegacyFormElementsUtil::formRadioButton ( bool  $checked,
string  $varname,
string  $value,
?string  $onclick = null,
bool  $disabled = false 
)
static
Deprecated:

Definition at line 393 of file class.ilLegacyFormElementsUtil.php.

399 : string {
400 $str = '<input ';
401
402 if ($onclick !== null) {
403 $str .= ('onclick="' . $onclick . '"');
404 }
405
406 $str .= (" type=\"radio\" name=\"" . $varname . "\"");
407 if ($checked === true) {
408 $str .= " checked=\"checked\"";
409 }
410
411 if ($disabled === true) {
412 $str .= " disabled=\"disabled\"";
413 }
414
415 $str .= " value=\"" . $value . "\"";
416
417 $str .= " id=\"" . $value . "\" />\n";
418
419 return $str;
420 }

Referenced by ilECSNodeMappingCmsExplorer\buildFormItem(), ilECSNodeMappingLocalExplorer\buildFormItem(), and ilPasteIntoMultipleItemsExplorer\buildFormItem().

+ Here is the caller graph for this function:

◆ formSelect()

static ilLegacyFormElementsUtil::formSelect (   $selected,
string  $varname,
array  $options,
bool  $multiple = false,
bool  $direct_text = false,
int  $size = 0,
string  $style_class = "",
array  $attribs = [],
bool  $disabled = false 
)
static

Builds a select form field with options and shows the selected option first.

@access public

Parameters
string/arrayvalue to be selected
stringvariable name in formular
arrayarray with $options (key = lang_key, value = long name)
booleanmultiple selection list true/false
booleanif true, the option values are displayed directly, otherwise they are handled as language variable keys and the corresponding language variable is displayed
intsize
stringstyle class
arrayadditional attributes (key = attribute name, value = attribute value)
booleandisabled
Deprecated:

Definition at line 310 of file class.ilLegacyFormElementsUtil.php.

320 : string {
321 global $DIC;
322
323 $lng = $DIC->language();
324
325 if ($multiple == true) {
326 $multiple = " multiple=\"multiple\"";
327 } else {
328 $multiple = "";
329 $size = 0;
330 }
331
332 $class = " class=\" form-control " . $style_class . "\"";
333
334 // use form-inline!
335 // this is workaround the whole function should be set deprecated
336 // $attributes = " style='display:inline-block;' ";
337
338 $attributes = "";
339 if (is_array($attribs)) {
340 foreach ($attribs as $key => $val) {
341 $attributes .= " " . $key . "=\"" . $val . "\"";
342 }
343 }
344 if ($disabled) {
345 $disabled = ' disabled=\"disabled\"';
346 }
347
348 $size_str = "";
349 if ($size > 0) {
350 $size_str = ' size="' . $size . '" ';
351 }
352 $str = "<select name=\"" . $varname . "\"" . $multiple . " $class " . $size_str . " $attributes $disabled>\n";
353
354 foreach ($options as $key => $val) {
355 $style = "";
356 if (is_array($val)) {
357 $style = $val["style"];
358 $val = $val["text"]; // mus be last line, since we overwrite
359 }
360
361 $sty = ($style != "")
362 ? ' style="' . $style . '" '
363 : "";
364
365 if ($direct_text) {
366 $str .= " <option $sty value=\"" . $key . "\"";
367 } else {
368 $str .= " <option $sty value=\"" . $val . "\"";
369 }
370 if (is_array($selected)) {
371 if (in_array($key, $selected)) {
372 $str .= " selected=\"selected\"";
373 }
374 } elseif ($selected == $key) {
375 $str .= " selected=\"selected\"";
376 }
377
378 if ($direct_text) {
379 $str .= ">" . $val . "</option>\n";
380 } else {
381 $str .= ">" . $lng->txt($val) . "</option>\n";
382 }
383 }
384
385 $str .= "</select>\n";
386
387 return $str;
388 }
global $lng
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26

Referenced by ilObjUserGUI\__buildFilterSelect(), ilObjUserGUI\__getDateSelect(), ilRecurrenceInputGUI\buildMonthlyByDaySelection(), ilRecurrenceInputGUI\buildMonthlyByMonthDaySelection(), ilRecurrenceInputGUI\buildYearlyByDaySelection(), ilRecurrenceInputGUI\buildYearlyByMonthDaySelection(), ilObjTypeDefinitionGUI\editObject(), ilTable2GUI\fillActionRow(), ilAdvancedMDRecordTableGUI\fillRow(), ilPCFileListTableGUI\fillRow(), ilPCGridCellTableGUI\fillRow(), ilPCImageMapTableGUI\fillRow(), ilMultilingualismTableGUI\fillRow(), ilImageMapTableGUI\fillRow(), ilModulesTableGUI\fillRow(), ilLPCollectionSettingsTableGUI\fillRow(), ilWebResourceEditableLinkTableGUI\fillRow(), ilECSCommunityTableGUI\fillRow(), ilImportantPagesTableGUI\fillRow(), ilInstallationHeadingTableGUI\fillRow(), ilTable2GUI\getLinkbar(), ilRecurrenceInputGUI\insert(), ilLocationInputGUI\insert(), ilDurationInputGUI\render(), ilInternalLinkGUI\showLinkHelp(), ilPageObjectGUI\showPage(), ilObjectGUI\showPossibleSubObjects(), and ilObjUserFolderGUI\showPossibleSubObjects().

+ Here is the caller graph for this function:

◆ makeTimeSelect()

static ilLegacyFormElementsUtil::makeTimeSelect ( string  $prefix,
bool  $short = true,
int  $hour = 0,
int  $minute = 0,
int  $second = 0,
bool  $a_use_default = true,
array  $a_further_options = [] 
)
static

Creates a combination of HTML selects for time inputs.

Creates a combination of HTML selects for time inputs. The select names are $prefix[h] for hours, $prefix[m] for minutes and $prefix[s] for seconds.

@access public

Parameters
string$prefixPrefix of the select name
boolean$shortSet TRUE for a short time input (only hours and minutes). Default is TRUE
integer$hourDefault hour value
integer$minuteDefault minute value
integer$secondDefault second value
Deprecated:

Definition at line 165 of file class.ilLegacyFormElementsUtil.php.

173 : string {
174 global $DIC;
175
176 $lng = $DIC->language();
177 $ilUser = $DIC->user();
178
179 $minute_steps = 1;
180 $disabled = '';
181 if (count($a_further_options)) {
182 if (isset($a_further_options['minute_steps'])) {
183 $minute_steps = $a_further_options['minute_steps'];
184 }
185 if (isset($a_further_options['disabled']) and $a_further_options['disabled']) {
186 $disabled = 'disabled="disabled" ';
187 }
188 }
189
190 if ($a_use_default and !strlen("$hour$minute$second")) {
191 $now = localtime();
192 $hour = $now[2];
193 $minute = $now[1];
194 $second = $now[0];
195 }
196
197 // build hour select
198 $sel_hour = '<select ';
199 if (isset($a_further_options['select_attributes'])) {
200 foreach ($a_further_options['select_attributes'] as $name => $value) {
201 $sel_hour .= $name . '=' . $value . ' ';
202 }
203 }
204 $sel_hour .= " " . $disabled . "name=\"" . $prefix . "[h]\" id=\"" . $prefix . "_h\" class=\"form-control\">\n";
205
206 $format = $ilUser->getTimeFormat();
207 for ($i = 0; $i <= 23; $i++) {
208 if ($format == ilCalendarSettings::TIME_FORMAT_24) {
209 $sel_hour .= "<option value=\"$i\">" . sprintf("%02d", $i) . "</option>\n";
210 } else {
211 $sel_hour .= "<option value=\"$i\">" . date("ga", mktime($i, 0, 0)) . "</option>\n";
212 }
213 }
214 $sel_hour .= "</select>\n";
215 $sel_hour = preg_replace("/(value\=\"$hour\")/", "$1 selected=\"selected\"", $sel_hour);
216
217 // build minutes select
218 $sel_minute = "<select " . $disabled . "name=\"" . $prefix . "[m]\" id=\"" . $prefix . "_m\" class=\"form-control\">\n";
219
220 for ($i = 0; $i <= 59; $i = $i + $minute_steps) {
221 $sel_minute .= "<option value=\"$i\">" . sprintf("%02d", $i) . "</option>\n";
222 }
223 $sel_minute .= "</select>\n";
224 $sel_minute = preg_replace("/(value\=\"$minute\")/", "$1 selected=\"selected\"", $sel_minute);
225
226 if (!$short) {
227 // build seconds select
228 $sel_second = "<select " . $disabled . "name=\"" . $prefix . "[s]\" id=\"" . $prefix . "_s\" class=\"form-control\">\n";
229
230 for ($i = 0; $i <= 59; $i++) {
231 $sel_second .= "<option value=\"$i\">" . sprintf("%02d", $i) . "</option>\n";
232 }
233 $sel_second .= "</select>\n";
234 $sel_second = preg_replace("/(value\=\"$second\")/", "$1 selected=\"selected\"", $sel_second);
235 }
236 $timeformat = ($lng->text["lang_timeformat"] ?? '');
237 if (strlen($timeformat) == 0) {
238 $timeformat = "H:i:s";
239 }
240 $timeformat = strtolower(preg_replace("/\W/", "", $timeformat));
241 $timeformat = preg_replace("/(\w)/", "%%$1", $timeformat);
242 $timeformat = preg_replace("/%%h/", $sel_hour, $timeformat);
243 $timeformat = preg_replace("/%%i/", $sel_minute, $timeformat);
244 if ($short) {
245 $timeformat = preg_replace("/%%s/", "", $timeformat);
246 } else {
247 $timeformat = preg_replace("/%%s/", $sel_second, $timeformat);
248 }
249 return $timeformat;
250 }

Referenced by ilLPCollectionSettingsTableGUI\fillRow().

+ Here is the caller graph for this function:

◆ period2String()

static ilLegacyFormElementsUtil::period2String ( ilDateTime  $a_from,
  $a_to = null 
)
static

Return a string of time period.

Deprecated:

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

59 : string
60 {
61 global $DIC;
62
63 $lng = $DIC->language();
64
65 if (!$a_to) {
66 $a_to = new ilDateTime(time(), IL_CAL_UNIX);
67 }
68
69 $from = new DateTime($a_from->get(IL_CAL_DATETIME));
70 $to = new DateTime($a_to->get(IL_CAL_DATETIME));
71 $diff = $to->diff($from);
72
73 $periods = [];
74 $periods["years"] = $diff->format("%y");
75 $periods["months"] = $diff->format("%m");
76 $periods["days"] = $diff->format("%d");
77 $periods["hours"] = $diff->format("%h");
78 $periods["minutes"] = $diff->format("%i");
79 $periods["seconds"] = $diff->format("%s");
80
81 if (!array_sum($periods)) {
82 return '';
83 }
84 $array = [];
85 foreach ($periods as $key => $value) {
86 if ($value) {
87 $segment_name = ($value > 1)
88 ? $key
89 : substr($key, 0, -1);
90 $array[] = $value . ' ' . $lng->txt($segment_name);
91 }
92 }
93
94 if ($len = count($array) > 3) {
95 $array = array_slice($array, 0, (3 - $len));
96 }
97
98 return implode(', ', $array);
99 }
const IL_CAL_UNIX
const IL_CAL_DATETIME
@classDescription Date and time handling
get(int $a_format, string $a_format_str='', string $a_tz='')
get formatted date

References $DIC, $lng, ilDateTime\get(), IL_CAL_DATETIME, and IL_CAL_UNIX.

Referenced by ilExcAssMemberState\getRemainingPeerReviewPresentation(), ilExcAssMemberState\getRemainingTimePresentation(), ilExcAssMemberState\getRemainingTimePresentationOfLastSubmissionOfRelativeDeadline(), and ILIAS\Exercise\Assignment\PropertyAndActionBuilderUI\getTimeString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareFormOutput()

static ilLegacyFormElementsUtil::prepareFormOutput (   $a_str,
bool  $a_strip = false 
)
static
Parameters
string | int$a_str
Deprecated:

Definition at line 37 of file class.ilLegacyFormElementsUtil.php.

37 : string
38 {
39 if ($a_strip) {
40 $a_str = ilUtil::stripSlashes($a_str);
41 }
42 $a_str = htmlspecialchars((string) $a_str);
43 // Added replacement of curly brackets to prevent
44 // problems with PEAR templates, because {xyz} will
45 // be removed as unused template variable
46 $a_str = str_replace("{", "&#123;", $a_str);
47 $a_str = str_replace("}", "&#125;", $a_str);
48 // needed for LaTeX conversion \\ in LaTeX is a line break
49 // but without this replacement, php changes \\ to \
50 $a_str = str_replace("\\", "&#92;", $a_str);
51 return $a_str;
52 }
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")

References ilUtil\stripSlashes().

Referenced by ILIAS\Test\Certificate\TestPlaceholderDescription\__construct(), ilCmiXapiPlaceholderDescription\__construct(), ilLTIConsumerPlaceholderDescription\__construct(), ILIAS\Exercise\Certificate\ExercisePlaceholderDescription\__construct(), ILIAS\Course\Certificate\CoursePlaceholderDescription\__construct(), ilScormPlaceholderDescription\__construct(), assQuestionGUI\addBasicQuestionFormProperties(), ilInfoScreenGUI\addPropertyTextinput(), assFileUploadFileTableGUI\buildFileItemContent(), ilAssClozeTestFeedback\buildGapFeedbackLabel(), ilAssClozeTestFeedback\buildSelectGapOptionFeedbackLabel(), ilAssClozeTestFeedback\buildTextGapGivenAnswerFeedbackLabel(), ilObjStyleSheetGUI\deleteColorConfirmationObject(), ilObjTest\deliverPDFfromHTML(), ilPCGridCellTableGUI\fillRow(), ilPCTabsTableGUI\fillRow(), ilMultilingualismTableGUI\fillRow(), ilExGradesTableGUI\fillRow(), ilLanguageExtTableGUI\fillRow(), ilExportIDTableGUI\fillRow(), ilHelpMappingTableGUI\fillRow(), ilHelpTooltipTableGUI\fillRow(), ilLMEditShortTitlesTableGUI\fillRow(), ilImageMapTableGUI\fillRow(), ilMultiSrtConfirmationTable2GUI\fillRow(), ilPortfolioPageTableGUI\fillRow(), ilModulesTableGUI\fillRow(), ilStyleColorTableGUI\fillRow(), ilSurveyQuestionblockbrowserTableGUI\fillRow(), ilSurveyQuestionbrowserTableGUI\fillRow(), ilSurveyQuestionPoolExportTableGUI\fillRow(), ilTaxonomyTableGUI\fillRow(), ilAnswerFrequencyStatisticTableGUI\fillRow(), ilKprimChoiceAnswerFreqStatTableGUI\fillRow(), ilQuestionPoolPrintViewTableGUI\fillRow(), ilWebResourceEditableLinkTableGUI\fillRow(), ilWikiContributorsTableGUI\fillRow(), ilInstallationHeadingTableGUI\fillRow(), ilMailErrorFormatter\format(), assFormulaQuestion\generateResultInputHTML(), ilAwarenessGUI\getAwarenessList(), assClozeTestGUI\getBestSolutionText(), assErrorText\getErrorTokenHtml(), ilAccessibilitySupportContactsGUI\getFooterLink(), ilSystemSupportContactsGUI\getFooterLink(), ilUserFilterGUI\getHTML(), ilTaggingGUI\getHTML(), ilAdvancedSelectionListGUI\getHTML(), ilAssNestedOrderingElementsInputGUI\getItemHtml(), ilRepositoryObjectSearchBlockGUI\getLegacyContent(), ilMailExplorer\getNodeContent(), ILIAS\StudyProgramme\Certificate\ilStudyProgrammePlaceholderValues\getPlaceholderValues(), ILIAS\Course\Certificate\CoursePlaceholderValues\getPlaceholderValuesForPreview(), ILIAS\StudyProgramme\Certificate\ilStudyProgrammePlaceholderValues\getPlaceholderValuesForPreview(), SurveyQuestionGUI\getPrintViewQuestionTitle(), assQuestion\getSuggestedSolutionOutput(), ilTaggingGUI\getTaggingInputHTML(), ilHiddenInputGUI\getToolbarHTML(), SurveyMultipleChoiceQuestionGUI\getWorkingForm(), SurveyTextQuestionGUI\getWorkingForm(), ilRepositoryObjectSearchResultTableGUI\init(), LDAPRoleMappingTable\initRecords(), ilMailSearchGUI\initSearchForm(), ilRandomTestROInputGUI\insert(), ilColorPickerInputGUI\insert(), ilCSSRectInputGUI\insert(), ilEMailInputGUI\insert(), ilFileWizardInputGUI\insert(), ilHiddenInputGUI\insert(), ilSelectBuilderInputGUI\insert(), ilTextAreaInputGUI\insert(), ilUserLoginInputGUI\insert(), ilBackgroundImageInputGUI\insert(), ilTRBLColorPickerInputGUI\insert(), ilMatrixRowWizardInputGUI\insert(), ilAnswerWizardInputGUI\insert(), ilErrorTextWizardInputGUI\insert(), ilEssayKeywordWizardInputGUI\insert(), ilKprimChoiceWizardInputGUI\insert(), ilMatchingPairWizardInputGUI\insert(), ilMatchingWizardInputGUI\insert(), ilMultipleChoiceWizardInputGUI\insert(), ilSingleChoiceWizardInputGUI\insert(), ilAssErrorTextCorrectionsInputGUI\insert(), ilAssMultipleChoiceCorrectionsInputGUI\insert(), ilAssSingleChoiceCorrectionsInputGUI\insert(), assQuestionGUI\outPageSelector(), ilLuceneSearchGUI\performSearch(), assClozeTestGUI\populateNumericGapCorrectionFormProperty(), assClozeTestGUI\populateNumericGapFormPart(), ilObjForumGUI\prepareFormOutput(), ilCertificateUtilHelper\prepareFormOutput(), ilSelectInputGUI\render(), ilRepositorySelectorInputGUI\render(), ilCheckboxInputGUI\render(), ilDateDurationInputGUI\render(), ilMultiSelectInputGUI\render(), ilNonEditableValueGUI\render(), ilNumberInputGUI\render(), ilPasswordInputGUI\render(), ilTagInputGUI\render(), ilOrgUnitGenericMultiInputGUI\render(), ilTextInputGUI\render(), ilTextWizardInputGUI\render(), ilMultipleImagesInputGUI\render(), ilMultipleTextsInputGUI\render(), ilSearchBaseGUI\renderSearch(), ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistration\saveLegacyForm(), ilHelpGUI\search(), ilMailFormGUI\searchUsers(), ilPasswordAssistanceGUI\showAssistanceForm(), ilAccessibilityControlConceptGUI\showControlConcept(), ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\Agreement\showDocument(), ilHelpGUI\showPage(), ilLuceneSearchGUI\showSavedResults(), ilPasswordAssistanceGUI\showUsernameAssistanceForm(), and assQuestionGUI\suggestedsolution().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareTextareaOutput()

static ilLegacyFormElementsUtil::prepareTextareaOutput ( string  $txt_output,
bool  $prepare_for_latex_output = false,
bool  $omitNl2BrWhenTextArea = false 
)
static

Prepares a string for a text area output where latex code may be in it If the text is HTML-free, CHR(13) will be converted to a line break.

Parameters
string$txt_outputString which should be prepared for output @access public
Returns
array|string|string[]|null

Definition at line 109 of file class.ilLegacyFormElementsUtil.php.

113 {
114 $result = $txt_output;
115 $is_html = ilUtil::isHTML($result);
116
117 // removed: did not work with magic_quotes_gpc = On
118 if (!$is_html) {
119 if (!$omitNl2BrWhenTextArea) {
120 // if the string does not contain HTML code, replace the newlines with HTML line breaks
121 $result = preg_replace("/[\n]/", "<br />", $result);
122 }
123 } else {
124 // patch for problems with the <pre> tags in tinyMCE
125 if (preg_match_all("/(<pre>.*?<\/pre>)/ims", $result, $matches)) {
126 foreach ($matches[0] as $found) {
127 $replacement = "";
128 if (strpos("\n", $found) === false) {
129 $replacement = "\n";
130 }
131 $removed = preg_replace("/<br\s*?\/>/ims", $replacement, $found);
132 $result = str_replace($found, $removed, $result);
133 }
134 }
135 }
136
137 if ($prepare_for_latex_output) {
138 $result = ilRTE::replaceLatexSpan($result);
139
140 // replace special characters to prevent problems with the ILIAS template system
141 // eg. if someone uses {1} as an answer, nothing will be shown without the replacement
142 $result = str_replace("{", "&#123;", $result);
143 $result = str_replace("}", "&#125;", $result);
144 $result = str_replace("\\", "&#92;", $result);
145 }
146
147 return $result;
148 }
static replaceLatexSpan(string $text)
Replace the latex delimiters used by the rich text editor Unfortunately these can't be processed by M...
static isHTML(string $a_text)
Checks if a given string contains HTML or not.

References ilUtil\isHTML(), and ilRTE\replaceLatexSpan().

Referenced by assMatchingQuestionGUI\buildTermHtml(), ilAssClozeTestFeedback\completeFbPropsForNumericGap(), ilAssClozeTestFeedback\completeFbPropsForSelectGap(), ilAssClozeTestFeedback\completeFbPropsForTextGap(), ilAssClozeTestFeedback\completeFormPropsForFeedbackModeGapQuestion(), ilAssConfigurableMultiOptionQuestionFeedback\completeSpecificFormProperties(), ilAssMultiOptionQuestionFeedback\completeSpecificFormProperties(), assClozeTest\getClozeTextForHTMLOutput(), assQuestionGUI\getGenericFeedbackOutput(), assQuestionGUI\getGenericFeedbackOutputForCorrectSolution(), assQuestionGUI\getGenericFeedbackOutputForIncorrectSolution(), assLongMenuGUI\getLongMenuTextWithInputFieldsInsteadOfGaps(), ilAssClozeTestFeedback\getSpecificAnswerFeedbackFormValue(), assClozeTestGUI\getSpecificFeedbackOutput(), assErrorTextGUI\getSpecificFeedbackOutput(), assSingleChoiceGUI\getSpecificFeedbackOutput(), assTextSubsetGUI\getSpecificFeedbackOutput(), assFileUploadGUI\getSpecificFeedbackOutput(), assImagemapQuestionGUI\getSpecificFeedbackOutput(), assLongMenuGUI\getSpecificFeedbackOutput(), assMatchingQuestionGUI\getSpecificFeedbackOutput(), assMultipleChoiceGUI\getSpecificFeedbackOutput(), assNumericGUI\getSpecificFeedbackOutput(), ilAssConfigurableMultiOptionQuestionFeedback\initSpecificFormProperties(), ilAssMultiOptionQuestionFeedback\initSpecificFormProperties(), ilAnswerWizardInputGUI\insert(), ilAssMatchingPairCorrectionsInputGUI\insert(), assMatchingQuestionGUI\populateDefinition(), assSingleChoiceGUI\populateInlineFeedback(), assKprimChoiceGUI\populateSpecificFeedbackInline(), assMultipleChoiceGUI\populateSpecificFeedbackInline(), ilObjTest\prepareTextareaOutput(), assQuestion\purifyAndPrepareTextAreaOutput(), and assClozeTest\updateClozeTextFromGaps().

+ 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: