ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
ilPCMediaObject Class Reference

Class ilPCMediaObject Media content object (see ILIAS DTD) More...

+ Inheritance diagram for ilPCMediaObject:
+ Collaboration diagram for ilPCMediaObject:

Public Member Functions

 init ()
 Init object. More...
 
 readMediaObject (int $a_mob_id=0)
 
 setHierId (string $a_hier_id)
 
 setMediaObject (ilObjMediaObject $a_mediaobject)
 
 getMediaObject ()
 
 createMediaObject ()
 
 create ()
 
 createAlias (ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id="")
 
 updateObjectReference ()
 Updates the media object referenced by the media alias. More...
 
 dumpXML ()
 
 setClass (string $a_class)
 
 getClass ()
 Get characteristic of section. More...
 
 setCaptionClass (string $a_class)
 Set caption style class of media object. More...
 
 getCaptionClass ()
 
 modifyPageContentPostXsl (string $a_output, string $a_mode, bool $a_abstract_only=false)
 Modify page content after xsl. More...
 
 getOnloadCode (string $a_mode)
 
 getJavascriptFiles (string $a_mode)
 
 getCssFiles (string $a_mode)
 
 getStandardMediaAliasItem ()
 
 getFullscreenMediaAliasItem ()
 
- Public Member Functions inherited from ilPageContent
 __construct (ilPageObject $a_pg_obj, ?PageManagerInterface $page_manager=null, ?ObjectAdapterInterface $object_adapter=null)
 
 setPage (ilPageObject $a_val)
 
 getPage ()
 
 init ()
 Init object. More...
 
 getType ()
 
 getDomNode ()
 
 getDomDoc ()
 
 setDomNode (DOMNode $node)
 
 getChildNode ()
 
 getJavascriptFiles (string $a_mode)
 
 getCssFiles (string $a_mode)
 
 getOnloadCode (string $a_mode)
 
 setHierId (string $a_hier_id)
 
 getHierId ()
 
 lookupHierId ()
 
 readHierId ()
 
 setPcId (string $a_pcid)
 
 getPCId ()
 
 setFileDownloadLink (string $a_download_link)
 
 getFileDownloadLink ()
 
 setProfileBackUrl (string $url)
 
 getProfileBackUrl ()
 
 setFullscreenLink (string $a_fullscreen_link)
 
 getFullscreenLink ()
 
 setSourcecodeDownloadScript (string $script_name)
 
 getSourcecodeDownloadScript ()
 
 readPCId ()
 
 writePCId (string $a_pc_id)
 
 setEnabled (string $value)
 Set Enabled value for page content component. More...
 
 enable ()
 
 disable ()
 
 isEnabled ()
 
 createPageContentNode (bool $a_set_this_node=true)
 Create page content node (always use this method first when adding a new element) More...
 
 getNewPageContentNode ()
 
 modifyPageContentPostXsl (string $a_output, string $a_mode, bool $a_abstract_only=false)
 Modify page content after xsl. More...
 
 getModel ()
 Get model as needed for the front-end editor. More...
 

Static Public Member Functions

static getLangVars ()
 Get lang vars needed for editing. More...
 
static afterPageUpdate (ilPageObject $a_page, DOMDocument $a_domdoc, string $a_xml, bool $a_creation)
 After page has been updated (or created) More...
 
static beforePageDelete (ilPageObject $a_page)
 Before page is being deleted. More...
 
static afterPageHistoryEntry (ilPageObject $a_page, DOMDocument $a_old_domdoc, string $a_old_xml, int $a_old_nr)
 After page history entry has been created. More...
 
static saveMobUsage (ilPageObject $a_page, DOMDocument $a_domdoc, int $a_old_nr=0)
 
static deleteHistoryLowerEqualThan (string $parent_type, int $page_id, string $lang, int $delete_lower_than_nr)
 Overwrite in derived classes, if old history entries are being deleted. More...
 
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)
 Handle copied content. More...
 
- Static Public Member Functions inherited from ilPageContent
static sortHierIds (array $a_array)
 Sort an array of Hier IDS in ascending order. More...
 
static isGreaterHierId (string $a, string $b)
 Check whether Hier ID $a is greater than Hier ID $b. More...
 
static getLangVars ()
 Get lang vars needed for editing. More...
 
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)
 Handle copied content. More...
 
static afterPageUpdate (ilPageObject $a_page, DOMDocument $a_domdoc, string $a_xml, bool $a_creation)
 After page has been updated (or created) More...
 
static beforePageDelete (ilPageObject $a_page)
 Before page is being deleted. More...
 
static afterRepositoryCopy (ilPageObject $page, array $mapping, int $source_ref_id)
 After repository (container) copy action. More...
 
static afterPageHistoryEntry (ilPageObject $a_page, DOMDocument $a_old_domdoc, string $a_old_xml, int $a_old_nr)
 After page history entry has been created. More...
 
static deleteHistoryLowerEqualThan (string $parent_type, int $page_id, string $lang, int $delete_lower_than_nr)
 Overwrite in derived classes, if old history entries are being deleted. More...
 

Protected Member Functions

 getMediaAliasNode ()
 
- Protected Member Functions inherited from ilPageContent
 getPageManager ()
 
 setType (string $a_type)
 Set Type. More...
 
 hasNode ()
 
 createInitialChildNode (string $hier_id, string $pc_id, string $child, array $child_attributes=[])
 

Protected Attributes

ILIAS MediaObjects MediaObjectManager $mob_manager
 
ilCtrlInterface $ctrl
 
UsageDBRepository $mob_usage_repo
 
DOMNode $mal_node
 
ilObjUser $user
 
DOMNode $mob_node
 
ILIAS DI UIServices $ui
 
ilObjMediaObject $mediaobject = null
 
ilLanguage $lng
 
ilGlobalPageTemplate $global_tpl
 
- Protected Attributes inherited from ilPageContent
DOMDocument $dom_doc
 
ILIAS COPage InternalDomainService $domain
 
string $pcid
 
string $type = ""
 
ilPageObject $pg_obj
 
string $file_download_link = ''
 
string $fullscreen_link = ''
 
string $sourcecode_download_script = ''
 
ilLogger $log
 
string $profile_back_url = ""
 
ILIAS COPage Dom DomUtil $dom_util
 
PageManagerInterface $page_manager = null
 
ObjectAdapterInterface $object = null
 

Static Protected Attributes

static string $modal_show_signal = ""
 
static string $modal_suffix = ""
 

Additional Inherited Members

- Data Fields inherited from ilPageContent
string $hier_id = ""
 
DOMNode $dom_node = null
 
string $page_lang = ""
 

Detailed Description

Class ilPCMediaObject Media content object (see ILIAS DTD)

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 26 of file class.ilPCMediaObject.php.

Member Function Documentation

◆ afterPageHistoryEntry()

static ilPCMediaObject::afterPageHistoryEntry ( ilPageObject  $a_page,
DOMDocument  $a_old_domdoc,
string  $a_old_xml,
int  $a_old_nr 
)
static

After page history entry has been created.

Parameters
ilPageObject$a_pagepage object
DOMDocument$a_old_domdocold dom document
string$a_old_xmlold xml
int$a_old_nrhistory number

Reimplemented from ilPageContent.

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

319 : void {
320 self::saveMobUsage($a_page, $a_old_domdoc, $a_old_nr);
321 }
static saveMobUsage(ilPageObject $a_page, DOMDocument $a_domdoc, int $a_old_nr=0)

◆ afterPageUpdate()

static ilPCMediaObject::afterPageUpdate ( ilPageObject  $a_page,
DOMDocument  $a_domdoc,
string  $a_xml,
bool  $a_creation 
)
static

After page has been updated (or created)

Parameters
ilPageObject$a_pagepage object
DOMDocument$a_domdocdom document
string$a_xmlxml
bool$a_creationtrue on creation, otherwise false

Reimplemented from ilPageContent.

Definition at line 251 of file class.ilPCMediaObject.php.

256 : void {
257 if (!$a_page->getImportMode()) {
259 $a_page->getParentType() . ":pg",
260 $a_page->getId(),
261 0,
262 $a_page->getLanguage()
263 );
264 }
265 self::saveMobUsage($a_page, $a_domdoc);
266 if (!$a_page->getImportMode()) {
267 foreach ($mob_ids as $mob) { // check, whether media object can be deleted
268 if (ilObject::_exists($mob) && ilObject::_lookupType($mob) == "mob") {
269 $mob_obj = new ilObjMediaObject($mob);
270 $usages = $mob_obj->getUsages(false);
271 if (count($usages) == 0) { // delete, if no usage exists
272 $mob_obj->delete();
273 }
274 }
275 }
276 }
277 }
static _getMobsOfObject(string $a_type, int $a_id, int|false $a_usage_hist_nr=0, string $a_lang="-")
static _lookupType(int $id, bool $reference=false)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data

References ilObjMediaObject\_getMobsOfObject(), ilPageObject\getId(), ilPageObject\getLanguage(), and ilPageObject\getParentType().

+ Here is the call graph for this function:

◆ beforePageDelete()

static ilPCMediaObject::beforePageDelete ( ilPageObject  $a_page)
static

Before page is being deleted.

Parameters
ilPageObject$a_pagepage object

Reimplemented from ilPageContent.

Definition at line 279 of file class.ilPCMediaObject.php.

281 : void {
283 $a_page->getParentType() . ":pg",
284 $a_page->getId(),
285 0,
286 $a_page->getLanguage()
287 );
288
290 $a_page->getParentType() . ":pg",
291 $a_page->getId(),
292 null,
293 $a_page->getLanguage()
294 );
295
296 foreach ($mob_ids as $mob) { // check, whether media object can be deleted
297 if (ilObject::_exists($mob) && ilObject::_lookupType($mob) == "mob") {
298 $mob_obj = new ilObjMediaObject($mob);
299 $usages = $mob_obj->getUsages(false);
300 if (count($usages) == 0) { // delete, if no usage exists
301 $mob_obj->delete();
302 }
303 }
304 }
305 }
static _deleteAllUsages(string $a_type, int $a_id, ?int $a_usage_hist_nr=0, string $a_lang="-")

◆ create()

ilPCMediaObject::create ( )

Definition at line 85 of file class.ilPCMediaObject.php.

85 : void
86 {
87 $this->createPageContentNode();
88 }
createPageContentNode(bool $a_set_this_node=true)
Create page content node (always use this method first when adding a new element)

References ilPageContent\createPageContentNode().

+ Here is the call graph for this function:

◆ createAlias()

ilPCMediaObject::createAlias ( ilPageObject  $a_pg_obj,
string  $a_hier_id,
string  $a_pc_id = "" 
)

Definition at line 90 of file class.ilPCMediaObject.php.

94 : void {
95 $this->setDomNode($this->dom_doc->createElement("PageContent"));
96 $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
97 $mob_node = $this->dom_doc->createElement("MediaObject");
98 $mob_node = $this->getDomNode()->appendChild($mob_node);
99 $this->mal_node = $this->dom_doc->createElement("MediaAlias");
100 $this->mal_node = $mob_node->appendChild($this->mal_node);
101 $this->mal_node->setAttribute("OriginId", "il__mob_" . $this->getMediaObject()->getId());
102
103 // standard view
104 $item_node = $this->dom_doc->createElement("MediaAliasItem");
105 $item_node = $mob_node->appendChild($item_node);
106 $item_node->setAttribute("Purpose", "Standard");
107 $media_item = $this->getMediaObject()->getMediaItem("Standard");
108 if (is_null($media_item)) {
109 return;
110 }
111
112 $layout_node = $this->dom_doc->createElement("Layout");
113 $layout_node = $item_node->appendChild($layout_node);
114 if ($media_item->getWidth() > 0) {
115 //$layout_node->set_attribute("Width", $media_item->getWidth());
116 }
117 if ($media_item->getHeight() > 0) {
118 //$layout_node->set_attribute("Height", $media_item->getHeight());
119 }
120 $layout_node->setAttribute("HorizontalAlign", "Left");
121
122 // caption
123 if ($media_item->getCaption() != "") {
124 $cap_node = $this->dom_doc->createElement("Caption");
125 $cap_node = $item_node->appendChild($cap_node);
126 $cap_node->setAttribute("Align", "bottom");
127 $this->dom_util->setContent($cap_node, $media_item->getCaption());
128 }
129
130 // text representation
131 if ($media_item->getTextRepresentation() != "") {
132 $tr_node = $this->dom_doc->createElement("TextRepresentation");
133 $tr_node = $item_node->appendChild($tr_node);
134 $this->dom_util->setContent($tr_node, $media_item->getTextRepresentation());
135 }
136
137 $pars = $media_item->getParameters();
138 foreach ($pars as $par => $val) {
139 $par_node = $this->dom_doc->createElement("Parameter");
140 $par_node = $item_node->appendChild($par_node);
141 $par_node->setAttribute("Name", $par);
142 $par_node->setAttribute("Value", $val);
143 }
144
145 // fullscreen view
146 $fullscreen_item = $this->getMediaObject()->getMediaItem("Fullscreen");
147 if (is_object($fullscreen_item)) {
148 $item_node = $this->dom_doc->createElement("MediaAliasItem");
149 $item_node = $mob_node->appendChild($item_node);
150 $item_node->setAttribute("Purpose", "Fullscreen");
151
152 // width and height
153 $layout_node = $this->dom_doc->createElement("Layout");
154 $layout_node = $item_node->appendChild($layout_node);
155 if ($fullscreen_item->getWidth() > 0) {
156 $layout_node->setAttribute("Width", $fullscreen_item->getWidth());
157 }
158 if ($fullscreen_item->getHeight() > 0) {
159 $layout_node->setAttribute("Height", $fullscreen_item->getHeight());
160 }
161
162 // caption
163 if ($fullscreen_item->getCaption() != "") {
164 $cap_node = $this->dom_doc->createElement("Caption");
165 $cap_node = $item_node->appendChild($cap_node);
166 $cap_node->setAttribute("Align", "bottom");
167 $this->dom_util->setContent($cap_node, $fullscreen_item->getCaption());
168 }
169
170 // text representation
171 if ($fullscreen_item->getTextRepresentation() != "") {
172 $tr_node = $this->dom_doc->createElement("TextRepresentation");
173 $tr_node = $item_node->appendChild($tr_node);
174 $this->dom_util->setContent($tr_node, $fullscreen_item->getTextRepresentation());
175 }
176
177 $pars = $fullscreen_item->getParameters();
178 foreach ($pars as $par => $val) {
179 $par_node = $this->dom_doc->createElement("Parameter");
180 $par_node = $item_node->appendChild($par_node);
181 $par_node->setAttribute("Name", $par);
182 $par_node->setAttribute("Value", $val);
183 }
184 }
185 }
const IL_INSERT_AFTER
setDomNode(DOMNode $node)
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

◆ createMediaObject()

ilPCMediaObject::createMediaObject ( )

Definition at line 80 of file class.ilPCMediaObject.php.

80 : void
81 {
82 $this->setMediaObject(new ilObjMediaObject());
83 }
setMediaObject(ilObjMediaObject $a_mediaobject)

References setMediaObject().

+ Here is the call graph for this function:

◆ deleteHistoryLowerEqualThan()

static ilPCMediaObject::deleteHistoryLowerEqualThan ( string  $parent_type,
int  $page_id,
string  $lang,
int  $delete_lower_than_nr 
)
static

Overwrite in derived classes, if old history entries are being deleted.

Reimplemented from ilPageContent.

Definition at line 581 of file class.ilPCMediaObject.php.

586 : void {
587 global $DIC;
588
589 $mob_usage_repo = $DIC->mediaObjects()
590 ->internal()
591 ->repo()
592 ->usage();
593
595
597 $parent_type . ":pg",
598 $page_id,
599 $delete_lower_than_nr,
600 $lang
601 );
602
604 $parent_type . ":pg",
605 $page_id,
606 $delete_lower_than_nr,
607 $lang
608 );
609
610 foreach ($mob_ids as $mob_id) {
611 $usages = ilObjMediaObject::lookupUsages($mob_id, true);
612 $log->debug("...check deletion of mob $mob_id. Usages: " . count($usages));
613 if (count($usages) == 0) {
614 if (ilObject::_lookupType($mob_id) === "mob") {
615 $mob = new ilObjMediaObject($mob_id);
616 $log->debug("Deleting Mob ID: " . $mob_id);
617 $mob->delete();
618 }
619 }
620 }
621 }
deleteHistoryUsagesLowerEqualThan(string $a_type, int $a_id, int $a_usage_hist_nr, string $a_lang="-")
getHistoryUsagesLowerEqualThan(string $a_type, int $a_id, int $a_usage_hist_nr, string $a_lang="-")
static getLogger(string $a_component_id)
Get component logger.
debug(string $message, array $context=[])
static lookupUsages(int $a_id, bool $a_include_history=true)
Lookup usages of media object.
UsageDBRepository $mob_usage_repo
global $DIC
Definition: shib_login.php:26

◆ dumpXML()

ilPCMediaObject::dumpXML ( )

Definition at line 208 of file class.ilPCMediaObject.php.

208 : string
209 {
210 return $this->dom_util->dump($this->getDomNode());
211 }

◆ getCaptionClass()

ilPCMediaObject::getCaptionClass ( )

Definition at line 234 of file class.ilPCMediaObject.php.

234 : string
235 {
236 return (string) $this->getMediaAliasNode()?->getAttribute("CaptionClass");
237 }

◆ getClass()

ilPCMediaObject::getClass ( )

Get characteristic of section.

Definition at line 221 of file class.ilPCMediaObject.php.

221 : string
222 {
223 return (string) $this->getMediaAliasNode()?->getAttribute("Class");
224 }

◆ getCssFiles()

ilPCMediaObject::getCssFiles ( string  $a_mode)

Reimplemented from ilPageContent.

Definition at line 518 of file class.ilPCMediaObject.php.

520 : array {
521 return [];
522 }

◆ getFullscreenMediaAliasItem()

ilPCMediaObject::getFullscreenMediaAliasItem ( )

Definition at line 535 of file class.ilPCMediaObject.php.

536 {
537 $std_alias_item = new ilMediaAliasItem(
538 $this->getDomDoc(),
539 $this->getHierId(),
540 "Fullscreen",
541 $this->getPCId()
542 );
543 return $std_alias_item;
544 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getJavascriptFiles()

ilPCMediaObject::getJavascriptFiles ( string  $a_mode)

Reimplemented from ilPageContent.

Definition at line 512 of file class.ilPCMediaObject.php.

514 : array {
515 return [];
516 }

◆ getLangVars()

static ilPCMediaObject::getLangVars ( )
static

Get lang vars needed for editing.

Returns
string[] array of lang var keys

Reimplemented from ilPageContent.

Definition at line 239 of file class.ilPCMediaObject.php.

239 : array
240 {
241 return array("pc_mob");
242 }

◆ getMediaAliasNode()

ilPCMediaObject::getMediaAliasNode ( )
protected

Definition at line 187 of file class.ilPCMediaObject.php.

187 : ?DOMNode
188 {
189 if (is_object($this->getChildNode())) {
190 $mal_node = $this->getChildNode()->firstChild;
191 if (is_object($mal_node) && $mal_node->nodeName == "MediaAlias") {
192 return $mal_node;
193 }
194 }
195 return null;
196 }

◆ getMediaObject()

ilPCMediaObject::getMediaObject ( )

Definition at line 75 of file class.ilPCMediaObject.php.

76 {
77 return $this->mediaobject;
78 }
ilObjMediaObject $mediaobject

References $mediaobject.

Referenced by ilPCMediaObjectQuickEdit\__construct(), and ilPCImageMapTableGUI\__construct().

+ Here is the caller graph for this function:

◆ getOnloadCode()

ilPCMediaObject::getOnloadCode ( string  $a_mode)

Reimplemented from ilPageContent.

Definition at line 501 of file class.ilPCMediaObject.php.

501 : array
502 {
503 $onload_code = [];
504 // necessary due to 32198 (other main template used)
505 if (self::$modal_show_signal !== "") {
506 $onload_code[] = "il.COPagePres.setFullscreenModalShowSignal('" . self::$modal_show_signal .
507 "', '" . self::$modal_suffix . "');";
508 }
509 return $onload_code;
510 }

◆ getStandardMediaAliasItem()

ilPCMediaObject::getStandardMediaAliasItem ( )

Definition at line 524 of file class.ilPCMediaObject.php.

525 {
526 $std_alias_item = new ilMediaAliasItem(
527 $this->getDomDoc(),
528 $this->getHierId(),
529 "Standard",
530 $this->getPCId()
531 );
532 return $std_alias_item;
533 }

◆ handleCopiedContent()

static ilPCMediaObject::handleCopiedContent ( DOMDocument  $a_domdoc,
bool  $a_self_ass = true,
bool  $a_clone_mobs = false,
int  $new_parent_id = 0,
int  $obj_copy_id = 0 
)
static

Handle copied content.

This function must, e.g. create copies of objects referenced within the content (e.g. question objects)

Parameters
DOMDocument$a_domdoc
bool$a_self_ass
bool$a_clone_mobs
int$new_parent_id
int$obj_copy_id

Reimplemented from ilPageContent.

Definition at line 623 of file class.ilPCMediaObject.php.

629 : void {
630 global $DIC;
631
632 if (!$a_clone_mobs) {
633 return;
634 }
635
636 $dom_util = $DIC->copage()->internal()->domain()->domUtil();
637 $path = "//MediaObject/MediaAlias";
638 $nodes = $dom_util->path($a_domdoc, $path);
639 foreach ($nodes as $node) {
640 $or_id = $node->getAttribute("OriginId");
641
642 $inst_id = ilInternalLink::_extractInstOfTarget($or_id);
644
645 if (!($inst_id > 0)) {
646 if ($mob_id > 0) {
647 $media_object = new ilObjMediaObject($mob_id);
648 $new_mob = $media_object->duplicate();
649 $node->setAttribute("OriginId", "il__mob_" . $new_mob->getId());
650 }
651 }
652 }
653 }
ILIAS COPage Dom DomUtil $dom_util
$path
Definition: ltiservices.php:30

◆ init()

ilPCMediaObject::init ( )

Init object.

This function must be overwritten and at least set the content type.

Reimplemented from ilPageContent.

Definition at line 41 of file class.ilPCMediaObject.php.

41 : void
42 {
43 global $DIC;
44
45 $this->user = $DIC->user();
46 $this->setType("media");
47 $this->ui = $DIC->ui();
48 $this->lng = $DIC->language();
49 $this->mob_usage_repo = $DIC->mediaObjects()
50 ->internal()
51 ->repo()
52 ->usage();
53 $this->ctrl = $DIC->ctrl();
54 $this->mob_manager = $DIC->mediaObjects()->internal()->domain()->mediaObject();
55 }
setType(string $a_type)
Set Type.

References $DIC, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilPageContent\setType(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ modifyPageContentPostXsl()

ilPCMediaObject::modifyPageContentPostXsl ( string  $a_output,
string  $a_mode,
bool  $a_abstract_only = false 
)

Modify page content after xsl.

Reimplemented from ilPageContent.

Definition at line 390 of file class.ilPCMediaObject.php.

394 : string {
395 global $DIC;
396
397 $this->global_tpl = $DIC['tpl'];
398 $ilUser = $this->user;
399
400 if ($a_mode == "offline") {
401 $page = $this->getPage();
402
404 $page->getParentType() . ":pg",
405 $page->getId(),
406 0,
407 $page->getLanguage()
408 );
409 foreach ($mob_ids as $mob_id) {
410 $mob = new ilObjMediaObject($mob_id);
411 $srts = $mob->getSrtFiles();
412 foreach ($srts as $srt) {
413 if ($ilUser->getLanguage() == $srt["language"]) {
414 $srt_content = "";
415 $file_path = ilObjMediaObject::_getDirectory($mob->getId()) . "/" . $srt["full_path"];
416 if (is_file($file_path)) {
417 $srt_content = $file_path;
418 } else {
419 $srt_content = $this->mob_manager->getLocationContent(
420 $mob->getId(),
421 $srt["full_path"]
422 );
423 }
424 if ($srt_content !== "") {
425 $a_output = str_replace(
426 "[[[[[mobsubtitle;il__mob_" . $mob->getId() . "_Standard]]]]]",
427 $srt_content,
428 $a_output
429 );
430 }
431 }
432 }
433 }
434 }
435
436 if ($a_abstract_only) {
437 return $a_output;
438 }
439
440 if ($a_mode === "edit") {
441 $a_output = str_replace(
442 "{{{{{Unsupported Media Type}}}}}",
443 $this->ui->renderer()->render(
444 $this->ui->factory()->messageBox()->info(
445 $this->lng->txt("copg_unsupported_media_type")
446 )
447 ),
448 $a_output
449 );
450 // currently media objects, when in translation mode
451 $a_output = str_replace(
452 "{{{{{No Media Type}}}}}",
453 '<div class="copg-new-content-placeholder">' .
454 $this->ui->renderer()->render(
455 $this->ui->factory()->symbol()->icon()->standard("pemed", "pemed", 'medium')
456 ) . "</div>",
457 $a_output
458 );
459 } else {
460 $a_output = str_replace(
461 "{{{{{Unsupported Media Type}}}}}",
462 "",
463 $a_output
464 );
465 $a_output = str_replace(
466 "{{{{{No Media Type}}}}}",
467 "",
468 $a_output
469 );
470 }
471
472 // add fullscreen modals
473 $page = $this->getPage();
474 $suffix = "-" . $page->getParentType() . "-" . $page->getId();
475 $modal = $this->ui->factory()->modal()->roundtrip(
476 $this->lng->txt("cont_fullscreen"),
477 $this->ui->factory()->legacy()->content("<iframe class='il-copg-mob-fullscreen' id='il-copg-mob-fullscreen" . $suffix . "'></iframe>")
478 );
479 $show_signal = $modal->getShowSignal();
480
481 $js = "
482 $(function () {
483 il.COPagePres.setFullscreenModalShowSignal('$show_signal', '$suffix');
484 });
485 ";
486 self::$modal_show_signal = $show_signal;
487 self::$modal_suffix = $suffix;
488 $this->global_tpl->addOnloadCode($js);
489
490 // async ensures to have onloadcode of modal in output
491 // if other main tpl is used, see #32198
492 // note: if always rendered async, $ not defined errors will be thrown in non-async cases
493 if ($this->ctrl->isAsynch()) {
494 $html = $this->ui->renderer()->renderAsync($modal);
495 } else {
496 $html = $this->ui->renderer()->render($modal);
497 }
498 return $a_output . "<div class='il-copg-mob-fullscreen-modal'>" . $html . "</div>";
499 }
static _getDirectory(int $a_mob_id)
Get absolute directory.

References ilObjMediaObject\_getDirectory(), and ilObjMediaObject\_getMobsOfObject().

+ Here is the call graph for this function:

◆ readMediaObject()

ilPCMediaObject::readMediaObject ( int  $a_mob_id = 0)

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

57 : void
58 {
59 if ($a_mob_id > 0) {
60 $mob = new ilObjMediaObject($a_mob_id);
61 $this->setMediaObject($mob);
62 }
63 }

References setMediaObject().

+ Here is the call graph for this function:

◆ saveMobUsage()

static ilPCMediaObject::saveMobUsage ( ilPageObject  $a_page,
DOMDocument  $a_domdoc,
int  $a_old_nr = 0 
)
static

Definition at line 323 of file class.ilPCMediaObject.php.

327 : array {
328 $usages = array();
329
330 // media aliases
331 $xpath = new DOMXPath($a_domdoc);
332 $nodes = $xpath->query('//MediaAlias');
333 foreach ($nodes as $node) {
334 $id_arr = explode("_", $node->getAttribute("OriginId"));
335 $mob_id = $id_arr[count($id_arr) - 1];
336 if ($mob_id > 0 && $id_arr[1] == "") {
337 $usages[$mob_id] = true;
338 }
339 }
340
341 // media objects
342 $xpath = new DOMXPath($a_domdoc);
343 $nodes = $xpath->query('//MediaObject/MetaData/General/Identifier');
344 foreach ($nodes as $node) {
345 $mob_entry = $node->getAttribute("Entry");
346 $mob_arr = explode("_", $mob_entry);
347 $mob_id = $mob_arr[count($mob_arr) - 1];
348 if ($mob_id > 0 && $mob_arr[1] == "") {
349 $usages[$mob_id] = true;
350 }
351 }
352
353 // internal links
354 $xpath = new DOMXPath($a_domdoc);
355 $nodes = $xpath->query("//IntLink[@Type='MediaObject']");
356 foreach ($nodes as $node) {
357 $mob_target = $node->getAttribute("Target");
358 $mob_arr = explode("_", $mob_target);
359 //echo "<br>3<br>";
360 //echo $mob_target."<br>";
361 //var_dump($mob_arr);
362 $mob_id = $mob_arr[count($mob_arr) - 1];
363 if ($mob_id > 0 && $mob_arr[1] == "") {
364 $usages[$mob_id] = true;
365 }
366 }
367
369 $a_page->getParentType() . ":pg",
370 $a_page->getId(),
371 $a_old_nr,
372 $a_page->getLanguage()
373 );
374 foreach ($usages as $mob_id => $val) {
375 // save usage, if object exists...
376 if (ilObject::_lookupType($mob_id) == "mob") {
378 $mob_id,
379 $a_page->getParentType() . ":pg",
380 $a_page->getId(),
381 $a_old_nr,
382 $a_page->getLanguage()
383 );
384 }
385 }
386
387 return $usages;
388 }
static _saveUsage(int $a_mob_id, string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
Save usage of mob within another container (e.g.

◆ setCaptionClass()

ilPCMediaObject::setCaptionClass ( string  $a_class)

Set caption style class of media object.

Definition at line 229 of file class.ilPCMediaObject.php.

229 : void
230 {
231 $this->dom_util->setAttribute($this->getMediaAliasNode(), "CaptionClass", $a_class);
232 }

◆ setClass()

ilPCMediaObject::setClass ( string  $a_class)

Definition at line 213 of file class.ilPCMediaObject.php.

213 : void
214 {
215 $this->dom_util->setAttribute($this->getMediaAliasNode(), "Class", $a_class);
216 }

◆ setHierId()

ilPCMediaObject::setHierId ( string  $a_hier_id)

Reimplemented from ilPageContent.

Definition at line 65 of file class.ilPCMediaObject.php.

65 : void
66 {
67 $this->hier_id = $a_hier_id;
68 }

◆ setMediaObject()

ilPCMediaObject::setMediaObject ( ilObjMediaObject  $a_mediaobject)

Definition at line 70 of file class.ilPCMediaObject.php.

70 : void
71 {
72 $this->mediaobject = $a_mediaobject;
73 }

Referenced by createMediaObject(), and readMediaObject().

+ Here is the caller graph for this function:

◆ updateObjectReference()

ilPCMediaObject::updateObjectReference ( )

Updates the media object referenced by the media alias.

This makes only sense, after the media object has changed. (-> change object reference function)

Definition at line 203 of file class.ilPCMediaObject.php.

203 : void
204 {
205 $this->getMediaAliasNode()?->setAttribute("OriginId", "il__mob_" . $this->getMediaObject()->getId());
206 }

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrlInterface ilPCMediaObject::$ctrl
protected

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

◆ $global_tpl

ilGlobalPageTemplate ilPCMediaObject::$global_tpl
protected

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

◆ $lng

ilLanguage ilPCMediaObject::$lng
protected

Definition at line 36 of file class.ilPCMediaObject.php.

◆ $mal_node

DOMNode ilPCMediaObject::$mal_node
protected

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

◆ $mediaobject

ilObjMediaObject ilPCMediaObject::$mediaobject = null
protected

Definition at line 35 of file class.ilPCMediaObject.php.

Referenced by getMediaObject().

◆ $mob_manager

ILIAS MediaObjects MediaObjectManager ilPCMediaObject::$mob_manager
protected

Definition at line 28 of file class.ilPCMediaObject.php.

◆ $mob_node

DOMNode ilPCMediaObject::$mob_node
protected

Definition at line 33 of file class.ilPCMediaObject.php.

◆ $mob_usage_repo

UsageDBRepository ilPCMediaObject::$mob_usage_repo
protected

Definition at line 30 of file class.ilPCMediaObject.php.

◆ $modal_show_signal

string ilPCMediaObject::$modal_show_signal = ""
staticprotected

Definition at line 38 of file class.ilPCMediaObject.php.

◆ $modal_suffix

string ilPCMediaObject::$modal_suffix = ""
staticprotected

Definition at line 39 of file class.ilPCMediaObject.php.

◆ $ui

ILIAS DI UIServices ilPCMediaObject::$ui
protected

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

◆ $user

ilObjUser ilPCMediaObject::$user
protected

Definition at line 32 of file class.ilPCMediaObject.php.


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