ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilObjMediaObjectGUI.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/MediaObjects/classes/class.ilObjMediaObject.php");
5require_once("./Services/Link/classes/class.ilInternalLinkGUI.php");
6require_once("./Services/Object/classes/class.ilObjectGUI.php");
7
20{
24 protected $access;
25
29 protected $error;
30
34 protected $help;
35
39 protected $tabs;
40
44 protected $toolbar;
45
49 protected $user;
50
51 // $adv_ref_id - $adv_type - $adv_subtype:
52 // Object, that defines the adv md records being used. Default is $this->object, but the
53 // context may set another object (e.g. media pool for media objects)
57 protected $adv_ref_id = null;
61 protected $adv_type = null;
65 protected $adv_subtype = null;
66
67
68 public $ctrl;
69 public $header;
71 public $enabledmapareas = true;
72
73 public function __construct($a_data, $a_id = 0, $a_call_by_reference = false, $a_prepare_output = false)
74 {
75 global $DIC;
76
77 $this->tpl = $DIC["tpl"];
78 $this->access = $DIC->access();
79 $this->error = $DIC["ilErr"];
80 $this->help = $DIC["ilHelp"];
81 $this->tabs = $DIC->tabs();
82 $this->toolbar = $DIC->toolbar();
83 $this->user = $DIC->user();
84 $lng = $DIC->language();
85 $ilCtrl = $DIC->ctrl();
86
87 $this->ctrl = $ilCtrl;
88 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
89 $this->lng = $lng;
90 $this->back_title = "";
91 $this->type = "mob";
92
93 $lng->loadLanguageModule("mob");
94 }
95
102 public function setAdvMdRecordObject($a_adv_ref_id, $a_adv_type, $a_adv_subtype = "-")
103 {
104 $this->adv_ref_id = $a_adv_ref_id;
105 $this->adv_type = $a_adv_type;
106 $this->adv_subtype = $a_adv_subtype;
107 }
108
114 public function getAdvMdRecordObject()
115 {
116 if ($this->adv_type == null) {
117 return [$this->ref_id, $this->obj_type, $this->sub_type];
118 }
120 }
121
122 public function setHeader($a_title = "")
123 {
124 $this->header = $a_title;
125 }
126
127 public function getHeader()
128 {
129 return $this->header;
130 }
131
137 public function setEnabledMapAreas($a_enabledmapareas)
138 {
139 $this->enabledmapareas = $a_enabledmapareas;
140 }
141
147 public function getEnabledMapAreas()
148 {
150 }
151
157 public function setWidthPreset($a_val)
158 {
159 $this->width_preset = $a_val;
160 }
161
167 public function getWidthPreset()
168 {
169 return $this->width_preset;
170 }
171
177 public function setHeightPreset($a_val)
178 {
179 $this->height_preset = $a_val;
180 }
181
187 public function getHeightPreset()
188 {
189 return $this->height_preset;
190 }
191
197 public function getForm()
198 {
199 return $this->form_gui;
200 }
201
202 public function assignObject()
203 {
204 if ($this->id != 0) {
205 $this->object = new ilObjMediaObject($this->id);
206 }
207 }
208
209 public function returnToContextObject()
210 {
211 $this->ctrl->returnToParent($this);
212 }
213
214
220 public function executeCommand()
221 {
223 $ilAccess = $this->access;
225
226 $next_class = $this->ctrl->getNextClass($this);
227 $cmd = $this->ctrl->getCmd();
228
229 switch ($next_class) {
230 case 'ilobjectmetadatagui':
231 include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
232 $md_gui = new ilObjectMetaDataGUI(null, $this->object->getType(), $this->object->getId());
233 // object is subtype, so we have to do it ourselves
234 $md_gui->addMDObserver($this->object, 'MDUpdateListener', 'General');
235
236 // set adv metadata record dobject
237 if ($this->adv_type != "") {
238 $md_gui->setAdvMdRecordObject($this->adv_ref_id, $this->adv_type, $this->adv_subtype);
239 }
240
241 $this->ctrl->forwardCommand($md_gui);
242 break;
243
244 case "ilimagemapeditorgui":
245 require_once("./Services/MediaObjects/classes/class.ilImageMapEditorGUI.php");
246 $image_map_edit = new ilImageMapEditorGUI($this->object);
247 $ret = $this->ctrl->forwardCommand($image_map_edit);
248 $tpl->setContent($ret);
249 $this->checkFixSize();
250 break;
251
252 case "ilfilesystemgui":
253 include_once("./Services/FileSystem/classes/class.ilFileSystemGUI.php");
254 $fs_gui = new ilFileSystemGUI(ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId());
255 $fs_gui->setAllowedSuffixes(ilObjMediaObject::getRestrictedFileTypes());
256 $fs_gui->setForbiddenSuffixes(ilObjMediaObject::getForbiddenFileTypes());
257 $fs_gui->activateLabels(true, $this->lng->txt("cont_purpose"));
258 $fs_gui->setTableId("mobfs" . $this->object->getId());
259 $fs_gui->labelFile(
260 $this->object->getMediaItem("Standard")->getLocation(),
261 $this->lng->txt("cont_std_view")
262 );
263 if ($this->object->hasFullscreenItem()) {
264 $fs_gui->labelFile(
265 $this->object->getMediaItem("Fullscreen")->getLocation(),
266 $this->lng->txt("cont_fullscreen")
267 );
268 }
269 $fs_gui->addCommand($this, "assignStandardObject", $this->lng->txt("cont_assign_std"));
270 $fs_gui->addCommand($this, "assignFullscreenObject", $this->lng->txt("cont_assign_full"));
271 ilObjMediaObject::renameExecutables(ilObjMediaObject::_getDirectory($this->object->getId())); // see #20187
272 $ret = $this->ctrl->forwardCommand($fs_gui);
273 ilObjMediaObject::renameExecutables(ilObjMediaObject::_getDirectory($this->object->getId())); // see #20187
274 include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
275 ilMediaSvgSanitizer::sanitizeDir(ilObjMediaObject::_getDirectory($this->object->getId())); // see #20339
276 break;
277
278
279 default:
280 if (isset($_POST["editImagemapForward"]) ||
281 isset($_POST["editImagemapForward_x"]) ||
282 isset($_POST["editImagemapForward_y"])) {
283 $cmd = "editImagemapForward";
284 }
285 $cmd .= "Object";
286 $ret = $this->$cmd();
287 break;
288 }
289
290 return $ret;
291 }
292
296 public function setBackTitle($a_title)
297 {
298 $this->back_title = $a_title;
299 }
300
304 public function createObject()
305 {
307 $ilHelp = $this->help;
308
309 $ilHelp->setScreenId("create");
310 $this->initForm();
311 $tpl->setContent($this->form_gui->getHTML());
312 }
313
317 public function initForm($a_mode = "create")
318 {
321
322 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
323
324 if ($a_mode == "edit") {
325 $std_item = $this->object->getMediaItem("Standard");
326 }
327
328 $this->form_gui = new ilPropertyFormGUI();
329
330 // standard view resource
331 $title = new ilTextInputGUI($lng->txt("title"), "standard_title");
332 $title->setSize(40);
333 $title->setMaxLength(120);
334 $this->form_gui->addItem($title);
335 $radio_prop = new ilRadioGroupInputGUI($lng->txt("cont_resource"), "standard_type");
336 $op1 = new ilRadioOption($lng->txt("cont_file"), "File");
337 $up = new ilFileInputGUI("", "standard_file");
339 $up->setForbiddenSuffixes(ilObjMediaObject::getForbiddenFileTypes());
340 $up->setInfo("");
341 if ($a_mode == "create" || $std_item->getLocationType() != "LocalFile") {
342 $up->setRequired(true);
343 }
344 $op1->addSubItem($up);
345 $radio_prop->addOption($op1);
346 $op2 = new ilRadioOption($lng->txt("url"), "Reference");
347 $ref = new ilTextInputGUI("", "standard_reference");
348 $ref->setInfo($lng->txt("cont_ref_helptext"));
349 $ref->setRequired(true);
350 $op2->addSubItem($ref);
351 $radio_prop->addOption($op2);
352 $radio_prop->setValue("File");
353 $this->form_gui->addItem($radio_prop);
354
355 // standard format
356 if ($a_mode == "edit") {
357 $format = new ilNonEditableValueGUI($lng->txt("cont_format"), "standard_format");
358 $format->setValue($std_item->getFormat());
359 $this->form_gui->addItem($format);
360 }
361
362 // standard size
363 $radio_size = new ilRadioGroupInputGUI($lng->txt("size"), "standard_size");
364 if ($a_mode == "edit") {
365 if ($orig_size = $std_item->getOriginalSize()) {
366 $add_str = " (" . $orig_size["width"] . " x " . $orig_size["height"] . ")";
367 }
368 $op1 = new ilRadioOption($lng->txt("cont_resource_size") . $add_str, "original");
369 $op1->setInfo($lng->txt("cont_resource_size_info"));
370 $op2 = new ilRadioOption($lng->txt("cont_custom_size"), "selected");
371 } else {
372 $op1 = new ilRadioOption($lng->txt("cont_orig_size"), "original");
373 $op1->setInfo($lng->txt("cont_resource_size_info"));
374 $op2 = new ilRadioOption($lng->txt("cont_adjust_size"), "selected");
375 }
376 $radio_size->addOption($op1);
377
378 // width height
379 include_once("./Services/MediaObjects/classes/class.ilWidthHeightInputGUI.php");
380 $width_height = new ilWidthHeightInputGUI($lng->txt("cont_width") .
381 " / " . $lng->txt("cont_height"), "standard_width_height");
382 $width_height->setConstrainProportions(true);
383 $op2->addSubItem($width_height);
384
385 // resize image
386 if ($a_mode == "edit") {
387 $std_item = $this->object->getMediaItem("Standard");
388 if (is_int(strpos($std_item->getFormat(), "image"))
389 && $std_item->getLocationType() == "LocalFile") {
390 $resize = new ilCheckboxInputGUI($lng->txt("cont_resize_img"), "standard_resize");
391 $op2->addSubItem($resize);
392 }
393 }
394
395 $radio_size->setValue("original");
396 if ($a_mode == "create" && ($this->getHeightPreset() > 0 || $this->getWidthPreset() > 0)) {
397 $radio_size->setValue("selected");
398 $width_height->setWidth($this->getWidthPreset());
399 $width_height->setHeight($this->getHeightPreset());
400 }
401 $radio_size->addOption($op2);
402 $this->form_gui->addItem($radio_size);
403
404 // standard caption
405 $caption = new ilTextAreaInputGUI($lng->txt("cont_caption"), "standard_caption");
406 $caption->setCols(30);
407 $caption->setRows(2);
408 $this->form_gui->addItem($caption);
409
410 /*$caption = new ilTextInputGUI($lng->txt("cont_caption"), "standard_caption");
411 $caption->setSize(40);
412 $caption->setMaxLength(200);
413 $this->form_gui->addItem($caption);*/
414
415 // text representation (alt text)
416 if ($a_mode == "edit" && is_int(strpos($std_item->getFormat(), "image"))) {
417 $ta = new ilTextAreaInputGUI($lng->txt("text_repr"), "text_representation");
418 $ta->setCols(30);
419 $ta->setRows(2);
420 $ta->setInfo($lng->txt("text_repr_info"));
421 $this->form_gui->addItem($ta);
422 }
423
424 // standard parameters
425 if ($a_mode == "edit" &&
426 !in_array($std_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes())) {
428 $std_item->getLocation(),
429 $std_item->getFormat()
430 )) { // autostart
431 $auto = new ilCheckboxInputGUI($lng->txt("cont_autostart"), "standard_autostart");
432 $this->form_gui->addItem($auto);
433 } else { // parameters
434 $par = new ilTextAreaInputGUI($lng->txt("cont_parameter"), "standard_parameters");
435 $par->setRows(5);
436 $par->setCols(50);
437 $this->form_gui->addItem($par);
438 }
439 }
440
441 if ($a_mode == "edit") {
442 $full_item = $this->object->getMediaItem("Fullscreen");
443 }
444
445 // fullscreen view resource
446 $fs_sec = new ilFormSectionHeaderGUI();
447 $fs_sec->setTitle($lng->txt("cont_fullscreen"));
448 $this->form_gui->addItem($fs_sec);
449
450 $radio_prop2 = new ilRadioGroupInputGUI($lng->txt("cont_resource"), "full_type");
451 $op1 = new ilRadioOption($lng->txt("cont_none"), "None");
452 $radio_prop2->addOption($op1);
453 $op4 = new ilRadioOption($lng->txt("cont_use_same_resource_as_above"), "Standard");
454 $radio_prop2->addOption($op4);
455 $op2 = new ilRadioOption($lng->txt("cont_file"), "File");
456 $up = new ilFileInputGUI("", "full_file");
458 $up->setForbiddenSuffixes(ilObjMediaObject::getForbiddenFileTypes());
459 $up->setInfo("");
460 if ($a_mode == "create" || !$full_item || $full_item->getLocationType() != "LocalFile") {
461 $up->setRequired(true);
462 }
463 $op2->addSubItem($up);
464 $radio_prop2->addOption($op2);
465 $op3 = new ilRadioOption($lng->txt("url"), "Reference");
466 $ref = new ilTextInputGUI("", "full_reference");
467 $ref->setInfo($lng->txt("cont_ref_helptext"));
468 $ref->setRequired(true);
469 $op3->addSubItem($ref);
470 $radio_prop2->addOption($op3);
471 $radio_prop2->setValue("None");
472 $this->form_gui->addItem($radio_prop2);
473
474 // fullscreen format
475 if ($a_mode == "edit") {
476 if ($this->object->hasFullscreenItem()) {
477 $format = new ilNonEditableValueGUI($lng->txt("cont_format"), "full_format");
478 $format->setValue($full_item->getFormat());
479 $this->form_gui->addItem($format);
480 }
481 }
482
483 // fullscreen size
484 $radio_size = new ilRadioGroupInputGUI($lng->txt("size"), "full_size");
485 if ($a_mode == "edit") {
486 $add_str = "";
487 if ($this->object->hasFullscreenItem() && ($orig_size = $full_item->getOriginalSize())) {
488 $add_str = " (" . $orig_size["width"] . " x " . $orig_size["height"] . ")";
489 }
490 $op1 = new ilRadioOption($lng->txt("cont_resource_size") . $add_str, "original");
491 $op1->setInfo($lng->txt("cont_resource_size_info"));
492 $op2 = new ilRadioOption($lng->txt("cont_custom_size"), "selected");
493 } else {
494 $op1 = new ilRadioOption($lng->txt("cont_orig_size"), "original");
495 $op1->setInfo($lng->txt("cont_resource_size_info"));
496 $op2 = new ilRadioOption($lng->txt("cont_adjust_size"), "selected");
497 }
498 $radio_size->addOption($op1);
499
500 // width/height
501 $width_height = new ilWidthHeightInputGUI($lng->txt("cont_width") .
502 " / " . $lng->txt("cont_height"), "full_width_height");
503 $width_height->setConstrainProportions(true);
504 $op2->addSubItem($width_height);
505
506 // resize image
507 if ($a_mode == "edit") {
508 $full_item = $this->object->getMediaItem("Fullscreen");
509 if ($this->object->hasFullscreenItem() &&
510 is_int(strpos($full_item->getFormat(), "image")) &&
511 $full_item->getLocationType() == "LocalFile") {
512 $resize = new ilCheckboxInputGUI(
513 $lng->txt("cont_resize_img"),
514 "full_resize"
515 );
516 $op2->addSubItem($resize);
517 }
518 }
519
520 $radio_size->setValue("original");
521 $radio_size->addOption($op2);
522 $this->form_gui->addItem($radio_size);
523
524 // fullscreen caption
525 $caption = new ilTextAreaInputGUI($lng->txt("cont_caption"), "full_caption");
526 $caption->setCols(30);
527 $caption->setRows(2);
528 $this->form_gui->addItem($caption);
529
530 /*$caption = new ilTextInputGUI($lng->txt("cont_caption"), "full_caption");
531 $caption->setSize(40);
532 $caption->setMaxLength(200);
533 $this->form_gui->addItem($caption);*/
534
535 // text representation (alt text)
536 if ($a_mode == "edit" && $this->object->hasFullscreenItem() && is_int(strpos($std_item->getFormat(), "image"))) {
537 $ta = new ilTextAreaInputGUI($lng->txt("text_repr"), "full_text_representation");
538 $ta->setCols(30);
539 $ta->setRows(2);
540 $ta->setInfo($lng->txt("text_repr_info"));
541 $this->form_gui->addItem($ta);
542 }
543
544
545 // fullscreen parameters
546 if ($a_mode == "edit" && $this->object->hasFullscreenItem() &&
547 !in_array($full_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes())) {
549 $full_item->getLocation(),
550 $full_item->getFormat()
551 )) {
552 $auto = new ilCheckboxInputGUI($lng->txt("cont_autostart"), "full_autostart");
553 $this->form_gui->addItem($auto);
554 } else {
555 $par = new ilTextAreaInputGUI($lng->txt("cont_parameter"), "full_parameters");
556 $par->setRows(5);
557 $par->setCols(50);
558 $this->form_gui->addItem($par);
559 }
560 }
561
562 $this->form_gui->setTitle($lng->txt("cont_insert_mob"));
563 if ($a_mode == "edit") {
564 $this->form_gui->addCommandButton("saveProperties", $lng->txt("save"));
565 } else {
566 $this->form_gui->addCommandButton("save", $lng->txt("save"));
567 $this->form_gui->addCommandButton("cancel", $lng->txt("cancel"));
568 }
569 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
570 }
571
578 protected function checkFixSize()
579 {
580 $std_item = $this->object->getMediaItem("Standard");
581 if ($std_item->getWidth() == "" || $std_item->getHeight() == "") {
582 ilUtil::sendFailure($this->lng->txt("mob_no_fixed_size_map_editing"));
583 }
584 }
585
586
591 public function getValues()
592 {
593 $values = array();
594
595 $values["standard_title"] = $this->object->getTitle();
596
597 $std_item = $this->object->getMediaItem("Standard");
598 if ($std_item->getLocationType() == "LocalFile") {
599 $values["standard_type"] = "File";
600 $values["standard_file"] = $std_item->getLocation();
601 } else {
602 $values["standard_type"] = "Reference";
603 $values["standard_reference"] = $std_item->getLocation();
604 }
605 $values["standard_format"] = $std_item->getFormat();
606 $values["standard_width_height"]["width"] = $std_item->getWidth();
607 $values["standard_width_height"]["height"] = $std_item->getHeight();
608 $values["standard_width_height"]["constr_prop"] = true;
609
610 $values["standard_size"] = "selected";
611
612 $orig_size = $std_item->getOriginalSize();
613 if ($std_item->getWidth() == "" && $std_item->getHeight() == "") {
614 $values["standard_size"] = "original";
615 $values["standard_width_height"]["width"] = $orig_size["width"];
616 $values["standard_width_height"]["height"] = $orig_size["height"];
617 }
618
619 $values["standard_caption"] = $std_item->getCaption();
620 $values["text_representation"] = $std_item->getTextRepresentation();
622 $std_item->getLocation(),
623 $std_item->getFormat()
624 )) {
625 $par = $std_item->getParameters();
626 if ($par["autostart"]) {
627 $values["standard_autostart"] = true;
628 }
629 } else {
630 $values["standard_parameters"] = $std_item->getParameterString();
631 }
632
633 $values["full_type"] = "None";
634 $values["full_size"] = "original";
635 if ($this->object->hasFullScreenItem()) {
636 $full_item = $this->object->getMediaItem("Fullscreen");
637 if ($full_item->getLocationType() == "LocalFile") {
638 $values["full_type"] = "File";
639 $values["full_file"] = $full_item->getLocation();
640 } else {
641 $values["full_type"] = "Reference";
642 $values["full_reference"] = $full_item->getLocation();
643 }
644 $values["full_format"] = $full_item->getFormat();
645 $values["full_width_height"]["width"] = $full_item->getWidth();
646 $values["full_width_height"]["height"] = $full_item->getHeight();
647 $values["full_width_height"]["constr_prop"] = true;
648
649 $values["full_size"] = "selected";
650
651 $orig_size = $full_item->getOriginalSize();
652 if ($full_item->getWidth() == "" &&
653 $full_item->getHeight() == "") {
654 $values["full_size"] = "original";
655 $values["full_width_height"]["width"] = $orig_size["width"];
656 $values["full_width_height"]["height"] = $orig_size["height"];
657 }
658 $values["full_caption"] = $full_item->getCaption();
660 $full_item->getLocation(),
661 $full_item->getFormat()
662 )) {
663 $par = $full_item->getParameters();
664 if ($par["autostart"]) {
665 $values["full_autostart"] = true;
666 }
667 } else {
668 $values["full_parameters"] = $full_item->getParameterString();
669 }
670 $values["full_text_representation"] = $full_item->getTextRepresentation();
671 }
672
673 $this->form_gui->setValuesByArray($values);
674 }
675
679 public function saveObject()
680 {
683
684 $this->initForm();
685 if ($this->form_gui->checkInput()) {
686 $this->object = new ilObjMediaObject();
688 ilUtil::sendSuccess($lng->txt("saved_media_object"), true);
689 return $this->object;
690 } else {
691 $this->form_gui->setValuesByPost();
692 $tpl->setContent($this->form_gui->getHTML());
693 return false;
694 }
695 }
696
703 public function checkFormInput()
704 {
705 if (!$this->form_gui->checkInput()) {
706 $this->form_gui->setValuesByPost();
707 return false;
708 }
709 return true;
710 }
711
712
716 public static function setObjectPerCreationForm($a_mob)
717 {
718 // determinte title and format
719 if (trim($_POST["standard_title"]) != "") {
720 $title = trim($_POST["standard_title"]);
721 } else {
722 if ($_POST["standard_type"] == "File") {
723 $title = $_FILES['standard_file']['name'];
724 } else {
725 $title = ilUtil::stripSlashes($_POST["standard_reference"]);
726 }
727 }
728
729 $a_mob->setTitle($title);
730 $a_mob->setDescription("");
731 $a_mob->create();
732
733 // determine and create mob directory, move uploaded file to directory
734 //$mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$a_mob->getId();
735 $a_mob->createDirectory();
736 $mob_dir = ilObjMediaObject::_getDirectory($a_mob->getId());
737
738 $media_item = new ilMediaItem();
739 $a_mob->addMediaItem($media_item);
740 $media_item->setPurpose("Standard");
741
742 if ($_POST["standard_type"] == "File") {
743 $file_name = ilObjMediaObject::fixFilename($_FILES['standard_file']['name']);
744 $file = $mob_dir . "/" . $file_name;
745 ilUtil::moveUploadedFile(
746 $_FILES['standard_file']['tmp_name'],
747 $file_name,
748 $file
749 );
750
751 // get mime type
753 $location = $file_name;
754
755 // resize standard images
756 if ($_POST["standard_size"] != "original" &&
757 is_int(strpos($format, "image"))) {
759 $file,
760 (int) $_POST["standard_width_height"]["width"],
761 (int) $_POST["standard_width_height"]["height"],
762 (boolean) $_POST["standard_width_height"]["contr_prop"]
763 );
764 }
765
766 // set real meta and object data
767 $media_item->setFormat($format);
768 $media_item->setLocation($location);
769 $media_item->setLocationType("LocalFile");
770 } else { // standard type: reference
772 $media_item->setFormat($format);
773 $media_item->setLocation(ilUtil::secureLink(ilUtil::stripSlashes($_POST["standard_reference"])));
774 $media_item->setLocationType("Reference");
775 }
776 $a_mob->setDescription($format);
777
778 // determine width and height of known image types
780 $format,
781 $_POST["standard_type"],
782 $mob_dir . "/" . $location,
783 $media_item->getLocation(),
784 $_POST["standard_width_height"]["constr_prop"],
785 ($_POST["standard_size"] == "original"),
786 $_POST["standard_width_height"]["width"],
787 $_POST["standard_width_height"]["height"]
788 );
789 $media_item->setWidth($wh["width"]);
790 $media_item->setHeight($wh["height"]);
791 if ($wh["info"] != "") {
792 ilUtil::sendInfo($wh["info"], true);
793 }
794
795 if ($_POST["standard_caption"] != "") {
796 $media_item->setCaption(ilUtil::stripSlashes($_POST["standard_caption"]));
797 }
798
799
800 $media_item->setHAlign("Left");
801
802 // fullscreen view
803 if ($_POST["full_type"] != "None") {
804 $media_item2 = new ilMediaItem();
805 $a_mob->addMediaItem($media_item2);
806 $media_item2->setPurpose("Fullscreen");
807
808 // move file / set format and location
809 if ($_POST["full_type"] == "File") {
810 $format = $location = "";
811 if ($_FILES['full_file']['name'] != "") {
812 $full_file_name = ilObjMediaObject::fixFilename($_FILES['full_file']['name']);
813 $file = $mob_dir . "/" . $full_file_name;
814 ilUtil::moveUploadedFile(
815 $_FILES['full_file']['tmp_name'],
816 $full_file_name,
817 $file
818 );
820 $location = $full_file_name;
821 }
822 } elseif ($_POST["full_type"] == "Standard" && $_POST["standard_type"] == "File") {
823 $location = $file_name;
824 }
825
826 // resize file
827 if ($_POST["full_type"] == "File" ||
828 ($_POST["full_type"] == "Standard" && $_POST["standard_type"] == "File")) {
829 if (($_POST["full_size"] != "original" &&
830 is_int(strpos($format, "image")))
831 ) {
833 $file,
834 (int) $_POST["full_width_height"]["width"],
835 (int) $_POST["full_width_height"]["height"],
836 (boolean) $_POST["full_width_height"]["constr_prop"]
837 );
838 }
839
840 $media_item2->setFormat($format);
841 $media_item2->setLocation($location);
842 $media_item2->setLocationType("LocalFile");
843 $type = "File";
844 }
845
846 if ($_POST["full_type"] == "Reference") {
847 $format = $location = "";
848 if ($_POST["full_reference"] != "") {
849 $format = ilObjMediaObject::getMimeType($_POST["full_reference"], true);
850 $location = ilUtil::stripSlashes($_POST["full_reference"]);
851 }
852 }
853
854 if ($_POST["full_type"] == "Reference" ||
855 ($_POST["full_type"] == "Standard" && $_POST["standard_type"] == "Reference")) {
856 $media_item2->setFormat($format);
857 $media_item2->setLocation($location);
858 $media_item2->setLocationType("Reference");
859 $type = "Reference";
860 }
861
862 // determine width and height of known image types
864 $format,
865 $type,
866 $mob_dir . "/" . $location,
867 $media_item2->getLocation(),
868 $_POST["full_width_height"]["constr_prop"],
869 ($_POST["full_size"] == "original"),
870 $_POST["full_width_height"]["width"],
871 $_POST["full_width_height"]["height"]
872 );
873
874 $media_item2->setWidth($wh["width"]);
875 $media_item2->setHeight($wh["height"]);
876
877 if ($_POST["full_caption"] != "") {
878 $media_item2->setCaption(ilUtil::stripSlashes($_POST["full_caption"]));
879 }
880 }
881
883 include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
884 ilMediaSvgSanitizer::sanitizeDir($mob_dir); // see #20339
885 $a_mob->update();
886 }
887
888
892 public function cancelObject()
893 {
894 $this->ctrl->returnToParent($this);
895 }
896
900 public function editObject()
901 {
903
904 $this->setPropertiesSubTabs("general");
905
906 $this->initForm("edit");
907 $this->getValues();
908 $tpl->setContent($this->form_gui->getHTML());
909 }
910
911
915 public function resizeImagesObject()
916 {
917 // directory
918 $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
919
920 // standard item
921 $std_item = $this->object->getMediaItem("Standard");
922 if ($std_item->getLocationType() == "LocalFile" &&
923 is_int(strpos($std_item->getFormat(), "image"))
924 ) {
925 $file = $mob_dir . "/" . $std_item->getLocation();
927 $file,
928 $std_item->getWidth(),
929 $std_item->getHeight()
930 );
931 $std_item->setLocation($location);
932 $std_item->update();
933 }
934
935 // fullscreen item
936 if ($this->object->hasFullScreenItem()) {
937 $full_item = $this->object->getMediaItem("Fullscreen");
938 if ($full_item->getLocationType() == "LocalFile" &&
939 is_int(strpos($full_item->getFormat(), "image"))
940 ) {
941 $file = $mob_dir . "/" . $full_item->getLocation();
943 $file,
944 $full_item->getWidth(),
945 $full_item->getHeight()
946 );
947 $full_item->setLocation($location);
948 $full_item->update();
949 }
950 }
951
952 $this->ctrl->redirect($this, "edit");
953 }
954
955
959 public function getStandardSizeObject()
960 {
961 $std_item = $this->object->getMediaItem("Standard");
962 $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
963
964 if ($std_item->getLocationType() == "LocalFile") {
965 $file = $mob_dir . "/" . $std_item->getLocation();
966
967 include_once("./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
969
970 $std_item->setWidth($size[0]);
971 $std_item->setHeight($size[1]);
972 $this->object->update();
973 }
974 $this->ctrl->redirect($this, "edit");
975 }
976
977
981 public function getFullscreenSizeObject()
982 {
983 $full_item = $this->object->getMediaItem("Fullscreen");
984 $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
985
986 if ($full_item->getLocationType() == "LocalFile") {
987 $file = $mob_dir . "/" . $full_item->getLocation();
988 include_once("./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
990 $full_item->setWidth($size[0]);
991 $full_item->setHeight($size[1]);
992 $this->object->update();
993 }
994 $this->ctrl->redirect($this, "edit");
995 }
996
1000 public function savePropertiesObject()
1001 {
1002 $lng = $this->lng;
1003 $tpl = $this->tpl;
1004
1005 $this->initForm("edit");
1006 if ($this->form_gui->checkInput()) {
1007 $title = trim($_POST["standard_title"]);
1008 $this->object->setTitle($title);
1009
1010 $std_item = $this->object->getMediaItem("Standard");
1011 $location = $std_item->getLocation();
1012 $format = $std_item->getFormat();
1013 if ($_POST["standard_type"] == "Reference") {
1014 $format = ilObjMediaObject::getMimeType(ilUtil::stripSlashes($_POST["standard_reference"]), true);
1015 $std_item->setFormat($format);
1016 $std_item->setLocation(ilUtil::secureLink(ilUtil::stripSlashes($_POST["standard_reference"])));
1017 $std_item->setLocationType("Reference");
1018 }
1019 $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
1020 if ($_POST["standard_type"] == "File") {
1021 $resize = false;
1022 if ($_FILES['standard_file']['name'] != "") {
1023 $file_name = ilObjMediaObject::fixFilename($_FILES['standard_file']['name']);
1024 $file = $mob_dir . "/" . $file_name;
1025 ilUtil::moveUploadedFile(
1026 $_FILES['standard_file']['tmp_name'],
1027 $file_name,
1028 $file
1029 );
1030
1031 // get mime type
1033 $location = $file_name;
1034
1035 $resize = true;
1036 } elseif ($_POST["standard_resize"]) {
1037 $file = $mob_dir . "/" . $location;
1038 $resize = true;
1039 }
1040
1041 // resize
1042 if ($resize) {
1043 if ($_POST["standard_size"] != "original" &&
1044 is_int(strpos($format, "image"))) {
1046 $file,
1047 (int) $_POST["standard_width_height"]["width"],
1048 (int) $_POST["standard_width_height"]["height"],
1049 (boolean) $_POST["standard_width_height"]["contr_prop"]
1050 );
1051 }
1052 $std_item->setFormat($format);
1053 $std_item->setLocation($location);
1054 }
1055
1056 $std_item->setLocationType("LocalFile");
1057 }
1058 $this->object->setDescription($format);
1059 // determine width and height of known image types
1061 $format,
1062 $_POST["standard_type"],
1063 $mob_dir . "/" . $location,
1064 $std_item->getLocation(),
1065 $_POST["standard_width_height"]["constr_prop"],
1066 ($_POST["standard_size"] == "original"),
1067 $_POST["standard_width_height"]["width"],
1068 $_POST["standard_width_height"]["height"]
1069 );
1070 if ($wh["info"] != "") {
1071 ilUtil::sendInfo($wh["info"], true);
1072 }
1073 $std_item->setWidth($wh["width"]);
1074 $std_item->setHeight($wh["height"]);
1075
1076 // set caption
1077 $std_item->setCaption(ilUtil::stripSlashes($_POST["standard_caption"]));
1078
1079 // text representation
1080 $std_item->setTextRepresentation(ilUtil::stripSlashes($_POST["text_representation"]));
1081
1082 // set parameters
1083 if (!in_array($std_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes())) {
1085 $std_item->getLocation(),
1086 $std_item->getFormat()
1087 )) {
1088 if ($_POST["standard_autostart"]) { // save only autostart flag
1089 $std_item->setParameters('autostart="true"');
1090 } else {
1091 $std_item->setParameters("");
1092 }
1093 } else {
1094 $std_item->setParameters(ilUtil::stripSlashes(utf8_decode($_POST["standard_parameters"])));
1095 }
1096 }
1097
1098 // "None" selected
1099 if ($_POST["full_type"] == "None") {
1100 if ($this->object->hasFullscreenItem()) { // delete existing
1101 $this->object->removeMediaItem("Fullscreen");
1102 }
1103 } else { // Not "None" -> we need one
1104 if ($this->object->hasFullscreenItem()) { // take existing one
1105 $full_item = $this->object->getMediaItem("Fullscreen");
1106 } else { // create one
1107 $full_item = new ilMediaItem();
1108 $this->object->addMediaItem($full_item);
1109 $full_item->setPurpose("Fullscreen");
1110 }
1111 $location = $full_item->getLocation();
1112 $format = $full_item->getFormat();
1113 if ($_POST["full_type"] == "Reference") {
1115 $full_item->setFormat($format);
1116 $full_item->setLocationType("Reference");
1117 $location = ilUtil::stripSlashes($_POST["full_reference"]);
1118 $type = "Reference";
1119 }
1120 $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
1121 if ($_POST["full_type"] == "File") {
1122 $resize = false;
1123 if ($_FILES['full_file']['name'] != "") {
1124 $full_file_name = ilObjMediaObject::fixFilename($_FILES['full_file']['name']);
1125 $file = $mob_dir . "/" . $full_file_name;
1126 ilUtil::moveUploadedFile(
1127 $_FILES['full_file']['tmp_name'],
1128 $full_file_name,
1129 $file
1130 );
1131
1133 $location = $full_file_name;
1134
1135 $resize = true;
1136 } elseif ($_POST["full_resize"]) {
1137 $file = $mob_dir . "/" . $location;
1138 $resize = true;
1139 }
1140
1141 // resize
1142 if ($resize) {
1143 if ($_POST["full_size"] != "original" &&
1144 is_int(strpos($format, "image"))) {
1146 $file,
1147 (int) $_POST["full_width_height"]["width"],
1148 (int) $_POST["full_width_height"]["height"],
1149 (boolean) $_POST["full_width_height"]["contr_prop"]
1150 );
1151 }
1152 $full_item->setFormat($format);
1153 $full_item->setLocation($location);
1154 }
1155
1156 $full_item->setLocationType("LocalFile");
1157 $type = "File";
1158 }
1159 if ($_POST["full_type"] == "Standard") {
1160 $format = $std_item->getFormat();
1161 $location = $std_item->getLocation();
1162 $full_item->setLocationType($std_item->getLocationType());
1163 $full_item->setFormat($format);
1164 $full_item->setLocation($location);
1165 $type = $std_item->getLocationType();
1166 if ($type == "LocalFile") {
1167 $type = "File";
1168 }
1169 // resize image
1170 //echo "-".$_POST["full_size"]."-".is_int(strpos($format, "image"))."-".$full_item->getLocationType()."-";
1171 if ($_POST["full_size"] != "original" &&
1172 is_int(strpos($format, "image")) &&
1173 $full_item->getLocationType() == "LocalFile") {
1174 $file = $mob_dir . "/" . $location;
1176 $file,
1177 (int) $_POST["full_width_height"]["width"],
1178 (int) $_POST["full_width_height"]["height"],
1179 (boolean) $_POST["full_width_height"]["contr_prop"]
1180 );
1181 }
1182 }
1183
1184 // determine width and height of known image types
1186 $format,
1187 $type,
1188 $mob_dir . "/" . $location,
1189 $full_item->getLocation(),
1190 $_POST["full_width_height"]["constr_prop"],
1191 ($_POST["full_size"] == "original"),
1192 $_POST["full_width_height"]["width"],
1193 $_POST["full_width_height"]["height"]
1194 );
1195 if ($wh["info"] != "") {
1196 ilUtil::sendInfo($wh["info"], true);
1197 }
1198
1199 $full_item->setWidth($wh["width"]);
1200 $full_item->setHeight($wh["height"]);
1201 $full_item->setLocation($location);
1202
1203 $full_item->setCaption(ilUtil::stripSlashes($_POST["full_caption"]));
1204
1205 // text representation
1206 $full_item->setTextRepresentation(ilUtil::stripSlashes($_POST["full_text_representation"]));
1207
1208
1209 // set parameters
1210 if (!in_array($std_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes())) {
1212 $std_item->getLocation(),
1213 $std_item->getFormat()
1214 )) {
1215 if ($_POST["full_autostart"]) { // save only autostart flag
1216 $full_item->setParameters('autostart="true"');
1217 } else {
1218 $full_item->setParameters("");
1219 }
1220 } else {
1221 $full_item->setParameters(ilUtil::stripSlashes(utf8_decode($_POST["full_parameters"])));
1222 }
1223 }
1224 }
1225
1227 include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
1228 ilMediaSvgSanitizer::sanitizeDir(ilObjMediaObject::_getDirectory($this->object->getId())); // see #20339
1229
1230 $this->object->update();
1231 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1232 $this->ctrl->redirect($this, "edit");
1233 } else {
1234 $this->form_gui->setValuesByPost();
1235 $tpl->setContent($this->form_gui->getHTML());
1236 }
1237 }
1238
1239
1243 public function editFilesObject()
1244 {
1245 // standard item
1246 $std_item = $this->object->getMediaItem("Standard");
1247 if ($this->object->hasFullscreenItem()) {
1248 $full_item = $this->object->getMediaItem("Fullscreen");
1249 }
1250
1251 // create table
1252 require_once("./Services/Table/classes/class.ilTableGUI.php");
1253 $tbl = new ilTableGUI();
1254
1255 // determine directory
1256 $cur_subdir = $_GET["cdir"];
1257 if ($_GET["newdir"] == "..") {
1258 $cur_subdir = substr($cur_subdir, 0, strrpos($cur_subdir, "/"));
1259 } else {
1260 if (!empty($_GET["newdir"])) {
1261 if (!empty($cur_subdir)) {
1262 $cur_subdir = $cur_subdir . "/" . $_GET["newdir"];
1263 } else {
1264 $cur_subdir = $_GET["newdir"];
1265 }
1266 }
1267 }
1268
1269 $cur_subdir = str_replace(".", "", $cur_subdir);
1270 $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1271 $cur_dir = (!empty($cur_subdir))
1272 ? $mob_dir . "/" . $cur_subdir
1273 : $mob_dir;
1274
1275 // load files templates
1276 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.mob_files.html", "Services/MediaObjects");
1277
1278 $this->ctrl->setParameter($this, "cdir", urlencode($cur_subdir));
1279 $this->tpl->setVariable("FORMACTION1", $this->ctrl->getFormAction($this));
1280 //echo "--".$this->getTargetScript().
1281 //"&hier_id=".$_GET["hier_id"]."&cdir=".$cur_subdir."&cmd=post"."--<br>";
1282 $this->tpl->setVariable("TXT_NEW_DIRECTORY", $this->lng->txt("cont_new_dir"));
1283 $this->tpl->setVariable("TXT_NEW_FILE", $this->lng->txt("cont_new_file"));
1284 $this->tpl->setVariable("CMD_NEW_DIR", "createDirectory");
1285 $this->tpl->setVariable("CMD_NEW_FILE", "uploadFile");
1286 $this->tpl->setVariable("BTN_NEW_DIR", $this->lng->txt("create"));
1287 $this->tpl->setVariable("BTN_NEW_FILE", $this->lng->txt("upload"));
1288
1289 //
1290 $this->tpl->addBlockfile("FILE_TABLE", "files", "tpl.table.html");
1291
1292 // load template for table content data
1293 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.mob_file_row.html", "Services/MediaObjects");
1294
1295 $num = 0;
1296
1297 $obj_str = ($this->call_by_reference) ? "" : "&obj_id=" . $this->obj_id;
1298 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
1299
1300 $tbl->setTitle($this->lng->txt("cont_files") . " " . $cur_subdir);
1301 //$tbl->setHelp("tbl_help.php","icon_help.gif",$this->lng->txt("help"));
1302
1303 $tbl->setHeaderNames(array("", "", $this->lng->txt("cont_dir_file"),
1304 $this->lng->txt("cont_size"), $this->lng->txt("cont_purpose")));
1305
1306 $cols = array("", "", "dir_file", "size", "purpose");
1307 $header_params = array("ref_id" => $_GET["ref_id"], "obj_id" => $_GET["obj_id"],
1308 "cmd" => "editFiles", "hier_id" => $_GET["hier_id"], "item_id" => $_GET["item_id"]);
1309 $tbl->setHeaderVars($cols, $header_params);
1310 $tbl->setColumnWidth(array("1%", "1%", "33%", "33%", "32%"));
1311
1312 // control
1313 $tbl->setOrderColumn($_GET["sort_by"]);
1314 $tbl->setOrderDirection($_GET["sort_order"]);
1315 $tbl->setLimit($_GET["limit"]);
1316 $tbl->setOffset($_GET["offset"]);
1317 $tbl->setMaxCount($this->maxcount); // ???
1318 //$tbl->setMaxCount(30); // ???
1319
1320 $this->tpl->setVariable("COLUMN_COUNTS", 5);
1321
1322 // delete button
1323 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
1324 $this->tpl->setCurrentBlock("tbl_action_btn");
1325 $this->tpl->setVariable("BTN_NAME", "deleteFile");
1326 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete"));
1327 $this->tpl->parseCurrentBlock();
1328
1329 $this->tpl->setCurrentBlock("tbl_action_btn");
1330 $this->tpl->setVariable("BTN_NAME", "assignStandard");
1331 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("cont_assign_std"));
1332 $this->tpl->parseCurrentBlock();
1333
1334 $this->tpl->setCurrentBlock("tbl_action_btn");
1335 $this->tpl->setVariable("BTN_NAME", "assignFullscreen");
1336 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("cont_assign_full"));
1337 $this->tpl->parseCurrentBlock();
1338
1339 // footer
1340 $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next"));
1341 //$tbl->disable("footer");
1342
1343 $entries = ilUtil::getDir($cur_dir);
1344
1345 //$objs = ilUtil::sortArray($objs, $_GET["sort_by"], $_GET["sort_order"]);
1346 $tbl->setMaxCount(count($entries));
1347 $entries = array_slice($entries, $_GET["offset"], $_GET["limit"]);
1348
1349 $tbl->render();
1350 if (count($entries) > 0) {
1351 $i = 0;
1352 foreach ($entries as $entry) {
1353 if (($entry["entry"] == ".") || ($entry["entry"] == ".." && empty($cur_subdir))) {
1354 continue;
1355 }
1356
1357 //$this->tpl->setVariable("ICON", $obj["title"]);
1358 if ($entry["type"] == "dir") {
1359 $this->tpl->setCurrentBlock("FileLink");
1360 $this->ctrl->setParameter($this, "cdir", $cur_subdir);
1361 $this->ctrl->setParameter($this, "newdir", rawurlencode($entry["entry"]));
1362 $this->tpl->setVariable("LINK_FILENAME", $this->ctrl->getLinkTarget($this, "editFiles"));
1363 $this->tpl->setVariable("TXT_FILENAME", $entry["entry"]);
1364 $this->tpl->parseCurrentBlock();
1365
1366 $this->tpl->setVariable("ICON", "<img src=\"" .
1367 ilUtil::getImagePath("icon_cat.svg") . "\">");
1368 } else {
1369 $this->tpl->setCurrentBlock("File");
1370 $this->tpl->setVariable("TXT_FILENAME2", $entry["entry"]);
1371 $this->tpl->parseCurrentBlock();
1372 }
1373
1374 $this->tpl->setCurrentBlock("tbl_content");
1375 $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
1376 $this->tpl->setVariable("CSS_ROW", $css_row);
1377
1378 $this->tpl->setVariable("TXT_SIZE", $entry["size"]);
1379 $this->tpl->setVariable("CHECKBOX_ID", $entry["entry"]);
1380 $compare = (!empty($cur_subdir))
1381 ? $cur_subdir . "/" . $entry["entry"]
1382 : $entry["entry"];
1383 $purpose = array();
1384 if ($std_item->getLocation() == $compare) {
1385 $purpose[] = $this->lng->txt("cont_std_view");
1386 }
1387 if ($this->object->hasFullscreenItem()) {
1388 if ($full_item->getLocation() == $compare) {
1389 $purpose[] = $this->lng->txt("cont_fullscreen");
1390 }
1391 }
1392 $this->tpl->setVariable("TXT_PURPOSE", implode($purpose, ", "));
1393
1394 $this->tpl->parseCurrentBlock();
1395 }
1396 } //if is_array
1397 else {
1398 $this->tpl->setCurrentBlock("notfound");
1399 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
1400 $this->tpl->setVariable("NUM_COLS", 4);
1401 $this->tpl->parseCurrentBlock();
1402 }
1403
1404 $this->tpl->parseCurrentBlock();
1405 }
1406
1407
1411 public function createDirectoryObject()
1412 {
1413 //echo "cdir:".$_GET["cdir"].":<br>";
1414 // determine directory
1415 $cur_subdir = str_replace(".", "", $_GET["cdir"]);
1416 $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1417 $cur_dir = (!empty($cur_subdir))
1418 ? $mob_dir . "/" . $cur_subdir
1419 : $mob_dir;
1420
1421 $new_dir = str_replace(".", "", $_POST["new_dir"]);
1422 $new_dir = str_replace("/", "", $new_dir);
1423
1424 if (!empty($new_dir)) {
1425 ilUtil::makeDir($cur_dir . "/" . $new_dir);
1426 }
1427 $this->ctrl->saveParameter($this, "cdir");
1428 $this->ctrl->redirect($this, "editFiles");
1429 }
1430
1434 public function uploadFileObject()
1435 {
1436 // determine directory
1437 $cur_subdir = str_replace(".", "", $_GET["cdir"]);
1438 $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1439 $cur_dir = (!empty($cur_subdir))
1440 ? $mob_dir . "/" . $cur_subdir
1441 : $mob_dir;
1442 if (is_file($_FILES["new_file"]["tmp_name"])) {
1443 $file_name = ilObjMediaObject::fixFilename($_FILES["new_file"]["name"]);
1444 $file = $cur_dir . "/" . $file_name;
1445 ilUtil::moveUploadedFile(
1446 $_FILES['new_file']['tmp_name'],
1447 $file_name,
1448 $file
1449 );
1450 }
1452 include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
1453 ilMediaSvgSanitizer::sanitizeDir($mob_dir); // see #20339
1454
1455 $this->ctrl->saveParameter($this, "cdir");
1456 $this->ctrl->redirect($this, "editFiles");
1457 }
1458
1462 public function assignStandardObject($a_file)
1463 {
1464 // determine directory
1465 $cur_subdir = dirname($a_file);
1466 $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1467 $cur_dir = (!empty($cur_subdir))
1468 ? $mob_dir . "/" . $cur_subdir
1469 : $mob_dir;
1470 $file = $cur_dir . "/" . basename($a_file);
1471 $location = $a_file;
1472
1473 if (!is_file($file)) {
1474 $this->ilias->raiseError($this->lng->txt("cont_select_file"), $this->ilias->error_obj->MESSAGE);
1475 }
1476
1477 $std_item = $this->object->getMediaItem("Standard");
1478 $std_item->setLocationType("LocalFile");
1479 $std_item->setLocation($location);
1481 $std_item->setFormat($format);
1482 $this->object->update();
1483 // $this->ctrl->saveParameter($this, "cdir");
1484 $this->ctrl->redirectByClass("ilfilesystemgui", "listFiles");
1485 }
1486
1487
1491 public function assignFullscreenObject($a_file)
1492 {
1493 // determine directory
1494 $cur_subdir = dirname($a_file);
1495 $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1496 $cur_dir = (!empty($cur_subdir))
1497 ? $mob_dir . "/" . $cur_subdir
1498 : $mob_dir;
1499 $file = $cur_dir . "/" . basename($a_file);
1500 $location = $a_file;
1501
1502 if (!is_file($file)) {
1503 $this->ilias->raiseError($this->lng->txt("cont_select_file"), $this->ilias->error_obj->MESSAGE);
1504 }
1505
1506 if (!$this->object->hasFullScreenItem()) { // create new fullscreen item
1507 $std_item = $this->object->getMediaItem("Standard");
1508 $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1509 $file = $mob_dir . "/" . $location;
1510 $full_item = new ilMediaItem();
1511 $full_item->setMobId($std_item->getMobId());
1512 $full_item->setLocation($location);
1513 $full_item->setLocationType("LocalFile");
1514 $full_item->setFormat(ilObjMediaObject::getMimeType($file));
1515 $full_item->setPurpose("Fullscreen");
1516 $this->object->addMediaItem($full_item);
1517 } else { // alter existing fullscreen item
1518 $full_item = $this->object->getMediaItem("Fullscreen");
1519
1520 $full_item->setLocationType("LocalFile");
1521 $full_item->setLocation($location);
1523 $full_item->setFormat($format);
1524 }
1525 $this->object->update();
1526 // $this->ctrl->saveParameter($this, "cdir");
1527 $this->ctrl->redirectByClass("ilfilesystemgui", "listFiles");
1528 }
1529
1530
1534 public function removeFullscreenObject()
1535 {
1536 $this->object->removeMediaItem("Fullscreen");
1537 $this->object->update();
1538
1539 $this->ctrl->redirect($this, "edit");
1540 }
1541
1542
1546 public function addFullscreenObject()
1547 {
1548 if (!$this->object->hasFullScreenItem()) {
1549 $std_item = $this->object->getMediaItem("Standard");
1550 $full_item = new ilMediaItem();
1551 $full_item->setMobId($std_item->getMobId());
1552 $full_item->setLocation($std_item->getLocation());
1553 $full_item->setLocationType($std_item->getLocationType());
1554 $full_item->setFormat($std_item->getFormat());
1555 $full_item->setWidth($std_item->getWidth());
1556 $full_item->setHeight($std_item->getHeight());
1557 $full_item->setCaption($std_item->getCaption());
1558 $full_item->setTextRepresentation($std_item->getTextRepresentation());
1559 $full_item->setPurpose("Fullscreen");
1560 $this->object->addMediaItem($full_item);
1561
1562 $this->object->update();
1563 }
1564
1565 $this->ctrl->redirect($this, "edit");
1566 }
1567
1568
1572 public function deleteFileObject()
1573 {
1574 if (!isset($_POST["file"])) {
1575 $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
1576 }
1577
1578 if (count($_POST["file"]) > 1) {
1579 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"), $this->ilias->error_obj->MESSAGE);
1580 }
1581
1582 if ($_POST["file"][0] == "..") {
1583 $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
1584 }
1585
1586 $cur_subdir = str_replace(".", "", $_GET["cdir"]);
1587 $mob_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->object->getId();
1588 $cur_dir = (!empty($cur_subdir))
1589 ? $mob_dir . "/" . $cur_subdir
1590 : $mob_dir;
1591 $file = $cur_dir . "/" . $_POST["file"][0];
1592 $location = (!empty($cur_subdir))
1593 ? $cur_subdir . "/" . $_POST["file"][0]
1594 : $_POST["file"][0];
1595
1596 $full_item = $this->object->getMediaItem("Fullscreen");
1597 $std_item = $this->object->getMediaItem("Standard");
1598
1599 if ($location == $std_item->getLocation()) {
1600 $this->ilias->raiseError($this->lng->txt("cont_cant_del_std"), $this->ilias->error_obj->MESSAGE);
1601 }
1602
1603 if ($this->object->hasFullScreenItem()) {
1604 if ($location == $full_item->getLocation()) {
1605 $this->ilias->raiseError($this->lng->txt("cont_cant_del_full"), $this->ilias->error_obj->MESSAGE);
1606 }
1607 }
1608
1609 if (@is_dir($file)) {
1610 if (substr($std_item->getLocation(), 0, strlen($location)) == $location) {
1611 $this->ilias->raiseError($this->lng->txt("cont_std_is_in_dir"), $this->ilias->error_obj->MESSAGE);
1612 }
1613
1614 if ($this->object->hasFullScreenItem()) {
1615 if (substr($full_item->getLocation(), 0, strlen($location)) == $location) {
1616 $this->ilias->raiseError($this->lng->txt("cont_full_is_in_dir"), $this->ilias->error_obj->MESSAGE);
1617 }
1618 }
1619 }
1620
1621 if (@is_file($file)) {
1622 unlink($file);
1623 }
1624
1625 if (@is_dir($file)) {
1626 ilUtil::delDir($file);
1627 }
1628
1629 $this->ctrl->saveParameter($this, "cdir");
1630 $this->ctrl->redirect($this, "editFiles");
1631 }
1632
1636 public function showAllUsagesObject()
1637 {
1638 $this->showUsagesObject(true);
1639 }
1640
1641
1645 public function showUsagesObject($a_all = false)
1646 {
1647 $tpl = $this->tpl;
1648 $ilTabs = $this->tabs;
1649 $ilTabs = $this->tabs;
1650 $lng = $this->lng;
1652
1653 $ilTabs->addSubTab(
1654 "current_usages",
1655 $lng->txt("cont_current_usages"),
1656 $ilCtrl->getLinkTarget($this, "showUsages")
1657 );
1658
1659 $ilTabs->addSubTab(
1660 "all_usages",
1661 $lng->txt("cont_all_usages"),
1662 $ilCtrl->getLinkTarget($this, "showAllUsages")
1663 );
1664
1665 if ($a_all) {
1666 $ilTabs->activateSubTab("all_usages");
1667 $cmd = "showAllUsages";
1668 } else {
1669 $ilTabs->activateSubTab("current_usages");
1670 $cmd = "showUsages";
1671 }
1672
1673 include_once("./Services/MediaObjects/classes/class.ilMediaObjectUsagesTableGUI.php");
1674 $usages_table = new ilMediaObjectUsagesTableGUI(
1675 $this,
1676 $cmd,
1677 $this->object,
1678 $a_all
1679 );
1680 $tpl->setContent($usages_table->getHTML());
1681 }
1682
1686 public static function _getMediaInfoHTML(&$a_mob)
1687 {
1688 global $DIC;
1689
1690 $lng = $DIC->language();
1691
1692 $tpl = new ilTemplate("tpl.media_info.html", true, true, "Services/MediaObjects");
1693 $types = array("Standard", "Fullscreen");
1694 foreach ($types as $type) {
1695 if ($type == "Fullscreen" && !$a_mob->hasFullScreenItem()) {
1696 continue;
1697 }
1698
1699 $med = $a_mob->getMediaItem($type);
1700 if (!$med) {
1701 return "";
1702 }
1703
1704 $tpl->setCurrentBlock("media_info");
1705 if ($type == "Standard") {
1706 $tpl->setVariable("TXT_PURPOSE", $lng->txt("cont_std_view"));
1707 } else {
1708 $tpl->setVariable("TXT_PURPOSE", $lng->txt("cont_fullscreen"));
1709 }
1710 $tpl->setVariable("TXT_TYPE", $lng->txt("cont_" . strtolower($med->getLocationType())));
1711 $tpl->setVariable("VAL_LOCATION", $med->getLocation());
1712 if ($med->getLocationType() == "LocalFile") {
1713 $file = ilObjMediaObject::_getDirectory($med->getMobId()) . "/" . $med->getLocation();
1714 if (is_file($file)) {
1715 $size = filesize($file);
1716 } else {
1717 $size = 0;
1718 }
1719 $tpl->setVariable("VAL_FILE_SIZE", " ($size " . $lng->txt("bytes") . ")");
1720 }
1721 $tpl->setVariable("TXT_FORMAT", $lng->txt("cont_format"));
1722 $tpl->setVariable("VAL_FORMAT", $med->getFormat());
1723 if ($med->getWidth() != "" && $med->getHeight() != "") {
1724 $tpl->setCurrentBlock("size");
1725 $tpl->setVariable("TXT_SIZE", $lng->txt("size"));
1726 $tpl->setVariable("VAL_SIZE", $med->getWidth() . "x" . $med->getHeight());
1727 $tpl->parseCurrentBlock();
1728 }
1729
1730 // original size
1731 if ($orig_size = $med->getOriginalSize()) {
1732 if ($orig_size["width"] != $med->getWidth() ||
1733 $orig_size["height"] != $med->getHeight()) {
1734 $tpl->setCurrentBlock("orig_size");
1735 $tpl->setVariable("TXT_ORIG_SIZE", $lng->txt("cont_orig_size"));
1736 $tpl->setVariable("ORIG_WIDTH", $orig_size["width"]);
1737 $tpl->setVariable("ORIG_HEIGHT", $orig_size["height"]);
1738 $tpl->parseCurrentBlock();
1739 }
1740 }
1741
1742 // output caption
1743 if ($med && strlen($med->getCaption())) {
1744 $tpl->setCurrentBlock('additional_info');
1745 $tpl->setVariable('ADD_INFO', $lng->txt('cont_caption') . ': ' . $med->getCaption());
1746 $tpl->parseCurrentBlock();
1747 }
1748
1749 // output keywords
1750 if ($type == "Standard") {
1751 include_once './Services/MetaData/classes/class.ilMDKeyword.php';
1752 if (count($kws = ilMDKeyword::lookupKeywords(0, $med->getMobId()))) {
1753 $tpl->setCurrentBlock('additional_info');
1754 $tpl->setVariable('ADD_INFO', $lng->txt('keywords') . ': ' . implode(', ', $kws));
1755 $tpl->parseCurrentBlock();
1756 }
1757 }
1758
1759 $tpl->setCurrentBlock("media_info");
1760 $tpl->parseCurrentBlock();
1761 }
1762
1763 return $tpl->get();
1764 }
1765
1769 //function setAdminTabs()
1770 public function setTabs()
1771 {
1772 //echo "setAdminTabs should not be called.";
1773
1774 // catch feedback message
1775 $this->getTabs();
1776
1777 $this->tpl->clearHeader();
1778 if (is_object($this->object) && strtolower(get_class($this->object)) == "ilobjmediaobject") {
1779 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_mob.svg"));
1780 $this->tpl->setTitle($this->object->getTitle());
1781 } else {
1782 //$title = $this->object->getTitle();
1783 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_mob.svg"));
1784 $this->tpl->setTitle($this->lng->txt("cont_create_mob"));
1785 }
1786 }
1787
1788
1792 public function getTabs()
1793 {
1794 $ilHelp = $this->help;
1795
1796 $ilHelp->setScreenIdComponent("mob");
1797
1798 if (is_object($this->object) && strtolower(get_class($this->object)) == "ilobjmediaobject"
1799 && $this->object->getId() > 0) {
1800 // object properties
1801 $this->tabs_gui->addTarget(
1802 "cont_mob_def_prop",
1803 $this->ctrl->getLinkTarget($this, "edit"),
1804 "edit",
1805 get_class($this)
1806 );
1807
1808 $st_item = $this->object->getMediaItem("Standard");
1809
1810 // link areas
1811
1812 if (is_object($st_item) && $this->getEnabledMapAreas()) {
1813 $format = $st_item->getFormat();
1814 if (substr($format, 0, 5) == "image" && !is_int(strpos($format, "svg"))) {
1815 $this->tabs_gui->addTarget(
1816 "cont_def_map_areas",
1817 $this->ctrl->getLinkTargetByClass(
1818 array("ilobjmediaobjectgui", "ilimagemapeditorgui"),
1819 "editMapAreas"
1820 ),
1821 "editMapAreas",
1822 "ilimagemapeditorgui"
1823 );
1824 }
1825 }
1826
1827 // object usages
1828 $this->tabs_gui->addTarget(
1829 "cont_mob_usages",
1830 $this->ctrl->getLinkTarget($this, "showUsages"),
1831 "showUsages",
1832 get_class($this)
1833 );
1834
1835 // object files
1836 $std_item = $this->object->getMediaItem("Standard");
1837 $full_item = $this->object->getMediaItem("Fullscreen");
1838 $mset = new ilSetting("mobs");
1839 if ($mset->get("file_manager_always") ||
1840 (!in_array($std_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes()) ||
1841 (is_object($full_item) && !in_array($full_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes())))
1842 ) {
1843 // $ilTabs->addTarget("cont_files",
1844 // $this->ctrl->getLinkTarget($this, "editFiles"), "editFiles",
1845 // get_class($this));
1846
1847 $this->tabs_gui->addTarget(
1848 "cont_files",
1849 $this->ctrl->getLinkTargetByClass(
1850 array("ilobjmediaobjectgui", "ilfilesystemgui"),
1851 "listFiles"
1852 ),
1853 "",
1854 "ilfilesystemgui"
1855 );
1856 }
1857
1858 include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
1859 $mdgui = new ilObjectMetaDataGUI(null, $this->object->getType(), $this->object->getId());
1860 $mdtab = $mdgui->getTab("ilobjmediaobjectgui");
1861 if ($mdtab) {
1862 $this->tabs_gui->addTarget(
1863 "meta_data",
1864 $mdtab,
1865 "",
1866 "ilmdeditorgui"
1867 );
1868 }
1869 }
1870
1871 // back to upper context
1872 if ($this->back_title != "") {
1873 $this->tabs_gui->setBackTarget(
1874 $this->back_title,
1875 $this->ctrl->getParentReturn($this)
1876 );
1877 }
1878 }
1879
1886 public function showVideoToolObject()
1887 {
1888 $tpl = $this->tpl;
1889
1890 include_once("./Services/MediaObjects/classes/class.ilFFmpeg.php");
1891
1892 /*$codecs = ilFFmpeg::getSupportedCodecsInfo();
1893 $codec_str = implode($codecs, "<br />");
1894 $tpl->setContent($codec_str);*/
1895
1897 $formats_str = implode($formats, "<br />");
1898 $tpl->setContent($formats_str);
1899 }
1900
1901
1905 public static function includePresentationJS($a_tpl = null)
1906 {
1907 global $DIC;
1908
1909 $tpl = $DIC["tpl"];
1910
1911 if ($a_tpl == null) {
1912 $a_tpl = $tpl;
1913 }
1914
1915 include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
1916 iljQueryUtil::initjQUery($a_tpl);
1917 include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
1918 $a_tpl->addJavascript(iljQueryUtil::getLocalMaphilightPath());
1919 $a_tpl->addJavascript("./Services/COPage/js/ilCOPagePres.js");
1920
1921 include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1923 }
1924
1930 public function setPropertiesSubTabs($a_active)
1931 {
1932 $ilTabs = $this->tabs;
1934 $lng = $this->lng;
1935
1936 $ilTabs->activateTab("cont_mob_def_prop");
1937
1938 $ilTabs->addSubTab(
1939 "general",
1940 $lng->txt("mob_general"),
1941 $ilCtrl->getLinkTarget($this, "edit")
1942 );
1943
1944 if ($this->object->getMediaItem("Standard")->getFormat() == "video/webm" ||
1945 $this->object->getMediaItem("Standard")->getFormat() == "video/mp4") {
1946 $ilTabs->addSubTab(
1947 "subtitles",
1948 $lng->txt("mob_subtitles"),
1949 $ilCtrl->getLinkTarget($this, "listSubtitleFiles")
1950 );
1951 }
1952
1953 $ilTabs->activateSubTab($a_active);
1954 }
1955
1962 public function listSubtitleFilesObject()
1963 {
1964 $ilToolbar = $this->toolbar;
1965 $tpl = $this->tpl;
1967 $lng = $this->lng;
1969
1970 $this->setPropertiesSubTabs("subtitles");
1971
1972 // upload file
1973 $ilToolbar->setFormAction($ilCtrl->getFormAction($this), true);
1974 include_once("./Services/Form/classes/class.ilFileInputGUI.php");
1975 $fi = new ilFileInputGUI($lng->txt("mob_subtitle_file") . " (.srt)", "subtitle_file");
1976 $fi->setSuffixes(array("srt"));
1977 $ilToolbar->addInputItem($fi, true);
1978
1979 // language
1980 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
1981 include_once("./Services/MetaData/classes/class.ilMDLanguageItem.php");
1983 $si = new ilSelectInputGUI($this->lng->txt("mob_language"), "language");
1984 $si->setOptions($options);
1985 $si->setValue($ilUser->getLanguage());
1986 $ilToolbar->addInputItem($si, true);
1987
1988 $ilToolbar->addFormButton($lng->txt("upload"), "uploadSubtitleFile");
1989
1990 $ilToolbar->addSeparator();
1991 $ilToolbar->addFormButton($lng->txt("mob_upload_multi_srt"), "uploadMultipleSubtitleFileForm");
1992
1993 include_once("./Services/MediaObjects/classes/class.ilMobSubtitleTableGUI.php");
1994 $tab = new ilMobSubtitleTableGUI($this, "listSubtitleFiles", $this->object);
1995
1996 $tpl->setContent($tab->getHTML());
1997 }
1998
2006 {
2007 $lng = $this->lng;
2009
2010 if ($this->object->uploadSrtFile($_FILES["subtitle_file"]["tmp_name"], ilUtil::stripSlashes($_POST["language"]))) {
2011 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
2012 }
2013 $ilCtrl->redirect($this, "listSubtitleFiles");
2014 }
2015
2020 {
2022 $tpl = $this->tpl;
2023 $lng = $this->lng;
2024
2025 $lng->loadLanguageModule("meta");
2026
2027 if (!is_array($_POST["srt"]) || count($_POST["srt"]) == 0) {
2028 ilUtil::sendInfo($lng->txt("no_checkbox"), true);
2029 $ilCtrl->redirect($this, "listSubtitleFiles");
2030 } else {
2031 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
2032 $cgui = new ilConfirmationGUI();
2033 $cgui->setFormAction($ilCtrl->getFormAction($this));
2034 $cgui->setHeaderText($lng->txt("mob_really_delete_srt"));
2035 $cgui->setCancel($lng->txt("cancel"), "listSubtitleFiles");
2036 $cgui->setConfirm($lng->txt("delete"), "deleteSrtFiles");
2037
2038 foreach ($_POST["srt"] as $i) {
2039 $cgui->addItem("srt[]", $i, "subtitle_" . $i . ".srt (" . $lng->txt("meta_l_" . $i) . ")");
2040 }
2041
2042 $tpl->setContent($cgui->getHTML());
2043 }
2044 }
2045
2049 public function deleteSrtFilesObject()
2050 {
2051 $lng = $this->lng;
2053
2054 foreach ($_POST["srt"] as $i) {
2055 if (strlen($i) == 2 && !is_int(strpos($i, "."))) {
2056 $this->object->removeAdditionalFile("srt/subtitle_" . $i . ".srt");
2057 }
2058 }
2059 ilUtil::sendSuccess($lng->txt("mob_srt_files_deleted"), true);
2060 $ilCtrl->redirect($this, "listSubtitleFiles");
2061 }
2062
2070 {
2071 $ilToolbar = $this->toolbar;
2072 $lng = $this->lng;
2074
2075 ilUtil::sendInfo($lng->txt("mob_upload_multi_srt_howto"));
2076
2077 $this->setPropertiesSubTabs("subtitles");
2078
2079 // upload file
2080 $ilToolbar->setFormAction($ilCtrl->getFormAction($this), true);
2081 include_once("./Services/Form/classes/class.ilFileInputGUI.php");
2082 $fi = new ilFileInputGUI($lng->txt("mob_subtitle_file") . " (.zip)", "subtitle_file");
2083 $fi->setSuffixes(array("zip"));
2084 $ilToolbar->addInputItem($fi, true);
2085
2086 $ilToolbar->addFormButton($lng->txt("upload"), "uploadMultipleSubtitleFile");
2087 }
2088
2093 {
2094 try {
2095 $this->object->uploadMultipleSubtitleFile(ilUtil::stripSlashesArray($_FILES["subtitle_file"]));
2096 $this->ctrl->redirect($this, "showMultiSubtitleConfirmationTable");
2097 } catch (ilMediaObjectsException $e) {
2098 ilUtil::sendFailure($e->getMessage(), true);
2099 $this->ctrl->redirect($this, "uploadMultipleSubtitleFileForm");
2100 }
2101 }
2102
2107 {
2108 $tpl = $this->tpl;
2109
2110 $this->setPropertiesSubTabs("subtitles");
2111
2112 include_once("./Services/MediaObjects/classes/class.ilMultiSrtConfirmationTable2GUI.php");
2113 $tab = new ilMultiSrtConfirmationTable2GUI($this, "showMultiSubtitleConfirmationTable");
2114 $tpl->setContent($tab->getHTML());
2115 }
2116
2120 public function cancelMultiSrtObject()
2121 {
2122 $this->object->clearMultiSrtDirectory();
2123 $this->ctrl->redirect($this, "listSubtitleFiles");
2124 }
2125
2129 public function saveMultiSrtObject()
2130 {
2132 $srt_files = $this->object->getMultiSrtFiles();
2133 if (is_array($_POST["file"])) {
2134 foreach ($_POST["file"] as $f) {
2135 foreach ($srt_files as $srt_file) {
2136 if ($f == $srt_file["filename"]) {
2137 $this->object->uploadSrtFile($this->object->getMultiSrtUploadDir() . "/" . $srt_file["filename"], $srt_file["lang"], "rename");
2138 }
2139 }
2140 }
2141 }
2142 $this->object->clearMultiSrtDirectory();
2143 $ilCtrl->redirect($this, "listSubtitleFiles");
2144 }
2145}
user()
Definition: user.php:4
$size
Definition: RandomTest.php:84
$location
Definition: buildRTE.php:44
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
This class represents a checkbox property in a property form.
Confirmation screen class.
static getSupportedFormatsInfo()
Get all supported formats.
This class represents a file property in a property form.
File System Explorer GUI class.
This class represents a section header in a property form.
User interface class for map editor.
static lookupKeywords($a_rbac_id, $a_obj_id, $a_return_ids=false)
Lookup Keywords.
static getImageSize($a_location)
Get image size from location.
Class ilMediaItem.
TableGUI class for media object usages listing.
General exception class for media objects.
static sanitizeDir($a_path)
Sanitize directory recursively.
TableGUI class for subtitle list.
List srt files from zip file for upload confirmation.
This class represents a non editable value in a property form.
Class ilObjMediaObjectGUI.
showUsagesObject($a_all=false)
show all usages of mob
getAdvMdRecordObject()
Get adv md record type.
deleteSrtFilesObject()
Delete srt files.
setHeightPreset($a_val)
Set height preset.
cancelMultiSrtObject()
Cancel Multi Feedback.
static includePresentationJS($a_tpl=null)
Include media object presentation JS.
uploadSubtitleFileObject()
Upload srt file.
getValues()
Get values for form.
showAllUsagesObject()
Show all media object usages (incl history)
saveObject()
create new media object in dom and update page in db
createDirectoryObject()
create directory
showMultiSubtitleConfirmationTableObject()
List of srt files in zip file.
static _getMediaInfoHTML(&$a_mob)
get media info as html
getStandardSizeObject()
set original size of standard file
confirmSrtDeletionObject()
Confirm srt file deletion.
listSubtitleFilesObject()
List subtitls files.
removeFullscreenObject()
remove fullscreen view
uploadMultipleSubtitleFileFormObject()
Upload multiple stubtitles.
savePropertiesObject()
save properties in db and return to page edit screen
assignFullscreenObject($a_file)
assign file to fullscreen view
executeCommand()
Execute current command.
getWidthPreset()
Get width preset.
setWidthPreset($a_val)
Set width preset.
createObject()
create new media object form
setEnabledMapAreas($a_enabledmapareas)
Set Enable map areas.
setBackTitle($a_title)
set title for back tab
editFilesObject()
administrate files of media object
editObject()
edit media object properties
deleteFileObject()
delete object file
assignStandardObject($a_file)
assign file to standard view
setPropertiesSubTabs($a_active)
Set subtabs for properties.
getFullscreenSizeObject()
set original size of fullscreen file
setAdvMdRecordObject($a_adv_ref_id, $a_adv_type, $a_adv_subtype="-")
Set object, that defines the adv md records being used.
resizeImagesObject()
resize images to specified size
initForm($a_mode="create")
Init creation form.
getHeightPreset()
Get height preset.
saveMultiSrtObject()
Save selected srt files as new srt files.
uploadMultipleSubtitleFileObject()
Upload multiple subtitles.
__construct($a_data, $a_id=0, $a_call_by_reference=false, $a_prepare_output=false)
static setObjectPerCreationForm($a_mob)
Set media object values from creation form.
addFullscreenObject()
add fullscreen view
showVideoToolObject()
Show video tools.
getEnabledMapAreas()
Get Enable map areas.
Class ilObjMediaObject.
static getMimeType($a_file, $a_external=null)
get mime type for file
static _useAutoStartParameterOnly($a_loc, $a_format)
Check whether only autostart parameter should be supported (instead of parameters input field.
static getRestrictedFileTypes()
Get restricted file types (this is for the input form, this list will be empty, if "allowed list" is ...
static _getDirectory($a_mob_id)
Get absolute directory.
static _getSimpleMimeTypes()
Get simple mime types that deactivate parameter property files tab in ILIAS.
static fixFilename($a_name)
Fix filename of uploaded file.
static _determineWidthHeight( $a_format, $a_type, $a_file, $a_reference, $a_constrain_proportions, $a_use_original, $a_user_width, $a_user_height)
Determine width and height.
static _resizeImage($a_file, $a_width, $a_height, $a_constrain_prop=false)
resize image and return new image file ("_width_height" string appended)
static getForbiddenFileTypes()
Get forbidden file types.
static renameExecutables($a_dir)
Rename executables.
Class ilObjectGUI Basic methods of all Output classes.
Class ilObjectMetaDataGUI.
static initMediaElementJs($a_tpl=null)
Init mediaelement.js scripts.
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.
This class represents a selection list property in a property form.
ILIAS Setting Class.
Class ilTableGUI.
special template class to simplify handling of ITX/PEAR
This class represents a text area property in a property form.
This class represents a text property in a property form.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static getWebspaceDir($mode="filesystem")
get webspace directory
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows)
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static secureLink($a_str)
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)
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
This class represents a width/height item in a property form.
static getLocalMaphilightPath()
Get local path of maphilight file.
$formats
Definition: date.php:77
$i
Definition: disco.tpl.php:19
$tbl
Definition: example_048.php:81
global $ilCtrl
Definition: ilias.php:18
$format
Definition: metadata.php:141
redirection script todo: (a better solution should control the processing via a xml file)
$ret
Definition: parser.php:6
$type
global $DIC
Definition: saml.php:7
$values
$ilUser
Definition: imgupload.php:18
$cols
Definition: xhr_table.php:11