4 require_once(
"./Services/COPage/classes/class.ilPageContent.php");
45 $this->mob_node =& $a_node->first_child();
61 $this->hier_id = $a_hier_id;
71 $this->mediaobject = $a_mediaobject;
81 return $this->mediaobject;
92 function create(&$a_pg_obj, $a_hier_id)
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());
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");
119 $layout_node =& $this->dom->create_element(
"Layout");
120 $layout_node =& $item_node->append_child($layout_node);
121 if ($media_item->getWidth() > 0)
125 if ($media_item->getHeight() > 0)
129 $layout_node->set_attribute(
"HorizontalAlign",
"Left");
132 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());
141 if ($media_item->getTextRepresentation() !=
"")
143 $tr_node =& $this->dom->create_element(
"TextRepresentation");
144 $tr_node =& $item_node->append_child($tr_node);
145 $tr_node->set_content($media_item->getTextRepresentation());
148 $pars = $media_item->getParameters();
149 foreach($pars as $par => $val)
151 $par_node =& $this->dom->create_element(
"Parameter");
152 $par_node =& $item_node->append_child($par_node);
153 $par_node->set_attribute(
"Name", $par);
154 $par_node->set_attribute(
"Value", $val);
158 $fullscreen_item =& $this->
getMediaObject()->getMediaItem(
"Fullscreen");
159 if (is_object($fullscreen_item))
161 $item_node =& $this->dom->create_element(
"MediaAliasItem");
162 $item_node =& $this->mob_node->append_child($item_node);
163 $item_node->set_attribute(
"Purpose",
"Fullscreen");
166 $layout_node =& $this->dom->create_element(
"Layout");
167 $layout_node =& $item_node->append_child($layout_node);
168 if ($fullscreen_item->getWidth() > 0)
170 $layout_node->set_attribute(
"Width", $fullscreen_item->getWidth());
172 if ($fullscreen_item->getHeight() > 0)
174 $layout_node->set_attribute(
"Height", $fullscreen_item->getHeight());
178 if ($fullscreen_item->getCaption() !=
"")
180 $cap_node =& $this->dom->create_element(
"Caption");
181 $cap_node =& $item_node->append_child($cap_node);
182 $cap_node->set_attribute(
"Align",
"bottom");
183 $cap_node->set_content($fullscreen_item->getCaption());
187 if ($fullscreen_item->getTextRepresentation() !=
"")
189 $tr_node =& $this->dom->create_element(
"TextRepresentation");
190 $tr_node =& $item_node->append_child($tr_node);
191 $tr_node->set_content($fullscreen_item->getTextRepresentation());
194 $pars = $fullscreen_item->getParameters();
195 foreach($pars as $par => $val)
197 $par_node =& $this->dom->create_element(
"Parameter");
198 $par_node =& $item_node->append_child($par_node);
199 $par_node->set_attribute(
"Name", $par);
200 $par_node->set_attribute(
"Value", $val);
212 if (is_object($this->mob_node))
214 $this->mal_node =& $this->mob_node->first_child();
215 if (is_object($this->mal_node) && $this->mal_node->node_name() ==
"MediaAlias")
217 $this->mal_node->set_attribute(
"OriginId",
"il__mob_".$this->
getMediaObject()->getId());
227 $xml = $this->dom->dump_node($this->node);
238 if (is_object($this->mob_node))
240 $mal_node = $this->mob_node->first_child();
241 if (is_object($mal_node))
243 if (!empty($a_class))
245 $mal_node->set_attribute(
"Class", $a_class);
249 if ($mal_node->has_attribute(
"Class"))
251 $mal_node->remove_attribute(
"Class");
265 if (is_object($this->mob_node))
267 $mal_node = $this->mob_node->first_child();
268 if (is_object($mal_node))
270 $class = $mal_node->get_attribute(
"Class");
282 return array(
"pc_mob");
295 if (!$a_page->getImportMode())
297 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
299 $a_page->getParentType().
":pg", $a_page->getId(), 0, $a_page->getLanguage());
301 foreach($mob_ids as $mob)
306 $usages = $mob_obj->getUsages(
false);
307 if (count($usages) == 0)
323 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
325 $a_page->getParentType().
":pg", $a_page->getId(), 0, $a_page->getLanguage());
328 $a_page->getLanguage());
330 foreach($mob_ids as $mob)
335 $usages = $mob_obj->getUsages(
false);
336 if (count($usages) == 0)
367 $xpath =
new DOMXPath($a_domdoc);
368 $nodes = $xpath->query(
'//MediaAlias');
369 foreach($nodes as
$node)
371 $id_arr = explode(
"_", $node->getAttribute(
"OriginId"));
372 $mob_id = $id_arr[count($id_arr) - 1];
373 if ($mob_id > 0 && $id_arr[1] ==
"")
375 $usages[$mob_id] =
true;
380 $xpath =
new DOMXPath($a_domdoc);
381 $nodes = $xpath->query(
'//MediaObject/MetaData/General/Identifier');
382 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] ==
"")
389 $usages[$mob_id] =
true;
394 $xpath =
new DOMXPath($a_domdoc);
395 $nodes = $xpath->query(
"//IntLink[@Type='MediaObject']");
396 foreach($nodes as $node)
398 $mob_target = $node->getAttribute(
"Target");
399 $mob_arr = explode(
"_", $mob_target);
403 $mob_id = $mob_arr[count($mob_arr) - 1];
404 if ($mob_id > 0 && $mob_arr[1] ==
"")
406 $usages[$mob_id] =
true;
410 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
412 $a_page->getLanguage());
413 foreach($usages as $mob_id => $val)
419 $a_page->getLanguage());