ILIAS  release_8 Revision v8.24
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)
 
 setNode (php4DOMElement $a_node)
 Set xml node of page content. More...
 
 setDom (php4DOMDocument $a_dom)
 
 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)
 
 setPage (ilPageObject $a_val)
 
 getPage ()
 
 init ()
 Init object. More...
 
 getType ()
 
 setNode (php4DOMElement $a_node)
 Set xml node of page content. More...
 
 getNode ()
 
 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...
 
 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 Public Member Functions inherited from ilPageContent
static incEdId (string $ed_id)
 Increases an hierarchical editing id at lowest level (last number) More...
 
static decEdId (string $ed_id)
 Decreases an hierarchical editing id at lowest level (last number) More...
 
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 Attributes

ilCtrlInterface $ctrl
 
UsageDBRepository $mob_usage_repo
 
php4DOMElement $mal_node
 
ilObjUser $user
 
php4DOMElement $mob_node
 
ILIAS DI UIServices $ui
 
ilObjMediaObject $mediaobject = null
 
ilLanguage $lng
 
ilGlobalPageTemplate $global_tpl
 
- Protected Attributes inherited from ilPageContent
string $pcid
 
string $type = ""
 
ilPageObject $pg_obj
 
string $file_download_link
 
string $fullscreen_link
 
string $sourcecode_download_script
 
ilLogger $log
 
string $profile_back_url = ""
 

Static Protected Attributes

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

Additional Inherited Members

- Data Fields inherited from ilPageContent
string $hier_id = ""
 
php4DOMElement $node = null
 
php4DOMDocument $dom = null
 
string $page_lang = ""
 
- Protected Member Functions inherited from ilPageContent
 setType (string $a_type)
 Set Type. More...
 

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 353 of file class.ilPCMediaObject.php.

358 : void {
359 self::saveMobUsage($a_page, $a_old_domdoc, $a_old_nr);
360 }
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 292 of file class.ilPCMediaObject.php.

297 : void {
298 if (!$a_page->getImportMode()) {
300 $a_page->getParentType() . ":pg",
301 $a_page->getId(),
302 0,
303 $a_page->getLanguage()
304 );
305 self::saveMobUsage($a_page, $a_domdoc);
306 foreach ($mob_ids as $mob) { // check, whether media object can be deleted
307 if (ilObject::_exists($mob) && ilObject::_lookupType($mob) == "mob") {
308 $mob_obj = new ilObjMediaObject($mob);
309 $usages = $mob_obj->getUsages(false);
310 if (count($usages) == 0) { // delete, if no usage exists
311 $mob_obj->delete();
312 }
313 }
314 }
315 }
316 }
static _getMobsOfObject(string $a_type, int $a_id, int $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 ilObject\_exists(), ilObjMediaObject\_getMobsOfObject(), ilObject\_lookupType(), 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 318 of file class.ilPCMediaObject.php.

320 : void {
322 $a_page->getParentType() . ":pg",
323 $a_page->getId(),
324 0,
325 $a_page->getLanguage()
326 );
327
329 $a_page->getParentType() . ":pg",
330 $a_page->getId(),
331 null,
332 $a_page->getLanguage()
333 );
334
335 foreach ($mob_ids as $mob) { // check, whether media object can be deleted
336 if (ilObject::_exists($mob) && ilObject::_lookupType($mob) == "mob") {
337 $mob_obj = new ilObjMediaObject($mob);
338 $usages = $mob_obj->getUsages(false);
339 if (count($usages) == 0) { // delete, if no usage exists
340 $mob_obj->delete();
341 }
342 }
343 }
344 }
static _deleteAllUsages(string $a_type, int $a_id, ?int $a_usage_hist_nr=0, string $a_lang="-")

◆ create()

ilPCMediaObject::create ( )

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

95 : void
96 {
97 $this->node = $this->createPageContentNode();
98 }
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 100 of file class.ilPCMediaObject.php.

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

90 : void
91 {
92 $this->setMediaObject(new ilObjMediaObject());
93 }
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 595 of file class.ilPCMediaObject.php.

600 : void {
601 global $DIC;
602
603 $mob_usage_repo = $DIC->mediaObjects()
604 ->internal()
605 ->repo()
606 ->usage();
607
609
611 $parent_type . ":pg",
612 $page_id,
613 $delete_lower_than_nr,
614 $lang
615 );
616
618 $parent_type . ":pg",
619 $page_id,
620 $delete_lower_than_nr,
621 $lang
622 );
623
624 foreach ($mob_ids as $mob_id) {
625 $usages = ilObjMediaObject::lookupUsages($mob_id, true);
626 $log->debug("...check deletion of mob $mob_id. Usages: " . count($usages));
627 if (count($usages) == 0) {
628 if (ilObject::_lookupType($mob_id) === "mob") {
629 $mob = new ilObjMediaObject($mob_id);
630 $log->debug("Deleting Mob ID: " . $mob_id);
631 $mob->delete();
632 }
633 }
634 }
635 }
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 $a_message, array $a_context=array())
static lookupUsages(int $a_id, bool $a_include_history=true)
Lookup usages of media object.
UsageDBRepository $mob_usage_repo
global $DIC
Definition: feed.php:28
$lang
Definition: xapiexit.php:26

◆ dumpXML()

ilPCMediaObject::dumpXML ( )

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

212 : string
213 {
214 $xml = $this->dom->dump_node($this->node);
215 return $xml;
216 }
$xml
Definition: metadata.php:351

References $xml.

◆ getCaptionClass()

ilPCMediaObject::getCaptionClass ( )

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

268 : string
269 {
270 if (is_object($this->mob_node)) {
271 $mal_node = $this->mob_node->first_child();
272 if (is_object($mal_node)) {
273 $class = $mal_node->get_attribute("CaptionClass");
274 return $class;
275 }
276 }
277 return "";
278 }
php4DOMElement $mal_node

References php4DOMNode\first_child(), and php4DOMElement\get_attribute().

+ Here is the call graph for this function:

◆ getClass()

ilPCMediaObject::getClass ( )

Get characteristic of section.

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

237 : string
238 {
239 if (is_object($this->mob_node)) {
240 $mal_node = $this->mob_node->first_child();
241 if (is_object($mal_node)) {
242 $class = $mal_node->get_attribute("Class");
243 return $class;
244 }
245 }
246 return "";
247 }

References php4DOMNode\first_child(), and php4DOMElement\get_attribute().

+ Here is the call graph for this function:

◆ getCssFiles()

ilPCMediaObject::getCssFiles ( string  $a_mode)

Reimplemented from ilPageContent.

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

532 : array {
533 $js_files = ilPlayerUtil::getCssFilePaths();
534
535 return $js_files;
536 }
static getCssFilePaths()

◆ getFullscreenMediaAliasItem()

ilPCMediaObject::getFullscreenMediaAliasItem ( )

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

550 {
551 $std_alias_item = new ilMediaAliasItem(
552 $this->dom,
553 $this->getHierId(),
554 "Fullscreen",
555 $this->getPCId()
556 );
557 return $std_alias_item;
558 }
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 522 of file class.ilPCMediaObject.php.

524 : array {
525 $js_files = ilPlayerUtil::getJsFilePaths();
527 return $js_files;
528 }
static getJsFilePaths()
static getLocalMaphilightPath()
Get local path of maphilight file.

◆ getLangVars()

static ilPCMediaObject::getLangVars ( )
static

Get lang vars needed for editing.

Returns
string[] array of lang var keys

Reimplemented from ilPageContent.

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

280 : array
281 {
282 return array("pc_mob");
283 }

◆ getMediaObject()

ilPCMediaObject::getMediaObject ( )

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

86 {
87 return $this->mediaobject;
88 }
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 511 of file class.ilPCMediaObject.php.

511 : array
512 {
513 $onload_code = [];
514 // necessary due to 32198 (other main template used)
515 if (self::$modal_show_signal !== "") {
516 $onload_code[] = "il.COPagePres.setFullscreenModalShowSignal('" . self::$modal_show_signal .
517 "', '" . self::$modal_suffix . "');";
518 }
519 return $onload_code;
520 }

◆ getStandardMediaAliasItem()

ilPCMediaObject::getStandardMediaAliasItem ( )

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

539 {
540 $std_alias_item = new ilMediaAliasItem(
541 $this->dom,
542 $this->getHierId(),
543 "Standard",
544 $this->getPCId()
545 );
546 return $std_alias_item;
547 }

◆ init()

ilPCMediaObject::init ( )

Init object.

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

Reimplemented from ilPageContent.

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

40 : void
41 {
42 global $DIC;
43
44 $this->user = $DIC->user();
45 $this->setType("media");
46 $this->ui = $DIC->ui();
47 $this->lng = $DIC->language();
48 $this->global_tpl = $DIC['tpl'];
49 $this->mob_usage_repo = $DIC->mediaObjects()
50 ->internal()
51 ->repo()
52 ->usage();
53 $this->ctrl = $DIC->ctrl();
54 }
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 432 of file class.ilPCMediaObject.php.

436 : string {
438
439 if ($a_mode == "offline") {
440 $page = $this->getPage();
441
443 $page->getParentType() . ":pg",
444 $page->getId(),
445 0,
446 $page->getLanguage()
447 );
448 foreach ($mob_ids as $mob_id) {
449 $mob = new ilObjMediaObject($mob_id);
450 $srts = $mob->getSrtFiles();
451 foreach ($srts as $srt) {
452 if ($ilUser->getLanguage() == $srt["language"]) {
453 $srt_content = file_get_contents(ilObjMediaObject::_getDirectory($mob->getId()) . "/" . $srt["full_path"]);
454 $a_output = str_replace("[[[[[mobsubtitle;il__mob_" . $mob->getId() . "_Standard]]]]]", $srt_content, $a_output);
455 }
456 }
457 }
458 }
459
460 if ($a_abstract_only) {
461 return $a_output;
462 }
463
464 if ($a_mode === "edit") {
465 $a_output = str_replace(
466 "{{{{{Unsupported Media Type}}}}}",
467 $this->ui->renderer()->render(
468 $this->ui->factory()->messageBox()->info(
469 $this->lng->txt("copg_unsupported_media_type")
470 )
471 ),
472 $a_output
473 );
474 } else {
475 $a_output = str_replace(
476 "{{{{{Unsupported Media Type}}}}}",
477 "",
478 $a_output
479 );
480 }
481
482 // add fullscreen modals
483 $page = $this->getPage();
484 $suffix = "-" . $page->getParentType() . "-" . $page->getId();
485 $modal = $this->ui->factory()->modal()->roundtrip(
486 $this->lng->txt("cont_fullscreen"),
487 $this->ui->factory()->legacy("<iframe class='il-copg-mob-fullscreen' id='il-copg-mob-fullscreen" . $suffix . "'></iframe>")
488 );
489 $show_signal = $modal->getShowSignal();
490
491 $js = "
492 $(function () {
493 il.COPagePres.setFullscreenModalShowSignal('$show_signal', '$suffix');
494 });
495 ";
496 self::$modal_show_signal = $show_signal;
497 self::$modal_suffix = $suffix;
498 $this->global_tpl->addOnloadCode($js);
499
500 // async ensures to have onloadcode of modal in output
501 // if other main tpl is used, see #32198
502 // note: if always rendered async, $ not defined errors will be thrown in non-async cases
503 if ($this->ctrl->isAsynch()) {
504 $html = $this->ui->renderer()->renderAsync($modal);
505 } else {
506 $html = $this->ui->renderer()->render($modal);
507 }
508 return $a_output . "<div class='il-copg-mob-fullscreen-modal'>" . $html . "</div>";
509 }
static _getDirectory(int $a_mob_id)
Get absolute directory.
$ilUser
Definition: imgupload.php:34

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

+ Here is the call graph for this function:

◆ readMediaObject()

ilPCMediaObject::readMediaObject ( int  $a_mob_id = 0)

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

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

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 362 of file class.ilPCMediaObject.php.

366 : array {
368
369 $usages = array();
370 // media aliases
371 $xpath = new DOMXPath($a_domdoc);
372 $nodes = $xpath->query('//MediaAlias');
373 foreach ($nodes as $node) {
374 $id_arr = explode("_", $node->getAttribute("OriginId"));
375 $mob_id = $id_arr[count($id_arr) - 1];
376 if ($mob_id > 0 && $id_arr[1] == "") {
377 $usages[$mob_id] = true;
378 }
379 }
380
381 // media objects
382 $xpath = new DOMXPath($a_domdoc);
383 $nodes = $xpath->query('//MediaObject/MetaData/General/Identifier');
384 foreach ($nodes as $node) {
385 $mob_entry = $node->getAttribute("Entry");
386 $mob_arr = explode("_", $mob_entry);
387 $mob_id = $mob_arr[count($mob_arr) - 1];
388 if ($mob_id > 0 && $mob_arr[1] == "") {
389 $usages[$mob_id] = true;
390 }
391 }
392
393 // internal links
394 $xpath = new DOMXPath($a_domdoc);
395 $nodes = $xpath->query("//IntLink[@Type='MediaObject']");
396 foreach ($nodes as $node) {
397 $mob_target = $node->getAttribute("Target");
398 $mob_arr = explode("_", $mob_target);
399 //echo "<br>3<br>";
400 //echo $mob_target."<br>";
401 //var_dump($mob_arr);
402 $mob_id = $mob_arr[count($mob_arr) - 1];
403 if ($mob_id > 0 && $mob_arr[1] == "") {
404 $usages[$mob_id] = true;
405 }
406 }
407
409 $a_page->getParentType() . ":pg",
410 $a_page->getId(),
411 $a_old_nr,
412 $a_page->getLanguage()
413 );
414 $log->debug("Deleted all mob usages page id: " . $a_page->getId() . ", lang" . $a_page->getLanguage() . ", old nr: " . $a_old_nr);
415 foreach ($usages as $mob_id => $val) {
416 // save usage, if object exists...
417 if (ilObject::_lookupType($mob_id) == "mob") {
418 $log->debug("Save usage mob id: " . $mob_id . ", old nr: " . $a_old_nr);
420 $mob_id,
421 $a_page->getParentType() . ":pg",
422 $a_page->getId(),
423 $a_old_nr,
424 $a_page->getLanguage()
425 );
426 }
427 }
428
429 return $usages;
430 }
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.
php4DOMElement $node

◆ setCaptionClass()

ilPCMediaObject::setCaptionClass ( string  $a_class)

Set caption style class of media object.

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

252 : void
253 {
254 if (is_object($this->mob_node)) {
255 $mal_node = $this->mob_node->first_child();
256 if (is_object($mal_node)) {
257 if (!empty($a_class)) {
258 $mal_node->set_attribute("CaptionClass", $a_class);
259 } else {
260 if ($mal_node->has_attribute("CaptionClass")) {
261 $mal_node->remove_attribute("CaptionClass");
262 }
263 }
264 }
265 }
266 }
set_attribute($name, $value)

References php4DOMNode\first_child(), php4DOMElement\has_attribute(), php4DOMElement\remove_attribute(), and php4DOMElement\set_attribute().

+ Here is the call graph for this function:

◆ setClass()

ilPCMediaObject::setClass ( string  $a_class)

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

218 : void
219 {
220 if (is_object($this->mob_node)) {
221 $mal_node = $this->mob_node->first_child();
222 if (is_object($mal_node)) {
223 if (!empty($a_class)) {
224 $mal_node->set_attribute("Class", $a_class);
225 } else {
226 if ($mal_node->has_attribute("Class")) {
227 $mal_node->remove_attribute("Class");
228 }
229 }
230 }
231 }
232 }

References php4DOMNode\first_child(), php4DOMElement\has_attribute(), php4DOMElement\remove_attribute(), and php4DOMElement\set_attribute().

+ Here is the call graph for this function:

◆ setDom()

ilPCMediaObject::setDom ( php4DOMDocument  $a_dom)

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

70 : void
71 {
72 $this->dom = $a_dom;
73 }

◆ setHierId()

ilPCMediaObject::setHierId ( string  $a_hier_id)

Reimplemented from ilPageContent.

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

75 : void
76 {
77 $this->hier_id = $a_hier_id;
78 }

◆ setMediaObject()

ilPCMediaObject::setMediaObject ( ilObjMediaObject  $a_mediaobject)

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

80 : void
81 {
82 $this->mediaobject = $a_mediaobject;
83 }

Referenced by createMediaObject(), and readMediaObject().

+ Here is the caller graph for this function:

◆ setNode()

ilPCMediaObject::setNode ( php4DOMElement  $a_node)

Set xml node of page content.

Parameters
php4DOMElement$a_nodenode object

Reimplemented from ilPageContent.

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

64 : void
65 {
66 parent::setNode($a_node); // this is the PageContent node
67 $this->mob_node = $a_node->first_child();
68 }

References php4DOMNode\first_child().

+ Here is the call 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 202 of file class.ilPCMediaObject.php.

202 : void
203 {
204 if (is_object($this->mob_node)) {
205 $this->mal_node = $this->mob_node->first_child();
206 if (is_object($this->mal_node) && $this->mal_node->node_name() == "MediaAlias") {
207 $this->mal_node->set_attribute("OriginId", "il__mob_" . $this->getMediaObject()->getId());
208 }
209 }
210 }

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrlInterface ilPCMediaObject::$ctrl
protected

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

◆ $global_tpl

ilGlobalPageTemplate ilPCMediaObject::$global_tpl
protected

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

◆ $lng

ilLanguage ilPCMediaObject::$lng
protected

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

◆ $mal_node

php4DOMElement ilPCMediaObject::$mal_node
protected

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

◆ $mediaobject

ilObjMediaObject ilPCMediaObject::$mediaobject = null
protected

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

Referenced by getMediaObject().

◆ $mob_node

php4DOMElement ilPCMediaObject::$mob_node
protected

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

◆ $mob_usage_repo

UsageDBRepository ilPCMediaObject::$mob_usage_repo
protected

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

◆ $modal_show_signal

string ilPCMediaObject::$modal_show_signal = ""
staticprotected

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

◆ $modal_suffix

string ilPCMediaObject::$modal_suffix = ""
staticprotected

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

◆ $ui

ILIAS DI UIServices ilPCMediaObject::$ui
protected

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

◆ $user

ilObjUser ilPCMediaObject::$user
protected

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


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