ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 __construct($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::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
34
35 $this->setCharacteristics(array(
36 "MediaContainer" => $this->lng->txt("cont_Media"),
37 "MediaContainerMax50" => "MediaContainerMax50",
38 "MediaContainerFull100" => "MediaContainerFull100"
39 ));
40
41 }
42
43 function setHeader($a_title = "")
44 {
45 $this->header = $a_title;
46 }
47
48 function getHeader()
49 {
50 return $this->header;
51 }
52
58 function setEnabledMapAreas($a_enabledmapareas)
59 {
60 $this->enabledmapareas = $a_enabledmapareas;
61 }
62
69 {
70 return $this->enabledmapareas;
71 }
72
76 function executeCommand()
77 {
78 global $tpl, $lng, $ilTabs;
79
80 $this->getCharacteristicsOfCurrentStyle("media_cont"); // scorm-2004
81
82 // get next class that processes or forwards current command
83 $next_class = $this->ctrl->getNextClass($this);
84
85 // get current command
86 $cmd = $this->ctrl->getCmd();
87
88 if (is_object ($this->content_obj))
89 {
90 $this->tpl->clearHeader();
91 $tpl->setTitleIcon(ilUtil::getImagePath("icon_mob.svg"));
92 $this->getTabs($this->tabs_gui);
93
94 $mob = $this->content_obj->getMediaObject();
95 if (is_object($mob))
96 {
97 $tpl->setVariable("HEADER", $lng->txt("mob").": ".
98 $this->content_obj->getMediaObject()->getTitle());
99 $mob_gui = new ilObjMediaObjectGUI("", $this->content_obj->getMediaObject()->getId(),false, false);
100 $mob_gui->setBackTitle($this->page_back_title);
101 $mob_gui->setEnabledMapAreas($this->getEnabledMapAreas());
102 $mob_gui->getTabs($this->tabs_gui);
103 }
104 }
105 else
106 {
107 }
108
109 switch($next_class)
110 {
111 case "ilobjmediaobjectgui":
112 include_once ("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
113 $this->tpl->clearHeader();
114 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_mob.svg"));
115 $this->tpl->setTitle($this->lng->txt("mob").": ".
116 $this->content_obj->getMediaObject()->getTitle());
117 $mob_gui = new ilObjMediaObjectGUI("", $this->content_obj->getMediaObject()->getId(),false, false);
118 $mob_gui->setBackTitle($this->page_back_title);
119 $mob_gui->setEnabledMapAreas($this->getEnabledMapAreas());
120 $ret = $this->ctrl->forwardCommand($mob_gui);
121 break;
122
123 // instance image map editing
124 case "ilpcimagemapeditorgui":
125 require_once("./Services/COPage/classes/class.ilPCImageMapEditorGUI.php");
126 $ilTabs->setTabActive("cont_inst_map_areas");
127 $image_map_edit = new ilPCImageMapEditorGUI($this->content_obj,
128 $this->pg_obj);
129 $ret = $this->ctrl->forwardCommand($image_map_edit);
130 $tpl->setContent($ret);
131 break;
132
133 default:
134 $ret = $this->$cmd();
135 break;
136 }
137
138 return $ret;
139 }
140
144 function insert($a_post_cmd = "edpost", $a_submit_cmd = "create_mob", $a_input_error = false)
145 {
146 global $ilTabs, $tpl, $ilCtrl, $lng;
147
148 if ($_GET["subCmd"] == "insertNew")
149 {
150 $_SESSION["cont_media_insert"] = "insertNew";
151 }
152 if ($_GET["subCmd"] == "insertFromPool")
153 {
154 $_SESSION["cont_media_insert"] = "insertFromPool";
155 }
156
157 if (($_GET["subCmd"] == "") && $_SESSION["cont_media_insert"] != "")
158 {
159 $_GET["subCmd"] = $_SESSION["cont_media_insert"];
160 }
161
162 switch ($_GET["subCmd"])
163 {
164 case "insertFromPool":
165 $this->insertFromPool();
166 break;
167
168 case "poolSelection":
169 $this->poolSelection();
170 break;
171
172 case "selectPool":
173 $this->selectPool();
174 break;
175
176 case "insertNew":
177 default:
178 $this->getTabs($ilTabs, true);
179 $ilTabs->setSubTabActive("cont_new_mob");
180
181 include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
182 if ($a_input_error)
183 {
184 $form = $this->form;
185 }
186 else
187 {
188 $mob_gui = new ilObjMediaObjectGUI("");
189 $mob_gui->initForm("create");
190 $form = $mob_gui->getForm();
191 }
192 $form->setFormAction($ilCtrl->getFormAction($this, "create_mob"));
193 $form->clearCommandButtons();
194 $form->addCommandButton("create_mob", $lng->txt("save"));
195 $form->addCommandButton("cancelCreate", $lng->txt("cancel"));
196
197 $this->displayValidationError();
198
199 $tpl->setContent($form->getHTML());
200
201 break;
202 }
203 }
204
209 {
210 global $ilTabs, $ilCtrl, $lng;
211
212 if ($_GET["subCmd"] == "insertNew")
213 {
214 $_SESSION["cont_media_insert"] = "insertNew";
215 }
216 if ($_GET["subCmd"] == "insertFromPool")
217 {
218 $_SESSION["cont_media_insert"] = "insertFromPool";
219 }
220
221 if (($_GET["subCmd"] == "") && $_SESSION["cont_media_insert"] != "")
222 {
223 $_GET["subCmd"] = $_SESSION["cont_media_insert"];
224 }
225
226 switch ($_GET["subCmd"])
227 {
228 case "insertFromPool":
229 $this->insertFromPool(true);
230 break;
231
232 case "poolSelection":
233 $this->poolSelection(true);
234 break;
235
236 case "selectPool":
237 $this->selectPool(true);
238 break;
239
240 case "insertNew":
241 default:
242 $ilCtrl->setParameter($this, "subCmd", "changeObjectReference");
243 $this->getTabs($ilTabs, true, true);
244 $ilTabs->setSubTabActive("cont_new_mob");
245
246 $this->displayValidationError();
247
248 $mob_gui = new ilObjMediaObjectGUI("");
249 $mob_gui->initForm("create");
250 $form = $mob_gui->getForm();
251 $form->setFormAction($ilCtrl->getFormAction($this));
252 $form->clearCommandButtons();
253 $form->addCommandButton("createNewObjectReference", $lng->txt("save"));
254 $form->addCommandButton("cancelCreate", $lng->txt("cancel"));
255 $this->tpl->setContent($form->getHTML());
256 }
257 }
258
262 function insertFromPool($a_change_obj_ref = false)
263 {
264 global $ilCtrl, $ilAccess, $ilTabs, $tpl, $lng, $ilToolbar;
265
266 if ($_SESSION["cont_media_pool"] != "" &&
267 $ilAccess->checkAccess("write", "", $_SESSION["cont_media_pool"])
268 && ilObject::_lookupType(ilObject::_lookupObjId($_SESSION["cont_media_pool"])) == "mep")
269 {
270 $html = "";
271 $tb = new ilToolbarGUI();
272
273 $ilCtrl->setParameter($this, "subCmd", "poolSelection");
274 if ($a_change_obj_ref)
275 {
276 $tb->addButton($lng->txt("cont_switch_to_media_pool"),
277 $ilCtrl->getLinkTarget($this, "changeObjectReference"));
278 }
279 else
280 {
281 $tb->addButton($lng->txt("cont_switch_to_media_pool"),
282 $ilCtrl->getLinkTarget($this, "insert"));
283
284 }
285 $ilCtrl->setParameter($this, "subCmd", "");
286
287 $html = $tb->getHTML();
288
289 $this->getTabs($ilTabs, true, $a_change_obj_ref);
290 $ilTabs->setSubTabActive("cont_mob_from_media_pool");
291
292 include_once("./Modules/MediaPool/classes/class.ilObjMediaPool.php");
293 include_once("./Modules/MediaPool/classes/class.ilMediaPoolTableGUI.php");
294 $pool = new ilObjMediaPool($_SESSION["cont_media_pool"]);
295 $ilCtrl->setParameter($this, "subCmd", "insertFromPool");
296 $tcmd = ($a_change_obj_ref)
297 ? "changeObjectReference"
298 : "insert";
299 $tmode = ($a_change_obj_ref)
302 $mpool_table = new ilMediaPoolTableGUI($this, $tcmd, $pool, "mep_folder",
303 $tmode);
304
305 $html.= $mpool_table->getHTML();
306
307 $tpl->setContent($html);
308 }
309 else
310 {
311 $this->poolSelection($a_change_obj_ref);
312 }
313 }
314
318 function selectPool($a_change_obj_ref = false)
319 {
320 global $ilCtrl;
321
322 $_SESSION["cont_media_pool"] = $_GET["pool_ref_id"];
323 $ilCtrl->setParameter($this, "subCmd", "insertFromPool");
324 if ($a_change_obj_ref)
325 {
326 $ilCtrl->redirect($this, "changeObjectReference");
327 }
328 else
329 {
330 $ilCtrl->redirect($this, "insert");
331 }
332 }
333
337 function poolSelection($a_change_obj_ref = false)
338 {
339 global $tpl, $ilTabs, $ilCtrl;
340
341 $this->getTabs($ilTabs, true, $a_change_obj_ref);
342 $ilTabs->setSubTabActive("cont_mob_from_media_pool");
343
344 include_once "./Services/COPage/classes/class.ilPoolSelectorGUI.php";
345
346 if ($a_change_obj_ref)
347 {
348 $ilCtrl->setParameter($this, "subCmd", "poolSelection");
349 $exp = new ilPoolSelectorGUI($this, "changeObjectReference", $this, "changeObjectReference");
350 }
351 else
352 {
353 $ilCtrl->setParameter($this, "subCmd", "poolSelection");
354 $exp = new ilPoolSelectorGUI($this, "insert");
355 }
356
357 // filter
358 $exp->setTypeWhiteList(array("root", "cat", "grp", "fold", "crs", "mep"));
359 $exp->setClickableTypes(array('mep'));
360
361 if (!$exp->handleCommand())
362 {
363 $tpl->setContent($exp->getHTML());
364 }
365 }
366
367
373 {
374 $this->create(false, true);
375 }
376
382 {
383 global $ilCtrl, $lng;
384 if (is_array($_POST["id"]) && count($_POST["id"]) == 1)
385 {
386 include_once("./Services/COPage/classes/class.ilPCMediaObject.php");
387 include_once("./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
389 $this->content_obj->readMediaObject($fid);
390 $this->content_obj->updateObjectReference();
391 $this->updated = $this->pg_obj->update();
392 }
393 else
394 {
395 ilUtil::sendInfo($lng->txt("cont_select_max_one_item"), true);
396 $ilCtrl->redirect($this, "changeObjectReference");
397
398 }
399 $ilCtrl->redirect($this, "editAlias");
400 }
401
405 function &create($a_create_alias = true, $a_change_obj_ref = false)
406 {
407 global $ilCtrl, $lng;
408
409 if ($_GET["subCmd"] == "insertFromPool")
410 {
411 if (is_array($_POST["id"]))
412 {
413 for($i = count($_POST["id"]) - 1; $i>=0; $i--)
414 {
415 include_once("./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
417 include_once("./Services/COPage/classes/class.ilPCMediaObject.php");
418 $this->content_obj = new ilPCMediaObject($this->getPage());
419 $this->content_obj->readMediaObject($fid);
420 $this->content_obj->createAlias($this->pg_obj, $_GET["hier_id"], $this->pc_id);
421 }
422 $this->updated = $this->pg_obj->update();
423 }
424
425 $ilCtrl->returnToParent($this);
426 }
427
428 // check form input
429 $mob_gui = new ilObjMediaObjectGUI("");
430 $mob_gui->initForm("create");
431
432 if (!$mob_gui->checkFormInput())
433 {
434 $this->form = $mob_gui->getForm();
435 $this->insert("edpost", "create_mob", true);
436 return;
437 }
438 // create dummy object in db (we need an id)
439 include_once("./Services/COPage/classes/class.ilPCMediaObject.php");
440 if ($a_change_obj_ref != true)
441 {
442 $this->content_obj = new ilPCMediaObject($this->getPage());
443 }
444 $this->content_obj->createMediaObject();
445 $media_obj = $this->content_obj->getMediaObject();
446
447 include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
449
450 if ($a_create_alias)
451 {
452 // need a pcmediaobject here
453 //$this->node = $this->createPageContentNode();
454
455 $this->content_obj->createAlias($this->pg_obj, $this->hier_id, $this->pc_id);
456 $this->updated = $this->pg_obj->update();
457 if ($this->updated === true)
458 {
459 $this->pg_obj->stripHierIDs();
460 $this->pg_obj->addHierIDs();
461 $ilCtrl->setParameter($this, "hier_id", $this->content_obj->readHierId());
462 $ilCtrl->setParameter($this, "pc_id", $this->content_obj->readPCId());
463 $this->content_obj->setHierId($this->content_obj->readHierId());
464 $this->setHierId($this->content_obj->readHierId());
465 $this->content_obj->setPCId($this->content_obj->readPCId());
466 ilUtil::sendSuccess($lng->txt("saved_media_object"), true);
467 $this->ctrl->redirectByClass("ilobjmediaobjectgui", "edit");
468
469 //$this->ctrl->returnToParent($this, "jump".$this->hier_id);
470 }
471 else
472 {
473 $this->insert();
474 }
475 }
476 else
477 {
478 if ($a_change_obj_ref == true)
479 {
480 $this->content_obj->updateObjectReference();
481 $this->updated = $this->pg_obj->update();
482 $this->ctrl->redirect($this, "editAlias");
483 }
484 return $this->content_obj;
485 }
486 }
487
488
492 function editAlias()
493 {
494 global $tpl;
495
496 $this->initAliasForm();
497 $this->getAliasValues();
498 $tpl->setContent($this->form_gui->getHTML());
499 }
500
504 function initAliasForm()
505 {
506 global $lng, $ilCtrl;
507
508 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
509
510 $this->form_gui = new ilPropertyFormGUI();
511
512 // standard view resource
513 $std_alias_item = new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard",
514 $this->content_obj->getPcId());
515 $std_item = $this->content_obj->getMediaObject()->getMediaItem("Standard");
516
517 // title, location and format
518 $title = new ilNonEditableValueGUI($lng->txt("title"), "title");
519 $this->form_gui->addItem($title);
520 $loc = new ilNonEditableValueGUI(
521 $this->lng->txt("cont_".strtolower($std_item->getLocationType())), "st_location");
522 $this->form_gui->addItem($loc);
523 $format = new ilNonEditableValueGUI(
524 $this->lng->txt("cont_format"), "st_format");
525 $this->form_gui->addItem($format);
526
527 // standard size
528 $radio_size = new ilRadioGroupInputGUI($lng->txt("size"), "st_derive_size");
529 $orig_size = $std_item->getOriginalSize();
530 $op1 = new ilRadioOption($lng->txt("cont_default").
531 " (".$orig_size["width"]." x ".$orig_size["height"].")", "y");
532 $op2 = new ilRadioOption($lng->txt("cont_custom"), "n");
533 $radio_size->addOption($op1);
534
535 // width height
536 include_once("./Services/MediaObjects/classes/class.ilWidthHeightInputGUI.php");
537 $width_height = new ilWidthHeightInputGUI($lng->txt("cont_width").
538 " / ".$lng->txt("cont_height"), "st_width_height");
539 $width_height->setConstrainProportions(true);
540 $op2->addSubItem($width_height);
541
542 $radio_size->addOption($op2);
543 $this->form_gui->addItem($radio_size);
544
545 // standard caption
546 $rad_caption = new ilRadioGroupInputGUI($lng->txt("cont_caption"), "st_derive_caption");
547 $op1 = new ilRadioOption($lng->txt("cont_default"), "y");
548 $def_cap = new ilNonEditableValueGUI("", "def_caption");
549 $op1->addSubItem($def_cap);
550 $op2 = new ilRadioOption($lng->txt("cont_custom"), "n");
551 $rad_caption->addOption($op1);
552
553 $caption = new ilTextAreaInputGUI("", "st_caption");
554 $caption->setCols(30);
555 $caption->setRows(2);
556 $op2->addSubItem($caption);
557
558 /*$caption = new ilTextInputGUI("", "st_caption");
559 $caption->setSize(40);
560 $caption->setMaxLength(200);
561 $op2->addSubItem($caption);*/
562 $rad_caption->addOption($op2);
563 $this->form_gui->addItem($rad_caption);
564
565 // standard text representation
566 if (substr($std_item->getFormat(), 0, 5) == "image")
567 {
568 $rad_tr = new ilRadioGroupInputGUI($lng->txt("text_repr"), "st_derive_text_representation");
569 $op1 = new ilRadioOption($lng->txt("cont_default"), "y");
570 $def_tr = new ilNonEditableValueGUI("", "def_text_representation");
571 $op1->addSubItem($def_tr);
572 $op2 = new ilRadioOption($lng->txt("cont_custom"), "n");
573 $tr = new ilTextAreaInputGUI("", "st_text_representation");
574 $tr->setCols(30);
575 $tr->setRows(2);
576 $rad_tr->addOption($op1);
577 $op2->addSubItem($tr);
578 $rad_tr->addOption($op2);
579 $this->form_gui->addItem($rad_tr);
580 $rad_tr->setInfo($lng->txt("text_repr_info"));
581 }
582
583 // standard parameters
584 if (!in_array($std_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes()))
585 {
586 if (ilObjMediaObject::_useAutoStartParameterOnly($std_item->getLocation(),
587 $std_item->getFormat())) // autostart
588 {
589 $par = $std_item->getParameters();
590 $def_str = ($par["autostart"] == "true")
591 ? " (".$lng->txt("yes").")"
592 : " (".$lng->txt("no").")";
593 $rad_auto = new ilRadioGroupInputGUI($lng->txt("cont_autostart"),
594 "st_derive_parameters");
595 $op1 = new ilRadioOption($lng->txt("cont_default").$def_str, "y");
596 $rad_auto->addOption($op1);
597 $op2 = new ilRadioOption($lng->txt("cont_custom"), "n");
598 $auto = new ilCheckboxInputGUI($lng->txt("enabled"), "st_autostart");
599 $op2->addSubItem($auto);
600 $rad_auto->addOption($op2);
601 $this->form_gui->addItem($rad_auto);
602 }
603 else // parameters
604 {
605 $rad_parameters = new ilRadioGroupInputGUI($lng->txt("cont_parameter"), "st_derive_parameters");
606 $op1 = new ilRadioOption($lng->txt("cont_default"), "y");
607 $def_par = new ilNonEditableValueGUI("", "def_parameters");
608 $op1->addSubItem($def_par);
609 $rad_parameters->addOption($op1);
610 $op2 = new ilRadioOption($lng->txt("cont_custom"), "n");
611 $par = new ilTextAreaInputGUI("", "st_parameters");
612 $par->setRows(5);
613 $par->setCols(50);
614 $op2->addSubItem($par);
615 $rad_parameters->addOption($op2);
616 $this->form_gui->addItem($rad_parameters);
617 }
618 }
619
620 // fullscreen view
621 if($this->content_obj->getMediaObject()->hasFullScreenItem())
622 {
623 $full_alias_item = new ilMediaAliasItem($this->dom, $this->getHierId(), "Fullscreen",
624 $this->content_obj->getPcId());
625 $full_item = $this->content_obj->getMediaObject()->getMediaItem("Fullscreen");
626
627 $fs_sec = new ilFormSectionHeaderGUI();
628 $fs_sec->setTitle($lng->txt("cont_fullscreen"));
629 $this->form_gui->addItem($fs_sec);
630
631
632 // resource
633 $radio_prop = new ilRadioGroupInputGUI($lng->txt("cont_resource"), "fullscreen");
634 $op1 = new ilRadioOption($lng->txt("cont_none"), "n");
635 $radio_prop->addOption($op1);
636 $op2 = new ilRadioOption($this->lng->txt("cont_".strtolower($full_item->getLocationType())).": ".
637 $full_item->getLocation(), "y");
638 $radio_prop->addOption($op2);
639 $this->form_gui->addItem($radio_prop);
640
641 // format
642 $format = new ilNonEditableValueGUI(
643 $this->lng->txt("cont_format"), "full_format");
644 $this->form_gui->addItem($format);
645
646 // full size
647 $radio_size = new ilRadioGroupInputGUI($lng->txt("size"), "full_derive_size");
648 $fw_size = $std_item->getOriginalSize();
649 $op1 = new ilRadioOption($lng->txt("cont_default").
650 " (".$fw_size["width"]." x ".$fw_size["height"].")", "y");
651 $op2 = new ilRadioOption($lng->txt("cont_custom"), "n");
652 $radio_size->addOption($op1);
653
654 // width height
655 include_once("./Services/MediaObjects/classes/class.ilWidthHeightInputGUI.php");
656 $width_height = new ilWidthHeightInputGUI($lng->txt("cont_width").
657 " / ".$lng->txt("cont_height"), "full_width_height");
658 $width_height->setConstrainProportions(true);
659 $op2->addSubItem($width_height);
660
661 $radio_size->addOption($op2);
662 $this->form_gui->addItem($radio_size);
663
664 // fullscreen caption
665 $rad_caption = new ilRadioGroupInputGUI($lng->txt("cont_caption"), "full_derive_caption");
666 $op1 = new ilRadioOption($lng->txt("cont_default"), "y");
667 $def_cap = new ilNonEditableValueGUI("", "full_def_caption");
668 $op1->addSubItem($def_cap);
669 $op2 = new ilRadioOption($lng->txt("cont_custom"), "n");
670 $rad_caption->addOption($op1);
671
672 $caption = new ilTextAreaInputGUI("", "full_caption");
673 $caption->setCols(30);
674 $caption->setRows(2);
675 $op2->addSubItem($caption);
676
677 /*$caption = new ilTextInputGUI("", "full_caption");
678 $caption->setSize(40);
679 $caption->setMaxLength(200);
680 $op2->addSubItem($caption);*/
681 $rad_caption->addOption($op2);
682 $this->form_gui->addItem($rad_caption);
683
684 // fullscreen text representation
685 if (substr($full_item->getFormat(), 0, 5) == "image")
686 {
687 $rad_tr = new ilRadioGroupInputGUI($lng->txt("text_repr"), "full_derive_text_representation");
688 $op1 = new ilRadioOption($lng->txt("cont_default"), "y");
689 $def_tr = new ilNonEditableValueGUI("", "full_def_text_representation");
690 $op1->addSubItem($def_tr);
691 $op2 = new ilRadioOption($lng->txt("cont_custom"), "n");
692 $tr = new ilTextAreaInputGUI("", "full_text_representation");
693 $tr->setCols(30);
694 $tr->setRows(2);
695 $rad_tr->addOption($op1);
696 $op2->addSubItem($tr);
697 $rad_tr->addOption($op2);
698 $this->form_gui->addItem($rad_tr);
699 $rad_tr->setInfo($lng->txt("text_repr_info"));
700 }
701
702 // fullscreen parameters
703 if (!in_array($full_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes()))
704 {
705 if (ilObjMediaObject::_useAutoStartParameterOnly($full_item->getLocation(),
706 $full_item->getFormat())) // autostart
707 {
708 $par = $full_item->getParameters();
709 $def_str = ($par["autostart"] == "true")
710 ? " (".$lng->txt("yes").")"
711 : " (".$lng->txt("no").")";
712 $rad_auto = new ilRadioGroupInputGUI($lng->txt("cont_autostart"),
713 "full_derive_parameters");
714 $op1 = new ilRadioOption($lng->txt("cont_default").$def_str, "y");
715 $rad_auto->addOption($op1);
716 $op2 = new ilRadioOption($lng->txt("cont_custom"), "n");
717 $auto = new ilCheckboxInputGUI($lng->txt("enabled"), "full_autostart");
718 $op2->addSubItem($auto);
719 $rad_auto->addOption($op2);
720 $this->form_gui->addItem($rad_auto);
721 }
722 else // parameters
723 {
724 $rad_parameters = new ilRadioGroupInputGUI($lng->txt("cont_parameter"), "full_derive_parameters");
725 $op1 = new ilRadioOption($lng->txt("cont_default"), "y");
726 $def_par = new ilNonEditableValueGUI("", "full_def_parameters");
727 $op1->addSubItem($def_par);
728 $rad_parameters->addOption($op1);
729 $op2 = new ilRadioOption($lng->txt("cont_custom"), "n");
730 $par = new ilTextAreaInputGUI("", "full_parameters");
731 $par->setRows(5);
732 $par->setCols(50);
733 $op2->addSubItem($par);
734 $rad_parameters->addOption($op2);
735 $this->form_gui->addItem($rad_parameters);
736 }
737 }
738 }
739
740 $this->form_gui->setTitle($lng->txt("cont_edit_mob_alias_prop"));
741 $this->form_gui->addCommandButton("saveAliasProperties", $lng->txt("save"));
742 $lm_set = new ilSetting("lm");
743 if ($lm_set->get("replace_mob_feature"))
744 {
745 $this->form_gui->addCommandButton("changeObjectReference", $lng->txt("cont_change_object_reference"));
746 }
747 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
748 }
749
753 function getAliasValues()
754 {
755 global $lng;
756
757 // standard view resource
758 $std_alias_item = new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard",
759 $this->content_obj->getPcId());
760 $std_item = $this->content_obj->getMediaObject()->getMediaItem("Standard");
761
762 $values["title"] = $this->content_obj->getMediaObject()->getTitle();
763 $values["st_location"] = $std_item->getLocation();
764 $values["st_format"] = $std_item->getFormat();
765
766 // size
767 $values["st_width_height"]["width"] = $std_alias_item->getWidth();
768 $values["st_width_height"]["height"] = $std_alias_item->getHeight();
769 $values["st_width_height"]["constr_prop"] = true;
770
771 // caption
772 $values["st_caption"] = $std_alias_item->getCaption();
773 if (trim($std_item->getCaption()) == "")
774 {
775 $values["def_caption"] = "<i>".$lng->txt("cont_no_caption")."</i>";
776 }
777 else
778 {
779 $values["def_caption"] = $std_item->getCaption();
780 }
781
782 // text representation
783 $values["st_text_representation"] = $std_alias_item->getTextRepresentation();
784 if (trim($std_item->getTextRepresentation()) == "")
785 {
786 $values["def_text_representation"] = "<i>".$lng->txt("cont_no_text")."</i>";
787 }
788 else
789 {
790 $values["def_text_representation"] = $std_item->getTextRepresentation();
791 }
792
793 // parameters / autostart
794 if (ilObjMediaObject::_useAutoStartParameterOnly($std_item->getLocation(),
795 $std_item->getFormat())) // autostart
796 {
797 $par = $std_alias_item->getParameters();
798 if ($par["autostart"] == "true")
799 {
800 $values["st_autostart"] = true;
801 }
802 }
803 else // parameters
804 {
805 $values["st_parameters"] = $std_alias_item->getParameterString();
806 }
807
808 // size
809 $values["st_derive_size"] = $std_alias_item->definesSize()
810 ? "n"
811 : "y";
812 if ($values["st_derive_size"] == "y")
813 {
814 $values["st_width_height"]["width"] = $std_item->getWidth();
815 $values["st_width_height"]["height"] = $std_item->getHeight();
816 }
817 $values["st_derive_caption"] = $std_alias_item->definesCaption()
818 ? "n"
819 : "y";
820 $values["st_derive_text_representation"] = $std_alias_item->definesTextRepresentation()
821 ? "n"
822 : "y";
823 $values["st_derive_parameters"] = $std_alias_item->definesParameters()
824 ? "n"
825 : "y";
826 if (trim($std_item->getParameterString()) == "")
827 {
828 $values["def_parameters"] = "<i>".$lng->txt("cont_no_parameters")."</i>";
829 }
830 else
831 {
832 $values["def_parameters"] = $std_item->getParameterString();
833 }
834
835 // fullscreen properties
836 if($this->content_obj->getMediaObject()->hasFullScreenItem())
837 {
838 $full_alias_item = new ilMediaAliasItem($this->dom, $this->getHierId(), "Fullscreen",
839 $this->content_obj->getPcId());
840 $full_item = $this->content_obj->getMediaObject()->getMediaItem("Fullscreen");
841
842 $values["fullscreen"] = "n";
843 if ($full_alias_item->exists())
844 {
845 $values["fullscreen"] = "y";
846 }
847
848 $values["full_location"] = $full_item->getLocation();
849 $values["full_format"] = $full_item->getFormat();
850 $values["full_width_height"]["width"] = $full_alias_item->getWidth();
851 $values["full_width_height"]["height"] = $full_alias_item->getHeight();
852 $values["full_width_height"]["constr_prop"] = true;
853 $values["full_caption"] = $full_alias_item->getCaption();
854 if (trim($full_item->getCaption()) == "")
855 {
856 $values["full_def_caption"] = "<i>".$lng->txt("cont_no_caption")."</i>";
857 }
858 else
859 {
860 $values["full_def_caption"] = $full_item->getCaption();
861 }
862 $values["full_text_representation"] = $full_alias_item->getTextRepresentation();
863 if (trim($full_item->getTextRepresentation()) == "")
864 {
865 $values["full_def_text_representation"] = "<i>".$lng->txt("cont_no_text")."</i>";
866 }
867 else
868 {
869 $values["full_def_text_representation"] = $full_item->getTextRepresentation();
870 }
871 $values["full_parameters"] = $full_alias_item->getParameterString();
872 $values["full_derive_size"] = $full_alias_item->definesSize()
873 ? "n"
874 : "y";
875 if ($values["full_derive_size"] == "y")
876 {
877 $values["full_width_height"]["width"] = $full_item->getWidth();
878 $values["full_width_height"]["height"] = $full_item->getHeight();
879 }
880 $values["full_derive_caption"] = $full_alias_item->definesCaption()
881 ? "n"
882 : "y";
883 $values["full_derive_text_representation"] = $full_alias_item->definesTextRepresentation()
884 ? "n"
885 : "y";
886
887 // parameters
888 if (ilObjMediaObject::_useAutoStartParameterOnly($full_item->getLocation(),
889 $full_item->getFormat())) // autostart
890 {
891 $par = $full_alias_item->getParameters();
892 if ($par["autostart"] == "true")
893 {
894 $values["full_autostart"] = true;
895 }
896 }
897 else // parameters
898 {
899 $values["full_parameters"] = $full_alias_item->getParameterString();
900 }
901
902 $values["full_derive_parameters"] = $full_alias_item->definesParameters()
903 ? "n"
904 : "y";
905 if (trim($full_item->getParameterString()) == "")
906 {
907 $values["full_def_parameters"] = "<i>".$lng->txt("cont_no_parameters")."</i>";
908 }
909 else
910 {
911 $values["full_def_parameters"] = $full_item->getParameterString();
912 }
913
914 }
915
916 $this->form_gui->setValuesByArray($values);
917 }
918
923 {
924 $std_alias_item = new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard",
925 $this->content_obj->getPcId());
926 $full_alias_item = new ilMediaAliasItem($this->dom, $this->getHierId(), "Fullscreen",
927 $this->content_obj->getPcId());
928 $std_item = $this->content_obj->getMediaObject()->getMediaItem("Standard");
929 $full_item = $this->content_obj->getMediaObject()->getMediaItem("Fullscreen");
930
931 // standard size
932 if($_POST["st_derive_size"] == "y")
933 {
934 $std_alias_item->deriveSize();
935 }
936 else
937 {
938 $std_alias_item->setWidth(ilUtil::stripSlashes($_POST["st_width_height"]["width"]));
939 $std_alias_item->setHeight(ilUtil::stripSlashes($_POST["st_width_height"]["height"]));
940 }
941
942 // standard caption
943 if($_POST["st_derive_caption"] == "y")
944 {
945 $std_alias_item->deriveCaption();
946 }
947 else
948 {
949 $std_alias_item->setCaption(ilUtil::stripSlashes($_POST["st_caption"]));
950 }
951
952 // text representation
953 if($_POST["st_derive_text_representation"] == "y")
954 {
955 $std_alias_item->deriveTextRepresentation();
956 }
957 else
958 {
959 $std_alias_item->setTextRepresentation(ilUtil::stripSlashes($_POST["st_text_representation"]));
960 }
961
962 // standard parameters
963 if($_POST["st_derive_parameters"] == "y")
964 {
965 $std_alias_item->deriveParameters();
966 }
967 else
968 {
969 if (ilObjMediaObject::_useAutoStartParameterOnly($std_item->getLocation(),
970 $std_item->getFormat())) // autostart
971 {
972 if ($_POST["st_autostart"])
973 {
974 $std_alias_item->setParameters(ilUtil::extractParameterString('autostart="true"'));
975 }
976 else
977 {
978 $std_alias_item->setParameters(ilUtil::extractParameterString('autostart="false"'));
979 }
980 }
981 else // parameters
982 {
983 $std_alias_item->setParameters(ilUtil::extractParameterString(ilUtil::stripSlashes(utf8_decode($_POST["st_parameters"]))));
984 }
985 }
986
987 if($this->content_obj->getMediaObject()->hasFullscreenItem())
988 {
989 if ($_POST["fullscreen"] == "y")
990 {
991 if (!$full_alias_item->exists())
992 {
993 $full_alias_item->insert();
994 }
995
996 // fullscreen size
997 if($_POST["full_derive_size"] == "y")
998 {
999 $full_alias_item->deriveSize();
1000 }
1001 else
1002 {
1003 $full_alias_item->setWidth(ilUtil::stripSlashes($_POST["full_width_height"]["width"]));
1004 $full_alias_item->setHeight(ilUtil::stripSlashes($_POST["full_width_height"]["height"]));
1005 }
1006
1007 // fullscreen caption
1008 if($_POST["full_derive_caption"] == "y")
1009 {
1010 $full_alias_item->deriveCaption();
1011 }
1012 else
1013 {
1014 $full_alias_item->setCaption(ilUtil::stripSlashes($_POST["full_caption"]));
1015 }
1016
1017 // fullscreen text representation
1018 if($_POST["full_derive_text_representation"] == "y")
1019 {
1020 $full_alias_item->deriveTextRepresentation();
1021 }
1022 else
1023 {
1024 $full_alias_item->setTextRepresentation(ilUtil::stripSlashes($_POST["full_text_representation"]));
1025 }
1026
1027 // fullscreen parameters
1028 if($_POST["full_derive_parameters"] == "y")
1029 {
1030 $full_alias_item->deriveParameters();
1031 }
1032 else
1033 {
1034 if (ilObjMediaObject::_useAutoStartParameterOnly($full_item->getLocation(),
1035 $full_item->getFormat())) // autostart
1036 {
1037 if ($_POST["full_autostart"])
1038 {
1039 $full_alias_item->setParameters(ilUtil::extractParameterString('autostart="true"'));
1040 }
1041 else
1042 {
1043 $full_alias_item->setParameters(ilUtil::extractParameterString('autostart="false"'));
1044 }
1045 }
1046 else
1047 {
1048 $full_alias_item->setParameters(ilUtil::extractParameterString(ilUtil::stripSlashes(utf8_decode($_POST["full_parameters"]))));
1049 }
1050 }
1051 }
1052 else
1053 {
1054 if ($full_alias_item->exists())
1055 {
1056 $full_alias_item->delete();
1057 }
1058 }
1059 }
1060
1061 $this->updated = $this->pg_obj->update();
1062 if ($this->updated === true)
1063 {
1064 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
1065 }
1066 else
1067 {
1068 $this->pg_obj->addHierIDs();
1069 $this->editAlias();
1070 }
1071 }
1072
1077 {
1078 $this->ilias->account->addObjectToClipboard($this->content_obj->getMediaObject()->getId(), $this->content_obj->getMediaObject()->getType()
1079 , $this->content_obj->getMediaObject()->getTitle());
1080 ilUtil::sendSuccess($this->lng->txt("copied_to_clipboard"), true);
1081 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
1082 }
1083
1087 function centerAlign()
1088 {
1089 $std_alias_item = new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard",
1090 $this->content_obj->getPcId());
1091 $std_alias_item->setHorizontalAlign("Center");
1092 $_SESSION["il_pg_error"] = $this->pg_obj->update();
1093 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
1094 }
1095
1099 function leftAlign()
1100 {
1101 $std_alias_item = new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard",
1102 $this->content_obj->getPcId());
1103 $std_alias_item->setHorizontalAlign("Left");
1104 $_SESSION["il_pg_error"] = $this->pg_obj->update();
1105 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
1106 }
1107
1111 function rightAlign()
1112 {
1113 $std_alias_item = new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard",
1114 $this->content_obj->getPcId());
1115 $std_alias_item->setHorizontalAlign("Right");
1116 $_SESSION["il_pg_error"] = $this->pg_obj->update();
1117 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
1118 }
1119
1124 {
1125 $std_alias_item = new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard",
1126 $this->content_obj->getPcId());
1127 $std_alias_item->setHorizontalAlign("LeftFloat");
1128 $_SESSION["il_pg_error"] = $this->pg_obj->update();
1129 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
1130 }
1131
1136 {
1137 $std_alias_item = new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard",
1138 $this->content_obj->getPcId());
1139 $std_alias_item->setHorizontalAlign("RightFloat");
1140 $_SESSION["il_pg_error"] = $this->pg_obj->update();
1141 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
1142 }
1143
1148 {
1149 // check whether there is more than one style class
1150 $chars = $this->getCharacteristics();
1151
1152 if (count($chars) > 1 ||
1153 ($this->content_obj->getClass() != "" && $this->content_obj->getClass() != "Media"))
1154 {
1155 return true;
1156 }
1157 return false;
1158 }
1159
1163 function editStyle()
1164 {
1165 global $ilCtrl, $tpl, $lng;
1166
1167 $this->displayValidationError();
1168
1169 // edit form
1170 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1171 $form = new ilPropertyFormGUI();
1172 $form->setFormAction($ilCtrl->getFormAction($this));
1173 $form->setTitle($this->lng->txt("cont_edit_style"));
1174
1175 // characteristic selection
1176 require_once("./Services/Form/classes/class.ilAdvSelectInputGUI.php");
1177 $char_prop = new ilAdvSelectInputGUI($this->lng->txt("cont_characteristic"),
1178 "characteristic");
1179
1180 $chars = $this->getCharacteristics();
1181 if (is_object($this->content_obj))
1182 {
1183 if ($chars[$a_seleted_value] == "" && ($this->content_obj->getClass() != ""))
1184 {
1185 $chars = array_merge(
1186 array($this->content_obj->getClass() => $this->content_obj->getClass()),
1187 $chars);
1188 }
1189 }
1190
1191 $selected = $this->content_obj->getClass();
1192 if ($selected == "")
1193 {
1194 $selected = "MediaContainer";
1195 }
1196
1197 foreach ($chars as $k => $char)
1198 {
1199 $html = '<div class="ilCOPgEditStyleSelectionItem">'.
1200 $char.'</div>';
1201 $char_prop->addOption($k, $char, $html);
1202 }
1203
1204 $char_prop->setValue($selected);
1205 $form->addItem($char_prop);
1206
1207 // save button
1208 $form->addCommandButton("saveStyle", $lng->txt("save"));
1209
1210 $html = $form->getHTML();
1211 $tpl->setContent($html);
1212 return $ret;
1213 }
1214
1218 function saveStyle()
1219 {
1220 $this->content_obj->setClass($_POST["characteristic"]);
1221 $this->updated = $this->pg_obj->update();
1222 if ($this->updated === true)
1223 {
1224 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
1225 }
1226 else
1227 {
1228 $this->pg_obj->addHierIDs();
1229 $this->editStyle();
1230 }
1231 }
1232
1239 function getTabs(&$tab_gui, $a_create = false, $a_change_obj_ref = false)
1240 {
1241 global $ilCtrl, $ilTabs;
1242
1243 if (!$a_create)
1244 {
1245 if ($this->checkStyleSelection())
1246 {
1247 $ilTabs->addTarget("cont_style",
1248 $ilCtrl->getLinkTarget($this, "editStyle"), "editStyle",
1249 get_class($this));
1250 }
1251
1252 $ilTabs->addTarget("cont_mob_inst_prop",
1253 $ilCtrl->getLinkTarget($this, "editAlias"), "editAlias",
1254 get_class($this));
1255
1256 if ($this->getEnabledMapAreas())
1257 {
1258 $st_item = $this->content_obj->getMediaObject()->getMediaItem("Standard");
1259 if (is_object($st_item))
1260 {
1261 $format = $st_item->getFormat();
1262 if (substr($format, 0, 5) == "image" && !is_int(strpos($format, "svg")))
1263 {
1264 $ilTabs->addTarget("cont_inst_map_areas",
1265 $ilCtrl->getLinkTargetByClass("ilpcimagemapeditorgui", "editMapAreas"), array(),
1266 "ilpcimagemapeditorgui");
1267 }
1268 }
1269 }
1270 }
1271 else
1272 {
1273 if ($a_change_obj_ref)
1274 {
1275 $cmd = "changeObjectReference";
1276 }
1277 else
1278 {
1279 $cmd = "insert";
1280 }
1281
1282 $ilCtrl->setParameter($this, "subCmd", "insertNew");
1283 $ilTabs->addSubTabTarget("cont_new_mob",
1284 $ilCtrl->getLinkTarget($this, $cmd), $cmd);
1285
1286 $ilCtrl->setParameter($this, "subCmd", "insertFromPool");
1287 $ilTabs->addSubTabTarget("cont_mob_from_media_pool",
1288 $ilCtrl->getLinkTarget($this, $cmd), $cmd);
1289 $ilCtrl->setParameter($this, "subCmd", "");
1290 }
1291 }
1292
1293}
1294?>
$_GET["client_id"]
$_POST["username"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
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
__construct($a_pg_obj, $a_content_obj, $a_hier_id=0, $a_pc_id="")
Constructor @access public.
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.
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.
$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)
$ret
Definition: parser.php:6
$cmd
Definition: sahs_server.php:35
$lm_set