ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilRTE Class Reference

Rich Text Editor base class. More...

+ Inheritance diagram for ilRTE:
+ Collaboration diagram for ilRTE:

Public Member Functions

 ilRTE ($a_version="")
 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.
 removeAllPlugins ()
 removeButton ($a_button_name)
 Removes a button from the button list.
 addRTESupport ()
 Adds support for an RTE in an ILIAS form.
 addUserTextEditor ($editor_selector)
 Adds support for an user text editor.
 addCustomRTESupport ($obj_id, $obj_type, $tags)
 Adds custom support for an RTE in an ILIAS form.
 _cleanupMediaObjectUsage ($a_text, $a_usage_type, $a_usage_id)
 synchronises appearances of media objects in $a_text with media object usage table
 setRTERootBlockElement ()
 getRTERootBlockElement ()
 disableButtons ()
 getDisabledButtons ()
 getInitialWidth ()
 setInitialWidth ($initialWidth)

Static Public Member Functions

static _getRTEClassname ()
static _replaceMediaObjectImageSrc ($a_text, $a_direction=0, $nic=IL_INST_ID)
 replaces image source from mob image urls with the mob id or replaces mob id with the correct image source
static _getMediaObjects ($a_text, $a_direction=0)
 Returns all media objects found in the passed string.

Data Fields

const ILIAS_IMG_MANAGER_PLUGIN = 'ilias_image_manager_plugin'
 $plugins
 $buttons
 $tpl
 $ctrl
 $lng

Protected Attributes

 $initialWidth = null

Detailed Description

Rich Text Editor base class.

This class provides access methods to a Rich Text Editor (RTE) integrated in ILIAS

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Version
Id:
class.ilRTE.php 61142 2015-10-19 11:50:12Z gitmgr

class.ilRTE.php

Definition at line 34 of file class.ilRTE.php.

Member Function Documentation

ilRTE::_cleanupMediaObjectUsage (   $a_text,
  $a_usage_type,
  $a_usage_id 
)

synchronises appearances of media objects in $a_text with media object usage table

Parameters
string$a_texttext, including media object tags
string$a_usage_typetype of context of usage, e.g. cat:html
int$a_usage_idif of context of usage, e.g. category id

Definition at line 193 of file class.ilRTE.php.

References $mobs, ilObjMediaObject\_getMobsOfObject(), ilObjMediaObject\_removeUsage(), and ilObjMediaObject\_saveUsage().

Referenced by ilObjSurvey\cleanupMediaobjectUsage(), ilObjTest\cleanupMediaobjectUsage(), assQuestion\cleanupMediaObjectUsage(), ilContainerGUI\savePageContentObject(), and SurveyQuestion\saveToDb().

{
// get current stored mobs
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
$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();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilRTE::_getMediaObjects (   $a_text,
  $a_direction = 0 
)
static

Returns all media objects found in the passed string.

Parameters
string$a_texttext, including media object tags
integer$a_direction0 to find image src, 1 to find mob id
Returns
array array of media objects

Definition at line 272 of file class.ilRTE.php.

References ilObjMediaObject\_exists().

Referenced by ilObjPaymentSettingsGUI\saveStatutoryRegulationsObject(), and ilObjExerciseGUI\updateAssignmentTextObject().

{
if (!strlen($a_text)) return array();
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
$mediaObjects = array();
switch ($a_direction)
{
case 0:
if(preg_match_all("/src\=\"(.*?\/mobs\/mm_([0-9]+)\/.*?)\"/", $a_text, $matches))
{
foreach ($matches[2] as $idx => $mob)
{
if (ilObjMediaObject::_exists($mob) && !in_array($mob, $mediaObjects))
{
$mediaObjects[] = $mob;
}
}
}
break;
default:
if(preg_match_all("/src\=\"il_([0-9]+)_mob_([0-9]+)\"/", $a_text, $matches))
{
foreach ($matches[2] as $idx => $mob)
{
if (ilObjMediaObject::_exists($mob) && !in_array($mob, $mediaObjects))
{
$mediaObjects[] = $mob;
}
}
}
break;
}
return $mediaObjects;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilRTE::_getRTEClassname ( )
static

Definition at line 170 of file class.ilRTE.php.

References ilObjAdvancedEditing\_getRichTextEditor().

Referenced by ilContainerGUI\editPageContentObject(), ilTextAreaInputGUI\insert(), and assTextQuestionGUI\outQuestionForTest().

{
include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
switch ($editor)
{
case "tinymce":
return "ilTinyMCE";
break;
default:
return "ilRTE";
break;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilRTE::_replaceMediaObjectImageSrc (   $a_text,
  $a_direction = 0,
  $nic = IL_INST_ID 
)
static

replaces image source from mob image urls with the mob id or replaces mob id with the correct image source

Parameters
string$a_texttext, including media object tags
integer$a_direction0 to replace image src => mob id, 1 to replace mob id => image src
Returns
string The text containing the replaced media object src

Definition at line 236 of file class.ilRTE.php.

References ilObjMediaObject\_exists().

Referenced by ilPurchaseBaseGUI\__sendBill(), SurveyQuestion\addMaterialTag(), ilObjSurvey\addMaterialTag(), assQuestion\addQTIMaterial(), ilObjTest\addQTIMaterial(), ilObjExerciseGUI\editAssignmentTextObject(), assQuestion\formatSAQuestion(), assKprimChoiceImport\fromXML(), assErrorTextImport\fromXML(), assFlashQuestionImport\fromXML(), assFileUploadImport\fromXML(), assNumericImport\fromXML(), assOrderingHorizontalImport\fromXML(), assOrderingQuestionImport\fromXML(), assSingleChoiceImport\fromXML(), assTextQuestionImport\fromXML(), assTextSubsetImport\fromXML(), assClozeTestImport\fromXML(), assFormulaQuestionImport\fromXML(), assImagemapQuestionImport\fromXML(), assJavaAppletImport\fromXML(), assMultipleChoiceImport\fromXML(), assMatchingQuestionImport\fromXML(), ilObjTest\fromXML(), ilForum\generatePost(), ilAssQuestionFeedback\getGenericFeedbackContent(), ilObjTest\getManualFeedback(), ilAssMultiOptionQuestionFeedback\getSpecificAnswerFeedbackContent(), ilObjSurvey\importObject(), ilSurveyImporter\importXmlRepresentation(), assKprimChoice\loadAnswerData(), assOrderingHorizontal\loadFromDb(), SurveyTextQuestion\loadFromDb(), SurveyMultipleChoiceQuestion\loadFromDb(), assFileUpload\loadFromDb(), assFlashQuestion\loadFromDb(), assTextQuestion\loadFromDb(), assTextSubset\loadFromDb(), assOrderingQuestion\loadFromDb(), assErrorText\loadFromDb(), SurveySingleChoiceQuestion\loadFromDb(), assClozeTest\loadFromDb(), assKprimChoice\loadFromDb(), assSingleChoice\loadFromDb(), assMultipleChoice\loadFromDb(), SurveyMetricQuestion\loadFromDb(), assMatchingQuestion\loadFromDb(), assJavaApplet\loadFromDb(), assImagemapQuestion\loadFromDb(), SurveyMatrixQuestion\loadFromDb(), assFormulaQuestion\loadFromDb(), ilObjSurvey\loadFromDb(), ilObjTest\loadFromDb(), assQuestion\loadFromDb(), ilExAssignmentListTextTableGUI\parse(), assQuestionImport\processNonAbstractedImageReferences(), assClozeTest\saveAdditionalQuestionDataToDb(), ilAssQuestionFeedback\saveGenericFeedbackContent(), assQuestion\saveQuestionDataToDb(), ilAssMultiOptionQuestionFeedback\saveSpecificAnswerFeedbackContent(), ilObjPaymentSettingsGUI\saveStatutoryRegulationsObject(), ilObjSurvey\saveToDb(), SurveyQuestion\saveToDb(), ilObjTest\saveToDb(), ilObjExerciseGUI\showAssignmentTextObject(), ilShopShoppingCartGUI\showItems(), ilForumXMLWriter\start(), ilObjPaymentSettingsGUI\StatutoryRegulationsObject(), assImagemapQuestion\toJSON(), assKprimChoice\toJSON(), assMultipleChoice\toJSON(), assSingleChoice\toJSON(), assErrorText\toJSON(), and ilObjExerciseGUI\updateAssignmentTextObject().

{
if (!strlen($a_text)) return "";
switch ($a_direction)
{
case 0:
$a_text = preg_replace("/src\=\"(.*?\/mobs\/mm_([0-9]+)\/.*?)\"/", "src=\"il_" . $nic . "_mob_" . "\\2" . "\"", $a_text);
break;
default:
include_once("./Services/MediaObjects/classes/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;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRTE::addButton (   $a_button_name)

Adds a button to the button list.

Adds a button to the button list

Parameters
string$a_button_nameThe name of the button public

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

{
array_push($this->buttons, $a_button_name);
}
ilRTE::addCustomRTESupport (   $obj_id,
  $obj_type,
  $tags 
)

Adds custom support for an RTE in an ILIAS form.

Adds custom support for an RTE in an ILIAS form

public

Reimplemented in ilTinyMCE.

Definition at line 164 of file class.ilRTE.php.

{
// must be overwritten in parent classes
}
ilRTE::addPlugin (   $a_plugin_name)

Adds a plugin to the plugin list.

Adds a plugin to the plugin list

Parameters
string$a_plugin_nameThe name of the plugin public

Reimplemented in ilTinyMCE.

Definition at line 75 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 142 of file class.ilRTE.php.

{
// must be overwritten in parent classes
}
ilRTE::addUserTextEditor (   $editor_selector)

Adds support for an user text editor.

public

Reimplemented in ilTinyMCE.

Definition at line 152 of file class.ilRTE.php.

{
// must be overwritten in parent classes
}
ilRTE::disableButtons ( )

Definition at line 319 of file class.ilRTE.php.

Referenced by ilTinyMCE\addCustomRTESupport(), and ilTinyMCE\handleImagePluginsBeforeRendering().

{
// must be overwritten in sub classes
}

+ Here is the caller graph for this function:

ilRTE::getDisabledButtons ( )

Definition at line 324 of file class.ilRTE.php.

Referenced by ilTinyMCE\_buildAdvancedButtonsFromHTMLTags(), ilTinyMCE\_buildAdvancedTableButtonsFromHTMLTags(), and ilTinyMCE\_buildButtonsFromHTMLTags().

{
// must be overwritten in sub classes
}

+ Here is the caller graph for this function:

ilRTE::getInitialWidth ( )
Returns
integer

Definition at line 332 of file class.ilRTE.php.

References $initialWidth.

Referenced by ilTinyMCE\addRTESupport().

{
}

+ Here is the caller graph for this function:

ilRTE::getRTERootBlockElement ( )

Reimplemented in ilTinyMCE.

Definition at line 314 of file class.ilRTE.php.

{
// must be overwritten in sub classes
}
ilRTE::ilRTE (   $a_version = "")

Definition at line 57 of file class.ilRTE.php.

References $ilCtrl, $lng, and $tpl.

Referenced by ilTinyMCE\ilTinyMCE().

{
global $tpl, $ilCtrl, $lng;
$this->tpl =& $tpl;
$this->ctrl =& $ilCtrl;
$this->lng =& $lng;
$this->plugins = array();
$this->buttons = array();
}

+ Here is the caller graph for this function:

ilRTE::removeAllPlugins ( )

Definition at line 110 of file class.ilRTE.php.

References removePlugin().

{
foreach($this->plugins as $plugin)
{
$this->removePlugin($plugin);
}
}

+ Here is the call graph for this function:

ilRTE::removeButton (   $a_button_name)

Removes a button from the button list.

Removes a button from the button list

Parameters
string$a_button_nameThe name of the button public

Definition at line 126 of file class.ilRTE.php.

{
$key = array_search($a_button_name, $this->buttons);
if ($key !== FALSE)
{
unset($this->buttons[$key]);
}
}
ilRTE::removePlugin (   $a_plugin_name)

Removes a plugin from the plugin list.

Removes a plugin from the plugin list

Parameters
string$a_plugin_nameThe name of the plugin public

Reimplemented in ilTinyMCE.

Definition at line 101 of file class.ilRTE.php.

Referenced by removeAllPlugins().

{
$key = array_search($a_plugin_name, $this->plugins);
if ($key !== FALSE)
{
unset($this->plugins[$key]);
}
}

+ Here is the caller graph for this function:

ilRTE::setInitialWidth (   $initialWidth)
Parameters
integer$initialWidth

Definition at line 340 of file class.ilRTE.php.

References $initialWidth.

{
$this->initialWidth = $initialWidth;
}
ilRTE::setRTERootBlockElement ( )

Definition at line 309 of file class.ilRTE.php.

{
// must be overwritten in sub classes
}

Field Documentation

ilRTE::$buttons

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

ilRTE::$ctrl

Definition at line 48 of file class.ilRTE.php.

ilRTE::$initialWidth = null
protected

Definition at line 54 of file class.ilRTE.php.

Referenced by getInitialWidth(), and setInitialWidth().

ilRTE::$lng

Definition at line 49 of file class.ilRTE.php.

Referenced by ilRTE().

ilRTE::$plugins

Definition at line 45 of file class.ilRTE.php.

const ilRTE::ILIAS_IMG_MANAGER_PLUGIN = 'ilias_image_manager_plugin'

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