4 require_once(
"./Services/COPage/classes/class.ilPageContent.php");
32 $this->
user = $DIC->user();
51 parent::setNode($a_node);
52 $this->mob_node = $a_node->first_child();
68 $this->hier_id = $a_hier_id;
78 $this->mediaobject = $a_mediaobject;
88 return $this->mediaobject;
99 public function create(&$a_pg_obj, $a_hier_id)
110 public function createAlias(&$a_pg_obj, $a_hier_id, $a_pc_id =
"")
112 $this->node = $this->dom->create_element(
"PageContent");
113 $a_pg_obj->insertContent($this, $a_hier_id,
IL_INSERT_AFTER, $a_pc_id);
114 $this->mob_node = $this->dom->create_element(
"MediaObject");
115 $this->mob_node = $this->node->append_child($this->mob_node);
116 $this->mal_node = $this->dom->create_element(
"MediaAlias");
117 $this->mal_node = $this->mob_node->append_child($this->mal_node);
118 $this->mal_node->set_attribute(
"OriginId",
"il__mob_" . $this->
getMediaObject()->getId());
121 $item_node = $this->dom->create_element(
"MediaAliasItem");
122 $item_node = $this->mob_node->append_child($item_node);
123 $item_node->set_attribute(
"Purpose",
"Standard");
126 $layout_node = $this->dom->create_element(
"Layout");
127 $layout_node = $item_node->append_child($layout_node);
128 if ($media_item->getWidth() > 0) {
131 if ($media_item->getHeight() > 0) {
134 $layout_node->set_attribute(
"HorizontalAlign",
"Left");
137 if ($media_item->getCaption() !=
"") {
138 $cap_node = $this->dom->create_element(
"Caption");
139 $cap_node = $item_node->append_child($cap_node);
140 $cap_node->set_attribute(
"Align",
"bottom");
141 $cap_node->set_content($media_item->getCaption());
145 if ($media_item->getTextRepresentation() !=
"") {
146 $tr_node = $this->dom->create_element(
"TextRepresentation");
147 $tr_node = $item_node->append_child($tr_node);
148 $tr_node->set_content($media_item->getTextRepresentation());
151 $pars = $media_item->getParameters();
152 foreach ($pars as $par => $val) {
153 $par_node = $this->dom->create_element(
"Parameter");
154 $par_node = $item_node->append_child($par_node);
155 $par_node->set_attribute(
"Name", $par);
156 $par_node->set_attribute(
"Value", $val);
160 $fullscreen_item = $this->
getMediaObject()->getMediaItem(
"Fullscreen");
161 if (is_object($fullscreen_item)) {
162 $item_node = $this->dom->create_element(
"MediaAliasItem");
163 $item_node = $this->mob_node->append_child($item_node);
164 $item_node->set_attribute(
"Purpose",
"Fullscreen");
167 $layout_node = $this->dom->create_element(
"Layout");
168 $layout_node = $item_node->append_child($layout_node);
169 if ($fullscreen_item->getWidth() > 0) {
170 $layout_node->set_attribute(
"Width", $fullscreen_item->getWidth());
172 if ($fullscreen_item->getHeight() > 0) {
173 $layout_node->set_attribute(
"Height", $fullscreen_item->getHeight());
177 if ($fullscreen_item->getCaption() !=
"") {
178 $cap_node = $this->dom->create_element(
"Caption");
179 $cap_node = $item_node->append_child($cap_node);
180 $cap_node->set_attribute(
"Align",
"bottom");
181 $cap_node->set_content($fullscreen_item->getCaption());
185 if ($fullscreen_item->getTextRepresentation() !=
"") {
186 $tr_node = $this->dom->create_element(
"TextRepresentation");
187 $tr_node = $item_node->append_child($tr_node);
188 $tr_node->set_content($fullscreen_item->getTextRepresentation());
191 $pars = $fullscreen_item->getParameters();
192 foreach ($pars as $par => $val) {
193 $par_node = $this->dom->create_element(
"Parameter");
194 $par_node = $item_node->append_child($par_node);
195 $par_node->set_attribute(
"Name", $par);
196 $par_node->set_attribute(
"Value", $val);
208 if (is_object($this->mob_node)) {
209 $this->mal_node = $this->mob_node->first_child();
210 if (is_object($this->mal_node) && $this->mal_node->node_name() ==
"MediaAlias") {
211 $this->mal_node->set_attribute(
"OriginId",
"il__mob_" . $this->
getMediaObject()->getId());
221 $xml = $this->dom->dump_node($this->node);
232 if (is_object($this->mob_node)) {
233 $mal_node = $this->mob_node->first_child();
234 if (is_object($mal_node)) {
235 if (!empty($a_class)) {
236 $mal_node->set_attribute(
"Class", $a_class);
238 if ($mal_node->has_attribute(
"Class")) {
239 $mal_node->remove_attribute(
"Class");
253 if (is_object($this->mob_node)) {
254 $mal_node = $this->mob_node->first_child();
255 if (is_object($mal_node)) {
256 $class = $mal_node->get_attribute(
"Class");
268 return array(
"pc_mob");
281 if (!$a_page->getImportMode()) {
282 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
284 $a_page->getParentType() .
":pg",
287 $a_page->getLanguage()
289 self::saveMobUsage($a_page, $a_domdoc);
290 foreach ($mob_ids as $mob) {
293 $usages = $mob_obj->getUsages(
false);
294 if (count($usages) == 0) {
309 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
311 $a_page->getParentType() .
":pg",
314 $a_page->getLanguage()
318 $a_page->getParentType() .
":pg",
321 $a_page->getLanguage()
324 foreach ($mob_ids as $mob) {
327 $usages = $mob_obj->getUsages(
false);
328 if (count($usages) == 0) {
345 self::saveMobUsage($a_page, $a_old_domdoc, $a_old_nr);
359 $nodes = $xpath->query(
'//MediaAlias');
360 foreach ($nodes as
$node) {
361 $id_arr = explode(
"_", $node->getAttribute(
"OriginId"));
362 $mob_id = $id_arr[count($id_arr) - 1];
363 if ($mob_id > 0 && $id_arr[1] ==
"") {
364 $usages[$mob_id] =
true;
370 $nodes = $xpath->query(
'//MediaObject/MetaData/General/Identifier');
371 foreach ($nodes as $node) {
372 $mob_entry = $node->getAttribute(
"Entry");
373 $mob_arr = explode(
"_", $mob_entry);
374 $mob_id = $mob_arr[count($mob_arr) - 1];
375 if ($mob_id > 0 && $mob_arr[1] ==
"") {
376 $usages[$mob_id] =
true;
382 $nodes = $xpath->query(
"//IntLink[@Type='MediaObject']");
383 foreach ($nodes as $node) {
384 $mob_target = $node->getAttribute(
"Target");
385 $mob_arr = explode(
"_", $mob_target);
389 $mob_id = $mob_arr[count($mob_arr) - 1];
390 if ($mob_id > 0 && $mob_arr[1] ==
"") {
391 $usages[$mob_id] =
true;
395 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
397 $a_page->getParentType() .
":pg",
400 $a_page->getLanguage()
402 foreach ($usages as $mob_id => $val) {
407 $a_page->getParentType() .
":pg",
410 $a_page->getLanguage()
428 if ($a_mode ==
"offline") {
432 $page->getParentType() .
":pg",
437 foreach ($mob_ids as $mob_id) {
439 $srts = $mob->getSrtFiles();
440 foreach ($srts as $srt) {
441 if (
$ilUser->getLanguage() == $srt[
"language"]) {
443 $a_html = str_replace(
"[[[[[mobsubtitle;il__mob_" . $mob->getId() .
"_Standard]]]]]", $srt_content, $a_html);
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
setType($a_type)
Set Type.
Create styles array
The data for the language used.
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) ...