ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 {
21  var $ctrl;
22  var $header;
24  var $enabledmapareas = true;
25 
26  function __construct($a_data, $a_id = 0, $a_call_by_reference = false, $a_prepare_output = false)
27  {
28  global $lng, $ilCtrl;
29 
30  $this->ctrl = $ilCtrl;
31  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
32  $this->lng = $lng;
33  $this->back_title = "";
34  $this->type = "mob";
35 
36  $lng->loadLanguageModule("mob");
37  }
38 
39  function setHeader($a_title = "")
40  {
41  $this->header = $a_title;
42  }
43 
44  function getHeader()
45  {
46  return $this->header;
47  }
48 
54  function setEnabledMapAreas($a_enabledmapareas)
55  {
56  $this->enabledmapareas = $a_enabledmapareas;
57  }
58 
64  function getEnabledMapAreas()
65  {
67  }
68 
74  function setWidthPreset($a_val)
75  {
76  $this->width_preset = $a_val;
77  }
78 
84  function getWidthPreset()
85  {
86  return $this->width_preset;
87  }
88 
94  function setHeightPreset($a_val)
95  {
96  $this->height_preset = $a_val;
97  }
98 
104  function getHeightPreset()
105  {
106  return $this->height_preset;
107  }
108 
114  function getForm()
115  {
116  return $this->form_gui;
117  }
118 
119  function assignObject()
120  {
121  if ($this->id != 0)
122  {
123  $this->object = new ilObjMediaObject($this->id);
124  }
125  }
126 
128  {
129  $this->ctrl->returnToParent($this);
130  }
131 
132 
136  function executeCommand()
137  {
138  global $tpl, $ilAccess, $ilErr;
139 
140  $next_class = $this->ctrl->getNextClass($this);
141  $cmd = $this->ctrl->getCmd();
142 
143  switch($next_class)
144  {
145  case 'ilobjectmetadatagui':
146  include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
147  $md_gui = new ilObjectMetaDataGUI(null, $this->object->getType(), $this->object->getId());
148  // object is subtype, so we have to do it ourselves
149  $md_gui->addMDObserver($this->object, 'MDUpdateListener', 'General');
150  $this->ctrl->forwardCommand($md_gui);
151  break;
152 
153  case "ilimagemapeditorgui":
154  require_once("./Services/MediaObjects/classes/class.ilImageMapEditorGUI.php");
155  $image_map_edit = new ilImageMapEditorGUI($this->object);
156  $ret = $this->ctrl->forwardCommand($image_map_edit);
157  $tpl->setContent($ret);
158  break;
159 
160  case "ilfilesystemgui":
161  include_once("./Services/FileSystem/classes/class.ilFileSystemGUI.php");
162  $fs_gui = new ilFileSystemGUI(ilUtil::getWebspaceDir()."/mobs/mm_".$this->object->getId());
164  $fs_gui->setForbiddenSuffixes(ilObjMediaObject::getForbiddenFileTypes());
165  $fs_gui->activateLabels(true, $this->lng->txt("cont_purpose"));
166  $fs_gui->setTableId("mobfs".$this->object->getId());
167  $fs_gui->labelFile($this->object->getMediaItem("Standard")->getLocation(),
168  $this->lng->txt("cont_std_view"));
169  if($this->object->hasFullscreenItem())
170  {
171  $fs_gui->labelFile($this->object->getMediaItem("Fullscreen")->getLocation(),
172  $this->lng->txt("cont_fullscreen"));
173  }
174  $fs_gui->addCommand($this, "assignStandardObject", $this->lng->txt("cont_assign_std"));
175  $fs_gui->addCommand($this, "assignFullscreenObject", $this->lng->txt("cont_assign_full"));
177  $ret = $this->ctrl->forwardCommand($fs_gui);
179  include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
181  break;
182 
183 
184  default:
185  if (isset($_POST["editImagemapForward"]) ||
186  isset($_POST["editImagemapForward_x"]) ||
187  isset($_POST["editImagemapForward_y"]))
188  {
189  $cmd = "editImagemapForward";
190  }
191  $cmd.= "Object";
192  $ret = $this->$cmd();
193  break;
194  }
195 
196  return $ret;
197  }
198 
202  function setBackTitle($a_title)
203  {
204  $this->back_title = $a_title;
205  }
206 
210  function createObject()
211  {
212  global $tpl, $ilHelp;
213 
214  $ilHelp->setScreenId("create");
215  $this->initForm();
216  $tpl->setContent($this->form_gui->getHTML());
217  }
218 
222  function initForm($a_mode = "create")
223  {
224  global $lng, $ilCtrl;
225 
226  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
227 
228  if ($a_mode == "edit")
229  {
230  $std_item = $this->object->getMediaItem("Standard");
231  }
232 
233  $this->form_gui = new ilPropertyFormGUI();
234 
235  // standard view resource
236  $title = new ilTextInputGUI($lng->txt("title"), "standard_title");
237  $title->setSize(40);
238  $title->setMaxLength(120);
239  $this->form_gui->addItem($title);
240  $radio_prop = new ilRadioGroupInputGUI($lng->txt("cont_resource"), "standard_type");
241  $op1 = new ilRadioOption($lng->txt("cont_file"), "File");
242  $up = new ilFileInputGUI("", "standard_file");
243  $up->setSuffixes(ilObjMediaObject::getRestrictedFileTypes());
244  $up->setForbiddenSuffixes(ilObjMediaObject::getForbiddenFileTypes());
245  $up->setInfo("");
246  $op1->addSubItem($up);
247  $radio_prop->addOption($op1);
248  $op2 = new ilRadioOption($lng->txt("url"), "Reference");
249  $ref = new ilTextInputGUI("", "standard_reference");
250  $ref->setInfo($lng->txt("cont_ref_helptext"));
251  $op2->addSubItem($ref);
252  $radio_prop->addOption($op2);
253  $radio_prop->setValue("File");
254  $this->form_gui->addItem($radio_prop);
255 
256  // standard format
257  if ($a_mode == "edit")
258  {
259  $format = new ilNonEditableValueGUI($lng->txt("cont_format"), "standard_format");
260  $format->setValue($std_item->getFormat());
261  $this->form_gui->addItem($format);
262  }
263 
264  // standard size
265  $radio_size = new ilRadioGroupInputGUI($lng->txt("size"), "standard_size");
266  if ($a_mode == "edit")
267  {
268  if ($orig_size = $std_item->getOriginalSize())
269  {
270  $add_str = " (".$orig_size["width"]." x ".$orig_size["height"].")";
271  }
272  $op1 = new ilRadioOption($lng->txt("cont_resource_size").$add_str, "original");
273  $op2 = new ilRadioOption($lng->txt("cont_custom_size"), "selected");
274  }
275  else
276  {
277  $op1 = new ilRadioOption($lng->txt("cont_orig_size"), "original");
278  $op2 = new ilRadioOption($lng->txt("cont_adjust_size"), "selected");
279  }
280  $radio_size->addOption($op1);
281 
282  // width height
283  include_once("./Services/MediaObjects/classes/class.ilWidthHeightInputGUI.php");
284  $width_height = new ilWidthHeightInputGUI($lng->txt("cont_width").
285  " / ".$lng->txt("cont_height"), "standard_width_height");
286  $width_height->setConstrainProportions(true);
287  $op2->addSubItem($width_height);
288 
289  // resize image
290  if ($a_mode == "edit")
291  {
292  $std_item = $this->object->getMediaItem("Standard");
293  if (is_int(strpos($std_item->getFormat(), "image"))
294  && $std_item->getLocationType() == "LocalFile")
295  {
296  $resize = new ilCheckboxInputGUI($lng->txt("cont_resize_img")
297  , "standard_resize");
298  $op2->addSubItem($resize);
299  }
300  }
301 
302  $radio_size->setValue("original");
303  if ($a_mode == "create" && ($this->getHeightPreset() > 0 || $this->getWidthPreset() > 0))
304  {
305  $radio_size->setValue("selected");
306  $width_height->setWidth($this->getWidthPreset());
307  $width_height->setHeight($this->getHeightPreset());
308  }
309  $radio_size->addOption($op2);
310  $this->form_gui->addItem($radio_size);
311 
312  // standard caption
313  $caption = new ilTextAreaInputGUI($lng->txt("cont_caption"), "standard_caption");
314  $caption->setCols(30);
315  $caption->setRows(2);
316  $this->form_gui->addItem($caption);
317 
318  /*$caption = new ilTextInputGUI($lng->txt("cont_caption"), "standard_caption");
319  $caption->setSize(40);
320  $caption->setMaxLength(200);
321  $this->form_gui->addItem($caption);*/
322 
323  // text representation (alt text)
324  if ($a_mode == "edit" && is_int(strpos($std_item->getFormat(), "image")))
325  {
326  $ta = new ilTextAreaInputGUI($lng->txt("text_repr"), "text_representation");
327  $ta->setCols(30);
328  $ta->setRows(2);
329  $ta->setInfo($lng->txt("text_repr_info"));
330  $this->form_gui->addItem($ta);
331  }
332 
333  // standard parameters
334  if ($a_mode == "edit" &&
335  !in_array($std_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes()))
336  {
337  if (ilObjMediaObject::_useAutoStartParameterOnly($std_item->getLocation(),
338  $std_item->getFormat())) // autostart
339  {
340  $auto = new ilCheckboxInputGUI($lng->txt("cont_autostart"), "standard_autostart");
341  $this->form_gui->addItem($auto);
342  }
343  else // parameters
344  {
345  $par = new ilTextAreaInputGUI($lng->txt("cont_parameter"), "standard_parameters");
346  $par->setRows(5);
347  $par->setCols(50);
348  $this->form_gui->addItem($par);
349  }
350  }
351 
352  if ($a_mode == "edit")
353  {
354  $full_item = $this->object->getMediaItem("Fullscreen");
355  }
356 
357  // fullscreen view resource
358  $fs_sec = new ilFormSectionHeaderGUI();
359  $fs_sec->setTitle($lng->txt("cont_fullscreen"));
360  $this->form_gui->addItem($fs_sec);
361 
362  $radio_prop2 = new ilRadioGroupInputGUI($lng->txt("cont_resource"), "full_type");
363  $op1 = new ilRadioOption($lng->txt("cont_none"), "None");
364  $radio_prop2->addOption($op1);
365  $op4 = new ilRadioOption($lng->txt("cont_use_same_resource_as_above"), "Standard");
366  $radio_prop2->addOption($op4);
367  $op2 = new ilRadioOption($lng->txt("cont_file"), "File");
368  $up = new ilFileInputGUI("", "full_file");
369  $up->setSuffixes(ilObjMediaObject::getRestrictedFileTypes());
370  $up->setForbiddenSuffixes(ilObjMediaObject::getForbiddenFileTypes());
371  $up->setInfo("");
372  $op2->addSubItem($up);
373  $radio_prop2->addOption($op2);
374  $op3 = new ilRadioOption($lng->txt("url"), "Reference");
375  $ref = new ilTextInputGUI("", "full_reference");
376  $ref->setInfo($lng->txt("cont_ref_helptext"));
377  $op3->addSubItem($ref);
378  $radio_prop2->addOption($op3);
379  $radio_prop2->setValue("None");
380  $this->form_gui->addItem($radio_prop2);
381 
382  // fullscreen format
383  if ($a_mode == "edit")
384  {
385  if ($this->object->hasFullscreenItem())
386  {
387  $format = new ilNonEditableValueGUI($lng->txt("cont_format"), "full_format");
388  $format->setValue($full_item->getFormat());
389  $this->form_gui->addItem($format);
390  }
391  }
392 
393  // fullscreen size
394  $radio_size = new ilRadioGroupInputGUI($lng->txt("size"), "full_size");
395  if ($a_mode == "edit")
396  {
397  $add_str = "";
398  if ($this->object->hasFullscreenItem() && ($orig_size = $full_item->getOriginalSize()))
399  {
400  $add_str = " (".$orig_size["width"]." x ".$orig_size["height"].")";
401  }
402  $op1 = new ilRadioOption($lng->txt("cont_resource_size").$add_str, "original");
403  $op2 = new ilRadioOption($lng->txt("cont_custom_size"), "selected");
404  }
405  else
406  {
407  $op1 = new ilRadioOption($lng->txt("cont_orig_size"), "original");
408  $op2 = new ilRadioOption($lng->txt("cont_adjust_size"), "selected");
409  }
410  $radio_size->addOption($op1);
411 
412  // width/height
413  $width_height = new ilWidthHeightInputGUI($lng->txt("cont_width").
414  " / ".$lng->txt("cont_height"), "full_width_height");
415  $width_height->setConstrainProportions(true);
416  $op2->addSubItem($width_height);
417 
418  // resize image
419  if ($a_mode == "edit")
420  {
421  $full_item = $this->object->getMediaItem("Fullscreen");
422  if ($this->object->hasFullscreenItem() &&
423  is_int(strpos($full_item->getFormat(), "image")) &&
424  $full_item->getLocationType() == "LocalFile")
425  {
426  $resize = new ilCheckboxInputGUI($lng->txt("cont_resize_img"),
427  "full_resize");
428  $op2->addSubItem($resize);
429  }
430  }
431 
432  $radio_size->setValue("original");
433  $radio_size->addOption($op2);
434  $this->form_gui->addItem($radio_size);
435 
436  // fullscreen caption
437  $caption = new ilTextAreaInputGUI($lng->txt("cont_caption"), "full_caption");
438  $caption->setCols(30);
439  $caption->setRows(2);
440  $this->form_gui->addItem($caption);
441 
442  /*$caption = new ilTextInputGUI($lng->txt("cont_caption"), "full_caption");
443  $caption->setSize(40);
444  $caption->setMaxLength(200);
445  $this->form_gui->addItem($caption);*/
446 
447  // text representation (alt text)
448  if ($a_mode == "edit" && $this->object->hasFullscreenItem() && is_int(strpos($std_item->getFormat(), "image")))
449  {
450  $ta = new ilTextAreaInputGUI($lng->txt("text_repr"), "full_text_representation");
451  $ta->setCols(30);
452  $ta->setRows(2);
453  $ta->setInfo($lng->txt("text_repr_info"));
454  $this->form_gui->addItem($ta);
455  }
456 
457 
458  // fullscreen parameters
459  if ($a_mode == "edit" && $this->object->hasFullscreenItem() &&
460  !in_array($full_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes()))
461  {
462  if (ilObjMediaObject::_useAutoStartParameterOnly($full_item->getLocation(),
463  $full_item->getFormat()))
464  {
465  $auto = new ilCheckboxInputGUI($lng->txt("cont_autostart"), "full_autostart");
466  $this->form_gui->addItem($auto);
467  }
468  else
469  {
470  $par = new ilTextAreaInputGUI($lng->txt("cont_parameter"), "full_parameters");
471  $par->setRows(5);
472  $par->setCols(50);
473  $this->form_gui->addItem($par);
474  }
475  }
476 
477  $this->form_gui->setTitle($lng->txt("cont_insert_mob"));
478  if ($a_mode == "edit")
479  {
480  $this->form_gui->addCommandButton("saveProperties", $lng->txt("save"));
481  }
482  else
483  {
484  $this->form_gui->addCommandButton("save", $lng->txt("save"));
485  $this->form_gui->addCommandButton("cancel", $lng->txt("cancel"));
486  }
487  $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
488 
489  }
490 
495  public function getValues()
496  {
497  $values = array();
498 
499  $values["standard_title"] = $this->object->getTitle();
500 
501  $std_item = $this->object->getMediaItem("Standard");
502  if ($std_item->getLocationType() == "LocalFile")
503  {
504  $values["standard_type"] = "File";
505  $values["standard_file"] = $std_item->getLocation();
506  }
507  else
508  {
509  $values["standard_type"] = "Reference";
510  $values["standard_reference"] = $std_item->getLocation();
511  }
512  $values["standard_format"] = $std_item->getFormat();
513  $values["standard_width_height"]["width"] = $std_item->getWidth();
514  $values["standard_width_height"]["height"] = $std_item->getHeight();
515  $values["standard_width_height"]["constr_prop"] = true;
516 
517  $values["standard_size"] = "selected";
518 
519  if ($orig_size = $std_item->getOriginalSize())
520  {
521  //if ($orig_size["width"] == $std_item->getWidth() &&
522  // $orig_size["height"] == $std_item->getHeight())
523  if ($std_item->getWidth() == "" && $std_item->getHeight() == "")
524  {
525  $values["standard_size"] = "original";
526  $values["standard_width_height"]["width"] = $orig_size["width"];
527  $values["standard_width_height"]["height"] = $orig_size["height"];
528  }
529  }
530  $values["standard_caption"] = $std_item->getCaption();
531  $values["text_representation"] = $std_item->getTextRepresentation();
532  if (ilObjMediaObject::_useAutoStartParameterOnly($std_item->getLocation(),
533  $std_item->getFormat()))
534  {
535  $par = $std_item->getParameters();
536  if ($par["autostart"])
537  {
538  $values["standard_autostart"] = true;
539  }
540  }
541  else
542  {
543  $values["standard_parameters"] = $std_item->getParameterString();
544  }
545 
546  $values["full_type"] = "None";
547  $values["full_size"] = "original";
548  if ($this->object->hasFullScreenItem())
549  {
550  $full_item = $this->object->getMediaItem("Fullscreen");
551  if ($full_item->getLocationType() == "LocalFile")
552  {
553  $values["full_type"] = "File";
554  $values["full_file"] = $full_item->getLocation();
555  }
556  else
557  {
558  $values["full_type"] = "Reference";
559  $values["full_reference"] = $full_item->getLocation();
560  }
561  $values["full_format"] = $full_item->getFormat();
562  $values["full_width_height"]["width"] = $full_item->getWidth();
563  $values["full_width_height"]["height"] = $full_item->getHeight();
564  $values["full_width_height"]["constr_prop"] = true;
565 
566  $values["full_size"] = "selected";
567 
568  if ($orig_size = $full_item->getOriginalSize())
569  {
570  if ($orig_size["width"] == $full_item->getWidth() &&
571  $orig_size["height"] == $full_item->getHeight())
572  {
573  $values["full_size"] = "original";
574  }
575  }
576  $values["full_caption"] = $full_item->getCaption();
577  if (ilObjMediaObject::_useAutoStartParameterOnly($full_item->getLocation(),
578  $full_item->getFormat()))
579  {
580  $par = $full_item->getParameters();
581  if ($par["autostart"])
582  {
583  $values["full_autostart"] = true;
584  }
585  }
586  else
587  {
588  $values["full_parameters"] = $full_item->getParameterString();
589  }
590  $values["full_text_representation"] = $full_item->getTextRepresentation();
591  }
592 
593  $this->form_gui->setValuesByArray($values);
594  }
595 
599  function saveObject()
600  {
601  global $tpl, $lng;
602 
603  $this->initForm();
604  if ($this->form_gui->checkInput())
605  {
606  $this->object = new ilObjMediaObject();
608  ilUtil::sendSuccess($lng->txt("saved_media_object"), true);
609  return $this->object;
610  }
611  else
612  {
613  $this->form_gui->setValuesByPost();
614  $tpl->setContent($this->form_gui->getHTML());
615  return false;
616  }
617  }
618 
625  function checkFormInput()
626  {
627  if (!$this->form_gui->checkInput())
628  {
629  $this->form_gui->setValuesByPost();
630  return false;
631  }
632  return true;
633  }
634 
635 
639  static function setObjectPerCreationForm($a_mob)
640  {
641  // determinte title and format
642  if (trim($_POST["standard_title"]) != "")
643  {
644  $title = trim($_POST["standard_title"]);
645  }
646  else
647  {
648  if ($_POST["standard_type"] == "File")
649  {
650  $title = $_FILES['standard_file']['name'];
651  }
652  else
653  {
654  $title = ilUtil::stripSlashes($_POST["standard_reference"]);
655  }
656  }
657 
658  $a_mob->setTitle($title);
659  $a_mob->setDescription("");
660  $a_mob->create();
661 
662  // determine and create mob directory, move uploaded file to directory
663  //$mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$a_mob->getId();
664  $a_mob->createDirectory();
665  $mob_dir = ilObjMediaObject::_getDirectory($a_mob->getId());
666 
667  $media_item = new ilMediaItem();
668  $a_mob->addMediaItem($media_item);
669  $media_item->setPurpose("Standard");
670 
671  if ($_POST["standard_type"] == "File")
672  {
673  $file_name = ilObjMediaObject::fixFilename($_FILES['standard_file']['name']);
674  $file = $mob_dir."/".$file_name;
675  ilUtil::moveUploadedFile($_FILES['standard_file']['tmp_name'],
676  $file_name, $file);
677 
678  // get mime type
680  $location = $file_name;
681 
682  // resize standard images
683  if ($_POST["standard_size"] != "original" &&
684  is_int(strpos($format, "image")))
685  {
686  $location = ilObjMediaObject::_resizeImage($file, (int) $_POST["standard_width_height"]["width"],
687  (int) $_POST["standard_width_height"]["height"], (boolean) $_POST["standard_width_height"]["contr_prop"]);
688  }
689 
690  // set real meta and object data
691  $media_item->setFormat($format);
692  $media_item->setLocation($location);
693  $media_item->setLocationType("LocalFile");
694  }
695  else // standard type: reference
696  {
697  $format = ilObjMediaObject::getMimeType(ilUtil::stripSlashes($_POST["standard_reference"]), true);
698  $media_item->setFormat($format);
699  $media_item->setLocation(ilUtil::secureLink(ilUtil::stripSlashes($_POST["standard_reference"])));
700  $media_item->setLocationType("Reference");
701  }
702  $a_mob->setDescription($format);
703 
704  // determine width and height of known image types
706  $_POST["standard_type"], $mob_dir."/".$location, $media_item->getLocation(),
707  $_POST["standard_width_height"]["constr_prop"], ($_POST["standard_size"] == "original"),
708  $_POST["standard_width_height"]["width"], $_POST["standard_width_height"]["height"]);
709  $media_item->setWidth($wh["width"]);
710  $media_item->setHeight($wh["height"]);
711  if ($wh["info"] != "")
712  {
713  ilUtil::sendInfo($wh["info"], true);
714  }
715 
716  if ($_POST["standard_caption"] != "")
717  {
718  $media_item->setCaption(ilUtil::stripSlashes($_POST["standard_caption"]));
719  }
720 
721 
722  $media_item->setHAlign("Left");
723 
724  // fullscreen view
725  if ($_POST["full_type"] != "None")
726  {
727  $media_item2 = new ilMediaItem();
728  $a_mob->addMediaItem($media_item2);
729  $media_item2->setPurpose("Fullscreen");
730 
731  // move file / set format and location
732  if ($_POST["full_type"] == "File")
733  {
734  $format = $location = "";
735  if ($_FILES['full_file']['name'] != "")
736  {
737  $full_file_name = ilObjMediaObject::fixFilename($_FILES['full_file']['name']);
738  $file = $mob_dir."/".$full_file_name;
739  ilUtil::moveUploadedFile($_FILES['full_file']['tmp_name'],
740  $full_file_name, $file);
742  $location = $full_file_name;
743  }
744  }
745  else if ($_POST["full_type"] == "Standard" && $_POST["standard_type"] == "File")
746  {
747  $location = $file_name;
748  }
749 
750  // resize file
751  if ($_POST["full_type"] == "File" ||
752  ($_POST["full_type"] == "Standard" && $_POST["standard_type"] == "File"))
753  {
754  if (($_POST["full_size"] != "original" &&
755  is_int(strpos($format, "image")))
756  )
757  {
758  $location = ilObjMediaObject::_resizeImage($file, (int) $_POST["full_width_height"]["width"],
759  (int) $_POST["full_width_height"]["height"], (boolean) $_POST["full_width_height"]["constr_prop"]);
760  }
761 
762  $media_item2->setFormat($format);
763  $media_item2->setLocation($location);
764  $media_item2->setLocationType("LocalFile");
765  $type = "File";
766  }
767 
768  if ($_POST["full_type"] == "Reference")
769  {
770  $format = $location = "";
771  if ($_POST["full_reference"] != "")
772  {
773  $format = ilObjMediaObject::getMimeType($_POST["full_reference"], true);
774  $location = ilUtil::stripSlashes($_POST["full_reference"]);
775  }
776  }
777 
778  if ($_POST["full_type"] == "Reference" ||
779  ($_POST["full_type"] == "Standard" && $_POST["standard_type"] == "Reference"))
780  {
781  $media_item2->setFormat($format);
782  $media_item2->setLocation($location);
783  $media_item2->setLocationType("Reference");
784  $type = "Reference";
785  }
786 
787  // determine width and height of known image types
789  $type, $mob_dir."/".$location, $media_item2->getLocation(),
790  $_POST["full_width_height"]["constr_prop"], ($_POST["full_size"] == "original"),
791  $_POST["full_width_height"]["width"], $_POST["full_width_height"]["height"]);
792 
793  $media_item2->setWidth($wh["width"]);
794  $media_item2->setHeight($wh["height"]);
795 
796  if ($_POST["full_caption"] != "")
797  {
798  $media_item2->setCaption(ilUtil::stripSlashes($_POST["full_caption"]));
799  }
800 
801  }
802 
804  include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
805  ilMediaSvgSanitizer::sanitizeDir($mob_dir); // see #20339
806  $a_mob->update();
807  }
808 
809 
813  function cancelObject()
814  {
815  $this->ctrl->returnToParent($this);
816  }
817 
821  function editObject()
822  {
823  global $tpl;
824 
825  $this->setPropertiesSubTabs("general");
826 
827  $this->initForm("edit");
828  $this->getValues();
829  $tpl->setContent($this->form_gui->getHTML());
830  }
831 
832 
837  {
838  // directory
839  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
840 
841  // standard item
842  $std_item = $this->object->getMediaItem("Standard");
843  if ($std_item->getLocationType() == "LocalFile" &&
844  is_int(strpos($std_item->getFormat(), "image"))
845  )
846  {
847  $file = $mob_dir."/".$std_item->getLocation();
848  $location = ilObjMediaObject::_resizeImage($file, $std_item->getWidth(),
849  $std_item->getHeight());
850  $std_item->setLocation($location);
851  $std_item->update();
852  }
853 
854  // fullscreen item
855  if($this->object->hasFullScreenItem())
856  {
857  $full_item = $this->object->getMediaItem("Fullscreen");
858  if ($full_item->getLocationType() == "LocalFile" &&
859  is_int(strpos($full_item->getFormat(), "image"))
860  )
861  {
862  $file = $mob_dir."/".$full_item->getLocation();
863  $location = ilObjMediaObject::_resizeImage($file, $full_item->getWidth(),
864  $full_item->getHeight());
865  $full_item->setLocation($location);
866  $full_item->update();
867  }
868  }
869 
870  $this->ctrl->redirect($this, "edit");
871  }
872 
873 
878  {
879  $std_item = $this->object->getMediaItem("Standard");
880  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
881 
882  if ($std_item->getLocationType() == "LocalFile")
883  {
884  $file = $mob_dir."/".$std_item->getLocation();
885 
886  include_once("./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
888 
889  $std_item->setWidth($size[0]);
890  $std_item->setHeight($size[1]);
891  $this->object->update();
892  }
893  $this->ctrl->redirect($this, "edit");
894  }
895 
896 
901  {
902  $full_item = $this->object->getMediaItem("Fullscreen");
903  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
904 
905  if ($full_item->getLocationType() == "LocalFile")
906  {
907  $file = $mob_dir."/".$full_item->getLocation();
908  include_once("./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
910  $full_item->setWidth($size[0]);
911  $full_item->setHeight($size[1]);
912  $this->object->update();
913  }
914  $this->ctrl->redirect($this, "edit");
915  }
916 
921  {
922  global $lng, $tpl;
923 
924  $this->initForm("edit");
925  if ($this->form_gui->checkInput())
926  {
927  $title = trim($_POST["standard_title"]);
928  $this->object->setTitle($title);
929 
930  $std_item = $this->object->getMediaItem("Standard");
931  $location = $std_item->getLocation();
932  $format = $std_item->getFormat();
933  if ($_POST["standard_type"] == "Reference")
934  {
935  $format = ilObjMediaObject::getMimeType(ilUtil::stripSlashes($_POST["standard_reference"]), true);
936  $std_item->setFormat($format);
937  $std_item->setLocation(ilUtil::secureLink(ilUtil::stripSlashes($_POST["standard_reference"])));
938  $std_item->setLocationType("Reference");
939  }
940  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
941  if ($_POST["standard_type"] == "File")
942  {
943  $resize = false;
944  if ($_FILES['standard_file']['name'] != "")
945  {
946  $file_name = ilObjMediaObject::fixFilename($_FILES['standard_file']['name']);
947  $file = $mob_dir."/".$file_name;
948  ilUtil::moveUploadedFile($_FILES['standard_file']['tmp_name'],
949  $file_name, $file);
950 
951  // get mime type
953  $location = $file_name;
954 
955  $resize = true;
956  }
957  else if ($_POST["standard_resize"])
958  {
959  $file = $mob_dir."/".$location;
960  $resize = true;
961  }
962 
963  // resize
964  if ($resize)
965  {
966  if ($_POST["standard_size"] != "original" &&
967  is_int(strpos($format, "image")))
968  {
969  $location = ilObjMediaObject::_resizeImage($file, (int) $_POST["standard_width_height"]["width"],
970  (int) $_POST["standard_width_height"]["height"], (boolean) $_POST["standard_width_height"]["contr_prop"]);
971  }
972  $std_item->setFormat($format);
973  $std_item->setLocation($location);
974  }
975 
976  $std_item->setLocationType("LocalFile");
977  }
978  $this->object->setDescription($format);
979  // determine width and height of known image types
981  $_POST["standard_type"], $mob_dir."/".$location, $std_item->getLocation(),
982  $_POST["standard_width_height"]["constr_prop"], ($_POST["standard_size"] == "original"),
983  $_POST["standard_width_height"]["width"], $_POST["standard_width_height"]["height"]);
984  if ($wh["info"] != "")
985  {
986  ilUtil::sendInfo($wh["info"], true);
987  }
988  $std_item->setWidth($wh["width"]);
989  $std_item->setHeight($wh["height"]);
990 
991  // set caption
992  $std_item->setCaption(ilUtil::stripSlashes($_POST["standard_caption"]));
993 
994  // text representation
995  $std_item->setTextRepresentation(ilUtil::stripSlashes($_POST["text_representation"]));
996 
997  // set parameters
998  if (!in_array($std_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes()))
999  {
1000  if (ilObjMediaObject::_useAutoStartParameterOnly($std_item->getLocation(),
1001  $std_item->getFormat()))
1002  {
1003  if ($_POST["standard_autostart"]) // save only autostart flag
1004  {
1005  $std_item->setParameters('autostart="true"');
1006  }
1007  else
1008  {
1009  $std_item->setParameters("");
1010  }
1011  }
1012  else
1013  {
1014  $std_item->setParameters(ilUtil::stripSlashes(utf8_decode($_POST["standard_parameters"])));
1015  }
1016  }
1017 
1018  // "None" selected
1019  if ($_POST["full_type"] == "None")
1020  {
1021  if ($this->object->hasFullscreenItem()) // delete existing
1022  {
1023  $this->object->removeMediaItem("Fullscreen");
1024  }
1025  }
1026  else // Not "None" -> we need one
1027  {
1028  if ($this->object->hasFullscreenItem()) // take existing one
1029  {
1030  $full_item = $this->object->getMediaItem("Fullscreen");
1031  }
1032  else // create one
1033  {
1034  $full_item = new ilMediaItem();
1035  $this->object->addMediaItem($full_item);
1036  $full_item->setPurpose("Fullscreen");
1037  }
1038  $location = $full_item->getLocation();
1039  $format = $full_item->getFormat();
1040  if ($_POST["full_type"] == "Reference")
1041  {
1042  $format = ilObjMediaObject::getMimeType(ilUtil::stripSlashes($_POST["full_reference"]), true);
1043  $full_item->setFormat($format);
1044  $full_item->setLocationType("Reference");
1045  $location = ilUtil::stripSlashes($_POST["full_reference"]);
1046  $type = "Reference";
1047  }
1048  $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
1049  if ($_POST["full_type"] == "File")
1050  {
1051  $resize = false;
1052  if ($_FILES['full_file']['name'] != "")
1053  {
1054  $full_file_name = ilObjMediaObject::fixFilename($_FILES['full_file']['name']);
1055  $file = $mob_dir."/".$full_file_name;
1056  ilUtil::moveUploadedFile($_FILES['full_file']['tmp_name'],
1057  $full_file_name, $file);
1058 
1060  $location = $full_file_name;
1061 
1062  $resize = true;
1063  }
1064  else if ($_POST["full_resize"])
1065  {
1066  $file = $mob_dir."/".$location;
1067  $resize = true;
1068  }
1069 
1070  // resize
1071  if ($resize)
1072  {
1073  if ($_POST["full_size"] != "original" &&
1074  is_int(strpos($format, "image")))
1075  {
1076  $location = ilObjMediaObject::_resizeImage($file, (int) $_POST["full_width_height"]["width"],
1077  (int) $_POST["full_width_height"]["height"], (boolean) $_POST["full_width_height"]["contr_prop"]);
1078  }
1079  $full_item->setFormat($format);
1080  $full_item->setLocation($location);
1081  }
1082 
1083  $full_item->setLocationType("LocalFile");
1084  $type = "File";
1085  }
1086  if ($_POST["full_type"] == "Standard")
1087  {
1088  $format = $std_item->getFormat();
1089  $location = $std_item->getLocation();
1090  $full_item->setLocationType($std_item->getLocationType());
1091  $full_item->setFormat($format);
1092  $full_item->setLocation($location);
1093  $type = $std_item->getLocationType();
1094  if ($type == "LocalFile")
1095  {
1096  $type = "File";
1097  }
1098  // resize image
1099 //echo "-".$_POST["full_size"]."-".is_int(strpos($format, "image"))."-".$full_item->getLocationType()."-";
1100  if ($_POST["full_size"] != "original" &&
1101  is_int(strpos($format, "image")) &&
1102  $full_item->getLocationType() == "LocalFile")
1103  {
1104  $file = $mob_dir."/".$location;
1105  $location = ilObjMediaObject::_resizeImage($file, (int) $_POST["full_width_height"]["width"],
1106  (int) $_POST["full_width_height"]["height"], (boolean) $_POST["full_width_height"]["contr_prop"]);
1107  }
1108  }
1109 
1110  // determine width and height of known image types
1112  $type, $mob_dir."/".$location, $full_item->getLocation(),
1113  $_POST["full_width_height"]["constr_prop"], ($_POST["full_size"] == "original"),
1114  $_POST["full_width_height"]["width"], $_POST["full_width_height"]["height"]);
1115  if ($wh["info"] != "")
1116  {
1117  ilUtil::sendInfo($wh["info"], true);
1118  }
1119 
1120  $full_item->setWidth($wh["width"]);
1121  $full_item->setHeight($wh["height"]);
1122  $full_item->setLocation($location);
1123 
1124  $full_item->setCaption(ilUtil::stripSlashes($_POST["full_caption"]));
1125 
1126  // text representation
1127  $full_item->setTextRepresentation(ilUtil::stripSlashes($_POST["full_text_representation"]));
1128 
1129 
1130  // set parameters
1131  if (!in_array($std_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes()))
1132  {
1133  if (ilObjMediaObject::_useAutoStartParameterOnly($std_item->getLocation(),
1134  $std_item->getFormat()))
1135  {
1136  if ($_POST["full_autostart"]) // save only autostart flag
1137  {
1138  $full_item->setParameters('autostart="true"');
1139  }
1140  else
1141  {
1142  $full_item->setParameters("");
1143  }
1144  }
1145  else
1146  {
1147  $full_item->setParameters(ilUtil::stripSlashes(utf8_decode($_POST["full_parameters"])));
1148  }
1149  }
1150  }
1151 
1153  include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
1155 
1156  $this->object->update();
1157  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1158  $this->ctrl->redirect($this, "edit");
1159  }
1160  else
1161  {
1162  $this->form_gui->setValuesByPost();
1163  $tpl->setContent($this->form_gui->getHTML());
1164  }
1165  }
1166 
1167 
1171  function editFilesObject()
1172  {
1173  // standard item
1174  $std_item = $this->object->getMediaItem("Standard");
1175  if($this->object->hasFullscreenItem())
1176  {
1177  $full_item = $this->object->getMediaItem("Fullscreen");
1178  }
1179 
1180  // create table
1181  require_once("./Services/Table/classes/class.ilTableGUI.php");
1182  $tbl = new ilTableGUI();
1183 
1184  // determine directory
1185  $cur_subdir = $_GET["cdir"];
1186  if($_GET["newdir"] == "..")
1187  {
1188  $cur_subdir = substr($cur_subdir, 0, strrpos($cur_subdir, "/"));
1189  }
1190  else
1191  {
1192  if (!empty($_GET["newdir"]))
1193  {
1194  if (!empty($cur_subdir))
1195  {
1196  $cur_subdir = $cur_subdir."/".$_GET["newdir"];
1197  }
1198  else
1199  {
1200  $cur_subdir = $_GET["newdir"];
1201  }
1202  }
1203  }
1204 
1205  $cur_subdir = str_replace(".", "", $cur_subdir);
1206  $mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$this->object->getId();
1207  $cur_dir = (!empty($cur_subdir))
1208  ? $mob_dir."/".$cur_subdir
1209  : $mob_dir;
1210 
1211  // load files templates
1212  $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.mob_files.html", "Services/MediaObjects");
1213 
1214  $this->ctrl->setParameter($this, "cdir", urlencode($cur_subdir));
1215  $this->tpl->setVariable("FORMACTION1", $this->ctrl->getFormAction($this));
1216 //echo "--".$this->getTargetScript().
1217  //"&hier_id=".$_GET["hier_id"]."&cdir=".$cur_subdir."&cmd=post"."--<br>";
1218  $this->tpl->setVariable("TXT_NEW_DIRECTORY", $this->lng->txt("cont_new_dir"));
1219  $this->tpl->setVariable("TXT_NEW_FILE", $this->lng->txt("cont_new_file"));
1220  $this->tpl->setVariable("CMD_NEW_DIR", "createDirectory");
1221  $this->tpl->setVariable("CMD_NEW_FILE", "uploadFile");
1222  $this->tpl->setVariable("BTN_NEW_DIR", $this->lng->txt("create"));
1223  $this->tpl->setVariable("BTN_NEW_FILE", $this->lng->txt("upload"));
1224 
1225  //
1226  $this->tpl->addBlockfile("FILE_TABLE", "files", "tpl.table.html");
1227 
1228  // load template for table content data
1229  $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.mob_file_row.html", "Services/MediaObjects");
1230 
1231  $num = 0;
1232 
1233  $obj_str = ($this->call_by_reference) ? "" : "&obj_id=".$this->obj_id;
1234  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
1235 
1236  $tbl->setTitle($this->lng->txt("cont_files")." ".$cur_subdir);
1237  //$tbl->setHelp("tbl_help.php","icon_help.gif",$this->lng->txt("help"));
1238 
1239  $tbl->setHeaderNames(array("", "", $this->lng->txt("cont_dir_file"),
1240  $this->lng->txt("cont_size"), $this->lng->txt("cont_purpose")));
1241 
1242  $cols = array("", "", "dir_file", "size", "purpose");
1243  $header_params = array("ref_id" => $_GET["ref_id"], "obj_id" => $_GET["obj_id"],
1244  "cmd" => "editFiles", "hier_id" => $_GET["hier_id"], "item_id" => $_GET["item_id"]);
1245  $tbl->setHeaderVars($cols, $header_params);
1246  $tbl->setColumnWidth(array("1%", "1%", "33%", "33%", "32%"));
1247 
1248  // control
1249  $tbl->setOrderColumn($_GET["sort_by"]);
1250  $tbl->setOrderDirection($_GET["sort_order"]);
1251  $tbl->setLimit($_GET["limit"]);
1252  $tbl->setOffset($_GET["offset"]);
1253  $tbl->setMaxCount($this->maxcount); // ???
1254  //$tbl->setMaxCount(30); // ???
1255 
1256  $this->tpl->setVariable("COLUMN_COUNTS", 5);
1257 
1258  // delete button
1259  $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
1260  $this->tpl->setCurrentBlock("tbl_action_btn");
1261  $this->tpl->setVariable("BTN_NAME", "deleteFile");
1262  $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete"));
1263  $this->tpl->parseCurrentBlock();
1264 
1265  $this->tpl->setCurrentBlock("tbl_action_btn");
1266  $this->tpl->setVariable("BTN_NAME", "assignStandard");
1267  $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("cont_assign_std"));
1268  $this->tpl->parseCurrentBlock();
1269 
1270  $this->tpl->setCurrentBlock("tbl_action_btn");
1271  $this->tpl->setVariable("BTN_NAME", "assignFullscreen");
1272  $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("cont_assign_full"));
1273  $this->tpl->parseCurrentBlock();
1274 
1275  // footer
1276  $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
1277  //$tbl->disable("footer");
1278 
1279  $entries = ilUtil::getDir($cur_dir);
1280 
1281  //$objs = ilUtil::sortArray($objs, $_GET["sort_by"], $_GET["sort_order"]);
1282  $tbl->setMaxCount(count($entries));
1283  $entries = array_slice($entries, $_GET["offset"], $_GET["limit"]);
1284 
1285  $tbl->render();
1286  if(count($entries) > 0)
1287  {
1288  $i=0;
1289  foreach($entries as $entry)
1290  {
1291  if(($entry["entry"] == ".") || ($entry["entry"] == ".." && empty($cur_subdir)))
1292  {
1293  continue;
1294  }
1295 
1296  //$this->tpl->setVariable("ICON", $obj["title"]);
1297  if($entry["type"] == "dir")
1298  {
1299  $this->tpl->setCurrentBlock("FileLink");
1300  $this->ctrl->setParameter($this, "cdir", $cur_subdir);
1301  $this->ctrl->setParameter($this, "newdir", rawurlencode($entry["entry"]));
1302  $this->tpl->setVariable("LINK_FILENAME", $this->ctrl->getLinkTarget($this, "editFiles"));
1303  $this->tpl->setVariable("TXT_FILENAME", $entry["entry"]);
1304  $this->tpl->parseCurrentBlock();
1305 
1306  $this->tpl->setVariable("ICON", "<img src=\"".
1307  ilUtil::getImagePath("icon_cat.svg")."\">");
1308  }
1309  else
1310  {
1311  $this->tpl->setCurrentBlock("File");
1312  $this->tpl->setVariable("TXT_FILENAME2", $entry["entry"]);
1313  $this->tpl->parseCurrentBlock();
1314  }
1315 
1316  $this->tpl->setCurrentBlock("tbl_content");
1317  $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
1318  $this->tpl->setVariable("CSS_ROW", $css_row);
1319 
1320  $this->tpl->setVariable("TXT_SIZE", $entry["size"]);
1321  $this->tpl->setVariable("CHECKBOX_ID", $entry["entry"]);
1322  $compare = (!empty($cur_subdir))
1323  ? $cur_subdir."/".$entry["entry"]
1324  : $entry["entry"];
1325  $purpose = array();
1326  if ($std_item->getLocation() == $compare)
1327  {
1328  $purpose[] = $this->lng->txt("cont_std_view");
1329  }
1330  if($this->object->hasFullscreenItem())
1331  {
1332  if ($full_item->getLocation() == $compare)
1333  {
1334  $purpose[] = $this->lng->txt("cont_fullscreen");
1335  }
1336  }
1337  $this->tpl->setVariable("TXT_PURPOSE", implode($purpose, ", "));
1338 
1339  $this->tpl->parseCurrentBlock();
1340  }
1341  } //if is_array
1342  else
1343  {
1344  $this->tpl->setCurrentBlock("notfound");
1345  $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
1346  $this->tpl->setVariable("NUM_COLS", 4);
1347  $this->tpl->parseCurrentBlock();
1348  }
1349 
1350  $this->tpl->parseCurrentBlock();
1351  }
1352 
1353 
1358  {
1359 //echo "cdir:".$_GET["cdir"].":<br>";
1360  // determine directory
1361  $cur_subdir = str_replace(".", "", $_GET["cdir"]);
1362  $mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$this->object->getId();
1363  $cur_dir = (!empty($cur_subdir))
1364  ? $mob_dir."/".$cur_subdir
1365  : $mob_dir;
1366 
1367  $new_dir = str_replace(".", "", $_POST["new_dir"]);
1368  $new_dir = str_replace("/", "", $new_dir);
1369 
1370  if (!empty($new_dir))
1371  {
1372  ilUtil::makeDir($cur_dir."/".$new_dir);
1373  }
1374  $this->ctrl->saveParameter($this, "cdir");
1375  $this->ctrl->redirect($this, "editFiles");
1376  }
1377 
1381  function uploadFileObject()
1382  {
1383  // determine directory
1384  $cur_subdir = str_replace(".", "", $_GET["cdir"]);
1385  $mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$this->object->getId();
1386  $cur_dir = (!empty($cur_subdir))
1387  ? $mob_dir."/".$cur_subdir
1388  : $mob_dir;
1389  if (is_file($_FILES["new_file"]["tmp_name"]))
1390  {
1391  $file_name = ilObjMediaObject::fixFilename($_FILES["new_file"]["name"]);
1392  $file = $cur_dir."/".$file_name;
1393  ilUtil::moveUploadedFile($_FILES['new_file']['tmp_name'],
1394  $file_name, $file);
1395 
1396  }
1398  include_once("./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
1399  ilMediaSvgSanitizer::sanitizeDir($mob_dir); // see #20339
1400 
1401  $this->ctrl->saveParameter($this, "cdir");
1402  $this->ctrl->redirect($this, "editFiles");
1403  }
1404 
1408  function assignStandardObject($a_file)
1409  {
1410  // determine directory
1411  $cur_subdir = dirname($a_file);
1412  $mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$this->object->getId();
1413  $cur_dir = (!empty($cur_subdir))
1414  ? $mob_dir."/".$cur_subdir
1415  : $mob_dir;
1416  $file = $cur_dir."/".basename($a_file);
1417  $location = $a_file;
1418 
1419  if(!is_file($file))
1420  {
1421  $this->ilias->raiseError($this->lng->txt("cont_select_file"),$this->ilias->error_obj->MESSAGE);
1422  }
1423 
1424  $std_item = $this->object->getMediaItem("Standard");
1425  $std_item->setLocationType("LocalFile");
1426  $std_item->setLocation($location);
1428  $std_item->setFormat($format);
1429  $this->object->update();
1430 // $this->ctrl->saveParameter($this, "cdir");
1431  $this->ctrl->redirectByClass("ilfilesystemgui", "listFiles");
1432  }
1433 
1434 
1438  function assignFullscreenObject($a_file)
1439  {
1440  // determine directory
1441  $cur_subdir = dirname($a_file);
1442  $mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$this->object->getId();
1443  $cur_dir = (!empty($cur_subdir))
1444  ? $mob_dir."/".$cur_subdir
1445  : $mob_dir;
1446  $file = $cur_dir."/".basename($a_file);
1447  $location = $a_file;
1448 
1449  if(!is_file($file))
1450  {
1451  $this->ilias->raiseError($this->lng->txt("cont_select_file"),$this->ilias->error_obj->MESSAGE);
1452  }
1453 
1454  if(!$this->object->hasFullScreenItem())
1455  { // 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  }
1467  else // alter existing fullscreen item
1468  {
1469  $full_item = $this->object->getMediaItem("Fullscreen");
1470 
1471  $full_item->setLocationType("LocalFile");
1472  $full_item->setLocation($location);
1474  $full_item->setFormat($format);
1475  }
1476  $this->object->update();
1477 // $this->ctrl->saveParameter($this, "cdir");
1478  $this->ctrl->redirectByClass("ilfilesystemgui", "listFiles");
1479  }
1480 
1481 
1486  {
1487  $this->object->removeMediaItem("Fullscreen");
1488  $this->object->update();
1489 
1490  $this->ctrl->redirect($this, "edit");
1491  }
1492 
1493 
1498  {
1499  if (!$this->object->hasFullScreenItem())
1500  {
1501  $std_item = $this->object->getMediaItem("Standard");
1502  $full_item = new ilMediaItem();
1503  $full_item->setMobId($std_item->getMobId());
1504  $full_item->setLocation($std_item->getLocation());
1505  $full_item->setLocationType($std_item->getLocationType());
1506  $full_item->setFormat($std_item->getFormat());
1507  $full_item->setWidth($std_item->getWidth());
1508  $full_item->setHeight($std_item->getHeight());
1509  $full_item->setCaption($std_item->getCaption());
1510  $full_item->setTextRepresentation($std_item->getTextRepresentation());
1511  $full_item->setPurpose("Fullscreen");
1512  $this->object->addMediaItem($full_item);
1513 
1514  $this->object->update();
1515  }
1516 
1517  $this->ctrl->redirect($this, "edit");
1518  }
1519 
1520 
1524  function deleteFileObject()
1525  {
1526  if (!isset($_POST["file"]))
1527  {
1528  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
1529  }
1530 
1531  if (count($_POST["file"]) > 1)
1532  {
1533  $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
1534  }
1535 
1536  if ($_POST["file"][0] == "..")
1537  {
1538  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
1539  }
1540 
1541  $cur_subdir = str_replace(".", "", $_GET["cdir"]);
1542  $mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$this->object->getId();
1543  $cur_dir = (!empty($cur_subdir))
1544  ? $mob_dir."/".$cur_subdir
1545  : $mob_dir;
1546  $file = $cur_dir."/".$_POST["file"][0];
1547  $location = (!empty($cur_subdir))
1548  ? $cur_subdir."/".$_POST["file"][0]
1549  : $_POST["file"][0];
1550 
1551  $full_item = $this->object->getMediaItem("Fullscreen");
1552  $std_item = $this->object->getMediaItem("Standard");
1553 
1554  if ($location == $std_item->getLocation())
1555  {
1556  $this->ilias->raiseError($this->lng->txt("cont_cant_del_std"),$this->ilias->error_obj->MESSAGE);
1557  }
1558 
1559  if($this->object->hasFullScreenItem())
1560  {
1561  if ($location == $full_item->getLocation())
1562  {
1563  $this->ilias->raiseError($this->lng->txt("cont_cant_del_full"),$this->ilias->error_obj->MESSAGE);
1564  }
1565  }
1566 
1567  if (@is_dir($file))
1568  {
1569  if (substr($std_item->getLocation(), 0 ,strlen($location)) == $location)
1570  {
1571  $this->ilias->raiseError($this->lng->txt("cont_std_is_in_dir"),$this->ilias->error_obj->MESSAGE);
1572  }
1573 
1574  if($this->object->hasFullScreenItem())
1575  {
1576  if (substr($full_item->getLocation(), 0 ,strlen($location)) == $location)
1577  {
1578  $this->ilias->raiseError($this->lng->txt("cont_full_is_in_dir"),$this->ilias->error_obj->MESSAGE);
1579  }
1580  }
1581  }
1582 
1583  if (@is_file($file))
1584  {
1585  unlink($file);
1586  }
1587 
1588  if (@is_dir($file))
1589  {
1591  }
1592 
1593  $this->ctrl->saveParameter($this, "cdir");
1594  $this->ctrl->redirect($this, "editFiles");
1595  }
1596 
1601  {
1602  $this->showUsagesObject(true);
1603  }
1604 
1605 
1609  function showUsagesObject($a_all = false)
1610  {
1611  global $tpl, $ilTabs, $ilTabs, $lng, $ilCtrl;
1612 
1613  $ilTabs->addSubTab("current_usages", $lng->txt("cont_current_usages"),
1614  $ilCtrl->getLinkTarget($this, "showUsages"));
1615 
1616  $ilTabs->addSubTab("all_usages", $lng->txt("cont_all_usages"),
1617  $ilCtrl->getLinkTarget($this, "showAllUsages"));
1618 
1619  if ($a_all)
1620  {
1621  $ilTabs->activateSubTab("all_usages");
1622  $cmd = "showAllUsages";
1623  }
1624  else
1625  {
1626  $ilTabs->activateSubTab("current_usages");
1627  $cmd = "showUsages";
1628  }
1629 
1630  include_once("./Services/MediaObjects/classes/class.ilMediaObjectUsagesTableGUI.php");
1631  $usages_table = new ilMediaObjectUsagesTableGUI($this, $cmd,
1632  $this->object, $a_all);
1633  $tpl->setContent($usages_table->getHTML());
1634  }
1635 
1639  static function _getMediaInfoHTML(&$a_mob)
1640  {
1641  global $lng;
1642 
1643  $tpl = new ilTemplate("tpl.media_info.html", true, true, "Services/MediaObjects");
1644  $types = array("Standard", "Fullscreen");
1645  foreach ($types as $type)
1646  {
1647  if($type == "Fullscreen" && !$a_mob->hasFullScreenItem())
1648  {
1649  continue;
1650  }
1651 
1652  $med = $a_mob->getMediaItem($type);
1653  if (!$med)
1654  {
1655  return "";
1656  }
1657 
1658  $tpl->setCurrentBlock("media_info");
1659  if ($type == "Standard")
1660  {
1661  $tpl->setVariable("TXT_PURPOSE", $lng->txt("cont_std_view"));
1662  }
1663  else
1664  {
1665  $tpl->setVariable("TXT_PURPOSE", $lng->txt("cont_fullscreen"));
1666  }
1667  $tpl->setVariable("TXT_TYPE", $lng->txt("cont_".strtolower($med->getLocationType())));
1668  $tpl->setVariable("VAL_LOCATION", $med->getLocation());
1669  if ($med->getLocationType() == "LocalFile")
1670  {
1671  $file = ilObjMediaObject::_getDirectory($med->getMobId())."/".$med->getLocation();
1672  if (is_file($file))
1673  {
1674  $size = filesize($file);
1675  }
1676  else
1677  {
1678  $size = 0;
1679  }
1680  $tpl->setVariable("VAL_FILE_SIZE", " ($size ".$lng->txt("bytes").")");
1681  }
1682  $tpl->setVariable("TXT_FORMAT", $lng->txt("cont_format"));
1683  $tpl->setVariable("VAL_FORMAT", $med->getFormat());
1684  if ($med->getWidth() != "" && $med->getHeight() != "")
1685  {
1686  $tpl->setCurrentBlock("size");
1687  $tpl->setVariable("TXT_SIZE", $lng->txt("size"));
1688  $tpl->setVariable("VAL_SIZE", $med->getWidth()."x".$med->getHeight());
1689  $tpl->parseCurrentBlock();
1690  }
1691 
1692  // original size
1693  if ($orig_size = $med->getOriginalSize())
1694  {
1695  if ($orig_size["width"] != $med->getWidth() ||
1696  $orig_size["height"] != $med->getHeight())
1697  {
1698  $tpl->setCurrentBlock("orig_size");
1699  $tpl->setVariable("TXT_ORIG_SIZE", $lng->txt("cont_orig_size"));
1700  $tpl->setVariable("ORIG_WIDTH", $orig_size["width"]);
1701  $tpl->setVariable("ORIG_HEIGHT", $orig_size["height"]);
1702  $tpl->parseCurrentBlock();
1703  }
1704  }
1705 
1706  // output caption
1707  if($med && strlen($med->getCaption()))
1708  {
1709  $tpl->setCurrentBlock('additional_info');
1710  $tpl->setVariable('ADD_INFO',$lng->txt('cont_caption').': '.$med->getCaption());
1711  $tpl->parseCurrentBlock();
1712  }
1713 
1714  // output keywords
1715  if ($type == "Standard")
1716  {
1717  include_once './Services/MetaData/classes/class.ilMDKeyword.php';
1718  if(count($kws = ilMDKeyword::lookupKeywords(0, $med->getMobId())))
1719  {
1720  $tpl->setCurrentBlock('additional_info');
1721  $tpl->setVariable('ADD_INFO',$lng->txt('keywords').': '.implode(', ',$kws));
1722  $tpl->parseCurrentBlock();
1723  }
1724  }
1725 
1726  $tpl->setCurrentBlock("media_info");
1727  $tpl->parseCurrentBlock();
1728  }
1729 
1730  return $tpl->get();
1731  }
1732 
1736  //function setAdminTabs()
1737  function setTabs()
1738  {
1739 //echo "setAdminTabs should not be called.";
1740 
1741  // catch feedback message
1742  $this->getTabs();
1743 
1744  //$tabs_gui->setTargetScript($this->ctrl->getLinkTarget($this));
1745  $this->tpl->clearHeader();
1746  if (is_object($this->object) && strtolower(get_class($this->object)) == "ilobjmediaobject")
1747  {
1748  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_mob.svg"));
1749  $this->tpl->setTitle($this->object->getTitle());
1750  }
1751  else
1752  {
1753  //$title = $this->object->getTitle();
1754  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_mob.svg"));
1755  $this->tpl->setTitle($this->lng->txt("cont_create_mob"));
1756  }
1757  }
1758 
1759 
1763  function getTabs()
1764  {
1765  global $ilHelp;
1766 
1767  $ilHelp->setScreenIdComponent("mob");
1768 
1769  //$this->tabs_gui->setTargetScript($this->ctrl->getLinkTarget($this));
1770  if (is_object($this->object) && strtolower(get_class($this->object)) == "ilobjmediaobject"
1771  && $this->object->getId() > 0)
1772  {
1773  // object properties
1774  $this->tabs_gui->addTarget("cont_mob_def_prop",
1775  $this->ctrl->getLinkTarget($this, "edit"), "edit",
1776  get_class($this));
1777 
1778  $st_item = $this->object->getMediaItem("Standard");
1779 
1780  // video tools
1781  if (substr($st_item->getFormat(), 0, 6) == "video/" && DEVMODE)
1782  {
1783  $this->tabs_gui->addTarget("mob_video_tools",
1784  $this->ctrl->getLinkTargetByClass("ilobjmediaobjectgui", "showVideoTool"),
1785  "showVideoTool", "ilobjmediaobjectgui");
1786  }
1787 
1788  // link areas
1789 
1790  if (is_object($st_item) && $this->getEnabledMapAreas())
1791  {
1792  $format = $st_item->getFormat();
1793  if (substr($format, 0, 5) == "image" && !is_int(strpos($format, "svg")))
1794  {
1795  $this->tabs_gui->addTarget("cont_def_map_areas",
1796  $this->ctrl->getLinkTargetByClass(
1797  array("ilobjmediaobjectgui", "ilimagemapeditorgui"), "editMapAreas"), "editMapAreas",
1798  "ilimagemapeditorgui");
1799  }
1800  }
1801 
1802  // object usages
1803  $this->tabs_gui->addTarget("cont_mob_usages",
1804  $this->ctrl->getLinkTarget($this, "showUsages"), "showUsages",
1805  get_class($this));
1806 
1807  // object files
1808  $std_item = $this->object->getMediaItem("Standard");
1809  $full_item = $this->object->getMediaItem("Fullscreen");
1810  $mset = new ilSetting("mobs");
1811  if ($mset->get("file_manager_always") ||
1812  (!in_array($std_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes()) ||
1813  (is_object($full_item) && !in_array($full_item->getFormat(), ilObjMediaObject::_getSimpleMimeTypes())))
1814  )
1815  {
1816 // $ilTabs->addTarget("cont_files",
1817 // $this->ctrl->getLinkTarget($this, "editFiles"), "editFiles",
1818 // get_class($this));
1819 
1820  $this->tabs_gui->addTarget("cont_files",
1821  $this->ctrl->getLinkTargetByClass(
1822  array("ilobjmediaobjectgui", "ilfilesystemgui"), "listFiles"), "",
1823  "ilfilesystemgui");
1824  }
1825 
1826  include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
1827  $mdgui = new ilObjectMetaDataGUI(null, $this->object->getType(), $this->object->getId());
1828  $mdtab = $mdgui->getTab("ilobjmediaobjectgui");
1829  if($mdtab)
1830  {
1831  $this->tabs_gui->addTarget("meta_data",
1832  $mdtab,
1833  "", "ilmdeditorgui");
1834  }
1835 
1836  }
1837 
1838  // back to upper context
1839  if ($this->back_title != "")
1840  {
1841  $this->tabs_gui->setBackTarget($this->back_title,
1842  $this->ctrl->getParentReturn($this));
1843  }
1844  }
1845 
1853  {
1854  global $tpl;
1855 
1856  include_once("./Services/MediaObjects/classes/class.ilFFmpeg.php");
1857 
1858  /*$codecs = ilFFmpeg::getSupportedCodecsInfo();
1859  $codec_str = implode($codecs, "<br />");
1860  $tpl->setContent($codec_str);*/
1861 
1862  $formats = ilFFmpeg::getSupportedFormatsInfo();
1863  $formats_str = implode($formats, "<br />");
1864  $tpl->setContent($formats_str);
1865  }
1866 
1867 
1871  static function includePresentationJS($a_tpl = null)
1872  {
1873  global $tpl;
1874 
1875  if ($a_tpl == null)
1876  {
1877  $a_tpl = $tpl;
1878  }
1879 
1880  include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
1881  iljQueryUtil::initjQUery($a_tpl);
1882  include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
1883  $a_tpl->addJavascript(iljQueryUtil::getLocalMaphilightPath());
1884  $a_tpl->addJavascript("./Services/COPage/js/ilCOPagePres.js");
1885 
1886  include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1888  }
1889 
1895  function setPropertiesSubTabs($a_active)
1896  {
1897  global $ilTabs, $ilCtrl, $lng;
1898 
1899  $ilTabs->activateTab("cont_mob_def_prop");
1900 
1901  $ilTabs->addSubTab("general",
1902  $lng->txt("mob_general"),
1903  $ilCtrl->getLinkTarget($this, "edit"));
1904 
1905  if ($this->object->getMediaItem("Standard")->getFormat() == "video/webm" ||
1906  $this->object->getMediaItem("Standard")->getFormat() == "video/mp4")
1907  {
1908  $ilTabs->addSubTab("subtitles",
1909  $lng->txt("mob_subtitles"),
1910  $ilCtrl->getLinkTarget($this, "listSubtitleFiles"));
1911  }
1912 
1913  $ilTabs->activateSubTab($a_active);
1914  }
1915 
1923  {
1924  global $ilToolbar, $tpl, $ilCtrl, $lng, $ilUser;
1925 
1926  $this->setPropertiesSubTabs("subtitles");
1927 
1928  // upload file
1929  $ilToolbar->setFormAction($ilCtrl->getFormAction($this), true);
1930  include_once("./Services/Form/classes/class.ilFileInputGUI.php");
1931  $fi = new ilFileInputGUI($lng->txt("mob_subtitle_file")." (.srt)", "subtitle_file");
1932  $fi->setSuffixes(array("srt"));
1933  $ilToolbar->addInputItem($fi, true);
1934 
1935  // language
1936  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
1937  include_once("./Services/MetaData/classes/class.ilMDLanguageItem.php");
1939  $si = new ilSelectInputGUI($this->lng->txt("mob_language"), "language");
1940  $si->setOptions($options);
1941  $si->setValue($ilUser->getLanguage());
1942  $ilToolbar->addInputItem($si, true);
1943 
1944  $ilToolbar->addFormButton($lng->txt("upload"), "uploadSubtitleFile");
1945 
1946  $ilToolbar->addSeparator();
1947  $ilToolbar->addFormButton($lng->txt("mob_upload_multi_srt"), "uploadMultipleSubtitleFileForm");
1948 
1949  include_once("./Services/MediaObjects/classes/class.ilMobSubtitleTableGUI.php");
1950  $tab = new ilMobSubtitleTableGUI($this, "listSubtitleFiles", $this->object);
1951 
1952  $tpl->setContent($tab->getHTML());
1953  }
1954 
1962  {
1963  global $lng, $ilCtrl;
1964 
1965  if ($this->object->uploadSrtFile($_FILES["subtitle_file"]["tmp_name"], ilUtil::stripSlashes($_POST["language"])))
1966  {
1967  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1968  }
1969  $ilCtrl->redirect($this, "listSubtitleFiles");
1970  }
1971 
1976  {
1977  global $ilCtrl, $tpl, $lng;
1978 
1979  $lng->loadLanguageModule("meta");
1980 
1981  if (!is_array($_POST["srt"]) || count($_POST["srt"]) == 0)
1982  {
1983  ilUtil::sendInfo($lng->txt("no_checkbox"), true);
1984  $ilCtrl->redirect($this, "listSubtitleFiles");
1985  }
1986  else
1987  {
1988  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1989  $cgui = new ilConfirmationGUI();
1990  $cgui->setFormAction($ilCtrl->getFormAction($this));
1991  $cgui->setHeaderText($lng->txt("mob_really_delete_srt"));
1992  $cgui->setCancel($lng->txt("cancel"), "listSubtitleFiles");
1993  $cgui->setConfirm($lng->txt("delete"), "deleteSrtFiles");
1994 
1995  foreach ($_POST["srt"] as $i)
1996  {
1997  $cgui->addItem("srt[]", $i, "subtitle_".$i.".srt (".$lng->txt("meta_l_".$i).")");
1998  }
1999 
2000  $tpl->setContent($cgui->getHTML());
2001  }
2002  }
2003 
2008  {
2009  global $lng, $ilCtrl;
2010 
2011  foreach ($_POST["srt"] as $i)
2012  {
2013  if (strlen($i) == 2 && !is_int(strpos($i, ".")))
2014  {
2015  $this->object->removeAdditionalFile("srt/subtitle_".$i.".srt");
2016  }
2017  }
2018  ilUtil::sendSuccess($lng->txt("mob_srt_files_deleted"), true);
2019  $ilCtrl->redirect($this, "listSubtitleFiles");
2020  }
2021 
2029  {
2030  global $ilToolbar, $lng, $ilCtrl;
2031 
2032  ilUtil::sendInfo($lng->txt("mob_upload_multi_srt_howto"));
2033 
2034  $this->setPropertiesSubTabs("subtitles");
2035 
2036  // upload file
2037  $ilToolbar->setFormAction($ilCtrl->getFormAction($this), true);
2038  include_once("./Services/Form/classes/class.ilFileInputGUI.php");
2039  $fi = new ilFileInputGUI($lng->txt("mob_subtitle_file")." (.zip)", "subtitle_file");
2040  $fi->setSuffixes(array("zip"));
2041  $ilToolbar->addInputItem($fi, true);
2042 
2043  $ilToolbar->addFormButton($lng->txt("upload"), "uploadMultipleSubtitleFile");
2044  }
2045 
2050  {
2051  try
2052  {
2053  $this->object->uploadMultipleSubtitleFile(ilUtil::stripSlashesArray($_FILES["subtitle_file"]));
2054  $this->ctrl->redirect($this, "showMultiSubtitleConfirmationTable");
2055  }
2056  catch (ilMediaObjectsException $e)
2057  {
2058  ilUtil::sendFailure($e->getMessage(), true);
2059  $this->ctrl->redirect($this, "uploadMultipleSubtitleFileForm");
2060  }
2061 
2062  }
2063 
2068  {
2069  global $tpl;
2070 
2071  $this->setPropertiesSubTabs("subtitles");
2072 
2073  include_once("./Services/MediaObjects/classes/class.ilMultiSrtConfirmationTable2GUI.php");
2074  $tab = new ilMultiSrtConfirmationTable2GUI($this, "showMultiSubtitleConfirmationTable");
2075  $tpl->setContent($tab->getHTML());
2076  }
2077 
2082  {
2083  $this->object->clearMultiSrtDirectory();
2084  $this->ctrl->redirect($this, "listSubtitleFiles");
2085  }
2086 
2091  {
2092  global $ilCtrl;
2093  $srt_files = $this->object->getMultiSrtFiles();
2094  if (is_array($_POST["file"]))
2095  {
2096  foreach ($_POST["file"] as $f)
2097  {
2098  foreach ($srt_files as $srt_file)
2099  {
2100  if ($f == $srt_file["filename"])
2101  {
2102  $this->object->uploadSrtFile($this->object->getMultiSrtUploadDir()."/".$srt_file["filename"], $srt_file["lang"], "rename");
2103  }
2104  }
2105  }
2106  }
2107  $this->object->clearMultiSrtDirectory();
2108  $ilCtrl->redirect($this, "listSubtitleFiles");
2109  }
2110 
2111 
2112 }
2113 ?>
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.
global $ilErr
Definition: raiseError.php:16
This class represents an option in a radio group.
ILIAS Setting Class.
Class ilObjectMetaDataGUI.
executeCommand()
Execute current command.
showUsagesObject($a_all=false)
show all usages of mob
$size
Definition: RandomTest.php:79
setEnabledMapAreas($a_enabledmapareas)
Set Enable map areas.
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.
static sanitizeDir($a_path)
Sanitize directory recursively.
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.
$cmd
Definition: sahs_server.php:35
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.
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
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 _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.
if(!is_array($argv)) $options
static renameExecutables($a_dir)
Rename executables.
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.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move 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.
static getMimeType($a_file, $a_external=false)
get mime type for file
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
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 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.
$_POST["username"]
initForm($a_mode="create")
Init creation form.
Confirmation screen class.
PHPExcel root directory.
Definition: Database.php:30