4 require_once(
"./Services/COPage/classes/class.ilPageContent.php");
42 $this->
user = $DIC->user();
44 $this->
ui = $DIC->ui();
45 $this->lng = $DIC->language();
63 parent::setNode($a_node);
64 $this->mob_node = $a_node->first_child();
80 $this->hier_id = $a_hier_id;
90 $this->mediaobject = $a_mediaobject;
100 return $this->mediaobject;
111 public function create(&$a_pg_obj, $a_hier_id)
122 public function createAlias(&$a_pg_obj, $a_hier_id, $a_pc_id =
"")
124 $this->node = $this->dom->create_element(
"PageContent");
125 $a_pg_obj->insertContent($this, $a_hier_id,
IL_INSERT_AFTER, $a_pc_id);
126 $this->mob_node = $this->dom->create_element(
"MediaObject");
127 $this->mob_node = $this->node->append_child($this->mob_node);
128 $this->mal_node = $this->dom->create_element(
"MediaAlias");
129 $this->mal_node = $this->mob_node->append_child($this->mal_node);
130 $this->mal_node->set_attribute(
"OriginId",
"il__mob_" . $this->
getMediaObject()->getId());
133 $item_node = $this->dom->create_element(
"MediaAliasItem");
134 $item_node = $this->mob_node->append_child($item_node);
135 $item_node->set_attribute(
"Purpose",
"Standard");
138 $layout_node = $this->dom->create_element(
"Layout");
139 $layout_node = $item_node->append_child($layout_node);
140 if ($media_item->getWidth() > 0) {
143 if ($media_item->getHeight() > 0) {
146 $layout_node->set_attribute(
"HorizontalAlign",
"Left");
149 if ($media_item->getCaption() !=
"") {
150 $cap_node = $this->dom->create_element(
"Caption");
151 $cap_node = $item_node->append_child($cap_node);
152 $cap_node->set_attribute(
"Align",
"bottom");
153 $cap_node->set_content($media_item->getCaption());
157 if ($media_item->getTextRepresentation() !=
"") {
158 $tr_node = $this->dom->create_element(
"TextRepresentation");
159 $tr_node = $item_node->append_child($tr_node);
160 $tr_node->set_content($media_item->getTextRepresentation());
163 $pars = $media_item->getParameters();
164 foreach ($pars as $par => $val) {
165 $par_node = $this->dom->create_element(
"Parameter");
166 $par_node = $item_node->append_child($par_node);
167 $par_node->set_attribute(
"Name", $par);
168 $par_node->set_attribute(
"Value", $val);
172 $fullscreen_item = $this->
getMediaObject()->getMediaItem(
"Fullscreen");
173 if (is_object($fullscreen_item)) {
174 $item_node = $this->dom->create_element(
"MediaAliasItem");
175 $item_node = $this->mob_node->append_child($item_node);
176 $item_node->set_attribute(
"Purpose",
"Fullscreen");
179 $layout_node = $this->dom->create_element(
"Layout");
180 $layout_node = $item_node->append_child($layout_node);
181 if ($fullscreen_item->getWidth() > 0) {
182 $layout_node->set_attribute(
"Width", $fullscreen_item->getWidth());
184 if ($fullscreen_item->getHeight() > 0) {
185 $layout_node->set_attribute(
"Height", $fullscreen_item->getHeight());
189 if ($fullscreen_item->getCaption() !=
"") {
190 $cap_node = $this->dom->create_element(
"Caption");
191 $cap_node = $item_node->append_child($cap_node);
192 $cap_node->set_attribute(
"Align",
"bottom");
193 $cap_node->set_content($fullscreen_item->getCaption());
197 if ($fullscreen_item->getTextRepresentation() !=
"") {
198 $tr_node = $this->dom->create_element(
"TextRepresentation");
199 $tr_node = $item_node->append_child($tr_node);
200 $tr_node->set_content($fullscreen_item->getTextRepresentation());
203 $pars = $fullscreen_item->getParameters();
204 foreach ($pars as $par => $val) {
205 $par_node = $this->dom->create_element(
"Parameter");
206 $par_node = $item_node->append_child($par_node);
207 $par_node->set_attribute(
"Name", $par);
208 $par_node->set_attribute(
"Value", $val);
220 if (is_object($this->mob_node)) {
221 $this->mal_node = $this->mob_node->first_child();
222 if (is_object($this->mal_node) && $this->mal_node->node_name() ==
"MediaAlias") {
223 $this->mal_node->set_attribute(
"OriginId",
"il__mob_" . $this->
getMediaObject()->getId());
233 $xml = $this->dom->dump_node($this->node);
244 if (is_object($this->mob_node)) {
245 $mal_node = $this->mob_node->first_child();
246 if (is_object($mal_node)) {
247 if (!empty($a_class)) {
248 $mal_node->set_attribute(
"Class", $a_class);
250 if ($mal_node->has_attribute(
"Class")) {
251 $mal_node->remove_attribute(
"Class");
265 if (is_object($this->mob_node)) {
266 $mal_node = $this->mob_node->first_child();
267 if (is_object($mal_node)) {
268 $class = $mal_node->get_attribute(
"Class");
280 return array(
"pc_mob");
291 public static function afterPageUpdate($a_page, DOMDocument $a_domdoc, $a_xml, $a_creation)
293 if (!$a_page->getImportMode()) {
294 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
296 $a_page->getParentType() .
":pg",
299 $a_page->getLanguage()
301 self::saveMobUsage($a_page, $a_domdoc);
302 foreach ($mob_ids as $mob) {
305 $usages = $mob_obj->getUsages(
false);
306 if (count($usages) == 0) {
321 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
323 $a_page->getParentType() .
":pg",
326 $a_page->getLanguage()
330 $a_page->getParentType() .
":pg",
333 $a_page->getLanguage()
336 foreach ($mob_ids as $mob) {
339 $usages = $mob_obj->getUsages(
false);
340 if (count($usages) == 0) {
357 self::saveMobUsage($a_page, $a_old_domdoc, $a_old_nr);
370 $xpath =
new DOMXPath($a_domdoc);
371 $nodes = $xpath->query(
'//MediaAlias');
372 foreach ($nodes as
$node) {
373 $id_arr = explode(
"_", $node->getAttribute(
"OriginId"));
374 $mob_id = $id_arr[count($id_arr) - 1];
375 if ($mob_id > 0 && $id_arr[1] ==
"") {
376 $usages[$mob_id] =
true;
381 $xpath =
new DOMXPath($a_domdoc);
382 $nodes = $xpath->query(
'//MediaObject/MetaData/General/Identifier');
383 foreach ($nodes as $node) {
384 $mob_entry = $node->getAttribute(
"Entry");
385 $mob_arr = explode(
"_", $mob_entry);
386 $mob_id = $mob_arr[count($mob_arr) - 1];
387 if ($mob_id > 0 && $mob_arr[1] ==
"") {
388 $usages[$mob_id] =
true;
393 $xpath =
new DOMXPath($a_domdoc);
394 $nodes = $xpath->query(
"//IntLink[@Type='MediaObject']");
395 foreach ($nodes as $node) {
396 $mob_target = $node->getAttribute(
"Target");
397 $mob_arr = explode(
"_", $mob_target);
401 $mob_id = $mob_arr[count($mob_arr) - 1];
402 if ($mob_id > 0 && $mob_arr[1] ==
"") {
403 $usages[$mob_id] =
true;
407 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
409 $a_page->getParentType() .
":pg",
412 $a_page->getLanguage()
414 foreach ($usages as $mob_id => $val) {
419 $a_page->getParentType() .
":pg",
422 $a_page->getLanguage()
437 if ($a_mode ==
"offline") {
441 $page->getParentType() .
":pg",
446 foreach ($mob_ids as $mob_id) {
448 $srts = $mob->getSrtFiles();
449 foreach ($srts as $srt) {
450 if (
$ilUser->getLanguage() == $srt[
"language"]) {
452 $a_html = str_replace(
"[[[[[mobsubtitle;il__mob_" . $mob->getId() .
"_Standard]]]]]", $srt_content, $a_html);
458 if ($a_abstract_only) {
464 $suffix =
"-".$page->getParentType().
"-".$page->getId();
465 $modal = $this->
ui->factory()->modal()->roundtrip(
466 $this->lng->txt(
"cont_fullscreen"),
467 $this->
ui->factory()->legacy(
"<iframe class='il-copg-mob-fullscreen' id='il-copg-mob-fullscreen".$suffix.
"'></iframe>")
469 $show_signal = $modal->getShowSignal();
471 return $a_html .
"<div class='il-copg-mob-fullscreen-modal'>" . $this->
ui->renderer()->render($modal) .
"</div><script>$(function () { il.COPagePres.setFullscreenModalShowSignal('" .
472 $show_signal .
"', '".$suffix.
"'); });</script>";
static getCssFilePaths()
Get css file paths.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
setType($a_type)
Set Type.
static getJsFilePaths()
Get js file paths.
static _lookupType($a_id, $a_reference=false)
lookup object type
createPageContentNode($a_set_this_node=true)
Create page content node (always use this method first when adding a new element) ...
static getLocalMaphilightPath()
Get local path of maphilight file.