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 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
297 $a_page->getParentType().
":pg", $a_page->getId(), 0, $a_page->getLanguage());
299 foreach($mob_ids as $mob)
304 $usages = $mob_obj->getUsages(
false);
305 if (count($usages) == 0)
320 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
322 $a_page->getParentType().
":pg", $a_page->getId(), 0, $a_page->getLanguage());
325 $a_page->getLanguage());
327 foreach($mob_ids as $mob)
332 $usages = $mob_obj->getUsages(
false);
333 if (count($usages) == 0)
364 $xpath =
new DOMXPath($a_domdoc);
365 $nodes = $xpath->query(
'//MediaAlias');
366 foreach($nodes as
$node)
368 $id_arr = explode(
"_", $node->getAttribute(
"OriginId"));
369 $mob_id = $id_arr[count($id_arr) - 1];
370 if ($mob_id > 0 && $id_arr[1] ==
"")
372 $usages[$mob_id] =
true;
377 $xpath =
new DOMXPath($a_domdoc);
378 $nodes = $xpath->query(
'//MediaObject/MetaData/General/Identifier');
379 foreach($nodes as $node)
381 $mob_entry = $node->getAttribute(
"Entry");
382 $mob_arr = explode(
"_", $mob_entry);
383 $mob_id = $mob_arr[count($mob_arr) - 1];
384 if ($mob_id > 0 && $mob_arr[1] ==
"")
386 $usages[$mob_id] =
true;
391 $xpath =
new DOMXPath($a_domdoc);
392 $nodes = $xpath->query(
"//IntLink[@Type='MediaObject']");
393 foreach($nodes as $node)
395 $mob_target = $node->getAttribute(
"Target");
396 $mob_arr = explode(
"_", $mob_target);
400 $mob_id = $mob_arr[count($mob_arr) - 1];
401 if ($mob_id > 0 && $mob_arr[1] ==
"")
403 $usages[$mob_id] =
true;
407 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
409 $a_page->getLanguage());
410 foreach($usages as $mob_id => $val)
413 $a_page->getLanguage());