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