ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilObjMediaPoolGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2017 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
5 
6 include_once("./Services/Object/classes/class.ilObject2GUI.php");
7 include_once("./Modules/MediaPool/classes/class.ilObjMediaPool.php");
8 include_once("./Services/Table/classes/class.ilTableGUI.php");
9 include_once("./Modules/Folder/classes/class.ilObjFolderGUI.php");
10 include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
11 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
12 include_once("./Services/Clipboard/classes/class.ilEditClipboardGUI.php");
13 
27 {
31  protected $tabs;
32 
36  protected $error;
37 
41  protected $help;
42 
46  protected $main_tpl;
47 
51  protected $upload;
52 
56  protected $mep_log;
57 
61  protected $mep_item_id = 0;
62 
66  public function __construct($a_id = 0, $a_id_type = self::REPOSITORY_NODE_ID, $a_parent_node_id = 0)
67  {
68  global $DIC;
69 
70  parent::__construct($a_id, $a_id_type, $a_parent_node_id);
71 
72  $this->tabs = $DIC->tabs();
73  $this->error = $DIC["ilErr"];
74  $this->locator = $DIC["ilLocator"];
75  $this->help = $DIC["ilHelp"];
76 
77  $this->main_tpl = $DIC->ui()->mainTemplate();
78 
79  $this->upload = $DIC->upload();
80 
81  $this->mep_log = ilLoggerFactory::getLogger("mep");
82  $this->mep_item_id = (int) $_GET["mepitem_id"];
83  }
84 
86 
90  protected function afterConstructor()
91  {
92  $lng = $this->lng;
93 
94  $lng->loadLanguageModule("mep");
95 
96  if ($this->ctrl->getCmd() == "explorer") {
97  $this->ctrl->saveParameter($this, array("ref_id"));
98  } else {
99  $this->ctrl->saveParameter($this, array("ref_id", "mepitem_id"));
100  }
101  $this->ctrl->saveParameter($this, array("mep_mode"));
102 
103  $lng->loadLanguageModule("content");
104  }
105 
109  final public function getType()
110  {
111  return "mep";
112  }
113 
120  public function executeCommand()
121  {
122  $ilTabs = $this->tabs;
123  $lng = $this->lng;
124  $ilAccess = $this->access;
125  $tpl = $this->tpl;
126  $ilCtrl = $this->ctrl;
127 
128  if ($this->ctrl->getRedirectSource() == "ilinternallinkgui") {
129  $this->explorer();
130  return;
131  }
132 
133  $next_class = $this->ctrl->getNextClass($this);
134  $cmd = $this->ctrl->getCmd();
135  $new_type = $_POST["new_type"]
136  ? $_POST["new_type"]
137  : $_GET["new_type"];
138 
139  if ($new_type != "" && ($cmd != "confirmRemove" && $cmd != "copyToClipboard"
140  && $cmd != "pasteFromClipboard")) {
141  $this->setCreationMode(true);
142  }
143 
144  if (!$this->getCreationMode()) {
145  $this->tpl->setPermanentLink("mep", $this->ref_id);
146  $tree = $this->object->getTree();
147  if ($_GET["mepitem_id"] == "") {
148  $_GET["mepitem_id"] = $tree->getRootId();
149  }
150  }
151  if ($cmd == "create") {
152  switch ($_POST["new_type"]) {
153  case "mob":
154  $this->ctrl->redirectByClass("ilobjmediaobjectgui", "create");
155  break;
156 
157  case "fold":
158  $this->ctrl->redirectByClass("ilobjfoldergui", "create");
159  break;
160  }
161  }
162 
163  switch ($next_class) {
164  case 'ilobjectmetadatagui':
165  $this->checkPermission("write");
166 
167  $this->prepareOutput();
168  $this->addHeaderAction();
169 
170  $this->tabs_gui->activateTab('meta_data');
171  include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
172  $md_gui = new ilObjectMetaDataGUI($this->object, 'mob');
173  $this->ctrl->forwardCommand($md_gui);
174  $this->tpl->printToStdout();
175  break;
176 
177 
178  case 'ilmediapoolpagegui':
179  $this->checkPermission("write");
180  $this->prepareOutput();
181  //$this->addHeaderAction();
182  $ilTabs->clearTargets();
183  $ilCtrl->setReturn($this, "returnFromItem");
184  $mep_page_gui = new ilMediaPoolPageGUI($_GET["mepitem_id"], $_GET["old_nr"]);
185  if (!$ilAccess->checkAccess("write", "", $this->object->getRefId())) {
186  $mep_page_gui->setEnableEditing(false);
187  }
188  $ret = $this->ctrl->forwardCommand($mep_page_gui);
189  if ($ret != "") {
190  $tpl->setContent($ret);
191  }
192  $this->setMediaPoolPageTabs();
193  $this->tpl->printToStdout();
194  break;
195 
196  case "ilobjmediaobjectgui":
197  $this->checkPermission("write");
198  if ($cmd == "create" || $cmd == "save" || $cmd == "cancel") {
199  $ret_obj = $_GET["mepitem_id"];
200  $ilObjMediaObjectGUI = new ilObjMediaObjectGUI("", 0, false, false);
201  $ilObjMediaObjectGUI->setWidthPreset($this->object->getDefaultWidth());
202  $ilObjMediaObjectGUI->setHeightPreset($this->object->getDefaultHeight());
203  } else {
204  $ret_obj = $tree->getParentId($_GET["mepitem_id"]);
205  $ilObjMediaObjectGUI = new ilObjMediaObjectGUI("", ilMediaPoolItem::lookupForeignId($_GET["mepitem_id"]), false, false);
206  $this->ctrl->setParameter($this, "mepitem_id", $this->getParentFolderId());
207  $ilTabs->setBackTarget(
208  $lng->txt("back"),
209  $this->ctrl->getLinkTarget(
210  $this,
211  $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia"
212  )
213  );
214  }
215  if ($this->ctrl->getCmdClass() == "ilinternallinkgui") {
216  $this->ctrl->setReturn($this, "explorer");
217  } else {
218  $this->ctrl->setParameter($this, "mepitem_id", $ret_obj);
219  $this->ctrl->setReturn(
220  $this,
221  $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia"
222  );
223  $this->ctrl->setParameter($this, "mepitem_id", $_GET["mepitem_id"]);
224  }
225  $this->getTemplate();
226  $ilObjMediaObjectGUI->setTabs();
227  $this->setLocator();
228 
229  // set adv metadata record dobject
230  $ilObjMediaObjectGUI->setAdvMdRecordObject($this->object->getRefId(), "mep", "mob");
231 
232  $ret = $this->ctrl->forwardCommand($ilObjMediaObjectGUI);
233 
234  if ($cmd == "save" && $ret != false) {
235  $mep_item = new ilMediaPoolItem();
236  $mep_item->setTitle($ret->getTitle());
237  $mep_item->setType("mob");
238  $mep_item->setForeignId($ret->getId());
239  $mep_item->create();
240 
241  $parent = ($_GET["mepitem_id"] == "")
242  ? $tree->getRootId()
243  : $_GET["mepitem_id"];
244  $tree->insertNode($mep_item->getId(), $parent);
245  ilUtil::redirect("ilias.php?baseClass=ilMediaPoolPresentationGUI&cmd=listMedia&ref_id=" .
246  $_GET["ref_id"] . "&mepitem_id=" . $_GET["mepitem_id"]);
247  } else {
248  $this->tpl->printToStdout();
249  }
250  break;
251 
252  case "ilobjfoldergui":
253  $this->checkPermission("write");
254  $this->addHeaderAction();
255  $folder_gui = new ilObjFolderGUI("", 0, false, false);
256  $this->ctrl->setReturn($this, "listMedia");
257  $cmd .= "Object";
258  switch ($cmd) {
259  case "createObject":
260  $this->prepareOutput();
261  $folder_gui = new ilObjFolderGUI("", 0, false, false);
262  $folder_gui->setFormAction(
263  "save",
264  $this->ctrl->getFormActionByClass("ilobjfoldergui")
265  );
266  $folder_gui->createObject();
267  $this->tpl->printToStdout();
268  break;
269 
270  case "saveObject":
271  //$folder_gui->setReturnLocation("save", $this->ctrl->getLinkTarget($this, "listMedia"));
272  $parent = ($_GET["mepitem_id"] == "")
273  ? $tree->getRootId()
274  : $_GET["mepitem_id"];
275  $folder_gui->setFolderTree($tree);
276  $folder_gui->saveObject($parent);
277  //$this->ctrl->redirect($this, "listMedia");
278  break;
279 
280  case "editObject":
281  $this->prepareOutput();
282  $folder_gui = new ilObjFolderGUI("", ilMediaPoolItem::lookupForeignId($_GET["mepitem_id"]), false, false);
283  $this->ctrl->setParameter($this, "foldereditmode", "1");
284  $folder_gui->setFormAction("update", $this->ctrl->getFormActionByClass("ilobjfoldergui"));
285  $folder_gui->editObject();
286  $this->tpl->printToStdout();
287  break;
288 
289  case "updateObject":
290  $folder_gui = new ilObjFolderGUI("", ilMediaPoolItem::lookupForeignId($_GET["mepitem_id"]), false, false);
291  $this->ctrl->setParameter($this, "mepitem_id", $this->getParentFolderId());
292  $this->ctrl->setReturn($this, "listMedia");
293  $folder_gui->updateObject(true); // this returns to parent
294  break;
295 
296  case "cancelObject":
297  if ($_GET["foldereditmode"]) {
298  $this->ctrl->setParameter($this, "mepitem_id", $this->getParentFolderId());
299  }
300  $this->ctrl->redirect($this, "listMedia");
301  break;
302  }
303  break;
304 
305  case "ileditclipboardgui":
306  $this->prepareOutput();
307  $this->addHeaderAction();
308  $this->ctrl->setReturn($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
309  $clip_gui = new ilEditClipboardGUI();
310  $clip_gui->setMultipleSelections(true);
311  $clip_gui->setInsertButtonTitle($lng->txt("mep_copy_to_mep"));
312  $ilTabs->setTabActive("clipboard");
313  $this->ctrl->forwardCommand($clip_gui);
314  $this->tpl->printToStdout();
315  break;
316 
317  case 'ilinfoscreengui':
318  $this->prepareOutput();
319  $this->addHeaderAction();
320  $this->infoScreen();
321  $this->tpl->printToStdout();
322  break;
323 
324  case 'ilpermissiongui':
325  $this->checkPermission("edit_permission");
326  $this->prepareOutput();
327  $this->addHeaderAction();
328  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
329  $perm_gui = new ilPermissionGUI($this);
330  $ilTabs->activateTab("perm_settings");
331  $this->ctrl->forwardCommand($perm_gui);
332  $this->tpl->printToStdout();
333  break;
334 
335  case "ilexportgui":
336  $this->checkPermission("write");
337  $this->prepareOutput();
338  $this->addHeaderAction();
339  $ilTabs->activateTab("export");
340  include_once("./Services/Export/classes/class.ilExportGUI.php");
341  $exp_gui = new ilExportGUI($this);
342  $exp_gui->addFormat("xml");
343  include_once("./Services/Object/classes/class.ilObjectTranslation.php");
344  $ot = ilObjectTranslation::getInstance($this->object->getId());
345  if ($ot->getContentActivated()) {
346  $exp_gui->addFormat("xml_master", "XML (" . $lng->txt("mep_master_language_only") . ")", $this, "export");
347  $exp_gui->addFormat("xml_masternomedia", "XML (" . $lng->txt("mep_master_language_only_no_media") . ")", $this, "export");
348  }
349  $this->ctrl->forwardCommand($exp_gui);
350  $this->tpl->printToStdout();
351  break;
352 
353  case "ilfilesystemgui":
354  $this->checkPermission("write");
355  $this->prepareOutput();
356  $this->addHeaderAction();
357  $ilTabs->clearTargets();
358  $ilTabs->setBackTarget(
359  $lng->txt("back"),
360  $ilCtrl->getLinkTarget($this, "listMedia")
361  );
362  $mset = new ilSetting("mobs");
363  $import_directory_factory = new ilImportDirectoryFactory();
364  $mob_import_directory = $import_directory_factory->getInstanceForComponent(ilImportDirectoryFactory::TYPE_MOB);
365  if ($mob_import_directory->exists()) {
366  $fs_gui = new ilFileSystemGUI($mob_import_directory->getAbsolutePath());
367  $fs_gui->setPostDirPath(true);
368  $fs_gui->setTableId("mepud" . $this->object->getId());
369  $fs_gui->setAllowFileCreation(false);
370  $fs_gui->setAllowDirectoryCreation(false);
371  $fs_gui->clearCommands();
372  $fs_gui->addCommand(
373  $this,
374  "selectUploadDirFiles",
375  $this->lng->txt("mep_sel_upload_dir_files"),
376  false,
377  true
378  );
379  $this->ctrl->forwardCommand($fs_gui);
380  }
381  $this->tpl->printToStdout();
382  break;
383 
384  case "ilcommonactiondispatchergui":
385  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
387  $this->ctrl->forwardCommand($gui);
388  break;
389 
390  case 'ilobjecttranslationgui':
391  $this->prepareOutput();
392  $this->addHeaderAction();
393  //$this->setTabs("settings");
394  $ilTabs->activateTab("settings");
395  $this->setSettingsSubTabs("obj_multilinguality");
396  include_once("./Services/Object/classes/class.ilObjectTranslationGUI.php");
397  $transgui = new ilObjectTranslationGUI($this);
398  $transgui->setTitleDescrOnlyMode(false);
399  $this->ctrl->forwardCommand($transgui);
400  $this->tpl->printToStdout();
401  break;
402 
403  case "ilmediapoolimportgui":
404  $this->prepareOutput();
405  $this->addHeaderAction();
406  $this->checkPermission("write");
407  $ilTabs->activateTab("import");
408  include_once("./Modules/MediaPool/classes/class.ilMediaPoolImportGUI.php");
409  $gui = new ilMediaPoolImportGUI($this->object);
410  $this->ctrl->forwardCommand($gui);
411  $this->tpl->printToStdout();
412  break;
413 
414  case "ilmobmultisrtuploadgui":
415  $this->checkPermission("write");
416  $this->prepareOutput();
417  $this->addHeaderAction();
418  //$this->setTabs("content");
419  $this->setContentSubTabs("srt_files");
420  include_once("./Services/MediaObjects/classes/class.ilMobMultiSrtUploadGUI.php");
421  include_once("./Modules/MediaPool/classes/class.ilMepMultiSrt.php");
422  $gui = new ilMobMultiSrtUploadGUI(new ilMepMultiSrt($this->object));
423  $this->ctrl->forwardCommand($gui);
424  $this->tpl->printToStdout();
425  break;
426 
427 
428  default:
429  $this->prepareOutput();
430  $this->addHeaderAction();
431  $cmd = $this->ctrl->getCmd("listMedia");
432  $this->$cmd();
433  if (!$this->getCreationMode()) {
434  $this->tpl->printToStdout();
435  }
436  break;
437  }
438  }
439 
443  public function createMediaObject()
444  {
445  $this->ctrl->redirectByClass("ilobjmediaobjectgui", "create");
446  }
447 
448  protected function initCreationForms($a_new_type)
449  {
450  $forms = array(self::CFORM_NEW => $this->initCreateForm($a_new_type),
451  self::CFORM_IMPORT => $this->initImportForm($a_new_type));
452 
453  return $forms;
454  }
455 
459  public function afterSave(ilObject $newObj)
460  {
461  // always send a message
462  ilUtil::sendSuccess($this->lng->txt("object_added"), true);
463 
464  //ilUtil::redirect($this->getReturnLocation("save","adm_object.php?".$this->link_params));
465  ilUtil::redirect("ilias.php?baseClass=ilMediaPoolPresentationGUI&ref_id=" . $newObj->getRefId() . "&cmd=listMedia");
466  }
467 
468  protected function initEditCustomForm(ilPropertyFormGUI $a_form)
469  {
470  $obj_service = $this->object_service;
471 
472  // default width
473  $ni = new ilNumberInputGUI($this->lng->txt("mep_default_width"), "default_width");
474  $ni->setMinValue(0);
475  $ni->setSuffix("px");
476  $ni->setMaxLength(5);
477  $ni->setSize(5);
478  $a_form->addItem($ni);
479 
480  // default height
481  $ni = new ilNumberInputGUI($this->lng->txt("mep_default_height"), "default_height");
482  $ni->setSuffix("px");
483  $ni->setMinValue(0);
484  $ni->setMaxLength(5);
485  $ni->setSize(5);
486  $ni->setInfo($this->lng->txt("mep_default_width_height_info"));
487  $a_form->addItem($ni);
488 
489  // presentation
490  $pres = new ilFormSectionHeaderGUI();
491  $pres->setTitle($this->lng->txt('obj_presentation'));
492  $a_form->addItem($pres);
493 
494  // tile image
495  $obj_service->commonSettings()->legacyForm($a_form, $this->object)->addTileImage();
496 
497  // additional features
498  $feat = new ilFormSectionHeaderGUI();
499  $feat->setTitle($this->lng->txt('obj_features'));
500  $a_form->addItem($feat);
501 
502  include_once './Services/Container/classes/class.ilContainer.php';
503  include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
505  $this->object->getId(),
506  $a_form,
507  array(
509  )
510  );
511  }
512 
518  public function edit()
519  {
520  $tpl = $this->tpl;
521  $ilTabs = $this->tabs_gui;
523 
524  $this->setSettingsSubTabs("settings");
525 
526  if (!$this->checkPermissionBool("write")) {
527  $ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $ilErr->MESSAGE);
528  }
529 
530  $ilTabs->activateTab("settings");
531 
532  $form = $this->initEditForm();
533  $values = $this->getEditFormValues();
534  if ($values) {
535  $form->setValuesByArray($values, true);
536  }
537 
538  $this->addExternalEditFormCustom($form);
539 
540  $tpl->setContent($form->getHTML());
541  }
542 
543 
544  protected function getEditFormCustomValues(array &$a_values)
545  {
546  if ($this->object->getDefaultWidth() > 0) {
547  $a_values["default_width"] = $this->object->getDefaultWidth();
548  }
549  if ($this->object->getDefaultHeight() > 0) {
550  $a_values["default_height"] = $this->object->getDefaultHeight();
551  }
552  }
553 
554  protected function updateCustom(ilPropertyFormGUI $a_form)
555  {
556  $obj_service = $this->object_service;
557 
558  $this->object->setDefaultWidth($a_form->getInput("default_width"));
559  $this->object->setDefaultHeight($a_form->getInput("default_height"));
560 
561 
562  // additional features
563  include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
565  $this->object->getId(),
566  $a_form,
567  array(
569  )
570  );
571 
572  // tile image
573  $obj_service->commonSettings()->legacyForm($a_form, $this->object)->saveTileImage();
574  }
575 
579  public function listMedia()
580  {
581  $ilAccess = $this->access;
582  $tpl = $this->tpl;
583  $ilTabs = $this->tabs;
584  $ilCtrl = $this->ctrl;
585  $ilToolbar = $this->toolbar;
586  $lng = $this->lng;
587 
588  $ilCtrl->setParameter($this, "mep_mode", "listMedia");
589 
590  $this->checkPermission("read");
591 
592  $ilTabs->setTabActive("content");
593  $this->setContentSubTabs("content");
594 
595  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
596  $ilToolbar->addButton(
597  $lng->txt("mep_create_mob"),
598  $ilCtrl->getLinkTarget($this, "createMediaObject")
599  );
600 
601  $mset = new ilSetting("mobs");
602  if ($mset->get("mep_activate_pages")) {
603  $ilToolbar->addButton(
604  $lng->txt("mep_create_content_snippet"),
605  $ilCtrl->getLinkTarget($this, "createMediaPoolPage")
606  );
607  }
608 
609  $ilToolbar->addButton(
610  $lng->txt("mep_create_folder"),
611  $ilCtrl->getLinkTarget($this, "createFolderForm")
612  );
613 
614  $upload_factory = new ilImportDirectoryFactory();
615  $media_upload = $upload_factory->getInstanceForComponent(ilImportDirectoryFactory::TYPE_MOB);
616  if ($media_upload->exists() && ilMainMenuGUI::_checkAdministrationPermission()) {
617  $ilToolbar->addButton(
618  $lng->txt("mep_create_from_upload_dir"),
619  $ilCtrl->getLinkTargetByClass("ilfilesystemgui", "listFiles")
620  );
621  }
622 
623  $ilToolbar->addButton(
624  $lng->txt("mep_bulk_upload"),
625  $ilCtrl->getLinkTarget($this, "bulkUpload")
626  );
627  }
628 
629  $mep_table_gui = new ilMediaPoolTableGUI($this, "listMedia", $this->object, "mepitem_id");
630  $tpl->setContent($mep_table_gui->getHTML());
631  }
632 
636  protected function toggleExplorerNodeState() : void
637  {
638  $exp = new ilMediaPoolExplorerGUI($this, "listMedia", $this->object);
639  $exp->toggleExplorerNodeState();
640  }
641 
645  public function allMedia()
646  {
647  $tpl = $this->tpl;
648  $ilTabs = $this->tabs;
649  $ilCtrl = $this->ctrl;
651 
652  $ilCtrl->setParameter($this, "mep_mode", "allMedia");
653 
654  $this->checkPermission("read");
655  $ilTabs->setTabActive("content");
656  $this->setContentSubTabs("mep_all_mobs");
657 
658 
659  include_once("./Modules/MediaPool/classes/class.ilMediaPoolTableGUI.php");
660  $mep_table_gui = new ilMediaPoolTableGUI(
661  $this,
662  "allMedia",
663  $this->object,
664  "mepitem_id",
666  true
667  );
668 
669 
670  if (isset($_GET['force_filter']) and $_GET['force_filter']) {
671  $_POST['title'] = ilMediaPoolItem::lookupTitle((int) $_GET['force_filter']);
672 
673  include_once("./Services/Table/classes/class.ilTablePropertiesStorage.php");
674  $tprop = new ilTablePropertiesStorage();
675  $tprop->storeProperty(
676  $mep_table_gui->getId(),
677  $ilUser->getId(),
678  'filter',
679  1
680  );
681  $mep_table_gui->resetFilter();
682  $mep_table_gui->resetOffset();
683  $mep_table_gui->writeFilterToSession();
684 
685  // Read again
686  $mep_table_gui = new ilMediaPoolTableGUI(
687  $this,
688  "allMedia",
689  $this->object,
690  "mepitem_id",
692  true
693  );
694  }
695 
696  $tpl->setContent($mep_table_gui->getHTML());
697  }
698 
702  public function applyFilter()
703  {
704  include_once("./Modules/MediaPool/classes/class.ilMediaPoolTableGUI.php");
705  $mtab = new ilMediaPoolTableGUI(
706  $this,
707  "allMedia",
708  $this->object,
709  "mepitem_id",
711  true
712  );
713  $mtab->writeFilterToSession();
714  $mtab->resetOffset();
715  $this->allMedia();
716  }
717 
721  public function resetFilter()
722  {
723  include_once("./Modules/MediaPool/classes/class.ilMediaPoolTableGUI.php");
724  $mtab = new ilMediaPoolTableGUI(
725  $this,
726  "allMedia",
727  $this->object,
728  "mepitem_id",
730  true
731  );
732  $mtab->resetFilter();
733  $mtab->resetOffset();
734  $this->allMedia();
735  }
736 
740  public function getTemplate()
741  {
742  $this->tpl->loadStandardTemplate();
743  }
744 
745 
749  public function getParentFolderId()
750  {
751  if ($_GET["mepitem_id"] == "") {
752  return "";
753  }
754  $par_id = $this->object->getPoolTree()->getParentId($_GET["mepitem_id"]);
755  if ($par_id != $this->object->getPoolTree()->getRootId()) {
756  return $par_id;
757  } else {
758  return "";
759  }
760  }
761 
765  protected function showMedia()
766  {
767  $this->checkPermission("read");
768 
769  $item = new ilMediaPoolItem((int) $_GET["mepitem_id"]);
770  $mob_id = $item->getForeignId();
771 
772  $this->tpl = new ilGlobalTemplate("tpl.fullscreen.html", true, true, "Services/COPage");
773  include_once("Services/Style/Content/classes/class.ilObjStyleSheet.php");
774  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
775  $this->tpl->setVariable(
776  "LOCATION_CONTENT_STYLESHEET",
778  );
779 
780 
781  require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
782  require_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
784  $media_obj = new ilObjMediaObject((int) $mob_id);
785 
786 
787  $this->tpl->setVariable("TITLE", " - " . $media_obj->getTitle());
788 
789  $xml = "<dummy>";
790  // todo: we get always the first alias now (problem if mob is used multiple
791  // times in page)
792  $xml .= $media_obj->getXML(IL_MODE_ALIAS);
793  $xml .= $media_obj->getXML(IL_MODE_OUTPUT);
794  $xml .= $link_xml;
795  $xml .= "</dummy>";
796 
797  $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
798  $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
799  $xh = xslt_create();
800 
801  $wb_path = ilUtil::getWebspaceDir("output") . "/";
802 
803  $mode = ($_GET["cmd"] != "showPreview")
804  ? "fullscreen"
805  : "media";
806  $enlarge_path = ilUtil::getImagePath("enlarge.svg", false, "output");
807  $fullscreen_link =
808  $this->ctrl->getLinkTarget($this, "showFullscreen", "", false, false);
809  $params = array('mode' => $mode, 'enlarge_path' => $enlarge_path,
810  'link_params' => "ref_id=" . $_GET["ref_id"],'fullscreen_link' => $fullscreen_link,
811  'enable_html_mob' => ilObjMediaObject::isTypeAllowed("html") ? "y" : "n",
812  'ref_id' => $_GET["ref_id"], 'pg_frame' => $pg_frame, 'webspace_path' => $wb_path);
813  $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
814  echo xslt_error($xh);
815  xslt_free($xh);
816  // unmask user html
817  $this->tpl->setVariable("MEDIA_CONTENT", $output);
818  }
819 
826  public function showPage()
827  {
828  $tpl = $this->tpl;
829 
830  //$tpl = new \ilGlobalPageTemplate($DIC->globalScreen(), $DIC->ui(), $DIC->http());
831  $tpl = new ilGlobalTemplate("tpl.fullscreen.html", true, true, "Services/COPage");
832 
836 
837  // get page object
838  $page_gui = new ilMediaPoolPageGUI((int) $_GET["mepitem_id"]);
839  $page_gui->setTemplate($tpl);
840 
841  $page_gui->setTemplateOutput(false);
842  $page_gui->setHeader("");
843  $ret = $page_gui->showPage(true);
844 
845  //$tpl->setBodyClass("ilMediaPoolPagePreviewBody");
846  $tpl->setVariable("MEDIA_CONTENT", "<div>" . $ret . "</div>");
847 
848 
849  $tpl->printToStdout();
850  exit;
851  }
852 
853 
857  public function showPreview()
858  {
859  $this->checkPermission("read");
860 
861  $item = new ilMediaPoolItem((int) $_GET["mepitem_id"]);
862 
863  switch ($item->getType()) {
864  case "mob":
865  $this->showMedia();
866  break;
867 
868  case "pg":
869  $this->showPage();
870  break;
871  }
872  }
873 
874 
878  public function showFullscreen()
879  {
880  $this->showMedia();
881  }
882 
886  public function confirmRemove()
887  {
888  $ilCtrl = $this->ctrl;
889  $lng = $this->lng;
891 
892  $this->checkPermission("write");
893 
894  if (!isset($_POST["id"])) {
895  $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
896  }
897 
898  // display confirmation message
899  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
900  $cgui = new ilConfirmationGUI();
901  $cgui->setFormAction($this->ctrl->getFormAction($this));
902  $cgui->setHeaderText($this->lng->txt("info_remove_sure"));
903  $cgui->setCancel($this->lng->txt("cancel"), "cancelRemove");
904  $cgui->setConfirm($this->lng->txt("confirm"), "remove");
905 
906  foreach ($_POST["id"] as $obj_id) {
908  $title = ilMediaPoolItem::lookupTitle($obj_id);
909 
910  // check whether page can be removed
911  $add = "";
912  if ($type == "pg") {
913  include_once("./Services/COPage/classes/class.ilPageContentUsage.php");
914  $usages = ilPageContentUsage::getUsages("incl", $obj_id, false);
915  if (count($usages) > 0) {
916  ilUtil::sendFailure(sprintf($lng->txt("mep_content_snippet_in_use"), $title), true);
917  $ilCtrl->redirect($this, "listMedia");
918  } else {
919  // check whether the snippet is used in older versions of pages
920  $usages = ilPageContentUsage::getUsages("incl", $obj_id, true);
921  if (count($usages) > 0) {
922  $add = "<div class='small'>" . $lng->txt("mep_content_snippet_used_in_older_versions") . "</div>";
923  }
924  }
925  }
926 
927  $caption = ilUtil::getImageTagByType($type, $this->tpl->tplPath) .
928  " " . $title . $add;
929 
930  $cgui->addItem("id[]", $obj_id, $caption);
931  }
932 
933  $this->tpl->setContent($cgui->getHTML());
934  }
935 
939  public function openClipboard()
940  {
941  $ilCtrl = $this->ctrl;
942  $ilAccess = $this->access;
943 
944  $this->checkPermission("write");
945 
946  $ilCtrl->setParameterByClass(
947  "ileditclipboardgui",
948  "returnCommand",
949  rawurlencode($ilCtrl->getLinkTarget(
950  $this,
951  "insertFromClipboard",
952  "",
953  false,
954  false
955  ))
956  );
957  $ilCtrl->redirectByClass("ilEditClipboardGUI", "getObject");
958  }
959 
960 
964  public function insertFromClipboard()
965  {
966  $ilAccess = $this->access;
967 
968  $this->checkPermission("write");
969 
970  include_once("./Services/Clipboard/classes/class.ilEditClipboardGUI.php");
972  $not_inserted = array();
973  if (is_array($ids)) {
974  foreach ($ids as $id2) {
975  $id = explode(":", $id2);
976  $type = $id[0];
977  $id = $id[1];
978 
979  if ($type == "mob") { // media object
980  if (ilObjMEdiaPool::isForeignIdInTree($this->object->getId(), $id)) {
981  $not_inserted[] = ilObject::_lookupTitle($id) . " [" .
982  $id . "]";
983  } else {
984  $item = new ilMediaPoolItem();
985  $item->setType("mob");
986  $item->setForeignId($id);
987  $item->setTitle(ilObject::_lookupTitle($id));
988  $item->create();
989  if ($item->getId() > 0) {
990  $this->object->insertInTree($item->getId(), $_GET["mepitem_id"]);
991  }
992  }
993  }
994  if ($type == "incl") { // content snippet
995  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
996  include_once("./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
997  if (ilObjMEdiaPool::isItemIdInTree($this->object->getId(), $id)) {
998  $not_inserted[] = ilMediaPoolPage::lookupTitle($id) . " [" .
999  $id . "]";
1000  } else {
1001  $original = new ilMediaPoolPage($id);
1002 
1003  // copy the page into the pool
1004  $item = new ilMediaPoolItem();
1005  $item->setType("pg");
1006  $item->setTitle(ilMediaPoolItem::lookupTitle($id));
1007  $item->create();
1008  if ($item->getId() > 0) {
1009  $this->object->insertInTree($item->getId(), $_GET["mepitem_id"]);
1010 
1011  // create page
1012  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
1013  $page = new ilMediaPoolPage();
1014  $page->setId($item->getId());
1015  $page->setParentId($this->object->getId());
1016  $page->create();
1017 
1018  // copy content
1019  $original->copy($page->getId(), $page->getParentType(), $page->getParentId(), true);
1020  }
1021  }
1022  }
1023  }
1024  }
1025  if (count($not_inserted) > 0) {
1026  ilUtil::sendInfo($this->lng->txt("mep_not_insert_already_exist") . "<br>" .
1027  implode("<br>", $not_inserted), true);
1028  }
1029  $this->ctrl->redirect($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
1030  }
1031 
1032 
1036  public function cancelRemove()
1037  {
1038  $this->ctrl->redirect($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
1039  }
1040 
1044  public function remove()
1045  {
1046  $ilAccess = $this->access;
1047 
1048  $this->checkPermission("write");
1049 
1050  foreach ($_POST["id"] as $obj_id) {
1051  $this->object->deleteChild($obj_id);
1052  }
1053 
1054  ilUtil::sendSuccess($this->lng->txt("cont_obj_removed"), true);
1055  $this->ctrl->redirect($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
1056  }
1057 
1058 
1062  public function copyToClipboard()
1063  {
1064  $ilUser = $this->user;
1065  $ilAccess = $this->access;
1066 
1067  $this->checkPermission("write");
1068 
1069  if (!isset($_POST["id"])) {
1070  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1071  $this->ctrl->redirect($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
1072  }
1073 
1074  foreach ($_POST["id"] as $obj_id) {
1076  if ($type == "fold") {
1077  ilUtil::sendFailure($this->lng->txt("cont_cant_copy_folders"), true);
1078  $this->ctrl->redirect($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
1079  }
1080  }
1081  foreach ($_POST["id"] as $obj_id) {
1082  $fid = ilMediaPoolItem::lookupForeignId($obj_id);
1084  if ($type == "mob") {
1085  $ilUser->addObjectToClipboard($fid, "mob", "");
1086  }
1087  if ($type == "pg") {
1088  $ilUser->addObjectToClipboard($obj_id, "incl", "");
1089  }
1090  }
1091  ilUtil::sendSuccess($this->lng->txt("copied_to_clipboard"), true);
1092  $this->ctrl->redirect($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
1093  }
1094 
1098  public function addLocatorItems()
1099  {
1100  $ilLocator = $this->locator;
1101  $ilAccess = $this->access;
1102 
1103  if (!$this->getCreationMode() && $this->ctrl->getCmd() != "explorer") {
1104  $tree = $this->object->getTree();
1105  $obj_id = ($_GET["mepitem_id"] == "")
1106  ? $tree->getRootId()
1107  : $_GET["mepitem_id"];
1108  $path = $tree->getPathFull($obj_id);
1109  foreach ($path as $node) {
1110  if ($node["child"] == $tree->getRootId()) {
1111  $this->ctrl->setParameter($this, "mepitem_id", "");
1112  if ($ilAccess->checkAccess("read", "", $this->object->getRefId())) {
1113  $link = $this->ctrl->getLinkTarget($this, "listMedia");
1114  } elseif ($ilAccess->checkAccess("visible", "", $this->object->getRefId())) {
1115  $link = $this->ctrl->getLinkTarget($this, "infoScreen");
1116  }
1117  $title = $this->object->getTitle();
1118  $this->ctrl->setParameter($this, "mepitem_id", $_GET["mepitem_id"]);
1119  $ilLocator->addItem($title, $link, "", $_GET["ref_id"]);
1120  }
1121  }
1122  }
1123  }
1124 
1128 
1132  public function createFolderForm()
1133  {
1134  $ilAccess = $this->access;
1135  $tpl = $this->tpl;
1136 
1137  $this->checkPermission("write");
1138 
1139  $this->initFolderForm("create");
1140  $tpl->setContent($this->form->getHTML());
1141  }
1142 
1149  public function editFolder()
1150  {
1151  $tpl = $this->tpl;
1152 
1153  $this->checkPermission("write");
1154 
1155  $this->initFolderForm();
1156  $this->getFolderValues();
1157  $tpl->setContent($this->form->getHTML());
1158  }
1159 
1163  public function getFolderValues()
1164  {
1165  $values = array();
1166 
1167  $values["title"] = ilMediaPoolItem::lookupTitle($_GET["mepitem_id"]);
1168 
1169  $this->form->setValuesByArray($values);
1170  }
1171 
1175  public function saveFolder()
1176  {
1177  $tpl = $this->tpl;
1178  $lng = $this->lng;
1179  $ilCtrl = $this->ctrl;
1180 
1181  $this->checkPermission("write");
1182 
1183  $this->initFolderForm("create");
1184  if ($this->form->checkInput()) {
1185  if ($this->object->createFolder($_POST["title"], (int) $_GET["mepitem_id"])) {
1186  ilUtil::sendSuccess($lng->txt("mep_folder_created"), true);
1187  }
1188  $ilCtrl->redirect($this, "listMedia");
1189  }
1190 
1191  $this->form->setValuesByPost();
1192  $tpl->setContent($this->form->getHtml());
1193  }
1194 
1198  public function updateFolder()
1199  {
1200  $lng = $this->lng;
1201  $ilCtrl = $this->ctrl;
1202  $tpl = $this->tpl;
1203 
1204  $this->checkPermission("write");
1205 
1206  $this->initFolderForm("edit");
1207  if ($this->form->checkInput()) {
1208  $item = new ilMediaPoolItem($_GET["mepitem_id"]);
1209  $item->setTitle($_POST["title"]);
1210  $item->update();
1211  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1212  $ilCtrl->setParameter(
1213  $this,
1214  "mepitem_id",
1215  $this->object->getTree()->getParentId($_GET["mepitem_id"])
1216  );
1217  $ilCtrl->redirect($this, "listMedia");
1218  }
1219 
1220  $this->form->setValuesByPost();
1221  $tpl->setContent($this->form->getHtml());
1222  }
1223 
1229  public function initFolderForm($a_mode = "edit")
1230  {
1231  $lng = $this->lng;
1232  $ilCtrl = $this->ctrl;
1233 
1234  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1235  $this->form = new ilPropertyFormGUI();
1236 
1237  // desc
1238  $ti = new ilTextInputGUI($lng->txt("title"), "title");
1239  $ti->setMaxLength(128);
1240  $ti->setRequired(true);
1241  $this->form->addItem($ti);
1242 
1243  // save and cancel commands
1244  if ($a_mode == "create") {
1245  $this->form->addCommandButton("saveFolder", $lng->txt("save"));
1246  $this->form->addCommandButton("cancelSave", $lng->txt("cancel"));
1247  $this->form->setTitle($lng->txt("mep_new_folder"));
1248  } else {
1249  $this->form->addCommandButton("updateFolder", $lng->txt("save"));
1250  $this->form->addCommandButton("cancelFolderUpdate", $lng->txt("cancel"));
1251  $this->form->setTitle($lng->txt("mep_edit_folder"));
1252  }
1253 
1254  $this->form->setFormAction($ilCtrl->getFormAction($this));
1255  }
1256 
1260  public function cancelFolderUpdate()
1261  {
1262  $ilCtrl = $this->ctrl;
1263  $ilCtrl->setParameter(
1264  $this,
1265  "mepitem_id",
1266  $this->object->getTree()->getParentId($_GET["mepitem_id"])
1267  );
1268  $ilCtrl->redirect($this, "listMedia");
1269  }
1270 
1274  public function cancelSave()
1275  {
1276  $ilCtrl = $this->ctrl;
1277  $ilCtrl->redirect($this, "listMedia");
1278  }
1279 
1283 
1287  public function createMediaPoolPage()
1288  {
1289  $tpl = $this->tpl;
1290 
1291  $this->checkPermission("write");
1292 
1293  $this->initMediaPoolPageForm("create");
1294  $tpl->setContent($this->form->getHTML());
1295  }
1296 
1303  public function editMediaPoolPage()
1304  {
1305  $tpl = $this->tpl;
1306  $ilTabs = $this->tabs;
1307 
1308  $this->checkPermission("write");
1309 
1310  $ilTabs->clearTargets();
1311 
1312  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPageGUI.php");
1313  $mep_page_gui = new ilMediaPoolPageGUI($_GET["mepitem_id"], $_GET["old_nr"]);
1314  $mep_page_gui->getTabs();
1315 
1316  $this->setMediaPoolPageTabs();
1317 
1318  $this->initMediaPoolPageForm("edit");
1319  $this->getMediaPoolPageValues();
1320  $tpl->setContent($this->form->getHTML());
1321  }
1322 
1326  public function saveMediaPoolPage()
1327  {
1328  $tpl = $this->tpl;
1329  $lng = $this->lng;
1330  $ilCtrl = $this->ctrl;
1331 
1332  $this->checkPermission("write");
1333 
1334  $this->initMediaPoolPageForm("create");
1335  if ($this->form->checkInput()) {
1336  // create media pool item
1337  include_once("./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
1338  $item = new ilMediaPoolItem();
1339  $item->setTitle($_POST["title"]);
1340  $item->setType("pg");
1341  $item->create();
1342 
1343  if ($item->getId() > 0) {
1344  // put in tree
1345  $tree = $this->object->getTree();
1346  $parent = $_GET["mepitem_id"] > 0
1347  ? $_GET["mepitem_id"]
1348  : $tree->getRootId();
1349  $this->object->insertInTree($item->getId(), $parent);
1350 
1351  // create page
1352  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
1353  $page = new ilMediaPoolPage();
1354  $page->setId($item->getId());
1355  $page->setParentId($this->object->getId());
1356  $page->create();
1357 
1358  $ilCtrl->setParameterByClass("ilmediapoolpagegui", "mepitem_id", $item->getId());
1359  $ilCtrl->redirectByClass("ilmediapoolpagegui", "edit");
1360  }
1361  $ilCtrl->redirect($this, "listMedia");
1362  }
1363 
1364  $this->form->setValuesByPost();
1365  $tpl->setContent($this->form->getHtml());
1366  }
1367 
1371  public function updateMediaPoolPage()
1372  {
1373  $lng = $this->lng;
1374  $ilCtrl = $this->ctrl;
1375  $tpl = $this->tpl;
1376 
1377  $this->checkPermission("write");
1378 
1379  $this->initMediaPoolPageForm("edit");
1380  if ($this->form->checkInput()) {
1381  $item = new ilMediaPoolItem($_GET["mepitem_id"]);
1382  $item->setTitle($_POST["title"]);
1383  $item->update();
1384  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1385  $ilCtrl->redirect($this, "editMediaPoolPage");
1386  }
1387 
1388  $this->form->setValuesByPost();
1389  $tpl->setContent($this->form->getHtml());
1390  }
1396  public function initMediaPoolPageForm($a_mode = "edit")
1397  {
1398  $lng = $this->lng;
1399  $ilCtrl = $this->ctrl;
1400 
1401  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1402  $this->form = new ilPropertyFormGUI();
1403 
1404  // title
1405  $ti = new ilTextInputGUI($lng->txt("title"), "title");
1406  $ti->setMaxLength(128);
1407  $ti->setRequired(true);
1408  $this->form->addItem($ti);
1409 
1410  // save and cancel commands
1411  if ($a_mode == "create") {
1412  $this->form->addCommandButton("saveMediaPoolPage", $lng->txt("save"));
1413  $this->form->addCommandButton("cancelSave", $lng->txt("cancel"));
1414  $this->form->setTitle($lng->txt("mep_new_content_snippet"));
1415  } else {
1416  $this->form->addCommandButton("updateMediaPoolPage", $lng->txt("save"));
1417  $this->form->setTitle($lng->txt("mep_edit_content_snippet"));
1418  }
1419 
1420  $this->form->setFormAction($ilCtrl->getFormAction($this));
1421  }
1422 
1426  public function getMediaPoolPageValues()
1427  {
1428  $values = array();
1429 
1430  include_once("./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
1431  $values["title"] = ilMediaPoolItem::lookupTitle($_GET["mepitem_id"]);
1432 
1433  $this->form->setValuesByArray($values);
1434  }
1435 
1442  public function setMediaPoolPageTabs()
1443  {
1444  $ilTabs = $this->tabs;
1445  $ilCtrl = $this->ctrl;
1446  $lng = $this->lng;
1447 
1448  $ilTabs->addTarget(
1449  "cont_usage",
1450  $ilCtrl->getLinkTarget($this, "showMediaPoolPageUsages"),
1451  array("showMediaPoolPageUsages", "showAllMediaPoolPageUsages"),
1452  get_class($this)
1453  );
1454  $ilTabs->addTarget(
1455  "settings",
1456  $ilCtrl->getLinkTarget($this, "editMediaPoolPage"),
1457  "editMediaPoolPage",
1458  get_class($this)
1459  );
1460  $ilCtrl->setParameter($this, "mepitem_id", $this->object->getPoolTree()->getParentId($_GET["mepitem_id"]));
1461  $ilTabs->setBackTarget($lng->txt("mep_folder"), $ilCtrl->getLinkTarget($this, "listMedia"));
1462  $ilCtrl->setParameter($this, "mepitem_id", $_GET["mepitem_id"]);
1463  }
1464 
1468  public function showAllMediaPoolPageUsages()
1469  {
1470  $this->showMediaPoolPageUsages(true);
1471  }
1472 
1473 
1477  public function showMediaPoolPageUsages($a_all = false)
1478  {
1479  $ilTabs = $this->tabs;
1480  $ilCtrl = $this->ctrl;
1481  $lng = $this->lng;
1482  $tpl = $this->tpl;
1483 
1484  $this->checkPermission("write");
1485 
1486  $ilTabs->clearTargets();
1487 
1488  $ilTabs->addSubTab(
1489  "current_usages",
1490  $lng->txt("cont_current_usages"),
1491  $ilCtrl->getLinkTarget($this, "showMediaPoolPageUsages")
1492  );
1493 
1494  $ilTabs->addSubTab(
1495  "all_usages",
1496  $lng->txt("cont_all_usages"),
1497  $ilCtrl->getLinkTarget($this, "showAllMediaPoolPageUsages")
1498  );
1499 
1500  if ($a_all) {
1501  $ilTabs->activateSubTab("all_usages");
1502  $cmd = "showAllMediaPoolPageUsages";
1503  } else {
1504  $ilTabs->activateSubTab("current_usages");
1505  $cmd = "showMediaPoolPageUsages";
1506  }
1507 
1508 
1509  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPageGUI.php");
1510  $mep_page_gui = new ilMediaPoolPageGUI($_GET["mepitem_id"], $_GET["old_nr"]);
1511  $mep_page_gui->getTabs();
1512 
1513  $this->setMediaPoolPageTabs();
1514 
1515  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
1516  $page = new ilMediaPoolPage((int) $_GET["mepitem_id"]);
1517 
1518  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPageUsagesTableGUI.php");
1519  $table = new ilMediaPoolPageUsagesTableGUI($this, $cmd, $page, $a_all);
1520 
1521  $tpl->setContent($table->getHTML());
1522  }
1523 
1524 
1528 
1534  public function setContentSubTabs($a_active)
1535  {
1536  $ilAccess = $this->access;
1537  $ilTabs = $this->tabs;
1538  $ilCtrl = $this->ctrl;
1539 
1540  $ilTabs->addSubTab("content", $this->lng->txt("objs_fold"), $this->ctrl->getLinkTarget($this, ""));
1541 
1542  $ilCtrl->setParameter($this, "mepitem_id", "");
1543  $ilTabs->addSubTab("mep_all_mobs", $this->lng->txt("mep_all_mobs"), $this->ctrl->getLinkTarget($this, "allMedia"));
1544  $ilCtrl->setParameter($this, "mepitem_id", $_GET["mepitem_id"]);
1545 
1546  if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
1547  $ilTabs->addSubtab(
1548  "srt_files",
1549  $this->lng->txt("mep_media_subtitles"),
1550  $ilCtrl->getLinkTargetByClass("ilmobmultisrtuploadgui", "")
1551  );
1552  }
1553 
1554  $ilTabs->activateSubTab($a_active);
1555  }
1556 
1557 
1561  public function setTabs()
1562  {
1563  $ilAccess = $this->access;
1564  $ilTabs = $this->tabs;
1565  $ilCtrl = $this->ctrl;
1566  $ilHelp = $this->help;
1567 
1568  $ilHelp->setScreenIdComponent("mep");
1569 
1570  if ($ilAccess->checkAccess('read', '', $this->ref_id) ||
1571  $ilAccess->checkAccess('write', '', $this->ref_id)) {
1572  $ilTabs->addTab("content", $this->lng->txt("mep_content"), $this->ctrl->getLinkTarget($this, ""));
1573  }
1574 
1575  // info tab
1576  if ($ilAccess->checkAccess('visible', '', $this->ref_id) ||
1577  $ilAccess->checkAccess('read', '', $this->ref_id) ||
1578  $ilAccess->checkAccess('write', '', $this->ref_id)) {
1579  $force_active = ($this->ctrl->getNextClass() == "ilinfoscreengui"
1580  || strtolower($_GET["cmdClass"]) == "ilnotegui")
1581  ? true
1582  : false;
1583  $ilTabs->addTarget(
1584  "info_short",
1585  $this->ctrl->getLinkTargetByClass(
1586  array("ilobjmediapoolgui", "ilinfoscreengui"),
1587  "showSummary"
1588  ),
1589  array("showSummary", "infoScreen"),
1590  "",
1591  "",
1592  $force_active
1593  );
1594  }
1595 
1596  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
1597  $ilTabs->addTarget(
1598  "settings",
1599  $this->ctrl->getLinkTarget($this, "edit"),
1600  "edit",
1601  array("", "ilobjmediapoolgui")
1602  );
1603  }
1604 
1605  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
1606  $ilTabs->addTarget(
1607  "clipboard",
1608  $this->ctrl->getLinkTarget($this, "openClipboard"),
1609  "view",
1610  "ileditclipboardgui"
1611  );
1612  }
1613 
1614  // properties
1615  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
1616  // meta data
1617  include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
1618  $mdgui = new ilObjectMetaDataGUI($this->object, "mob");
1619  $mdtab = $mdgui->getTab();
1620  if ($mdtab) {
1621  $ilTabs->addTarget(
1622  "meta_data",
1623  $mdtab,
1624  "",
1625  "ilobjectmetadatagui"
1626  );
1627  }
1628  }
1629 
1630  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
1631  $ilTabs->addTarget(
1632  "export",
1633  $this->ctrl->getLinkTargetByClass("ilexportgui", ""),
1634  "",
1635  "ilexportgui"
1636  );
1637 
1638  $ilTabs->addTarget(
1639  "import",
1640  $this->ctrl->getLinkTargetByClass("ilmediapoolimportgui", ""),
1641  "",
1642  "ilmediapoolimportgui"
1643  );
1644  }
1645 
1646  if ($ilAccess->checkAccess("edit_permission", "", $this->object->getRefId())) {
1647  $ilTabs->addTarget(
1648  "perm_settings",
1649  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
1650  array("perm","info","owner"),
1651  'ilpermissiongui'
1652  );
1653  }
1654  }
1655 
1662  public function setSettingsSubTabs($a_active)
1663  {
1664  $ilTabs = $this->tabs;
1665  $lng = $this->lng;
1666  $ilAccess = $this->access;
1667 
1668  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
1669  $ilTabs->addSubTab(
1670  "settings",
1671  $lng->txt("settings"),
1672  $this->ctrl->getLinkTarget($this, "edit")
1673  );
1674 
1675  $mset = new ilSetting("mobs");
1676  if ($mset->get("mep_activate_pages")) {
1677  $ilTabs->addSubTabTarget(
1678  "obj_multilinguality",
1679  $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", "")
1680  );
1681  }
1682  }
1683 
1684  $ilTabs->setSubTabActive($a_active);
1685  }
1686 
1687 
1691  public static function _goto($a_target)
1692  {
1693  global $DIC;
1694 
1695  $ilAccess = $DIC->access();
1696  $ilErr = $DIC["ilErr"];
1697  $lng = $DIC->language();
1698 
1699  $targets = explode('_', $a_target);
1700  if (count((array) $targets) > 1) {
1701  $ref_id = $targets[0];
1702  $subitem_id = $targets[1];
1703  } else {
1704  $ref_id = $targets[0];
1705  }
1706 
1707  if ($ilAccess->checkAccess("read", "", $ref_id)) {
1708  $_GET["baseClass"] = "ilMediaPoolPresentationGUI";
1709  $_GET["ref_id"] = $ref_id;
1710  $_GET['mepitem_id'] = $subitem_id;
1711  include("ilias.php");
1712  exit;
1713  } elseif ($ilAccess->checkAccess("visible", "", $ref_id)) {
1714  $_GET["baseClass"] = "ilMediaPoolPresentationGUI";
1715  $_GET["ref_id"] = $ref_id;
1716  $_GET["cmd"] = "infoScreen";
1717  include("ilias.php");
1718  exit;
1719  } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1720  ilUtil::sendFailure(sprintf(
1721  $lng->txt("msg_no_perm_read_item"),
1723  ), true);
1725  }
1726 
1727  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1728  }
1729 
1735  public function infoScreenObject()
1736  {
1737  $this->ctrl->setCmd("showSummary");
1738  $this->ctrl->setCmdClass("ilinfoscreengui");
1739  $this->infoScreen();
1740  }
1741 
1745  public function infoScreen()
1746  {
1747  $this->tabs->activateTab("info_short");
1748  $ilAccess = $this->access;
1749  $ilErr = $this->error;
1750 
1751  if (!$ilAccess->checkAccess("visible", "", $this->ref_id) &&
1752  !$ilAccess->checkAccess("read", "", $this->ref_id) &&
1753  !$ilAccess->checkAccess("write", "", $this->ref_id)) {
1754  $ilErr->raiseError($this->lng->txt("msg_no_perm_read"), $ilErr->MESSAGE);
1755  }
1756 
1757  if ($this->ctrl->getCmd() == "infoScreen") {
1758  $this->ctrl->setCmd("showSummary");
1759  $this->ctrl->setCmdClass("ilinfoscreengui");
1760  }
1761 
1762  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1763  $info = new ilInfoScreenGUI($this);
1764 
1765  $info->enablePrivateNotes();
1766 
1767 
1768  // standard meta data
1769  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
1770 
1771  // forward the command
1772  $this->ctrl->forwardCommand($info);
1773  }
1774 
1775 
1779 
1783  public function selectUploadDirFiles($a_files = null)
1784  {
1785  $tpl = $this->tpl;
1786  $ilTabs = $this->tabs;
1787  $lng = $this->lng;
1788  $ilCtrl = $this->ctrl;
1789  $ilToolbar = $this->toolbar;
1790 
1791  if (!$a_files) {
1792  $a_files = $_POST["file"];
1793  }
1794 
1795  $ilTabs->clearTargets();
1796  $ilTabs->setBackTarget(
1797  $lng->txt("back"),
1798  $ilCtrl->getLinkTarget($this, "listMedia")
1799  );
1800 
1801  $this->checkPermission("write");
1802 
1804 
1805  // action type
1806  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
1807  $options = array(
1808  "rename" => $lng->txt("mep_up_dir_move"),
1809  "copy" => $lng->txt("mep_up_dir_copy"),
1810  );
1811  $si = new ilSelectInputGUI("", "action");
1812  $si->setOptions($options);
1813  $ilToolbar->addInputItem($si);
1814  $ilToolbar->setCloseFormTag(false);
1815  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
1816  $ilToolbar->setFormName("mep_up_form");
1817 
1818  include_once("./Modules/MediaPool/classes/class.ilUploadDirFilesTableGUI.php");
1819  $tab = new ilUploadDirFilesTableGUI(
1820  $this,
1821  "selectUploadDirFiles",
1822  $a_files
1823  );
1824  $tab->setFormName("mep_up_form");
1825  $tpl->setContent($tab->getHTML());
1826  }
1827  }
1828 
1832  public function createMediaFromUploadDir()
1833  {
1834  $this->checkPermission("write");
1835 
1836  $mset = new ilSetting("mobs");
1837 
1838  $import_directory_factory = new ilImportDirectoryFactory();
1839  $mob_import_directory = $import_directory_factory->getInstanceForComponent(ilImportDirectoryFactory::TYPE_MOB);
1840  $upload_dir = $mob_import_directory->getAbsolutePath();
1841 
1842  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1843 
1844  if (is_array($_POST["file"]) && ilMainMenuGUI::_checkAdministrationPermission()) {
1845  foreach ($_POST["file"] as $f) {
1846  $f = str_replace("..", "", $f);
1847  $fullpath = $upload_dir . "/" . $f;
1848  $mob = new ilObjMediaObject();
1849  $mob->setTitle(basename($fullpath));
1850  $mob->setDescription("");
1851  $mob->create();
1852 
1853  // determine and create mob directory, move uploaded file to directory
1854  //$mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$a_mob->getId();
1855  $mob->createDirectory();
1856  $mob_dir = ilObjMediaObject::_getDirectory($mob->getId());
1857 
1858  $media_item = new ilMediaItem();
1859  $mob->addMediaItem($media_item);
1860  $media_item->setPurpose("Standard");
1861 
1862  $file = $mob_dir . "/" . basename($fullpath);
1863 
1864  // virus handling
1865  $vir = ilUtil::virusHandling($fullpath, basename($fullpath));
1866  if (!$vir[0]) {
1867  ilUtil::sendFailure($this->lng->txt("file_is_infected") . "<br />" . $vir[1], true);
1868  ilUtil::redirect("ilias.php?baseClass=ilMediaPoolPresentationGUI&cmd=listMedia&ref_id=" .
1869  $_GET["ref_id"] . "&mepitem_id=" . $_GET["mepitem_id"]);
1870  }
1871 
1872  switch ($_POST["action"]) {
1873  case "rename":
1874  rename($fullpath, $file);
1875  break;
1876 
1877  case "copy":
1878  copy($fullpath, $file);
1879  break;
1880  }
1881 
1882  // get mime type
1884  $location = basename($fullpath);
1885 
1886  // set real meta and object data
1887  $media_item->setFormat($format);
1888  $media_item->setLocation($location);
1889  $media_item->setLocationType("LocalFile");
1890 
1891  $mob->setDescription($format);
1892 
1893  // determine width and height of known image types
1895  $format,
1896  "File",
1897  $mob_dir . "/" . $location,
1898  $media_item->getLocation(),
1899  true,
1900  true,
1901  "",
1902  ""
1903  );
1904  $media_item->setWidth($wh["width"]);
1905  $media_item->setHeight($wh["height"]);
1906  if ($wh["info"] != "") {
1907  // ilUtil::sendInfo($wh["info"], true);
1908  }
1909 
1910  $media_item->setHAlign("Left");
1911  ilUtil::renameExecutables($mob_dir);
1912  $mob->update();
1913 
1914 
1915  // put it into current folder
1916  $mep_item = new ilMediaPoolItem();
1917  $mep_item->setTitle($mob->getTitle());
1918  $mep_item->setType("mob");
1919  $mep_item->setForeignId($mob->getId());
1920  $mep_item->create();
1921 
1922  $tree = $this->object->getTree();
1923  $parent = ($_GET["mepitem_id"] == "")
1924  ? $tree->getRootId()
1925  : $_GET["mepitem_id"];
1926  $tree->insertNode($mep_item->getId(), $parent);
1927  }
1928  }
1929  ilUtil::redirect("ilias.php?baseClass=ilMediaPoolPresentationGUI&cmd=listMedia&ref_id=" .
1930  $_GET["ref_id"] . "&mepitem_id=" . $_GET["mepitem_id"]);
1931  }
1932 
1936  public static function getPreviewModalHTML($a_mpool_ref_id, $a_tpl)
1937  {
1938  global $DIC;
1939 
1940  $tpl = $DIC["tpl"];
1941  $ilCtrl = $DIC->ctrl();
1942  $lng = $DIC->language();
1943 
1944  require_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1946 
1947  $tpl->addJavaScript("./Modules/MediaPool/js/ilMediaPool.js");
1948 
1949  $ilCtrl->setParameterByClass("ilobjmediapoolgui", "mepitem_id", "");
1950  $ilCtrl->setParameterByClass("ilobjmediapoolgui", "ref_id", $a_mpool_ref_id);
1951  $tpl->addOnloadCode("il.MediaPool.setPreviewUrl('" . $ilCtrl->getLinkTargetByClass(array("ilmediapoolpresentationgui", "ilobjmediapoolgui"), "showPreview", "", false, false) . "');");
1952  $ilCtrl->setParameterByClass("ilobjmediapoolgui", "mepitem_id", $_GET["mepitem_id"]);
1953  $ilCtrl->setParameterByClass("ilobjmediapoolgui", "ref_id", $_GET["red_id"]);
1954 
1955  include_once("./Services/UIComponent/Modal/classes/class.ilModalGUI.php");
1956  $modal = ilModalGUI::getInstance();
1957  $modal->setHeading($lng->txt("preview"));
1958  $modal->setId("ilMepPreview");
1959  $modal->setType(ilModalGUI::TYPE_LARGE);
1960  $modal->setBody("<iframe id='ilMepPreviewContent'></iframe>");
1961 
1962  return $modal->getHTML();
1963  }
1964 
1968  public function export()
1969  {
1970  $ot = ilObjectTranslation::getInstance($this->object->getId());
1971  $opt = "";
1972  if ($ot->getContentActivated()) {
1973  $format = explode("_", $_POST["format"]);
1974  $opt = ilUtil::stripSlashes($format[1]);
1975  }
1976 
1977  $this->object->exportXML($opt);
1978  }
1979 
1980  //
1981  // BULK UPLOAD
1982  //
1983 
1987  protected function bulkUpload()
1988  {
1989  $this->checkPermission("write");
1990 
1992 
1993  $form = $this->initBulkUploadForm();
1994  $main_tpl->setContent($form->getHTML());
1995  }
1996 
2000  public function initBulkUploadForm()
2001  {
2002  $ctrl = $this->ctrl;
2003  $lng = $this->lng;
2004 
2005  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
2006  $form = new ilPropertyFormGUI();
2007 
2008  $form->setFormAction($ctrl->getFormAction($this));
2009  $form->setPreventDoubleSubmission(false);
2010 
2011  $item = new ilFileStandardDropzoneInputGUI(
2012  'cancel',
2013  $lng->txt("mep_media_files"),
2014  'media_files'
2015  );
2016  $item->setUploadUrl($ctrl->getLinkTarget($this, "performBulkUpload", "", true, true));
2017  $item->setMaxFiles(20);
2018  $form->addItem($item);
2019 
2020  $form->addCommandButton("performBulkUpload", $lng->txt("upload"));
2021 
2022  $form->setTitle($lng->txt("mep_bulk_upload"));
2023 
2024  return $form;
2025  }
2026 
2030  public function performBulkUpload()
2031  {
2032  $this->checkPermission("write");
2033 
2034  $ctrl = $this->ctrl;
2035  $lng = $this->lng;
2038  $log = $this->mep_log;
2039 
2040  $form = $this->initBulkUploadForm();
2041  if ($form->checkInput()) {
2042  $mep_item_ids = [];
2043  // Check if this is a request to upload a file
2044  $log->debug("checking for uploads...");
2045  if ($upload->hasUploads()) {
2046  $log->debug("has upload...");
2047  try {
2048  $upload->process();
2049  $log->debug("nr of results: " . count($upload->getResults()));
2050  foreach ($upload->getResults() as $result) {
2051  $title = $result->getName();
2052 
2053  $mob = new ilObjMediaObject();
2054  $mob->setTitle($title);
2055  $mob->setDescription("");
2056  $mob->create();
2057 
2058  $mob->createDirectory();
2059  $media_item = new ilMediaItem();
2060  $mob->addMediaItem($media_item);
2061  $media_item->setPurpose("Standard");
2062 
2063  $mob_dir = ilObjMediaObject::_getRelativeDirectory($mob->getId());
2064  $file_name = ilObjMediaObject::fixFilename($title);
2065  $file = $mob_dir . "/" . $file_name;
2066 
2067  $upload->moveOneFileTo(
2068  $result,
2069  $mob_dir,
2070  Location::WEB,
2071  $file_name,
2072  true
2073  );
2074 
2075  $mep_item = new ilMediaPoolItem();
2076  $mep_item->setTitle($title);
2077  $mep_item->setType("mob");
2078  $mep_item->setForeignId($mob->getId());
2079  $mep_item->create();
2080 
2081  $tree = $this->object->getTree();
2082  $parent = ($_GET["mepitem_id"] == "")
2083  ? $tree->getRootId()
2084  : $_GET["mepitem_id"];
2085  $tree->insertNode($mep_item->getId(), $parent);
2086 
2087  // get mime type
2089  $location = $file_name;
2090 
2091  // set real meta and object data
2092  $media_item->setFormat($format);
2093  $media_item->setLocation($location);
2094  $media_item->setLocationType("LocalFile");
2095  $media_item->setUploadHash(ilUtil::stripSlashes($_POST["ilfilehash"]));
2096  $mob->update();
2097  $mep_item_ids[] = $mob->getId();
2098  }
2099  } catch (Exception $e) {
2100  $log->debug("Got exception: " . $e->getMessage());
2101  echo json_encode(array( 'success' => false, 'message' => $e->getMessage()));
2102  }
2103  $log->debug("end of 'has_uploads'");
2104  }
2105  $log->debug("has no upload...");
2106 
2107  $log->debug("calling redirect... (" . $_POST["ilfilehash"] . ")");
2108  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
2109  $ctrl->setParameter($this, "mep_hash", $_POST["ilfilehash"]);
2110  $ctrl->redirect($this, "editTitlesAndDescriptions");
2111  }
2112 
2113  $form->setValuesByPost();
2114  $main_tpl->setContent($form->getHtml());
2115  }
2116 
2120  protected function editTitlesAndDescriptions()
2121  {
2122  $ctrl = $this->ctrl;
2123  $lng = $this->lng;
2124 
2125  $this->checkPermission("write");
2126  $ctrl->saveParameter($this, "mep_hash");
2127 
2129 
2130  include_once("./Services/MediaObjects/classes/class.ilMediaItem.php");
2131  $media_items = ilMediaItem::getMediaItemsForUploadHash($_GET["mep_hash"]);
2132 
2133  include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
2134 
2135  $tb = new ilToolbarGUI();
2136  $tb->setFormAction($ctrl->getFormAction($this));
2137  $tb->addFormButton($lng->txt("save"), "saveTitlesAndDescriptions");
2138  $tb->setOpenFormTag(true);
2139  $tb->setCloseFormTag(false);
2140  $tb->setId("tb_top");
2141 
2142  $html = $tb->getHTML();
2143  foreach ($media_items as $mi) {
2144  $acc = new ilAccordionGUI();
2145  $acc->setBehaviour(ilAccordionGUI::ALL_CLOSED);
2146  $acc->setId("acc_" . $mi["mob_id"]);
2147 
2148  $mob = new ilObjMediaObject($mi["mob_id"]);
2149  $form = $this->initMediaBulkForm($mi["mob_id"], $mob->getTitle());
2150  $acc->addItem($mob->getTitle(), $form->getHTML());
2151 
2152  $html .= $acc->getHTML();
2153  }
2154 
2155  $html .= $tb->getHTML();
2156  $tb->setOpenFormTag(false);
2157  $tb->setCloseFormTag(true);
2158  $tb->setId("tb_bottom");
2159 
2160  $main_tpl->setContent($html);
2161  }
2162 
2166  public function initMediaBulkForm($a_id, $a_title)
2167  {
2168  $lng = $this->lng;
2169 
2170  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
2171  $form = new ilPropertyFormGUI();
2172  $form->setOpenTag(false);
2173  $form->setCloseTag(false);
2174 
2175  // title
2176  $ti = new ilTextInputGUI($lng->txt("title"), "title_" . $a_id);
2177  $ti->setValue($a_title);
2178  $form->addItem($ti);
2179 
2180  // description
2181  $ti = new ilTextAreaInputGUI($lng->txt("description"), "description_" . $a_id);
2182  $form->addItem($ti);
2183 
2184  return $form;
2185  }
2186 
2190  protected function saveTitlesAndDescriptions()
2191  {
2192  $lng = $this->lng;
2193  $ctrl = $this->ctrl;
2194 
2195  $this->checkPermission("write");
2196  //var_dump(_$POST); exit;
2197 
2198  $media_items = ilMediaItem::getMediaItemsForUploadHash($_GET["mep_hash"]);
2199  include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
2200 
2201  foreach ($media_items as $mi) {
2202  $mob = new ilObjMediaObject($mi["mob_id"]);
2203  $form = $this->initMediaBulkForm($mi["mob_id"], $mob->getTitle());
2204  $form->checkInput();
2205  $title = $form->getInput("title_" . $mi["mob_id"]);
2206  $desc = $form->getInput("description_" . $mi["mob_id"]);
2207  if (trim($title) != "") {
2208  $mob->setTitle($title);
2209  }
2210  $mob->setDescription($desc);
2211  $mob->update();
2212  }
2213  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
2214  $ctrl->redirect($this, "listMedia");
2215  }
2216 
2220  protected function returnFromItem() : void
2221  {
2222  $ctrl = $this->ctrl;
2223 
2224  $type = ilMediaPoolItem::lookupType($this->mep_item_id);
2225  if ($type !== "fold") {
2226  $tree = $this->object->getTree();
2227  $fold_id = $tree->getParentId($this->mep_item_id);
2228  if ($fold_id > 0) {
2229  $ctrl->setParameter($this, "mepitem_id", $fold_id);
2230  $ctrl->redirect($this, "listMedia");
2231  }
2232  }
2233  $this->listMedia();
2234  }
2235 }
showFullscreen()
show fullscreen
getFolderValues()
Get current values for folder from.
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
setLocator()
set Locator
xslt_create()
updateCustom(ilPropertyFormGUI $a_form)
initEditCustomForm(ilPropertyFormGUI $a_form)
static lookupType($a_id)
Lookup type.
Class ilObjectMetaDataGUI.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Class ilObjFolderGUI.
exit
Definition: login.php:29
static getMimeType($a_file, $a_external=null)
get mime type for file
Class ilInfoScreenGUI.
performBulkUpload()
Save bulk upload form.
Class ilEditClipboardGUI.
executeCommand()
execute command
static virusHandling($a_file, $a_orig_name="", $a_clean=true)
scan file for viruses and clean files if possible
$result
static _goto($a_target)
goto target media pool
openClipboard()
paste from clipboard
This class represents a property form user interface.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
New implementation of ilObjectGUI.
special template class to simplify handling of ITX/PEAR
$type
setSettingsSubTabs($a_active)
Set setting sub tabs.
const ROOT_FOLDER_ID
Definition: constants.php:30
setPostDirPath($a_val)
Set post dir path.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
$_GET["client_id"]
$location
Definition: buildRTE.php:44
This class represents a section header in a property form.
infoScreen()
show information screen
returnFromItem()
Return from item editing.
initBulkUploadForm()
Init bulk upload form.
xslt_free(&$proc)
static getImageTagByType($a_type, $a_path, $a_big=false)
Builds an html image tag TODO: function still in use, but in future use getImagePath and move HTML-Co...
saveMediaPoolPage()
Save media pool page.
allMedia()
list all objects
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually...
insertFromClipboard()
insert media object from clipboard
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
static _lookupTitle($a_id)
lookup object title
static includePresentationJS($a_tpl=null)
Include media object presentation JS.
addItem($a_item)
Add Item (Property, SectionHeader).
Saves (mostly asynchronously) user properties of tables (e.g.
initFolderForm($a_mode="edit")
Init folder form.
Class ilMediaPoolPage.
getTemplate()
Get standard template.
createMediaFromUploadDir()
Create media object from upload directory.
Media pool explorer GUI class.
static lookupTitle($a_page_id)
Lookup title.
addExternalEditFormCustom(ilPropertyFormGUI $a_form)
static _getDirectory($a_mob_id)
Get absolute directory.
toggleExplorerNodeState()
Toggle explorer node.
__construct($a_id=0, $a_id_type=self::REPOSITORY_NODE_ID, $a_parent_node_id=0)
Constructor.
TableGUI class for media pool page usages listing.
showPreview()
Show content snippet.
afterSave(ilObject $newObj)
save object
initMediaPoolPageForm($a_mode="edit")
Init page form.
setMediaPoolPageTabs()
Set media pool page tabs.
Handler class for multi srt upload in learning modules.
help()
Definition: help.php:2
getEditFormCustomValues(array &$a_values)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static isTypeAllowed($a_type)
Is type allowed.
setCreationMode($a_mode=true)
showMediaPoolPageUsages($a_all=false)
List usages of the contnet snippet.
static lookupForeignId($a_id)
Lookup Foreign Id.
xslt_error(&$proc)
Export User Interface Class.
initImportForm($a_new_type)
Init object import form.
setContentSubTabs($a_active)
Set sub tabs for content tab.
selectUploadDirFiles($a_files=null)
Select files from upload directory.
saveFolder()
Save folder form.
editMediaPoolPage()
Edit media pool page.
afterConstructor()
Initialisation.
setMinValue($a_minvalue, $a_display_always=false)
Set Minimum Value.
setSuffix($a_value)
Set suffix.
showAllMediaPoolPageUsages()
List usages of the contnet snippet.
setUploadUrl($upload_url)
Set the URL (using ilCtrl->getFormAction() ) to override the Endpoint the Form will be sent to...
Upload SRT files to a set of media objects.
$log
Definition: result.php:15
static getPreviewModalHTML($a_mpool_ref_id, $a_tpl)
Get preview modal html.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
This class represents a number property in a property form.
static fixFilename($a_name)
Fix filename of uploaded file.
static _lookupObjId($a_id)
static getUsages($a_pc_type, $a_pc_id, $a_incl_hist=true)
Get usages.
global $DIC
Definition: goto.php:24
cancelRemove()
cancel deletion of media objects/folders
Class ilMediaItem Media Item, component of a media object (file or reference)
listMedia()
list media objects
$format
Definition: metadata.php:218
Import related features for media pools (currently used for translation imports)
$xml
Definition: metadata.php:332
Class ilObjMediaObject.
initCreateForm($a_new_type)
Init object creation form.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getSyntaxStylePath()
get syntax style path
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
copyToClipboard()
copy media objects to clipboard
static updateServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Update service settings.
initEditForm()
Init object edit form.
const IL_MODE_ALIAS
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
getEditFormValues()
Get values for edit form.
static getMediaItemsForUploadHash($a_hash)
Get media items for upload hash.
getMediaPoolPageValues()
Get current values for media pool page from.
static getInstance()
Get instance.
Media Pool Item.
Class ilObjMediaObjectGUI.
initMediaBulkForm($a_id, $a_title)
Init media bulk form.
static lookupTitle($a_id)
Lookup title.
export()
export content object
getParentFolderId()
Get folder parent ID.
addLocatorItems()
add locator items for media pool
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
User Interface class for media pool objects.
__construct(Container $dic, ilPlugin $plugin)
editTitlesAndDescriptions()
Edit titles and descriptions.
This class represents a text area property in a property form.
Class ilFileStandardDropzoneInputGUI.
static getInstance($a_obj_id)
Get instance.
createMediaPoolPage()
Create new content snippet.
showMedia()
show media object
$ret
Definition: parser.php:6
static _checkAdministrationPermission()
static initServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Init service settings form.
getRefId()
get reference id public
static _getRelativeDirectory($a_mob_id)
Get relative (to webspace dir) directory.
prepareOutput($a_show_subobjects=true)
const IL_MODE_OUTPUT
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static getLogger($a_component_id)
Get component logger.
createFolderForm()
create folder form
File System Explorer GUI class.
$ilUser
Definition: imgupload.php:18
saveTitlesAndDescriptions()
Save titles and descriptions.
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.
updateMediaPoolPage()
Update media pool page.
static redirect($a_script)
Accordion user interface class.
addHeaderAction()
Add header action menu.
static getWebspaceDir($mode="filesystem")
get webspace directory
$_POST["username"]
Class ilMediaPoolPage GUI class.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
GUI class for object translation handling.
confirmRemove()
confirm remove of mobs
TableGUI class for recent changes in wiki.
Confirmation screen class.