Rich Text Editor base class. More...
Public Member Functions | |
ilRTE () | |
addPlugin ($a_plugin_name) | |
Adds a plugin to the plugin list. | |
addButton ($a_button_name) | |
Adds a button to the button list. | |
removePlugin ($a_plugin_name) | |
Removes a plugin from the plugin list. | |
removeButton ($a_button_name) | |
Removes a button from the button list. | |
addRTESupport () | |
Adds support for an RTE in an ILIAS form. | |
_getRTEClassname () | |
_cleanupMediaObjectUsage ($a_text, $a_usage_type, $a_usage_id) | |
synchronises appearances of media objects in $a_text with media object usage table | |
_replaceMediaObjectImageSrc ($a_text, $a_direction=0) | |
replaces image source from mob image urls with the mob id or replaces mob id with the correct image source | |
Data Fields | |
$plugins | |
$buttons | |
$tpl |
Rich Text Editor base class.
This class provides access methods to a Rich Text Editor (RTE) integrated in ILIAS
Definition at line 34 of file class.ilRTE.php.
ilRTE::_cleanupMediaObjectUsage | ( | $ | a_text, | |
$ | a_usage_type, | |||
$ | a_usage_id | |||
) |
synchronises appearances of media objects in $a_text with media object usage table
string | $a_text text, including media object tags | |
string | $a_usage_type type of context of usage, e.g. cat:html | |
int | $a_usage_id if of context of usage, e.g. category id |
Definition at line 150 of file class.ilRTE.php.
References $mobs, ilObjMediaObject::_getMobsOfObject(), ilObjMediaObject::_removeUsage(), and ilObjMediaObject::_saveUsage().
Referenced by ilContainerGUI::savePageContentObject(), SurveyTextQuestion::saveToDb(), SurveyOrdinalQuestion::saveToDb(), SurveyNominalQuestion::saveToDb(), SurveyMetricQuestion::saveToDb(), ilObjSurvey::saveToDb(), ilObjTest::saveToDb(), assTextSubset::saveToDb(), assTextQuestion::saveToDb(), assSingleChoice::saveToDb(), assOrderingQuestion::saveToDb(), assNumeric::saveToDb(), assMultipleChoice::saveToDb(), assMatchingQuestion::saveToDb(), assJavaApplet::saveToDb(), assImagemapQuestion::saveToDb(), and assClozeTest::saveToDb().
{ // get current stored mobs include_once("./content/classes/Media/class.ilObjMediaObject.php"); $mobs = ilObjMediaObject::_getMobsOfObject($a_usage_type, $a_usage_id); while (eregi("data\/".CLIENT_ID."\/mobs\/mm_([0-9]+)", $a_text, $found)) { $a_text = str_replace($found[0], "", $a_text); if (!in_array($found[1], $mobs)) { // save usage if missing ilObjMediaObject::_saveUsage($found[1], $a_usage_type, $a_usage_id); } else { // if already saved everything ok -> take mob out of mobs array unset($mobs[$found[1]]); } } // remaining usages are not in text anymore -> delete them // and media objects (note: delete method of ilObjMediaObject // checks whether object is used in another context; if yes, // the object is not deleted!) foreach($mobs as $mob) { ilObjMediaObject::_removeUsage($mob, $a_usage_type, $a_usage_id); $mob_obj =& new ilObjMediaObject($mob); $mob_obj->delete(); } }
ilRTE::_getRTEClassname | ( | ) |
Definition at line 127 of file class.ilRTE.php.
References ilObjAdvancedEditing::_getRichTextEditor().
Referenced by ilContainerGUI::editPageContentObject(), SurveyTextQuestionGUI::editQuestion(), SurveyOrdinalQuestionGUI::editQuestion(), SurveyNominalQuestionGUI::editQuestion(), SurveyMetricQuestionGUI::editQuestion(), assTextSubsetGUI::editQuestion(), assTextQuestionGUI::editQuestion(), assSingleChoiceGUI::editQuestion(), assOrderingQuestionGUI::editQuestion(), assNumericGUI::editQuestion(), assMultipleChoiceGUI::editQuestion(), assMatchingQuestionGUI::editQuestion(), assJavaAppletGUI::editQuestion(), assImagemapQuestionGUI::editQuestion(), assClozeTestGUI::editQuestion(), ilObjSurveyGUI::propertiesObject(), and ilObjTestGUI::propertiesObject().
{ include_once "./classes/class.ilObjAdvancedEditing.php"; $editor = ilObjAdvancedEditing::_getRichTextEditor(); switch ($editor) { case "tinymce": return "ilTinyMCE"; break; default: return "ilRTE"; break; } }
ilRTE::_replaceMediaObjectImageSrc | ( | $ | a_text, | |
$ | a_direction = 0 | |||
) |
replaces image source from mob image urls with the mob id or replaces mob id with the correct image source
string | $a_text text, including media object tags | |
integer | $a_direction 0 to replace image src => mob id, 1 to replace mob id => image src |
Definition at line 193 of file class.ilRTE.php.
References $idx.
Referenced by SurveyQuestion::addQTIMaterial(), ilObjTest::addQTIMaterial(), assQuestion::addQTIMaterial(), ilObjTest::fromXML(), assTextSubset::fromXML(), assTextQuestion::fromXML(), assSingleChoice::fromXML(), assOrderingQuestion::fromXML(), assNumeric::fromXML(), assMultipleChoice::fromXML(), assMatchingQuestion::fromXML(), assJavaApplet::fromXML(), assImagemapQuestion::fromXML(), assClozeTest::fromXML(), SurveyTextQuestion::loadFromDb(), SurveyOrdinalQuestion::loadFromDb(), SurveyNominalQuestion::loadFromDb(), SurveyMetricQuestion::loadFromDb(), ilObjSurvey::loadFromDb(), ilObjTest::loadFromDb(), assTextSubset::loadFromDb(), assTextQuestion::loadFromDb(), assSingleChoice::loadFromDb(), assOrderingQuestion::loadFromDb(), assNumeric::loadFromDb(), assMultipleChoice::loadFromDb(), assMatchingQuestion::loadFromDb(), assJavaApplet::loadFromDb(), assImagemapQuestion::loadFromDb(), assClozeTest::loadFromDb(), SurveyTextQuestion::saveToDb(), SurveyOrdinalQuestion::saveToDb(), SurveyNominalQuestion::saveToDb(), SurveyMetricQuestion::saveToDb(), ilObjSurvey::saveToDb(), ilObjTest::saveToDb(), assTextSubset::saveToDb(), assTextQuestion::saveToDb(), assSingleChoice::saveToDb(), assOrderingQuestion::saveToDb(), assNumeric::saveToDb(), assMultipleChoice::saveToDb(), assMatchingQuestion::saveToDb(), assJavaApplet::saveToDb(), assImagemapQuestion::saveToDb(), and assClozeTest::saveToDb().
{ switch ($a_direction) { case 0: $a_text = preg_replace("/src\=\"(.*?\/mobs\/mm_([0-9]+)\/.*?)\"/", "src=\"il_" . IL_INST_ID . "_mob_" . "\\2" . "\"", $a_text); break; default: include_once("./content/classes/Media/class.ilObjMediaObject.php"); $resulttext = $a_text; if (preg_match_all("/src\=\"il_([0-9]+)_mob_([0-9]+)\"/", $a_text, $matches)) { foreach ($matches[2] as $idx => $mob) { $mob_obj =& new ilObjMediaObject($mob); $replace = "il_" . $matches[1][$idx] . "_mob_" . $mob; $resulttext = str_replace("src=\"$replace\"", "src=\"" . ILIAS_HTTP_PATH . "/data/" . CLIENT_ID . "/mobs/mm_" . $mob . "/" . $mob_obj->getTitle() . "\"", $resulttext); } } $a_text = $resulttext; break; } return $a_text; }
ilRTE::addButton | ( | $ | a_button_name | ) |
Adds a button to the button list.
Adds a button to the button list
string | $a_button_name The name of the button public |
Definition at line 76 of file class.ilRTE.php.
{ array_push($this->buttons, $a_button_name); }
ilRTE::addPlugin | ( | $ | a_plugin_name | ) |
Adds a plugin to the plugin list.
Adds a plugin to the plugin list
string | $a_plugin_name The name of the plugin public |
Definition at line 63 of file class.ilRTE.php.
{ array_push($this->plugins, $a_plugin_name); }
ilRTE::addRTESupport | ( | ) |
Adds support for an RTE in an ILIAS form.
Adds support for an RTE in an ILIAS form
public
Definition at line 122 of file class.ilRTE.php.
{
// must be overwritten in parent classes
}
ilRTE::ilRTE | ( | ) |
Definition at line 47 of file class.ilRTE.php.
References $tpl.
Referenced by ilTinyMCE::ilTinyMCE().
{ global $tpl; $this->tpl =& $tpl; $this->plugins = array(); $this->buttons = array(); }
ilRTE::removeButton | ( | $ | a_button_name | ) |
Removes a button from the button list.
Removes a button from the button list
string | $a_button_name The name of the button public |
Definition at line 106 of file class.ilRTE.php.
References $key.
ilRTE::removePlugin | ( | $ | a_plugin_name | ) |
Removes a plugin from the plugin list.
Removes a plugin from the plugin list
string | $a_plugin_name The name of the plugin public |
Definition at line 89 of file class.ilRTE.php.
References $key.
ilRTE::$buttons |
Definition at line 44 of file class.ilRTE.php.
ilRTE::$plugins |
Definition at line 43 of file class.ilRTE.php.
ilRTE::$tpl |
Definition at line 45 of file class.ilRTE.php.
Referenced by ilTinyMCE::addRTESupport(), and ilRTE().