26     public const AREA = 
"Area";
    28     protected \ILIAS\MediaObjects\Thumbs\ThumbsManager 
$thumbs;
    29     protected \ILIAS\COPage\Xsl\XslManager 
$xsl;
    32     protected \ILIAS\DI\UIServices 
$ui;
    34     protected \ILIAS\COPage\PC\InteractiveImage\IIMManager 
$manager;
    41     public function init(): void
    45         $this->
lng = $DIC->language();
    47         $this->manager = $DIC->copage()->internal()->domain()->pc()->interactiveImage();
    48         $this->htmlTransform = $DIC->copage()->internal()->domain()->htmlTransformUtil();
    49         $this->
ui = $DIC->copage()->internal()->gui()->ui();
    50         $this->xsl = $DIC->copage()->internal()->domain()->xsl();
    51         $this->thumbs = $DIC->mediaObjects()->internal()->domain()->thumbs();
    64         parent::setDomNode($dom_node);          
    65         $this->iim_node = $dom_node->firstChild;
    66         if (isset($this->iim_node)) {
    67             $this->med_alias_node = $this->iim_node->firstChild;
    69         if (isset($this->med_alias_node)) {
    70             $id = $this->med_alias_node->getAttribute(
"OriginId");
    72             if ($this->
object->getTypeForObjId($mob_id) == 
"mob") {
    87         $this->mediaobject = $a_mediaobject;
   125         $this->
setDomNode($this->dom_doc->createElement(
"PageContent"));
   127         $this->iim_node = $this->dom_doc->createElement(
"InteractiveImage");
   128         $this->iim_node = $this->
getDomNode()->appendChild($this->iim_node);
   129         $this->mal_node = $this->dom_doc->createElement(
"MediaAlias");
   130         $this->mal_node = $this->iim_node->appendChild($this->mal_node);
   134         $item_node = $this->dom_doc->createElement(
"MediaAliasItem");
   135         $item_node = $this->iim_node->appendChild($item_node);
   136         $item_node->setAttribute(
"Purpose", 
"Standard");
   139         $layout_node = $this->dom_doc->createElement(
"Layout");
   140         $layout_node = $item_node->appendChild($layout_node);
   141         $layout_node->setAttribute(
"HorizontalAlign", 
"Left");
   144         if ($media_item->getCaption() != 
"") {
   145             $cap_node = $this->dom_doc->createElement(
"Caption");
   146             $cap_node = $item_node->appendChild($cap_node);
   147             $cap_node->setAttribute(
"Align", 
"bottom");
   148             $this->dom_util->setContent($cap_node, $media_item->getCaption());
   152         if ($media_item->getTextRepresentation() != 
"") {
   153             $tr_node = $this->dom_doc->createElement(
"TextRepresentation");
   154             $tr_node = $item_node->appendChild($tr_node);
   155             $this->dom_util->setContent($tr_node, $media_item->getTextRepresentation());
   161         $xml = $this->dom_util->dump($this->
getDomNode());
   177         if ($title === null) {
   178             $title = $lng->
txt(
"cont_new_popup");
   182         foreach ($popups as $p) {
   183             $max = max($max, (
int) $p[
"nr"]);
   186         $new_item = $this->dom_doc->createElement(
"ContentPopup");
   187         $new_item->setAttribute(
"Title", $title);
   188         $new_item->setAttribute(
"Nr", $max + 1);
   189         $new_item = $this->iim_node->appendChild($new_item);
   199         foreach ($this->iim_node->childNodes as 
$c) {
   200             if ($c->nodeName == 
"ContentPopup") {
   201                 $pc_id = $c->getAttribute(
"PCID");
   202                 $hier_id = $c->getAttribute(
"HierId");
   203                 $title = $c->getAttribute(
"Title");
   204                 $nr = $c->getAttribute(
"Nr");
   206                 $titles[] = array(
"title" => $title,
   222         foreach ($this->iim_node->childNodes as 
$c) {
   223             if ($c->nodeName == 
"ContentPopup") {
   224                 $pc_id = $c->getAttribute(
"PCID");
   225                 $hier_id = $c->getAttribute(
"HierId");
   227                 $c->setAttribute(
"Title", $a_popups[$k]);
   239         foreach ($this->iim_node->childNodes as 
$c) {
   240             if ($c->nodeName === 
"ContentPopup") {
   241                 if ($a_pc_id == $c->getAttribute(
"PCID") &&
   242                     $a_hier_id == $c->getAttribute(
"HierId")) {
   243                     $c->parentNode->removeChild($c);
   251         foreach ($this->iim_node->childNodes as 
$c) {
   252             if ($c->nodeName === 
"ContentPopup") {
   253                 if ($nr === $c->getAttribute(
"Nr")) {
   254                     $c->setAttribute(
"Title", $title);
   263         foreach ($this->iim_node->childNodes as 
$c) {
   264             if ($c->nodeName === 
"ContentPopup") {
   265                 if ($nr === $c->getAttribute(
"Nr")) {
   266                     $c->parentNode->removeChild($c);
   271         foreach ($tr_nodes as $tr_node) {
   272             if ($tr_node->getAttribute(
"PopupNr") === $nr) {
   273                 $tr_node->removeAttribute(
"PopupNr");
   284         string $a_shape_type,
   288         string $hl_mode = 
"",
   289         string $hl_class = 
""   313         string $a_shape_type,
   316         string $hl_mode = 
"",
   317         string $hl_class = 
""   321         foreach ($triggers as $t) {
   322             $max = max($max, (
int) $t[
"Nr"]);
   335         $attributes = array(
"Type" => self::AREA,
   344                             "PopupWidth" => 
"150",
   345                             "PopupHeight" => 
"200"   347         $ma_node = $this->dom_util->addElementToList(
   350             array(
"ContentPopup"),
   367         foreach ($triggers as $t) {
   368             $max = max($max, (
int) $t[
"Nr"]);
   372             $title = $lng->
txt(
"cont_new_marker");
   376         if ($coords !== 
"") {
   377             $coord_parts = explode(
",", $coords);
   378             $markerx = ($coord_parts[0] ?? 
"0");
   379             $markery = ($coord_parts[1] ?? 
"0");
   382         $attributes = array(
"Type" => self::MARKER,
   387                             "MarkerX" => $markerx,
   388                             "MarkerY" => $markery,
   392                             "PopupWidth" => 
"150",
   393                             "PopupHeight" => 
"200"   395         $ma_node = $this->dom_util->addElementToList(
   398             array(
"ContentPopup"),
   408         if ($a_pc_id != 
"") {
   409             $path = 
"//PageContent[@PCID = '" . $a_pc_id . 
"']/InteractiveImage/Trigger";
   410             return $this->dom_util->path($this->dom_doc, 
$path);
   413         $path = 
"//PageContent[@HierId = '" . $a_hier_id . 
"']/InteractiveImage/Trigger";
   414         return $this->dom_util->path($this->dom_doc, 
$path);
   420         $trigger_arr = array();
   421         foreach ($tr_nodes as $tr_node) {
   422             $childs = $tr_node->childNodes;
   423             $trigger_arr[] = array(
   424                 "Nr" => $tr_node->getAttribute(
"Nr"),
   425                 "Type" => $tr_node->getAttribute(
"Type"),
   426                 "Title" => $tr_node->getAttribute(
"Title"),
   427                 "OverlayX" => $tr_node->getAttribute(
"OverlayX"),
   428                 "OverlayY" => $tr_node->getAttribute(
"OverlayY"),
   429                 "MarkerX" => $tr_node->getAttribute(
"MarkerX"),
   430                 "MarkerY" => $tr_node->getAttribute(
"MarkerY"),
   431                 "Overlay" => $tr_node->getAttribute(
"Overlay"),
   432                 "PopupNr" => $tr_node->getAttribute(
"PopupNr"),
   433                 "PopupX" => $tr_node->getAttribute(
"PopupX"),
   434                 "PopupY" => $tr_node->getAttribute(
"PopupY"),
   435                 "PopupWidth" => $tr_node->getAttribute(
"PopupWidth"),
   436                 "PopupHeight" => $tr_node->getAttribute(
"PopupHeight"),
   437                 "PopupPosition" => $tr_node->getAttribute(
"PopupPosition"),
   438                 "PopupSize" => $tr_node->getAttribute(
"PopupSize")
   452         foreach ($this->iim_node->childNodes as 
$c) {
   453             if ($c->nodeName === 
"Trigger") {
   454                 if ($a_nr === (
int) $c->getAttribute(
"Nr")) {
   455                     $c->parentNode->removeChild($c);
   470         foreach ($tr_nodes as $tr_node) {
   471             if (isset($a_ovs[
"" . $tr_node->getAttribute(
"Nr")])) {
   472                 $tr_node->setAttribute(
   474                     $a_ovs[
"" . $tr_node->getAttribute(
"Nr")]
   484              ->removeAdditionalFile(
"overlays/" . $file);
   486         for ($i = 0; $i < count($tr_nodes); $i++) {
   487             $tr_node = $tr_nodes[$i];
   488             if ($tr_node->getAttribute(
"Overlay") === $file) {
   489                 $tr_node->removeAttribute(
"Overlay");
   502         for ($i = 0; $i < count($tr_nodes); $i++) {
   503             $tr_node = $tr_nodes[$i];
   504             if (isset($a_pos[
"" . $tr_node->getAttribute(
"Nr")])) {
   505                 $pos = explode(
",", $a_pos[
"" . $tr_node->getAttribute(
"Nr")]);
   506                 $tr_node->setAttribute(
"OverlayX", (
int) $pos[0]);
   507                 $tr_node->setAttribute(
"OverlayY", (
int) $pos[1]);
   520         foreach ($tr_nodes as $tr_node) {
   521             if ($tr_node->getAttribute(
"Type") == self::MARKER) {
   522                 if (isset($a_pos[
"" . $tr_node->getAttribute(
"Nr")])) {
   523                     $pos = explode(
",", $a_pos[
"" . $tr_node->getAttribute(
"Nr")]);
   524                     $tr_node->setAttribute(
"MarkerX", (
int) $pos[0]);
   525                     $tr_node->setAttribute(
"MarkerY", (
int) $pos[1]);
   539         foreach ($tr_nodes as $tr_node) {
   540             if (isset($a_pos[
"" . $tr_node->getAttribute(
"Nr")])) {
   541                 $pos = explode(
",", $a_pos[
"" . $tr_node->getAttribute(
"Nr")]);
   542                 $tr_node->setAttribute(
"PopupX", (
int) $pos[0]);
   543                 $tr_node->setAttribute(
"PopupY", (
int) $pos[1]);
   556         foreach ($tr_nodes as $tr_node) {
   557             if (isset($a_size[
"" . $tr_node->getAttribute(
"Nr")])) {
   558                 $size = explode(
",", $a_size[
"" . $tr_node->getAttribute(
"Nr")]);
   559                 $tr_node->setAttribute(
"PopupWidth", (
int) $size[0]);
   560                 $tr_node->setAttribute(
"PopupHeight", (
int) $size[1]);
   573         foreach ($tr_nodes as $tr_node) {
   574             if (isset($a_pops[(
string) $tr_node->getAttribute(
"Nr")])) {
   575                 $pop = $a_pops[(string) $tr_node->getAttribute(
"Nr")];
   576                 $tr_node->setAttribute(
"PopupNr", $pop);
   589         foreach ($tr_nodes as $tr_node) {
   590             if (isset($a_titles[(
string) $tr_node->getAttribute(
"Nr")])) {
   591                 $tr_node->setAttribute(
   593                     $a_titles[(
string) $tr_node->getAttribute(
"Nr")]
   596                     $tr_node->getAttribute(
"Nr"),
   597                     $a_titles[(string) $tr_node->getAttribute(
"Nr")]
   608             $path = 
"//PageContent[@PCID = '" . $this->
getPCId() . 
"']/InteractiveImage/MediaAliasItem/MapArea[@Id='" . $a_nr . 
"']/ExtLink";
   609             $res = $this->dom_util->path($this->dom_doc, 
$path);
   610             if (count(
$res) > 0) {
   611                 $this->dom_util->setContent(
$res->item(0), $a_title);
   616         $path = 
"//PageContent[@HierId = '" . $this->hier_id . 
"']/InteractiveImage/MediaAliasItem/MapArea[@Id='" . $a_nr . 
"']/ExtLink";
   617         $res = $this->dom_util->path($this->dom_doc, 
$path);
   618         if (count(
$res) > 0) {
   619             $this->dom_util->setContent(
$res->item(0), $a_title);
   625         bool $a_self_ass = 
true,
   626         bool $a_clone_mobs = 
false,
   627         int $new_parent_id = 0,
   632         $dom_util = $DIC->copage()->internal()->domain()->domUtil();
   633         $path = 
"//InteractiveImage/MediaAlias";
   635         foreach ($nodes as $node) {
   636             $or_id = $node->getAttribute(
"OriginId");
   639             if (!($inst_id > 0)) {
   642                     $new_mob = $media_object->duplicate();
   643                     $node->setAttribute(
"OriginId", 
"il__mob_" . $new_mob->getId());
   662         $model = new \stdClass();
   665         $model->media_item = $alias_item->getModel();
   666         $model->overlays = $this->manager->getOverlays($this->
getMediaObject());
   673         for ($i = 0; $i < count($tr_nodes); $i++) {
   674             $tr_node = $tr_nodes[$i];
   675             if ($tr_node->getAttribute(
"Nr") == $nr) {
   682     public function setTriggerProperties(
string $nr, 
string $title, 
string $shape_type, 
string $coords, 
string $hl_mode = 
"", 
string $hl_class = 
""): void
   686         if ($shape_type === 
"Marker") {
   695                 $tr_node->setAttribute(
"Type", 
"Marker");
   696                 $tr_node->setAttribute(
   700                 $coord_parts = explode(
",", $coords);
   701                 $tr_node->setAttribute(
"MarkerX", ($coord_parts[0] ?? 
"0"));
   702                 $tr_node->setAttribute(
"MarkerY", ($coord_parts[1] ?? 
"0"));
   705                 $path = 
"//PageContent[@HierId = '" . $this->hier_id . 
"']/InteractiveImage/MediaAliasItem/MapArea[@Id='" . $nr . 
"']";
   706                 $res = $this->dom_util->path($this->dom_doc, 
$path);
   707                 if ($child = 
$res->item(0)) {
   708                     $child->parentNode->removeChild($child);
   715             $tr_node->setAttribute(
"Type", 
"Area");
   716             $tr_node->removeAttribute(
"MarkerX");
   717             $tr_node->removeAttribute(
"MarkerY");
   718             $tr_node->setAttribute(
   747             $c = explode(
",", $coords);
   748             $x = (
int) (
$c[0] ?? 0);
   749             $y = (
int) (
$c[1] ?? 0);
   750             $tr_node->setAttribute(
"Overlay", $overlay);
   751             $tr_node->setAttribute(
"OverlayX", $x);
   752             $tr_node->setAttribute(
"OverlayY", $y);
   756     public function setTriggerPopup(
string $nr, 
string $popup, 
string $position, 
string $size): void
   760             $tr_node->setAttribute(
"PopupNr", $popup);
   761             $tr_node->setAttribute(
"PopupPosition", $position);
   762             $tr_node->setAttribute(
"PopupSize", $size);
   769         bool $a_abstract_only = 
false   771         $keep_original = 
false;
   773             $keep_original = 
true;
   776         while (!is_null(
$params = $trans->getPlaceholderParams($a_output, 
"InteractiveImage;PopupStart"))) {
   777             $params = $trans->getPlaceholderParams($a_output, 
"InteractiveImage;PopupStart");
   780             $inner = $trans->getInnerContentOfPlaceholders(
   782                 "InteractiveImage;PopupStart",
   783                 "InteractiveImage;PopupEnd"   785             if ($keep_original) {
   788                 $pop = $this->
ui->factory()->popover()->standard(
   789                     $this->
ui->factory()->legacy(
"#####popovercontent#####")
   791                 $signal_id = $pop->getShowSignal()->getId();
   793                 $new_inner = 
"#####popovercontent#####";
   795                 $new_inner = str_replace(
   796                     "#####popovercontent#####",
   797                     "<div style='position:relative'><div class='copg-iim-popup copg-iim-popup-md' style='display:none;' data-copg-cont-type='iim-popup' data-signal-id='$signal_id' data-copg-page='$par_page' data-copg-popup-nr='$par_pop_nr'>" . $inner . 
"</div></div>",
   801             $html = $trans->replaceInnerContentAndPlaceholders(
   803                 "InteractiveImage;PopupStart",
   804                 "InteractiveImage;PopupEnd",
   807             if (is_null($html)) {
   814 '<script type="module" src="./components/ILIAS/COPage/PC/InteractiveImage/js/presentation/src/presentation.js"></script>';
   820 <div style=
'position:relative'><div 
class=
'copg-iim-popup copg-iim-popup-md' data-copg-cont-type=
'iim-popup'>
   821 <div 
class=
"ilc_iim_ContentPopup" data-copg-iim-data-type=
"popup"><div 
class=
"ilc_Paragraph ilc_text_block_Standard">
   823 </div></div></div></div>
   840             'media_mode' => 
'enable',
   843             'webspace_path' => $wb_path);
   845         $output = $this->xsl->process($xml, 
$params);
 static getWebspaceDir(string $mode="filesystem")
get webspace directory 
 
getTriggerNode(string $nr)
 
ilMediaAliasItem $std_alias_item
 
setType(string $a_type)
Set Type. 
 
deletePopup(string $a_hier_id, string $a_pc_id)
Delete popup. 
 
setTriggerPopupPositions(array $a_pos)
Set trigger popup position. 
 
setMapAreaProperties(ilMediaAliasItem $a_alias_item, string $a_shape_type, string $a_coords, string $a_title, string $a_id, string $hl_mode="", string $hl_class="")
 
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
 
static _extractObjIdOfTarget(string $a_target)
Extract object id out of target. 
 
setTriggerOverlays(array $a_ovs)
Set trigger overlays. 
 
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
 
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
 
deleteOverlay(string $file)
 
createAlias(ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id="")
 
setDomNode(DOMNode $dom_node)
 
deletePopupByNr(string $nr)
 
Content object of ilPageObject (see ILIAS DTD). 
 
setTriggerProperties(string $nr, string $title, string $shape_type, string $coords, string $hl_mode="", string $hl_class="")
 
ILIAS COPage Html TransformUtil $htmlTransform
 
setTriggerTitles(array $a_titles)
Set trigger titles. 
 
addTriggerArea(ilMediaAliasItem $a_alias_item, string $a_shape_type, string $a_coords, string $a_title, string $hl_mode="", string $hl_class="")
Add a new trigger. 
 
static _extractInstOfTarget(string $a_target)
Extract installation id out of target. 
 
setTriggerPopup(string $nr, string $popup, string $position, string $size)
 
setTriggerPopupSize(array $a_size)
Set trigger popup size. 
 
deleteTrigger(ilMediaAliasItem $a_alias_item, int $a_nr)
Delete Trigger. 
 
getPopups()
Get popup captions. 
 
setMediaObject(ilObjMediaObject $a_mediaobject)
 
savePopups(array $a_popups)
Save popups. 
 
insertContent(ilPageContent $a_cont_obj, string $a_pos, int $a_mode=IL_INSERT_AFTER, string $a_pcid="", bool $remove_placeholder=true)
insert a content node before/after a sibling or as first child of a parent 
 
ilObjMediaObject $mediaobject
 
ILIAS COPage Xsl XslManager $xsl
 
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD) 
 
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory) 
 
setTriggerOverlay(string $nr, string $overlay, string $coords)
 
saveContentPopupTitle(string $nr, string $title)
 
createPageContentNode(bool $a_set_this_node=true)
Create page content node (always use this method first when adding a new element) ...
 
static handleCopiedContent(DOMDocument $a_domdoc, bool $a_self_ass=true, bool $a_clone_mobs=false, int $new_parent_id=0, int $obj_copy_id=0)
 
createFromMobId(\ilPageObject $page, int $mob_id, string $hier_id, string $pc_id)
 
setExtLinkTitle(int $a_nr, string $a_title)
 
ILIAS MediaObjects Thumbs ThumbsManager $thumbs
 
addContentPopup(?string $title=null)
Add a tab. 
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
setTriggerPopups(array $a_pops)
Set trigger popups. 
 
getTriggerNodes(string $a_hier_id, string $a_pc_id="")
 
setTriggerMarkerPositions(array $a_pos)
Set trigger marker position. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
ILIAS COPage Dom DomUtil $dom_util
 
readMediaObject(int $a_mob_id=0)
 
setTriggerOverlayPositions(array $a_pos)
Set trigger overlay position. 
 
ILIAS COPage PC InteractiveImage IIMManager $manager
 
modifyPageContentPostXsl(string $a_output, string $a_mode, bool $a_abstract_only=false)
 
addTriggerMarker(string $title="", string $coords="")
Add a new trigger marker.