ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilPCMediaObjectGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once ("./Services/COPage/classes/class.ilPageContentGUI.php");
5require_once ("./Services/COPage/classes/class.ilMediaAliasItem.php");
6require_once ("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
7
20// Todo: extend ilObjMediaObjectGUI !?
22{
24 var $ctrl;
25
26 function ilPCMediaObjectGUI($a_pg_obj, $a_content_obj, $a_hier_id = 0, $a_pc_id = "")
27 {
28 global $ilCtrl;
29
30 $this->ctrl =& $ilCtrl;
31
32//echo "constructor target:".$_SESSION["il_map_il_target"].":<br>";
33 parent::ilPageContentGUI($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
34
35 $this->setCharacteristics(array("Media" => $this->lng->txt("cont_Media")));
36
37 }
38
39 function setHeader($a_title = "")
40 {
41 $this->header = $a_title;
42 }
43
44 function getHeader()
45 {
46 return $this->header;
47 }
48
54 function setEnabledMapAreas($a_enabledmapareas)
55 {
56 $this->enabledmapareas = $a_enabledmapareas;
57 }
58
65 {
66 return $this->enabledmapareas;
67 }
68
72 function &executeCommand()
73 {
74 global $tpl, $lng, $ilTabs;
75
76 $this->getCharacteristicsOfCurrentStyle("media_cont"); // scorm-2004
77
78 // get next class that processes or forwards current command
79 $next_class = $this->ctrl->getNextClass($this);
80
81 // get current command
82 $cmd = $this->ctrl->getCmd();
83
84 if (is_object ($this->content_obj))
85 {
86 $this->tpl->clearHeader();
87 $tpl->setTitleIcon(ilUtil::getImagePath("icon_mob.svg"));
88 $this->getTabs($this->tabs_gui);
89
90 $mob = $this->content_obj->getMediaObject();
91 if (is_object($mob))
92 {
93 $tpl->setVariable("HEADER", $lng->txt("mob").": ".
94 $this->content_obj->getMediaObject()->getTitle());
95 $mob_gui =& new ilObjMediaObjectGUI("", $this->content_obj->getMediaObject()->getId(),false, false);
96 $mob_gui->setBackTitle($this->page_back_title);
97 $mob_gui->setEnabledMapAreas($this->getEnabledMapAreas());
98 $mob_gui->getTabs($this->tabs_gui);
99 }
100 }
101 else
102 {
103 }
104
105 switch($next_class)
106 {
107 case "ilobjmediaobjectgui":
108 include_once ("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
109 $this->tpl->clearHeader();
110 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_mob.svg"));
111 $this->tpl->setTitle($this->lng->txt("mob").": ".
112 $this->content_obj->getMediaObject()->getTitle());
113 $mob_gui =& new ilObjMediaObjectGUI("", $this->content_obj->getMediaObject()->getId(),false, false);
114 $mob_gui->setBackTitle($this->page_back_title);
115 $mob_gui->setEnabledMapAreas($this->getEnabledMapAreas());
116 $ret =& $this->ctrl->forwardCommand($mob_gui);
117 break;
118
119 // instance image map editing
120 case "ilpcimagemapeditorgui":
121 require_once("./Services/COPage/classes/class.ilPCImageMapEditorGUI.php");
122 $ilTabs->setTabActive("cont_inst_map_areas");
123 $image_map_edit = new ilPCImageMapEditorGUI($this->content_obj,
124 $this->pg_obj);
125 $ret = $this->ctrl->forwardCommand($image_map_edit);
126 $tpl->setContent($ret);
127 break;
128
129 default:
130 $ret =& $this->$cmd();
131 break;
132 }
133
134 return $ret;
135 }
136
140 function insert($a_post_cmd = "edpost", $a_submit_cmd = "create_mob", $a_input_error = false)
141 {
142 global $ilTabs, $tpl, $ilCtrl, $lng;
143
144 if ($_GET["subCmd"] == "insertNew")
145 {
146 $_SESSION["cont_media_insert"] = "insertNew";
147 }
148 if ($_GET["subCmd"] == "insertFromPool")
149 {
150 $_SESSION["cont_media_insert"] = "insertFromPool";
151 }
152
153 if (($_GET["subCmd"] == "") && $_SESSION["cont_media_insert"] != "")
154 {
155 $_GET["subCmd"] = $_SESSION["cont_media_insert"];
156 }
157
158 switch ($_GET["subCmd"])
159 {
160 case "insertFromPool":
161 $this->insertFromPool();
162 break;
163
164 case "poolSelection":
165 $this->poolSelection();
166 break;
167
168 case "selectPool":
169 $this->selectPool();
170 break;
171
172 case "insertNew":
173 default:
174 $this->getTabs($ilTabs, true);
175 $ilTabs->setSubTabActive("cont_new_mob");
176
177 include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
178 if ($a_input_error)
179 {
180 $form = $this->form;
181 }
182 else
183 {
184 $mob_gui = new ilObjMediaObjectGUI("");
185 $mob_gui->initForm("create");
186 $form = $mob_gui->getForm();
187 }
188 $form->setFormAction($ilCtrl->getFormAction($this, "create_mob"));
189 $form->clearCommandButtons();
190 $form->addCommandButton("create_mob", $lng->txt("save"));
191 $form->addCommandButton("cancelCreate", $lng->txt("cancel"));
192
193 $this->displayValidationError();
194
195 $tpl->setContent($form->getHTML());
196
197 break;
198 }
199 }
200
205 {
206 global $ilTabs, $ilCtrl, $lng;
207
208 if ($_GET["subCmd"] == "insertNew")
209 {
210 $_SESSION["cont_media_insert"] = "insertNew";
211 }
212 if ($_GET["subCmd"] == "insertFromPool")
213 {
214 $_SESSION["cont_media_insert"] = "insertFromPool";
215 }
216
217 if (($_GET["subCmd"] == "") && $_SESSION["cont_media_insert"] != "")
218 {
219 $_GET["subCmd"] = $_SESSION["cont_media_insert"];
220 }
221
222 switch ($_GET["subCmd"])
223 {
224 case "insertFromPool":
225 $this->insertFromPool(true);
226 break;
227
228 case "poolSelection":
229 $this->poolSelection(true);
230 break;
231
232 case "selectPool":
233 $this->selectPool(true);
234 break;
235
236 case "insertNew":
237 default:
238 $ilCtrl->setParameter($this, "subCmd", "changeObjectReference");
239 $this->getTabs($ilTabs, true, true);
240 $ilTabs->setSubTabActive("cont_new_mob");
241
242 $this->displayValidationError();
243
244 $mob_gui = new ilObjMediaObjectGUI("");
245 $mob_gui->initForm("create");
246 $form = $mob_gui->getForm();
247 $form->setFormAction($ilCtrl->getFormAction($this));
248 $form->clearCommandButtons();
249 $form->addCommandButton("createNewObjectReference", $lng->txt("save"));
250 $form->addCommandButton("cancelCreate", $lng->txt("cancel"));
251 $this->tpl->setContent($form->getHTML());
252 }
253 }
254
258 function insertFromPool($a_change_obj_ref = false)
259 {
260 global $ilCtrl, $ilAccess, $ilTabs, $tpl, $lng, $ilToolbar;
261
262 if ($_SESSION["cont_media_pool"] != "" &&
263 $ilAccess->checkAccess("write", "", $_SESSION["cont_media_pool"])
264 && ilObject::_lookupType(ilObject::_lookupObjId($_SESSION["cont_media_pool"])) == "mep")
265 {
266 $html = "";
267 $tb = new ilToolbarGUI();
268
269 $ilCtrl->setParameter($this, "subCmd", "poolSelection");
270 if ($a_change_obj_ref)
271 {
272 $tb->addButton($lng->txt("cont_switch_to_media_pool"),
273 $ilCtrl->getLinkTarget($this, "changeObjectReference"));
274 }
275 else
276 {
277 $tb->addButton($lng->txt("cont_switch_to_media_pool"),
278 $ilCtrl->getLinkTarget($this, "insert"));
279
280 }
281 $ilCtrl->setParameter($this, "subCmd", "");
282
283 $html = $tb->getHTML();
284
285 $this->getTabs($ilTabs, true, $a_change_obj_ref);
286 $ilTabs->setSubTabActive("cont_mob_from_media_pool");
287
288 include_once("./Modules/MediaPool/classes/class.ilObjMediaPool.php");
289 include_once("./Modules/MediaPool/classes/class.ilMediaPoolTableGUI.php");
290 $pool = new ilObjMediaPool($_SESSION["cont_media_pool"]);
291 $ilCtrl->setParameter($this, "subCmd", "insertFromPool");
292 $tcmd = ($a_change_obj_ref)
293 ? "changeObjectReference"
294 : "insert";
295 $tmode = ($a_change_obj_ref)
298 $mpool_table = new ilMediaPoolTableGUI($this, $tcmd, $pool, "mep_folder",
299 $tmode);
300
301 $html.= $mpool_table->getHTML();
302
303 $tpl->setContent($html);
304 }
305 else
306 {
307 $this->poolSelection($a_change_obj_ref);
308 }
309 }
310
314 function selectPool($a_change_obj_ref = false)
315 {
316 global $ilCtrl;
317
318 $_SESSION["cont_media_pool"] = $_GET["pool_ref_id"];
319 $ilCtrl->setParameter($this, "subCmd", "insertFromPool");
320 if ($a_change_obj_ref)
321 {
322 $ilCtrl->redirect($this, "changeObjectReference");
323 }
324 else
325 {
326 $ilCtrl->redirect($this, "insert");
327 }
328 }
329
333 function poolSelection($a_change_obj_ref = false)
334 {
335 global $tpl, $ilTabs, $ilCtrl;
336
337 $this->getTabs($ilTabs, true, $a_change_obj_ref);
338 $ilTabs->setSubTabActive("cont_mob_from_media_pool");
339
340 include_once "./Services/COPage/classes/class.ilPoolSelectorGUI.php";
341
342 if ($a_change_obj_ref)
343 {
344 $ilCtrl->setParameter($this, "subCmd", "poolSelection");
345 $exp = new ilPoolSelectorGUI($this, "changeObjectReference", $this, "changeObjectReference");
346 }
347 else
348 {
349 $ilCtrl->setParameter($this, "subCmd", "poolSelection");
350 $exp = new ilPoolSelectorGUI($this, "insert");
351 }
352
353 // filter
354 $exp->setTypeWhiteList(array("root", "cat", "grp", "fold", "crs", "mep"));
355 $exp->setClickableTypes(array('mep'));
356
357 if (!$exp->handleCommand())
358 {
359 $tpl->setContent($exp->getHTML());
360 }
361 }
362
363
369 {
370 $this->create(false, true);
371 }
372
378 {
379 global $ilCtrl, $lng;
380 if (is_array($_POST["id"]) && count($_POST["id"]) == 1)
381 {
382 include_once("./Services/COPage/classes/class.ilPCMediaObject.php");
383 include_once("./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
385 $this->content_obj->readMediaObject($fid);
386 $this->content_obj->updateObjectReference();
387 $this->updated = $this->pg_obj->update();
388 }
389 else
390 {
391 ilUtil::sendInfo($lng->txt("cont_select_max_one_item"), true);
392 $ilCtrl->redirect($this, "changeObjectReference");
393
394 }
395 $ilCtrl->redirect($this, "editAlias");
396 }
397
401 function &create($a_create_alias = true, $a_change_obj_ref = false)
402 {
403 global $ilCtrl, $lng;
404
405 if ($_GET["subCmd"] == "insertFromPool")
406 {
407 if (is_array($_POST["id"]))
408 {
409 for($i = count($_POST["id"]) - 1; $i>=0; $i--)
410 {
411 include_once("./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
413 include_once("./Services/COPage/classes/class.ilPCMediaObject.php");
414 $this->content_obj = new ilPCMediaObject($this->getPage());
415 $this->content_obj->readMediaObject($fid);
416 $this->content_obj->createAlias($this->pg_obj, $_GET["hier_id"], $this->pc_id);
417 }
418 $this->updated = $this->pg_obj->update();
419 }
420
421 $ilCtrl->returnToParent($this);
422 }
423
424 // check form input
425 $mob_gui = new ilObjMediaObjectGUI("");
426 $mob_gui->initForm("create");
427
428 if (!$mob_gui->checkFormInput())
429 {
430 $this->form = $mob_gui->getForm();
431 $this->insert("edpost", "create_mob", true);
432 return;
433 }
434 // create dummy object in db (we need an id)
435 include_once("./Services/COPage/classes/class.ilPCMediaObject.php");
436 if ($a_change_obj_ref != true)
437 {
438 $this->content_obj = new ilPCMediaObject($this->getPage());
439 }
440 $this->content_obj->createMediaObject();
441 $media_obj = $this->content_obj->getMediaObject();
442
443 include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
445
446 if ($a_create_alias)
447 {
448 // need a pcmediaobject here
449 //$this->node = $this->createPageContentNode();
450
451 $this->content_obj->createAlias($this->pg_obj, $this->hier_id, $this->pc_id);
452 $this->updated = $this->pg_obj->update();
453 if ($this->updated === true)
454 {
455 $this->pg_obj->stripHierIDs();
456 $this->pg_obj->addHierIDs();
457 $ilCtrl->setParameter($this, "hier_id", $this->content_obj->readHierId());
458 $ilCtrl->setParameter($this, "pc_id", $this->content_obj->readPCId());
459 $this->content_obj->setHierId($this->content_obj->readHierId());
460 $this->setHierId($this->content_obj->readHierId());
461 $this->content_obj->setPCId($this->content_obj->readPCId());
462 ilUtil::sendSuccess($lng->txt("saved_media_object"), true);
463 $this->ctrl->redirectByClass("ilobjmediaobjectgui", "edit");
464
465 //$this->ctrl->returnToParent($this, "jump".$this->hier_id);
466 }
467 else
468 {
469 $this->insert();
470 }
471 }
472 else
473 {
474 if ($a_change_obj_ref == true)
475 {
476 $this->content_obj->updateObjectReference();
477 $this->updated = $this->pg_obj->update();
478 $this->ctrl->redirect($this, "editAlias");
479 }
480 return $this->content_obj;
481 }
482 }
483
484
488 function editAlias()
489 {
490 global $tpl;
491
492 $this->initAliasForm();
493 $this->getAliasValues();
494 $tpl->setContent($this->form_gui->getHTML());
495 }
496
500 function initAliasForm()
501 {
502 global $lng, $ilCtrl;
503
504 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
505
506 $this->form_gui = new ilPropertyFormGUI();
507
508 // standard view resource
509 $std_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard",
510 $this->content_obj->getPcId());
511 $std_item = $this->content_obj->getMediaObject()->getMediaItem("Standard");
512
513 // title, location and format
514 $title = new ilNonEditableValueGUI($lng->txt("title"), "title");
515 $this->form_gui->addItem($title);
516 $loc = new ilNonEditableValueGUI(
517 $this->lng->txt("cont_".strtolower($std_item->getLocationType())), "st_location");
518 $this->form_gui->addItem($loc);
519 $format = new ilNonEditableValueGUI(
520 $this->lng->txt("cont_format"), "st_format");
521 $this->form_gui->addItem($format);
522
523 // standard size
524 $radio_size = new ilRadioGroupInputGUI($lng->txt("size"), "st_derive_size");
525 $op1 = new ilRadioOption($lng->txt("cont_default").
526 " (".$std_item->getWidth()." x ".$std_item->getHeight().")", "y");
527 $op2 = new ilRadioOption($lng->txt("cont_custom"), "n");
528 $radio_size->addOption($op1);
529
530 // width height
531 include_once("./Services/MediaObjects/classes/class.ilWidthHeightInputGUI.php");
532 $width_height = new ilWidthHeightInputGUI($lng->txt("cont_width").
533 " / ".$lng->txt("cont_height"), "st_width_height");
534 $width_height->setConstrainProportions(true);
535 $op2->addSubItem($width_height);
536
537 $radio_size->addOption($op2);
538 $this->form_gui->addItem($radio_size);
539
540 // standard caption
541 $rad_caption = new ilRadioGroupInputGUI($lng->txt("cont_caption"), "st_derive_caption");
542 $op1 = new ilRadioOption($lng->txt("cont_default"), "y");
543 $def_cap = new ilNonEditableValueGUI("", "def_caption");
544 $op1->addSubItem($def_cap);
545 $op2 = new ilRadioOption($lng->txt("cont_custom"), "n");
546 $rad_caption->addOption($op1);
547
548 $caption = new ilTextAreaInputGUI("", "st_caption");
549 $caption->setCols(30);
550 $caption->setRows(2);
551 $op2->addSubItem($caption);
552
553 /*$caption = new ilTextInputGUI("", "st_caption");
554 $caption->setSize(40);
555 $caption->setMaxLength(200);
556 $op2->addSubItem($caption);*/
557 $rad_caption->addOption($op2);
558 $this->form_gui->addItem($rad_caption);
559
560 // standard text representation
561 if (substr($std_item->getFormat(), 0, 5) == "image")
562 {
563 $rad_tr = new ilRadioGroupInputGUI($lng->txt("text_repr"), "st_derive_text_representation");
564 $op1 = new ilRadioOption($lng->txt("cont_default"), "y");
565 $def_tr = new ilNonEditableValueGUI("", "def_text_representation");
566 $op1->addSubItem($def_tr);
567 $op2 = new ilRadioOption($lng->txt("cont_custom"), "n");
568 $tr = new ilTextAreaInputGUI("", "st_text_representation");
569 $tr->setCols(30);
570 $tr->setRows(2);
571 $rad_tr->addOption($op1);
572 $op2->addSubItem($tr);
573 $rad_tr->addOption($op2);
574 $this->form_gui->addItem($rad_tr);
575 $rad_tr->setInfo($lng->txt("text_repr_info"));
576 }
577
578 // standard parameters
579 if (!in_array($std_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes()))
580 {
581 if (ilObjMediaObject::_useAutoStartParameterOnly($std_item->getLocation(),
582 $std_item->getFormat())) // autostart
583 {
584 $par = $std_item->getParameters();
585 $def_str = ($par["autostart"] == "true")
586 ? " (".$lng->txt("yes").")"
587 : " (".$lng->txt("no").")";
588 $rad_auto = new ilRadioGroupInputGUI($lng->txt("cont_autostart"),
589 "st_derive_parameters");
590 $op1 = new ilRadioOption($lng->txt("cont_default").$def_str, "y");
591 $rad_auto->addOption($op1);
592 $op2 = new ilRadioOption($lng->txt("cont_custom"), "n");
593 $auto = new ilCheckboxInputGUI($lng->txt("enabled"), "st_autostart");
594 $op2->addSubItem($auto);
595 $rad_auto->addOption($op2);
596 $this->form_gui->addItem($rad_auto);
597 }
598 else // parameters
599 {
600 $rad_parameters = new ilRadioGroupInputGUI($lng->txt("cont_parameter"), "st_derive_parameters");
601 $op1 = new ilRadioOption($lng->txt("cont_default"), "y");
602 $def_par = new ilNonEditableValueGUI("", "def_parameters");
603 $op1->addSubItem($def_par);
604 $rad_parameters->addOption($op1);
605 $op2 = new ilRadioOption($lng->txt("cont_custom"), "n");
606 $par = new ilTextAreaInputGUI("", "st_parameters");
607 $par->setRows(5);
608 $par->setCols(50);
609 $op2->addSubItem($par);
610 $rad_parameters->addOption($op2);
611 $this->form_gui->addItem($rad_parameters);
612 }
613 }
614
615 // fullscreen view
616 if($this->content_obj->getMediaObject()->hasFullScreenItem())
617 {
618 $full_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Fullscreen",
619 $this->content_obj->getPcId());
620 $full_item = $this->content_obj->getMediaObject()->getMediaItem("Fullscreen");
621
622 $fs_sec = new ilFormSectionHeaderGUI();
623 $fs_sec->setTitle($lng->txt("cont_fullscreen"));
624 $this->form_gui->addItem($fs_sec);
625
626
627 // resource
628 $radio_prop = new ilRadioGroupInputGUI($lng->txt("cont_resource"), "fullscreen");
629 $op1 = new ilRadioOption($lng->txt("cont_none"), "n");
630 $radio_prop->addOption($op1);
631 $op2 = new ilRadioOption($this->lng->txt("cont_".strtolower($full_item->getLocationType())).": ".
632 $full_item->getLocation(), "y");
633 $radio_prop->addOption($op2);
634 $this->form_gui->addItem($radio_prop);
635
636 // format
637 $format = new ilNonEditableValueGUI(
638 $this->lng->txt("cont_format"), "full_format");
639 $this->form_gui->addItem($format);
640
641 // full size
642 $radio_size = new ilRadioGroupInputGUI($lng->txt("size"), "full_derive_size");
643 $op1 = new ilRadioOption($lng->txt("cont_default").
644 " (".$full_item->getWidth()." x ".$full_item->getHeight().")", "y");
645 $op2 = new ilRadioOption($lng->txt("cont_custom"), "n");
646 $radio_size->addOption($op1);
647
648 // width height
649 include_once("./Services/MediaObjects/classes/class.ilWidthHeightInputGUI.php");
650 $width_height = new ilWidthHeightInputGUI($lng->txt("cont_width").
651 " / ".$lng->txt("cont_height"), "full_width_height");
652 $width_height->setConstrainProportions(true);
653 $op2->addSubItem($width_height);
654
655 $radio_size->addOption($op2);
656 $this->form_gui->addItem($radio_size);
657
658 // fullscreen caption
659 $rad_caption = new ilRadioGroupInputGUI($lng->txt("cont_caption"), "full_derive_caption");
660 $op1 = new ilRadioOption($lng->txt("cont_default"), "y");
661 $def_cap = new ilNonEditableValueGUI("", "full_def_caption");
662 $op1->addSubItem($def_cap);
663 $op2 = new ilRadioOption($lng->txt("cont_custom"), "n");
664 $rad_caption->addOption($op1);
665
666 $caption = new ilTextAreaInputGUI("", "full_caption");
667 $caption->setCols(30);
668 $caption->setRows(2);
669 $op2->addSubItem($caption);
670
671 /*$caption = new ilTextInputGUI("", "full_caption");
672 $caption->setSize(40);
673 $caption->setMaxLength(200);
674 $op2->addSubItem($caption);*/
675 $rad_caption->addOption($op2);
676 $this->form_gui->addItem($rad_caption);
677
678 // fullscreen text representation
679 if (substr($full_item->getFormat(), 0, 5) == "image")
680 {
681 $rad_tr = new ilRadioGroupInputGUI($lng->txt("text_repr"), "full_derive_text_representation");
682 $op1 = new ilRadioOption($lng->txt("cont_default"), "y");
683 $def_tr = new ilNonEditableValueGUI("", "full_def_text_representation");
684 $op1->addSubItem($def_tr);
685 $op2 = new ilRadioOption($lng->txt("cont_custom"), "n");
686 $tr = new ilTextAreaInputGUI("", "full_text_representation");
687 $tr->setCols(30);
688 $tr->setRows(2);
689 $rad_tr->addOption($op1);
690 $op2->addSubItem($tr);
691 $rad_tr->addOption($op2);
692 $this->form_gui->addItem($rad_tr);
693 $rad_tr->setInfo($lng->txt("text_repr_info"));
694 }
695
696 // fullscreen parameters
697 if (!in_array($full_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes()))
698 {
699 if (ilObjMediaObject::_useAutoStartParameterOnly($full_item->getLocation(),
700 $full_item->getFormat())) // autostart
701 {
702 $par = $full_item->getParameters();
703 $def_str = ($par["autostart"] == "true")
704 ? " (".$lng->txt("yes").")"
705 : " (".$lng->txt("no").")";
706 $rad_auto = new ilRadioGroupInputGUI($lng->txt("cont_autostart"),
707 "full_derive_parameters");
708 $op1 = new ilRadioOption($lng->txt("cont_default").$def_str, "y");
709 $rad_auto->addOption($op1);
710 $op2 = new ilRadioOption($lng->txt("cont_custom"), "n");
711 $auto = new ilCheckboxInputGUI($lng->txt("enabled"), "full_autostart");
712 $op2->addSubItem($auto);
713 $rad_auto->addOption($op2);
714 $this->form_gui->addItem($rad_auto);
715 }
716 else // parameters
717 {
718 $rad_parameters = new ilRadioGroupInputGUI($lng->txt("cont_parameter"), "full_derive_parameters");
719 $op1 = new ilRadioOption($lng->txt("cont_default"), "y");
720 $def_par = new ilNonEditableValueGUI("", "full_def_parameters");
721 $op1->addSubItem($def_par);
722 $rad_parameters->addOption($op1);
723 $op2 = new ilRadioOption($lng->txt("cont_custom"), "n");
724 $par = new ilTextAreaInputGUI("", "full_parameters");
725 $par->setRows(5);
726 $par->setCols(50);
727 $op2->addSubItem($par);
728 $rad_parameters->addOption($op2);
729 $this->form_gui->addItem($rad_parameters);
730 }
731 }
732 }
733
734 $this->form_gui->setTitle($lng->txt("cont_edit_mob_alias_prop"));
735 $this->form_gui->addCommandButton("saveAliasProperties", $lng->txt("save"));
736 $lm_set = new ilSetting("lm");
737 if ($lm_set->get("replace_mob_feature"))
738 {
739 $this->form_gui->addCommandButton("changeObjectReference", $lng->txt("cont_change_object_reference"));
740 }
741 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
742 }
743
747 function getAliasValues()
748 {
749 global $lng;
750
751 // standard view resource
752 $std_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard",
753 $this->content_obj->getPcId());
754 $std_item = $this->content_obj->getMediaObject()->getMediaItem("Standard");
755
756 $values["title"] = $this->content_obj->getMediaObject()->getTitle();
757 $values["st_location"] = $std_item->getLocation();
758 $values["st_format"] = $std_item->getFormat();
759
760 // size
761 $values["st_width_height"]["width"] = $std_alias_item->getWidth();
762 $values["st_width_height"]["height"] = $std_alias_item->getHeight();
763 $values["st_width_height"]["constr_prop"] = true;
764
765 // caption
766 $values["st_caption"] = $std_alias_item->getCaption();
767 if (trim($std_item->getCaption()) == "")
768 {
769 $values["def_caption"] = "<i>".$lng->txt("cont_no_caption")."</i>";
770 }
771 else
772 {
773 $values["def_caption"] = $std_item->getCaption();
774 }
775
776 // text representation
777 $values["st_text_representation"] = $std_alias_item->getTextRepresentation();
778 if (trim($std_item->getTextRepresentation()) == "")
779 {
780 $values["def_text_representation"] = "<i>".$lng->txt("cont_no_text")."</i>";
781 }
782 else
783 {
784 $values["def_text_representation"] = $std_item->getTextRepresentation();
785 }
786
787 // parameters / autostart
788 if (ilObjMediaObject::_useAutoStartParameterOnly($std_item->getLocation(),
789 $std_item->getFormat())) // autostart
790 {
791 $par = $std_alias_item->getParameters();
792 if ($par["autostart"] == "true")
793 {
794 $values["st_autostart"] = true;
795 }
796 }
797 else // parameters
798 {
799 $values["st_parameters"] = $std_alias_item->getParameterString();
800 }
801
802 // size
803 $values["st_derive_size"] = $std_alias_item->definesSize()
804 ? "n"
805 : "y";
806 if ($values["st_derive_size"] == "y")
807 {
808 $values["st_width_height"]["width"] = $std_item->getWidth();
809 $values["st_width_height"]["height"] = $std_item->getHeight();
810 }
811 $values["st_derive_caption"] = $std_alias_item->definesCaption()
812 ? "n"
813 : "y";
814 $values["st_derive_text_representation"] = $std_alias_item->definesTextRepresentation()
815 ? "n"
816 : "y";
817 $values["st_derive_parameters"] = $std_alias_item->definesParameters()
818 ? "n"
819 : "y";
820 if (trim($std_item->getParameterString()) == "")
821 {
822 $values["def_parameters"] = "<i>".$lng->txt("cont_no_parameters")."</i>";
823 }
824 else
825 {
826 $values["def_parameters"] = $std_item->getParameterString();
827 }
828
829 // fullscreen properties
830 if($this->content_obj->getMediaObject()->hasFullScreenItem())
831 {
832 $full_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Fullscreen",
833 $this->content_obj->getPcId());
834 $full_item = $this->content_obj->getMediaObject()->getMediaItem("Fullscreen");
835
836 $values["fullscreen"] = "n";
837 if ($full_alias_item->exists())
838 {
839 $values["fullscreen"] = "y";
840 }
841
842 $values["full_location"] = $full_item->getLocation();
843 $values["full_format"] = $full_item->getFormat();
844 $values["full_width_height"]["width"] = $full_alias_item->getWidth();
845 $values["full_width_height"]["height"] = $full_alias_item->getHeight();
846 $values["full_width_height"]["constr_prop"] = true;
847 $values["full_caption"] = $full_alias_item->getCaption();
848 if (trim($full_item->getCaption()) == "")
849 {
850 $values["full_def_caption"] = "<i>".$lng->txt("cont_no_caption")."</i>";
851 }
852 else
853 {
854 $values["full_def_caption"] = $full_item->getCaption();
855 }
856 $values["full_text_representation"] = $full_alias_item->getTextRepresentation();
857 if (trim($full_item->getTextRepresentation()) == "")
858 {
859 $values["full_def_text_representation"] = "<i>".$lng->txt("cont_no_text")."</i>";
860 }
861 else
862 {
863 $values["full_def_text_representation"] = $full_item->getTextRepresentation();
864 }
865 $values["full_parameters"] = $full_alias_item->getParameterString();
866 $values["full_derive_size"] = $full_alias_item->definesSize()
867 ? "n"
868 : "y";
869 if ($values["full_derive_size"] == "y")
870 {
871 $values["full_width_height"]["width"] = $full_item->getWidth();
872 $values["full_width_height"]["height"] = $full_item->getHeight();
873 }
874 $values["full_derive_caption"] = $full_alias_item->definesCaption()
875 ? "n"
876 : "y";
877 $values["full_derive_text_representation"] = $full_alias_item->definesTextRepresentation()
878 ? "n"
879 : "y";
880
881 // parameters
882 if (ilObjMediaObject::_useAutoStartParameterOnly($full_item->getLocation(),
883 $full_item->getFormat())) // autostart
884 {
885 $par = $full_alias_item->getParameters();
886 if ($par["autostart"] == "true")
887 {
888 $values["full_autostart"] = true;
889 }
890 }
891 else // parameters
892 {
893 $values["full_parameters"] = $full_alias_item->getParameterString();
894 }
895
896 $values["full_derive_parameters"] = $full_alias_item->definesParameters()
897 ? "n"
898 : "y";
899 if (trim($full_item->getParameterString()) == "")
900 {
901 $values["full_def_parameters"] = "<i>".$lng->txt("cont_no_parameters")."</i>";
902 }
903 else
904 {
905 $values["full_def_parameters"] = $full_item->getParameterString();
906 }
907
908 }
909
910 $this->form_gui->setValuesByArray($values);
911 }
912
917 {
918 $std_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard",
919 $this->content_obj->getPcId());
920 $full_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Fullscreen",
921 $this->content_obj->getPcId());
922 $std_item = $this->content_obj->getMediaObject()->getMediaItem("Standard");
923 $full_item = $this->content_obj->getMediaObject()->getMediaItem("Fullscreen");
924
925 // standard size
926 if($_POST["st_derive_size"] == "y")
927 {
928 $std_alias_item->deriveSize();
929 }
930 else
931 {
932 $std_alias_item->setWidth(ilUtil::stripSlashes($_POST["st_width_height"]["width"]));
933 $std_alias_item->setHeight(ilUtil::stripSlashes($_POST["st_width_height"]["height"]));
934 }
935
936 // standard caption
937 if($_POST["st_derive_caption"] == "y")
938 {
939 $std_alias_item->deriveCaption();
940 }
941 else
942 {
943 $std_alias_item->setCaption(ilUtil::stripSlashes($_POST["st_caption"]));
944 }
945
946 // text representation
947 if($_POST["st_derive_text_representation"] == "y")
948 {
949 $std_alias_item->deriveTextRepresentation();
950 }
951 else
952 {
953 $std_alias_item->setTextRepresentation(ilUtil::stripSlashes($_POST["st_text_representation"]));
954 }
955
956 // standard parameters
957 if($_POST["st_derive_parameters"] == "y")
958 {
959 $std_alias_item->deriveParameters();
960 }
961 else
962 {
963 if (ilObjMediaObject::_useAutoStartParameterOnly($std_item->getLocation(),
964 $std_item->getFormat())) // autostart
965 {
966 if ($_POST["st_autostart"])
967 {
968 $std_alias_item->setParameters(ilUtil::extractParameterString('autostart="true"'));
969 }
970 else
971 {
972 $std_alias_item->setParameters(ilUtil::extractParameterString('autostart="false"'));
973 }
974 }
975 else // parameters
976 {
977 $std_alias_item->setParameters(ilUtil::extractParameterString(ilUtil::stripSlashes(utf8_decode($_POST["st_parameters"]))));
978 }
979 }
980
981 if($this->content_obj->getMediaObject()->hasFullscreenItem())
982 {
983 if ($_POST["fullscreen"] == "y")
984 {
985 if (!$full_alias_item->exists())
986 {
987 $full_alias_item->insert();
988 }
989
990 // fullscreen size
991 if($_POST["full_derive_size"] == "y")
992 {
993 $full_alias_item->deriveSize();
994 }
995 else
996 {
997 $full_alias_item->setWidth(ilUtil::stripSlashes($_POST["full_width_height"]["width"]));
998 $full_alias_item->setHeight(ilUtil::stripSlashes($_POST["full_width_height"]["height"]));
999 }
1000
1001 // fullscreen caption
1002 if($_POST["full_derive_caption"] == "y")
1003 {
1004 $full_alias_item->deriveCaption();
1005 }
1006 else
1007 {
1008 $full_alias_item->setCaption(ilUtil::stripSlashes($_POST["full_caption"]));
1009 }
1010
1011 // fullscreen text representation
1012 if($_POST["full_derive_text_representation"] == "y")
1013 {
1014 $full_alias_item->deriveTextRepresentation();
1015 }
1016 else
1017 {
1018 $full_alias_item->setTextRepresentation(ilUtil::stripSlashes($_POST["full_text_representation"]));
1019 }
1020
1021 // fullscreen parameters
1022 if($_POST["full_derive_parameters"] == "y")
1023 {
1024 $full_alias_item->deriveParameters();
1025 }
1026 else
1027 {
1028 if (ilObjMediaObject::_useAutoStartParameterOnly($full_item->getLocation(),
1029 $full_item->getFormat())) // autostart
1030 {
1031 if ($_POST["full_autostart"])
1032 {
1033 $full_alias_item->setParameters(ilUtil::extractParameterString('autostart="true"'));
1034 }
1035 else
1036 {
1037 $full_alias_item->setParameters(ilUtil::extractParameterString('autostart="false"'));
1038 }
1039 }
1040 else
1041 {
1042 $full_alias_item->setParameters(ilUtil::extractParameterString(ilUtil::stripSlashes(utf8_decode($_POST["full_parameters"]))));
1043 }
1044 }
1045 }
1046 else
1047 {
1048 if ($full_alias_item->exists())
1049 {
1050 $full_alias_item->delete();
1051 }
1052 }
1053 }
1054
1055 $this->updated = $this->pg_obj->update();
1056 if ($this->updated === true)
1057 {
1058 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
1059 }
1060 else
1061 {
1062 $this->pg_obj->addHierIDs();
1063 $this->editAlias();
1064 }
1065 }
1066
1071 {
1072 $this->ilias->account->addObjectToClipboard($this->content_obj->getMediaObject()->getId(), $this->content_obj->getMediaObject()->getType()
1073 , $this->content_obj->getMediaObject()->getTitle());
1074 ilUtil::sendSuccess($this->lng->txt("copied_to_clipboard"), true);
1075 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
1076 }
1077
1081 function centerAlign()
1082 {
1083 $std_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard",
1084 $this->content_obj->getPcId());
1085 $std_alias_item->setHorizontalAlign("Center");
1086 $_SESSION["il_pg_error"] = $this->pg_obj->update();
1087 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
1088 }
1089
1093 function leftAlign()
1094 {
1095 $std_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard",
1096 $this->content_obj->getPcId());
1097 $std_alias_item->setHorizontalAlign("Left");
1098 $_SESSION["il_pg_error"] = $this->pg_obj->update();
1099 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
1100 }
1101
1105 function rightAlign()
1106 {
1107 $std_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard",
1108 $this->content_obj->getPcId());
1109 $std_alias_item->setHorizontalAlign("Right");
1110 $_SESSION["il_pg_error"] = $this->pg_obj->update();
1111 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
1112 }
1113
1118 {
1119 $std_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard",
1120 $this->content_obj->getPcId());
1121 $std_alias_item->setHorizontalAlign("LeftFloat");
1122 $_SESSION["il_pg_error"] = $this->pg_obj->update();
1123 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
1124 }
1125
1130 {
1131 $std_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard",
1132 $this->content_obj->getPcId());
1133 $std_alias_item->setHorizontalAlign("RightFloat");
1134 $_SESSION["il_pg_error"] = $this->pg_obj->update();
1135 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
1136 }
1137
1142 {
1143 // check whether there is more than one style class
1144 $chars = $this->getCharacteristics();
1145
1146 if (count($chars) > 1 ||
1147 ($this->content_obj->getClass() != "" && $this->content_obj->getClass() != "Media"))
1148 {
1149 return true;
1150 }
1151 return false;
1152 }
1153
1157 function editStyle()
1158 {
1159 global $ilCtrl, $tpl, $lng;
1160
1161 $this->displayValidationError();
1162
1163 // edit form
1164 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1165 $form = new ilPropertyFormGUI();
1166 $form->setFormAction($ilCtrl->getFormAction($this));
1167 $form->setTitle($this->lng->txt("cont_edit_style"));
1168
1169 // characteristic selection
1170 require_once("./Services/Form/classes/class.ilAdvSelectInputGUI.php");
1171 $char_prop = new ilAdvSelectInputGUI($this->lng->txt("cont_characteristic"),
1172 "characteristic");
1173
1174 $chars = $this->getCharacteristics();
1175 if (is_object($this->content_obj))
1176 {
1177 if ($chars[$a_seleted_value] == "" && ($this->content_obj->getClass() != ""))
1178 {
1179 $chars = array_merge(
1180 array($this->content_obj->getClass() => $this->content_obj->getClass()),
1181 $chars);
1182 }
1183 }
1184
1185 $selected = $this->content_obj->getClass();
1186 if ($selected == "")
1187 {
1188 $selected = "MediaContainer";
1189 }
1190
1191 foreach ($chars as $k => $char)
1192 {
1193 $html = '<table class="ilc_media_cont_'.$k.'"><tr><td>'.
1194 $char.'</td></tr></table>';
1195 $char_prop->addOption($k, $char, $html);
1196 }
1197
1198 $char_prop->setValue($selected);
1199 $form->addItem($char_prop);
1200
1201 // save button
1202 $form->addCommandButton("saveStyle", $lng->txt("save"));
1203
1204 $html = $form->getHTML();
1205 $tpl->setContent($html);
1206 return $ret;
1207 }
1208
1212 function saveStyle()
1213 {
1214 $this->content_obj->setClass($_POST["characteristic"]);
1215 $this->updated = $this->pg_obj->update();
1216 if ($this->updated === true)
1217 {
1218 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
1219 }
1220 else
1221 {
1222 $this->pg_obj->addHierIDs();
1223 $this->editStyle();
1224 }
1225 }
1226
1233 function getTabs(&$tab_gui, $a_create = false, $a_change_obj_ref = false)
1234 {
1235 global $ilCtrl, $ilTabs;
1236
1237 if (!$a_create)
1238 {
1239 if ($this->checkStyleSelection())
1240 {
1241 $ilTabs->addTarget("cont_style",
1242 $ilCtrl->getLinkTarget($this, "editStyle"), "editStyle",
1243 get_class($this));
1244 }
1245
1246 $ilTabs->addTarget("cont_mob_inst_prop",
1247 $ilCtrl->getLinkTarget($this, "editAlias"), "editAlias",
1248 get_class($this));
1249
1250 if ($this->getEnabledMapAreas())
1251 {
1252 $st_item = $this->content_obj->getMediaObject()->getMediaItem("Standard");
1253 if (is_object($st_item))
1254 {
1255 $format = $st_item->getFormat();
1256 if (substr($format, 0, 5) == "image" && !is_int(strpos($format, "svg")))
1257 {
1258 $ilTabs->addTarget("cont_inst_map_areas",
1259 $ilCtrl->getLinkTargetByClass("ilpcimagemapeditorgui", "editMapAreas"), array(),
1260 "ilpcimagemapeditorgui");
1261 }
1262 }
1263 }
1264 }
1265 else
1266 {
1267 if ($a_change_obj_ref)
1268 {
1269 $cmd = "changeObjectReference";
1270 }
1271 else
1272 {
1273 $cmd = "insert";
1274 }
1275
1276 $ilCtrl->setParameter($this, "subCmd", "insertNew");
1277 $ilTabs->addSubTabTarget("cont_new_mob",
1278 $ilCtrl->getLinkTarget($this, $cmd), $cmd);
1279
1280 $ilCtrl->setParameter($this, "subCmd", "insertFromPool");
1281 $ilTabs->addSubTabTarget("cont_mob_from_media_pool",
1282 $ilCtrl->getLinkTarget($this, $cmd), $cmd);
1283 $ilCtrl->setParameter($this, "subCmd", "");
1284 }
1285 }
1286
1287}
1288?>
$_GET["client_id"]
$_SESSION["AccountId"]
This class represents an advanced selection list property in a property form.
This class represents a checkbox property in a property form.
This class represents a section header in a property form.
Class ilMediaAliasItem.
static lookupForeignId($a_id)
Lookup Foreign Id.
TableGUI class for recent changes in wiki.
This class represents a non editable value in a property form.
Class ilObjMediaObjectGUI.
static setObjectPerCreationForm($a_mob)
Set media object values from creation form.
static _useAutoStartParameterOnly($a_loc, $a_format)
Check whether only autostart parameter should be supported (instead of parameters input field.
static _getSimpleMimeTypes()
Get simple mime types that deactivate parameter property files tab in ILIAS.
Media pool object.
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
User interface class for page content map editor.
Class ilPCMediaObjectGUI.
rightFloatAlign()
align media object to right, floating text
initAliasForm()
Init alias form.
editAlias()
edit properties form
leftFloatAlign()
align media object to left, floating text
leftAlign()
align media object to left
& executeCommand()
execute command
insert($a_post_cmd="edpost", $a_submit_cmd="create_mob", $a_input_error=false)
Insert new media object form.
copyToClipboard()
copy media object to clipboard
insertFromPool($a_change_obj_ref=false)
Insert media object from pool.
& create($a_create_alias=true, $a_change_obj_ref=false)
create new media object in dom and update page in db
getAliasValues()
Put alias values into form.
centerAlign()
align media object to center
rightAlign()
align media object to right
createNewObjectReference()
Create new media object and replace currrent media item with it.
poolSelection($a_change_obj_ref=false)
Pool Selection.
checkStyleSelection()
Checks whether style selection shoudl be available or not.
selectObjectReference()
Create new media object and replace currrent media item with it.
getEnabledMapAreas()
Get Enable map areas.
changeObjectReference()
Change object reference.
setEnabledMapAreas($a_enabledmapareas)
Set Enable map areas.
getTabs(&$tab_gui, $a_create=false, $a_change_obj_ref=false)
add tabs to ilTabsGUI object
selectPool($a_change_obj_ref=false)
Select concrete pool.
ilPCMediaObjectGUI($a_pg_obj, $a_content_obj, $a_hier_id=0, $a_pc_id="")
saveAliasProperties()
save table properties in db and return to page edit screen
Class ilPCMediaObject.
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
getHierId()
get hierarchical id in dom object
getCharacteristicsOfCurrentStyle($a_type)
Get characteristics of current style.
displayValidationError()
display validation errors
getCharacteristics()
Get characteristics.
setCharacteristics($a_chars)
Set Characteristics.
setHierId($a_hier_id)
get hierarchical id in dom object
Select media pool for adding objects into pages.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
ILIAS Setting Class.
This class represents a text area property in a property form.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static extractParameterString($a_parstr)
extracts parameter value pairs from a string into an array
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
This class represents a width/height item in a property form.
$_POST['username']
Definition: cron.php:12
$html
Definition: example_001.php:87
global $ilCtrl
Definition: ilias.php:18
redirection script todo: (a better solution should control the processing via a xml file)
$cmd
Definition: sahs_server.php:35
$lm_set