ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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  public function __construct($a_id = 0, $a_id_type = self::REPOSITORY_NODE_ID, $a_parent_node_id = 0)
62  {
63  global $DIC;
64 
65  parent::__construct($a_id, $a_id_type, $a_parent_node_id);
66 
67  $this->tabs = $DIC->tabs();
68  $this->error = $DIC["ilErr"];
69  $this->locator = $DIC["ilLocator"];
70  $this->help = $DIC["ilHelp"];
71 
72  $this->main_tpl = $DIC->ui()->mainTemplate();
73 
74  $this->upload = $DIC->upload();
75 
76  $this->mep_log = ilLoggerFactory::getLogger("mep");
77  }
78 
80 
84  protected function afterConstructor()
85  {
86  $lng = $this->lng;
87 
88  $lng->loadLanguageModule("mep");
89 
90  if ($this->ctrl->getCmd() == "explorer") {
91  $this->ctrl->saveParameter($this, array("ref_id"));
92  } else {
93  $this->ctrl->saveParameter($this, array("ref_id", "mepitem_id"));
94  }
95  $this->ctrl->saveParameter($this, array("mep_mode"));
96 
97  $lng->loadLanguageModule("content");
98  }
99 
103  final public function getType()
104  {
105  return "mep";
106  }
107 
114  public function executeCommand()
115  {
116  $ilTabs = $this->tabs;
117  $lng = $this->lng;
118  $ilAccess = $this->access;
119  $tpl = $this->tpl;
121 
122  if ($this->ctrl->getRedirectSource() == "ilinternallinkgui") {
123  $this->explorer();
124  return;
125  }
126 
127  $next_class = $this->ctrl->getNextClass($this);
128  $cmd = $this->ctrl->getCmd();
129  $new_type = $_POST["new_type"]
130  ? $_POST["new_type"]
131  : $_GET["new_type"];
132 
133  if ($new_type != "" && ($cmd != "confirmRemove" && $cmd != "copyToClipboard"
134  && $cmd != "pasteFromClipboard")) {
135  $this->setCreationMode(true);
136  }
137 
138  if (!$this->getCreationMode()) {
139  $tree = $this->object->getTree();
140  if ($_GET["mepitem_id"] == "") {
141  $_GET["mepitem_id"] = $tree->getRootId();
142  }
143  }
144  if ($cmd == "create") {
145  switch ($_POST["new_type"]) {
146  case "mob":
147  $this->ctrl->redirectByClass("ilobjmediaobjectgui", "create");
148  break;
149 
150  case "fold":
151  $this->ctrl->redirectByClass("ilobjfoldergui", "create");
152  break;
153  }
154  }
155 
156  switch ($next_class) {
157  case 'ilobjectmetadatagui':
158  $this->checkPermission("write");
159 
160  $this->prepareOutput();
161  $this->addHeaderAction();
162 
163  $this->tabs_gui->activateTab('meta_data');
164  include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
165  $md_gui = new ilObjectMetaDataGUI($this->object, 'mob');
166  $this->ctrl->forwardCommand($md_gui);
167  $this->tpl->printToStdout();
168  break;
169 
170 
171  case 'ilmediapoolpagegui':
172  $this->checkPermission("write");
173  $this->prepareOutput();
174  $this->addHeaderAction();
175  $ilTabs->clearTargets();
176  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPageGUI.php");
177  $mep_page_gui = new ilMediaPoolPageGUI($_GET["mepitem_id"], $_GET["old_nr"]);
178 
179  if (!$ilAccess->checkAccess("write", "", $this->object->getRefId())) {
180  $mep_page_gui->setEnableEditing(false);
181  }
182  $ret = $this->ctrl->forwardCommand($mep_page_gui);
183  if ($ret != "") {
184  $tpl->setContent($ret);
185  }
186  $this->setMediaPoolPageTabs();
187  $this->tpl->printToStdout();
188  break;
189 
190  case "ilobjmediaobjectgui":
191  $this->checkPermission("write");
192  if ($cmd == "create" || $cmd == "save" || $cmd == "cancel") {
193  $ret_obj = $_GET["mepitem_id"];
194  $ilObjMediaObjectGUI = new ilObjMediaObjectGUI("", 0, false, false);
195  $ilObjMediaObjectGUI->setWidthPreset($this->object->getDefaultWidth());
196  $ilObjMediaObjectGUI->setHeightPreset($this->object->getDefaultHeight());
197  } else {
198  $ret_obj = $tree->getParentId($_GET["mepitem_id"]);
199  $ilObjMediaObjectGUI = new ilObjMediaObjectGUI("", ilMediaPoolItem::lookupForeignId($_GET["mepitem_id"]), false, false);
200  $this->ctrl->setParameter($this, "mepitem_id", $this->getParentFolderId());
201  $ilTabs->setBackTarget(
202  $lng->txt("back"),
203  $this->ctrl->getLinkTarget(
204  $this,
205  $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia"
206  )
207  );
208  }
209  if ($this->ctrl->getCmdClass() == "ilinternallinkgui") {
210  $this->ctrl->setReturn($this, "explorer");
211  } else {
212  $this->ctrl->setParameter($this, "mepitem_id", $ret_obj);
213  $this->ctrl->setReturn(
214  $this,
215  $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia"
216  );
217  $this->ctrl->setParameter($this, "mepitem_id", $_GET["mepitem_id"]);
218  }
219  $this->getTemplate();
220  $ilObjMediaObjectGUI->setTabs();
221  $this->setLocator();
222 
223  // set adv metadata record dobject
224  $ilObjMediaObjectGUI->setAdvMdRecordObject($this->object->getRefId(), "mep", "mob");
225 
226  $ret = $this->ctrl->forwardCommand($ilObjMediaObjectGUI);
227 
228  if ($cmd == "save" && $ret != false) {
229  $mep_item = new ilMediaPoolItem();
230  $mep_item->setTitle($ret->getTitle());
231  $mep_item->setType("mob");
232  $mep_item->setForeignId($ret->getId());
233  $mep_item->create();
234 
235  $parent = ($_GET["mepitem_id"] == "")
236  ? $tree->getRootId()
237  : $_GET["mepitem_id"];
238  $tree->insertNode($mep_item->getId(), $parent);
239  ilUtil::redirect("ilias.php?baseClass=ilMediaPoolPresentationGUI&cmd=listMedia&ref_id=" .
240  $_GET["ref_id"] . "&mepitem_id=" . $_GET["mepitem_id"]);
241  } else {
242  $this->tpl->printToStdout();
243  }
244  break;
245 
246  case "ilobjfoldergui":
247  $this->checkPermission("write");
248  $this->addHeaderAction();
249  $folder_gui = new ilObjFolderGUI("", 0, false, false);
250  $this->ctrl->setReturn($this, "listMedia");
251  $cmd .= "Object";
252  switch ($cmd) {
253  case "createObject":
254  $this->prepareOutput();
255  $folder_gui = new ilObjFolderGUI("", 0, false, false);
256  $folder_gui->setFormAction(
257  "save",
258  $this->ctrl->getFormActionByClass("ilobjfoldergui")
259  );
260  $folder_gui->createObject();
261  $this->tpl->printToStdout();
262  break;
263 
264  case "saveObject":
265  //$folder_gui->setReturnLocation("save", $this->ctrl->getLinkTarget($this, "listMedia"));
266  $parent = ($_GET["mepitem_id"] == "")
267  ? $tree->getRootId()
268  : $_GET["mepitem_id"];
269  $folder_gui->setFolderTree($tree);
270  $folder_gui->saveObject($parent);
271  //$this->ctrl->redirect($this, "listMedia");
272  break;
273 
274  case "editObject":
275  $this->prepareOutput();
276  $folder_gui = new ilObjFolderGUI("", ilMediaPoolItem::lookupForeignId($_GET["mepitem_id"]), false, false);
277  $this->ctrl->setParameter($this, "foldereditmode", "1");
278  $folder_gui->setFormAction("update", $this->ctrl->getFormActionByClass("ilobjfoldergui"));
279  $folder_gui->editObject();
280  $this->tpl->printToStdout();
281  break;
282 
283  case "updateObject":
284  $folder_gui = new ilObjFolderGUI("", ilMediaPoolItem::lookupForeignId($_GET["mepitem_id"]), false, false);
285  $this->ctrl->setParameter($this, "mepitem_id", $this->getParentFolderId());
286  $this->ctrl->setReturn($this, "listMedia");
287  $folder_gui->updateObject(true); // this returns to parent
288  break;
289 
290  case "cancelObject":
291  if ($_GET["foldereditmode"]) {
292  $this->ctrl->setParameter($this, "mepitem_id", $this->getParentFolderId());
293  }
294  $this->ctrl->redirect($this, "listMedia");
295  break;
296  }
297  break;
298 
299  case "ileditclipboardgui":
300  $this->prepareOutput();
301  $this->addHeaderAction();
302  $this->ctrl->setReturn($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
303  $clip_gui = new ilEditClipboardGUI();
304  $clip_gui->setMultipleSelections(true);
305  $clip_gui->setInsertButtonTitle($lng->txt("mep_copy_to_mep"));
306  $ilTabs->setTabActive("clipboard");
307  $this->ctrl->forwardCommand($clip_gui);
308  $this->tpl->printToStdout();
309  break;
310 
311  case 'ilinfoscreengui':
312  $this->prepareOutput();
313  $this->addHeaderAction();
314  $this->infoScreen();
315  $this->tpl->printToStdout();
316  break;
317 
318  case 'ilpermissiongui':
319  $this->checkPermission("edit_permission");
320  $this->prepareOutput();
321  $this->addHeaderAction();
322  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
323  $perm_gui = new ilPermissionGUI($this);
324  $this->ctrl->forwardCommand($perm_gui);
325  $this->tpl->printToStdout();
326  break;
327 
328  case "ilexportgui":
329  $this->checkPermission("write");
330  $this->prepareOutput();
331  $this->addHeaderAction();
332  include_once("./Services/Export/classes/class.ilExportGUI.php");
333  $exp_gui = new ilExportGUI($this);
334  $exp_gui->addFormat("xml");
335  include_once("./Services/Object/classes/class.ilObjectTranslation.php");
336  $ot = ilObjectTranslation::getInstance($this->object->getId());
337  if ($ot->getContentActivated()) {
338  $exp_gui->addFormat("xml_master", "XML (" . $lng->txt("mep_master_language_only") . ")", $this, "export");
339  $exp_gui->addFormat("xml_masternomedia", "XML (" . $lng->txt("mep_master_language_only_no_media") . ")", $this, "export");
340  }
341  $this->ctrl->forwardCommand($exp_gui);
342  $this->tpl->printToStdout();
343  break;
344 
345  case "ilfilesystemgui":
346  $this->checkPermission("write");
347  $this->prepareOutput();
348  $this->addHeaderAction();
349  $ilTabs->clearTargets();
350  $ilTabs->setBackTarget(
351  $lng->txt("back"),
352  $ilCtrl->getLinkTarget($this, "listMedia")
353  );
354  $mset = new ilSetting("mobs");
355  if (trim($mset->get("upload_dir")) != "") {
356  include_once("./Services/FileSystem/classes/class.ilFileSystemGUI.php");
357  $fs_gui = new ilFileSystemGUI($mset->get("upload_dir"));
358  $fs_gui->setPostDirPath(true);
359  $fs_gui->setTableId("mepud" . $this->object->getId());
360  $fs_gui->setAllowFileCreation(false);
361  $fs_gui->setAllowDirectoryCreation(false);
362  $fs_gui->clearCommands();
363  $fs_gui->addCommand(
364  $this,
365  "selectUploadDirFiles",
366  $this->lng->txt("mep_sel_upload_dir_files"),
367  false,
368  true
369  );
370  $this->ctrl->forwardCommand($fs_gui);
371  }
372  $this->tpl->printToStdout();
373  break;
374 
375  case "ilcommonactiondispatchergui":
376  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
378  $this->ctrl->forwardCommand($gui);
379  break;
380 
381  case 'ilobjecttranslationgui':
382  $this->prepareOutput();
383  $this->addHeaderAction();
384  //$this->setTabs("settings");
385  $ilTabs->activateTab("settings");
386  $this->setSettingsSubTabs("obj_multilinguality");
387  include_once("./Services/Object/classes/class.ilObjectTranslationGUI.php");
388  $transgui = new ilObjectTranslationGUI($this);
389  $transgui->setTitleDescrOnlyMode(false);
390  $this->ctrl->forwardCommand($transgui);
391  $this->tpl->printToStdout();
392  break;
393 
394  case "ilmediapoolimportgui":
395  $this->prepareOutput();
396  $this->addHeaderAction();
397  $this->checkPermission("write");
398  $ilTabs->activateTab("import");
399  include_once("./Modules/MediaPool/classes/class.ilMediaPoolImportGUI.php");
400  $gui = new ilMediaPoolImportGUI($this->object);
401  $this->ctrl->forwardCommand($gui);
402  $this->tpl->printToStdout();
403  break;
404 
405  case "ilmobmultisrtuploadgui":
406  $this->checkPermission("write");
407  $this->prepareOutput();
408  $this->addHeaderAction();
409  //$this->setTabs("content");
410  $this->setContentSubTabs("srt_files");
411  include_once("./Services/MediaObjects/classes/class.ilMobMultiSrtUploadGUI.php");
412  include_once("./Modules/MediaPool/classes/class.ilMepMultiSrt.php");
413  $gui = new ilMobMultiSrtUploadGUI(new ilMepMultiSrt($this->object));
414  $this->ctrl->forwardCommand($gui);
415  $this->tpl->printToStdout();
416  break;
417 
418 
419  default:
420  $this->prepareOutput();
421  $this->addHeaderAction();
422  $cmd = $this->ctrl->getCmd("listMedia");
423  $this->$cmd();
424  if (!$this->getCreationMode()) {
425  $this->tpl->printToStdout();
426  }
427  break;
428  }
429  }
430 
434  public function createMediaObject()
435  {
436  $this->ctrl->redirectByClass("ilobjmediaobjectgui", "create");
437  }
438 
439  protected function initCreationForms($a_new_type)
440  {
441  $forms = array(self::CFORM_NEW => $this->initCreateForm($a_new_type),
442  self::CFORM_IMPORT => $this->initImportForm($a_new_type));
443 
444  return $forms;
445  }
446 
450  public function afterSave(ilObject $newObj)
451  {
452  // always send a message
453  ilUtil::sendSuccess($this->lng->txt("object_added"), true);
454 
455  //ilUtil::redirect($this->getReturnLocation("save","adm_object.php?".$this->link_params));
456  ilUtil::redirect("ilias.php?baseClass=ilMediaPoolPresentationGUI&ref_id=" . $newObj->getRefId() . "&cmd=listMedia");
457  }
458 
459  protected function initEditCustomForm(ilPropertyFormGUI $a_form)
460  {
461  $obj_service = $this->object_service;
462 
463  // default width
464  $ni = new ilNumberInputGUI($this->lng->txt("mep_default_width"), "default_width");
465  $ni->setMinValue(0);
466  $ni->setSuffix("px");
467  $ni->setMaxLength(5);
468  $ni->setSize(5);
469  $a_form->addItem($ni);
470 
471  // default height
472  $ni = new ilNumberInputGUI($this->lng->txt("mep_default_height"), "default_height");
473  $ni->setSuffix("px");
474  $ni->setMinValue(0);
475  $ni->setMaxLength(5);
476  $ni->setSize(5);
477  $ni->setInfo($this->lng->txt("mep_default_width_height_info"));
478  $a_form->addItem($ni);
479 
480  // presentation
481  $pres = new ilFormSectionHeaderGUI();
482  $pres->setTitle($this->lng->txt('obj_presentation'));
483  $a_form->addItem($pres);
484 
485  // tile image
486  $obj_service->commonSettings()->legacyForm($a_form, $this->object)->addTileImage();
487 
488  // additional features
489  $feat = new ilFormSectionHeaderGUI();
490  $feat->setTitle($this->lng->txt('obj_features'));
491  $a_form->addItem($feat);
492 
493  include_once './Services/Container/classes/class.ilContainer.php';
494  include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
496  $this->object->getId(),
497  $a_form,
498  array(
500  )
501  );
502  }
503 
509  public function edit()
510  {
511  $tpl = $this->tpl;
512  $ilTabs = $this->tabs_gui;
514 
515  $this->setSettingsSubTabs("settings");
516 
517  if (!$this->checkPermissionBool("write")) {
518  $ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $ilErr->MESSAGE);
519  }
520 
521  $ilTabs->activateTab("settings");
522 
523  $form = $this->initEditForm();
524  $values = $this->getEditFormValues();
525  if ($values) {
526  $form->setValuesByArray($values, true);
527  }
528 
529  $this->addExternalEditFormCustom($form);
530 
531  $tpl->setContent($form->getHTML());
532  }
533 
534 
535  protected function getEditFormCustomValues(array &$a_values)
536  {
537  if ($this->object->getDefaultWidth() > 0) {
538  $a_values["default_width"] = $this->object->getDefaultWidth();
539  }
540  if ($this->object->getDefaultHeight() > 0) {
541  $a_values["default_height"] = $this->object->getDefaultHeight();
542  }
543  }
544 
545  protected function updateCustom(ilPropertyFormGUI $a_form)
546  {
547  $obj_service = $this->object_service;
548 
549  $this->object->setDefaultWidth($a_form->getInput("default_width"));
550  $this->object->setDefaultHeight($a_form->getInput("default_height"));
551 
552 
553  // additional features
554  include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
556  $this->object->getId(),
557  $a_form,
558  array(
560  )
561  );
562 
563  // tile image
564  $obj_service->commonSettings()->legacyForm($a_form, $this->object)->saveTileImage();
565  }
566 
570  public function listMedia()
571  {
572  $ilAccess = $this->access;
573  $tpl = $this->tpl;
574  $ilTabs = $this->tabs;
576  $ilToolbar = $this->toolbar;
577  $lng = $this->lng;
578 
579  $ilCtrl->setParameter($this, "mep_mode", "listMedia");
580 
581  $this->checkPermission("read");
582 
583  $ilTabs->setTabActive("content");
584  $this->setContentSubTabs("content");
585 
586  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
587  $ilToolbar->addButton(
588  $lng->txt("mep_create_mob"),
589  $ilCtrl->getLinkTarget($this, "createMediaObject")
590  );
591 
592  $mset = new ilSetting("mobs");
593  if ($mset->get("mep_activate_pages")) {
594  $ilToolbar->addButton(
595  $lng->txt("mep_create_content_snippet"),
596  $ilCtrl->getLinkTarget($this, "createMediaPoolPage")
597  );
598  }
599 
600  $ilToolbar->addButton(
601  $lng->txt("mep_create_folder"),
602  $ilCtrl->getLinkTarget($this, "createFolderForm")
603  );
604 
605  if (trim($mset->get("upload_dir")) != "" && ilMainMenuGUI::_checkAdministrationPermission()) {
606  $ilToolbar->addButton(
607  $lng->txt("mep_create_from_upload_dir"),
608  $ilCtrl->getLinkTargetByClass("ilfilesystemgui", "listFiles")
609  );
610  }
611 
612  $ilToolbar->addButton(
613  $lng->txt("mep_bulk_upload"),
614  $ilCtrl->getLinkTarget($this, "bulkUpload")
615  );
616  }
617 
618  $mep_table_gui = new ilMediaPoolTableGUI($this, "listMedia", $this->object, "mepitem_id");
619  $tpl->setContent($mep_table_gui->getHTML());
620  }
621 
625  protected function toggleExplorerNodeState() : void
626  {
627  $exp = new ilMediaPoolExplorerGUI($this, "listMedia", $this->object);
628  $exp->toggleExplorerNodeState();
629  }
630 
634  public function allMedia()
635  {
636  $tpl = $this->tpl;
637  $ilTabs = $this->tabs;
640 
641  $ilCtrl->setParameter($this, "mep_mode", "allMedia");
642 
643  $this->checkPermission("read");
644  $ilTabs->setTabActive("content");
645  $this->setContentSubTabs("mep_all_mobs");
646 
647 
648  include_once("./Modules/MediaPool/classes/class.ilMediaPoolTableGUI.php");
649  $mep_table_gui = new ilMediaPoolTableGUI(
650  $this,
651  "allMedia",
652  $this->object,
653  "mepitem_id",
655  true
656  );
657 
658 
659  if (isset($_GET['force_filter']) and $_GET['force_filter']) {
660  $_POST['title'] = ilMediaPoolItem::lookupTitle((int) $_GET['force_filter']);
661 
662  include_once("./Services/Table/classes/class.ilTablePropertiesStorage.php");
663  $tprop = new ilTablePropertiesStorage();
664  $tprop->storeProperty(
665  $mep_table_gui->getId(),
666  $ilUser->getId(),
667  'filter',
668  1
669  );
670  $mep_table_gui->resetFilter();
671  $mep_table_gui->resetOffset();
672  $mep_table_gui->writeFilterToSession();
673 
674  // Read again
675  $mep_table_gui = new ilMediaPoolTableGUI(
676  $this,
677  "allMedia",
678  $this->object,
679  "mepitem_id",
681  true
682  );
683  }
684 
685  $tpl->setContent($mep_table_gui->getHTML());
686  }
687 
691  public function applyFilter()
692  {
693  include_once("./Modules/MediaPool/classes/class.ilMediaPoolTableGUI.php");
694  $mtab = new ilMediaPoolTableGUI(
695  $this,
696  "allMedia",
697  $this->object,
698  "mepitem_id",
700  true
701  );
702  $mtab->writeFilterToSession();
703  $mtab->resetOffset();
704  $this->allMedia();
705  }
706 
710  public function resetFilter()
711  {
712  include_once("./Modules/MediaPool/classes/class.ilMediaPoolTableGUI.php");
713  $mtab = new ilMediaPoolTableGUI(
714  $this,
715  "allMedia",
716  $this->object,
717  "mepitem_id",
719  true
720  );
721  $mtab->resetFilter();
722  $mtab->resetOffset();
723  $this->allMedia();
724  }
725 
729  public function getTemplate()
730  {
731  $this->tpl->loadStandardTemplate();
732  }
733 
734 
738  public function getParentFolderId()
739  {
740  if ($_GET["mepitem_id"] == "") {
741  return "";
742  }
743  $par_id = $this->object->getPoolTree()->getParentId($_GET["mepitem_id"]);
744  if ($par_id != $this->object->getPoolTree()->getRootId()) {
745  return $par_id;
746  } else {
747  return "";
748  }
749  }
750 
754  protected function showMedia()
755  {
756  $this->checkPermission("read");
757 
758  $item = new ilMediaPoolItem((int) $_GET["mepitem_id"]);
759  $mob_id = $item->getForeignId();
760 
761  $this->tpl = new ilGlobalTemplate("tpl.fullscreen.html", true, true, "Services/COPage");
762  include_once("Services/Style/Content/classes/class.ilObjStyleSheet.php");
763  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
764  $this->tpl->setVariable(
765  "LOCATION_CONTENT_STYLESHEET",
767  );
768 
769 
770  require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
771  require_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
773  $media_obj = new ilObjMediaObject((int) $mob_id);
774 
775 
776  $this->tpl->setVariable("TITLE", " - " . $media_obj->getTitle());
777 
778  $xml = "<dummy>";
779  // todo: we get always the first alias now (problem if mob is used multiple
780  // times in page)
781  $xml .= $media_obj->getXML(IL_MODE_ALIAS);
782  $xml .= $media_obj->getXML(IL_MODE_OUTPUT);
783  $xml .= $link_xml;
784  $xml .= "</dummy>";
785 
786  $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
787  $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
788  $xh = xslt_create();
789 
790  $wb_path = ilUtil::getWebspaceDir("output") . "/";
791 
792  $mode = ($_GET["cmd"] != "showPreview")
793  ? "fullscreen"
794  : "media";
795  $enlarge_path = ilUtil::getImagePath("enlarge.svg", false, "output");
796  $fullscreen_link =
797  $this->ctrl->getLinkTarget($this, "showFullscreen", "", false, false);
798  $params = array('mode' => $mode, 'enlarge_path' => $enlarge_path,
799  'link_params' => "ref_id=" . $_GET["ref_id"],'fullscreen_link' => $fullscreen_link,
800  'ref_id' => $_GET["ref_id"], 'pg_frame' => $pg_frame, 'webspace_path' => $wb_path);
801  $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
802  echo xslt_error($xh);
803  xslt_free($xh);
804  // unmask user html
805  $this->tpl->setVariable("MEDIA_CONTENT", $output);
806  }
807 
814  public function showPage()
815  {
816  $tpl = $this->tpl;
817 
818  //$tpl = new \ilGlobalPageTemplate($DIC->globalScreen(), $DIC->ui(), $DIC->http());
819  $tpl = new ilGlobalTemplate("tpl.fullscreen.html", true, true, "Services/COPage");
820 
824 
825  // get page object
826  $page_gui = new ilMediaPoolPageGUI((int) $_GET["mepitem_id"]);
827  $page_gui->setTemplate($tpl);
828 
829  $page_gui->setTemplateOutput(false);
830  $page_gui->setHeader("");
831  $ret = $page_gui->showPage(true);
832 
833  //$tpl->setBodyClass("ilMediaPoolPagePreviewBody");
834  $tpl->setVariable("MEDIA_CONTENT", "<div>" . $ret . "</div>");
835 
836 
837  $tpl->printToStdout();
838  exit;
839  }
840 
841 
845  public function showPreview()
846  {
847  $this->checkPermission("read");
848 
849  $item = new ilMediaPoolItem((int) $_GET["mepitem_id"]);
850 
851  switch ($item->getType()) {
852  case "mob":
853  $this->showMedia();
854  break;
855 
856  case "pg":
857  $this->showPage();
858  break;
859  }
860  }
861 
862 
866  public function showFullscreen()
867  {
868  $this->showMedia();
869  }
870 
874  public function confirmRemove()
875  {
877  $lng = $this->lng;
879 
880  $this->checkPermission("write");
881 
882  if (!isset($_POST["id"])) {
883  $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
884  }
885 
886  // display confirmation message
887  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
888  $cgui = new ilConfirmationGUI();
889  $cgui->setFormAction($this->ctrl->getFormAction($this));
890  $cgui->setHeaderText($this->lng->txt("info_remove_sure"));
891  $cgui->setCancel($this->lng->txt("cancel"), "cancelRemove");
892  $cgui->setConfirm($this->lng->txt("confirm"), "remove");
893 
894  foreach ($_POST["id"] as $obj_id) {
896  $title = ilMediaPoolItem::lookupTitle($obj_id);
897 
898  // check whether page can be removed
899  $add = "";
900  if ($type == "pg") {
901  include_once("./Services/COPage/classes/class.ilPageContentUsage.php");
902  $usages = ilPageContentUsage::getUsages("incl", $obj_id, false);
903  if (count($usages) > 0) {
904  ilUtil::sendFailure(sprintf($lng->txt("mep_content_snippet_in_use"), $title), true);
905  $ilCtrl->redirect($this, "listMedia");
906  } else {
907  // check whether the snippet is used in older versions of pages
908  $usages = ilPageContentUsage::getUsages("incl", $obj_id, true);
909  if (count($usages) > 0) {
910  $add = "<div class='small'>" . $lng->txt("mep_content_snippet_used_in_older_versions") . "</div>";
911  }
912  }
913  }
914 
915  $caption = ilUtil::getImageTagByType($type, $this->tpl->tplPath) .
916  " " . $title . $add;
917 
918  $cgui->addItem("id[]", $obj_id, $caption);
919  }
920 
921  $this->tpl->setContent($cgui->getHTML());
922  }
923 
927  public function openClipboard()
928  {
930  $ilAccess = $this->access;
931 
932  $this->checkPermission("write");
933 
934  $ilCtrl->setParameterByClass(
935  "ileditclipboardgui",
936  "returnCommand",
937  rawurlencode($ilCtrl->getLinkTarget(
938  $this,
939  "insertFromClipboard",
940  "",
941  false,
942  false
943  ))
944  );
945  $ilCtrl->redirectByClass("ilEditClipboardGUI", "getObject");
946  }
947 
948 
952  public function insertFromClipboard()
953  {
954  $ilAccess = $this->access;
955 
956  $this->checkPermission("write");
957 
958  include_once("./Services/Clipboard/classes/class.ilEditClipboardGUI.php");
960  $not_inserted = array();
961  if (is_array($ids)) {
962  foreach ($ids as $id2) {
963  $id = explode(":", $id2);
964  $type = $id[0];
965  $id = $id[1];
966 
967  if ($type == "mob") { // media object
968  if (ilObjMEdiaPool::isForeignIdInTree($this->object->getId(), $id)) {
969  $not_inserted[] = ilObject::_lookupTitle($id) . " [" .
970  $id . "]";
971  } else {
972  $item = new ilMediaPoolItem();
973  $item->setType("mob");
974  $item->setForeignId($id);
975  $item->setTitle(ilObject::_lookupTitle($id));
976  $item->create();
977  if ($item->getId() > 0) {
978  $this->object->insertInTree($item->getId(), $_GET["mepitem_id"]);
979  }
980  }
981  }
982  if ($type == "incl") { // content snippet
983  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
984  include_once("./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
985  if (ilObjMEdiaPool::isItemIdInTree($this->object->getId(), $id)) {
986  $not_inserted[] = ilMediaPoolPage::lookupTitle($id) . " [" .
987  $id . "]";
988  } else {
989  $original = new ilMediaPoolPage($id);
990 
991  // copy the page into the pool
992  $item = new ilMediaPoolItem();
993  $item->setType("pg");
994  $item->setTitle(ilMediaPoolItem::lookupTitle($id));
995  $item->create();
996  if ($item->getId() > 0) {
997  $this->object->insertInTree($item->getId(), $_GET["mepitem_id"]);
998 
999  // create page
1000  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
1001  $page = new ilMediaPoolPage();
1002  $page->setId($item->getId());
1003  $page->setParentId($this->object->getId());
1004  $page->create();
1005 
1006  // copy content
1007  $original->copy($page->getId(), $page->getParentType(), $page->getParentId(), true);
1008  }
1009  }
1010  }
1011  }
1012  }
1013  if (count($not_inserted) > 0) {
1014  ilUtil::sendInfo($this->lng->txt("mep_not_insert_already_exist") . "<br>" .
1015  implode("<br>", $not_inserted), true);
1016  }
1017  $this->ctrl->redirect($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
1018  }
1019 
1020 
1024  public function cancelRemove()
1025  {
1026  $this->ctrl->redirect($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
1027  }
1028 
1032  public function remove()
1033  {
1034  $ilAccess = $this->access;
1035 
1036  $this->checkPermission("write");
1037 
1038  foreach ($_POST["id"] as $obj_id) {
1039  $this->object->deleteChild($obj_id);
1040  }
1041 
1042  ilUtil::sendSuccess($this->lng->txt("cont_obj_removed"), true);
1043  $this->ctrl->redirect($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
1044  }
1045 
1046 
1050  public function copyToClipboard()
1051  {
1052  $ilUser = $this->user;
1053  $ilAccess = $this->access;
1054 
1055  $this->checkPermission("write");
1056 
1057  if (!isset($_POST["id"])) {
1058  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1059  $this->ctrl->redirect($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
1060  }
1061 
1062  foreach ($_POST["id"] as $obj_id) {
1064  if ($type == "fold") {
1065  ilUtil::sendFailure($this->lng->txt("cont_cant_copy_folders"), true);
1066  $this->ctrl->redirect($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
1067  }
1068  }
1069  foreach ($_POST["id"] as $obj_id) {
1070  $fid = ilMediaPoolItem::lookupForeignId($obj_id);
1072  if ($type == "mob") {
1073  $ilUser->addObjectToClipboard($fid, "mob", "");
1074  }
1075  if ($type == "pg") {
1076  $ilUser->addObjectToClipboard($obj_id, "incl", "");
1077  }
1078  }
1079  ilUtil::sendSuccess($this->lng->txt("copied_to_clipboard"), true);
1080  $this->ctrl->redirect($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
1081  }
1082 
1086  public function addLocatorItems()
1087  {
1088  $ilLocator = $this->locator;
1089  $ilAccess = $this->access;
1090 
1091  if (!$this->getCreationMode() && $this->ctrl->getCmd() != "explorer") {
1092  $tree = $this->object->getTree();
1093  $obj_id = ($_GET["mepitem_id"] == "")
1094  ? $tree->getRootId()
1095  : $_GET["mepitem_id"];
1096  $path = $tree->getPathFull($obj_id);
1097  foreach ($path as $node) {
1098  if ($node["child"] == $tree->getRootId()) {
1099  $this->ctrl->setParameter($this, "mepitem_id", "");
1100  if ($ilAccess->checkAccess("read", "", $this->object->getRefId())) {
1101  $link = $this->ctrl->getLinkTarget($this, "listMedia");
1102  } elseif ($ilAccess->checkAccess("visible", "", $this->object->getRefId())) {
1103  $link = $this->ctrl->getLinkTarget($this, "infoScreen");
1104  }
1105  $title = $this->object->getTitle();
1106  $this->ctrl->setParameter($this, "mepitem_id", $_GET["mepitem_id"]);
1107  $ilLocator->addItem($title, $link, "", $_GET["ref_id"]);
1108  }
1109  }
1110  }
1111  }
1112 
1116 
1120  public function createFolderForm()
1121  {
1122  $ilAccess = $this->access;
1123  $tpl = $this->tpl;
1124 
1125  $this->checkPermission("write");
1126 
1127  $this->initFolderForm("create");
1128  $tpl->setContent($this->form->getHTML());
1129  }
1130 
1137  public function editFolder()
1138  {
1139  $tpl = $this->tpl;
1140 
1141  $this->checkPermission("write");
1142 
1143  $this->initFolderForm();
1144  $this->getFolderValues();
1145  $tpl->setContent($this->form->getHTML());
1146  }
1147 
1151  public function getFolderValues()
1152  {
1153  $values = array();
1154 
1155  $values["title"] = ilMediaPoolItem::lookupTitle($_GET["mepitem_id"]);
1156 
1157  $this->form->setValuesByArray($values);
1158  }
1159 
1163  public function saveFolder()
1164  {
1165  $tpl = $this->tpl;
1166  $lng = $this->lng;
1167  $ilCtrl = $this->ctrl;
1168 
1169  $this->checkPermission("write");
1170 
1171  $this->initFolderForm("create");
1172  if ($this->form->checkInput()) {
1173  if ($this->object->createFolder($_POST["title"], (int) $_GET["mepitem_id"])) {
1174  ilUtil::sendSuccess($lng->txt("mep_folder_created"), true);
1175  }
1176  $ilCtrl->redirect($this, "listMedia");
1177  }
1178 
1179  $this->form->setValuesByPost();
1180  $tpl->setContent($this->form->getHtml());
1181  }
1182 
1186  public function updateFolder()
1187  {
1188  $lng = $this->lng;
1189  $ilCtrl = $this->ctrl;
1190  $tpl = $this->tpl;
1191 
1192  $this->checkPermission("write");
1193 
1194  $this->initFolderForm("edit");
1195  if ($this->form->checkInput()) {
1196  $item = new ilMediaPoolItem($_GET["mepitem_id"]);
1197  $item->setTitle($_POST["title"]);
1198  $item->update();
1199  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1200  $ilCtrl->setParameter(
1201  $this,
1202  "mepitem_id",
1203  $this->object->getTree()->getParentId($_GET["mepitem_id"])
1204  );
1205  $ilCtrl->redirect($this, "listMedia");
1206  }
1207 
1208  $this->form->setValuesByPost();
1209  $tpl->setContent($this->form->getHtml());
1210  }
1211 
1217  public function initFolderForm($a_mode = "edit")
1218  {
1219  $lng = $this->lng;
1220  $ilCtrl = $this->ctrl;
1221 
1222  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1223  $this->form = new ilPropertyFormGUI();
1224 
1225  // desc
1226  $ti = new ilTextInputGUI($lng->txt("title"), "title");
1227  $ti->setMaxLength(128);
1228  $ti->setRequired(true);
1229  $this->form->addItem($ti);
1230 
1231  // save and cancel commands
1232  if ($a_mode == "create") {
1233  $this->form->addCommandButton("saveFolder", $lng->txt("save"));
1234  $this->form->addCommandButton("cancelSave", $lng->txt("cancel"));
1235  $this->form->setTitle($lng->txt("mep_new_folder"));
1236  } else {
1237  $this->form->addCommandButton("updateFolder", $lng->txt("save"));
1238  $this->form->addCommandButton("cancelFolderUpdate", $lng->txt("cancel"));
1239  $this->form->setTitle($lng->txt("mep_edit_folder"));
1240  }
1241 
1242  $this->form->setFormAction($ilCtrl->getFormAction($this));
1243  }
1244 
1248  public function cancelFolderUpdate()
1249  {
1250  $ilCtrl = $this->ctrl;
1251  $ilCtrl->setParameter(
1252  $this,
1253  "mepitem_id",
1254  $this->object->getTree()->getParentId($_GET["mepitem_id"])
1255  );
1256  $ilCtrl->redirect($this, "listMedia");
1257  }
1258 
1262  public function cancelSave()
1263  {
1264  $ilCtrl = $this->ctrl;
1265  $ilCtrl->redirect($this, "listMedia");
1266  }
1267 
1271 
1275  public function createMediaPoolPage()
1276  {
1277  $tpl = $this->tpl;
1278 
1279  $this->checkPermission("write");
1280 
1281  $this->initMediaPoolPageForm("create");
1282  $tpl->setContent($this->form->getHTML());
1283  }
1284 
1291  public function editMediaPoolPage()
1292  {
1293  $tpl = $this->tpl;
1294  $ilTabs = $this->tabs;
1295 
1296  $this->checkPermission("write");
1297 
1298  $ilTabs->clearTargets();
1299 
1300  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPageGUI.php");
1301  $mep_page_gui = new ilMediaPoolPageGUI($_GET["mepitem_id"], $_GET["old_nr"]);
1302  $mep_page_gui->getTabs();
1303 
1304  $this->setMediaPoolPageTabs();
1305 
1306  $this->initMediaPoolPageForm("edit");
1307  $this->getMediaPoolPageValues();
1308  $tpl->setContent($this->form->getHTML());
1309  }
1310 
1314  public function saveMediaPoolPage()
1315  {
1316  $tpl = $this->tpl;
1317  $lng = $this->lng;
1318  $ilCtrl = $this->ctrl;
1319 
1320  $this->checkPermission("write");
1321 
1322  $this->initMediaPoolPageForm("create");
1323  if ($this->form->checkInput()) {
1324  // create media pool item
1325  include_once("./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
1326  $item = new ilMediaPoolItem();
1327  $item->setTitle($_POST["title"]);
1328  $item->setType("pg");
1329  $item->create();
1330 
1331  if ($item->getId() > 0) {
1332  // put in tree
1333  $tree = $this->object->getTree();
1334  $parent = $_GET["mepitem_id"] > 0
1335  ? $_GET["mepitem_id"]
1336  : $tree->getRootId();
1337  $this->object->insertInTree($item->getId(), $parent);
1338 
1339  // create page
1340  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
1341  $page = new ilMediaPoolPage();
1342  $page->setId($item->getId());
1343  $page->setParentId($this->object->getId());
1344  $page->create();
1345 
1346  $ilCtrl->setParameterByClass("ilmediapoolpagegui", "mepitem_id", $item->getId());
1347  $ilCtrl->redirectByClass("ilmediapoolpagegui", "edit");
1348  }
1349  $ilCtrl->redirect($this, "listMedia");
1350  }
1351 
1352  $this->form->setValuesByPost();
1353  $tpl->setContent($this->form->getHtml());
1354  }
1355 
1359  public function updateMediaPoolPage()
1360  {
1361  $lng = $this->lng;
1362  $ilCtrl = $this->ctrl;
1363  $tpl = $this->tpl;
1364 
1365  $this->checkPermission("write");
1366 
1367  $this->initMediaPoolPageForm("edit");
1368  if ($this->form->checkInput()) {
1369  $item = new ilMediaPoolItem($_GET["mepitem_id"]);
1370  $item->setTitle($_POST["title"]);
1371  $item->update();
1372  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1373  $ilCtrl->redirect($this, "editMediaPoolPage");
1374  }
1375 
1376  $this->form->setValuesByPost();
1377  $tpl->setContent($this->form->getHtml());
1378  }
1384  public function initMediaPoolPageForm($a_mode = "edit")
1385  {
1386  $lng = $this->lng;
1387  $ilCtrl = $this->ctrl;
1388 
1389  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1390  $this->form = new ilPropertyFormGUI();
1391 
1392  // title
1393  $ti = new ilTextInputGUI($lng->txt("title"), "title");
1394  $ti->setMaxLength(128);
1395  $ti->setRequired(true);
1396  $this->form->addItem($ti);
1397 
1398  // save and cancel commands
1399  if ($a_mode == "create") {
1400  $this->form->addCommandButton("saveMediaPoolPage", $lng->txt("save"));
1401  $this->form->addCommandButton("cancelSave", $lng->txt("cancel"));
1402  $this->form->setTitle($lng->txt("mep_new_content_snippet"));
1403  } else {
1404  $this->form->addCommandButton("updateMediaPoolPage", $lng->txt("save"));
1405  $this->form->setTitle($lng->txt("mep_edit_content_snippet"));
1406  }
1407 
1408  $this->form->setFormAction($ilCtrl->getFormAction($this));
1409  }
1410 
1414  public function getMediaPoolPageValues()
1415  {
1416  $values = array();
1417 
1418  include_once("./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
1419  $values["title"] = ilMediaPoolItem::lookupTitle($_GET["mepitem_id"]);
1420 
1421  $this->form->setValuesByArray($values);
1422  }
1423 
1430  public function setMediaPoolPageTabs()
1431  {
1432  $ilTabs = $this->tabs;
1433  $ilCtrl = $this->ctrl;
1434  $lng = $this->lng;
1435 
1436  $ilTabs->addTarget(
1437  "cont_usage",
1438  $ilCtrl->getLinkTarget($this, "showMediaPoolPageUsages"),
1439  array("showMediaPoolPageUsages", "showAllMediaPoolPageUsages"),
1440  get_class($this)
1441  );
1442  $ilTabs->addTarget(
1443  "settings",
1444  $ilCtrl->getLinkTarget($this, "editMediaPoolPage"),
1445  "editMediaPoolPage",
1446  get_class($this)
1447  );
1448  $ilCtrl->setParameter($this, "mepitem_id", $this->object->getPoolTree()->getParentId($_GET["mepitem_id"]));
1449  $ilTabs->setBackTarget($lng->txt("mep_folder"), $ilCtrl->getLinkTarget($this, "listMedia"));
1450  $ilCtrl->setParameter($this, "mepitem_id", $_GET["mepitem_id"]);
1451  }
1452 
1456  public function showAllMediaPoolPageUsages()
1457  {
1458  $this->showMediaPoolPageUsages(true);
1459  }
1460 
1461 
1465  public function showMediaPoolPageUsages($a_all = false)
1466  {
1467  $ilTabs = $this->tabs;
1468  $ilCtrl = $this->ctrl;
1469  $lng = $this->lng;
1470  $tpl = $this->tpl;
1471 
1472  $this->checkPermission("write");
1473 
1474  $ilTabs->clearTargets();
1475 
1476  $ilTabs->addSubTab(
1477  "current_usages",
1478  $lng->txt("cont_current_usages"),
1479  $ilCtrl->getLinkTarget($this, "showMediaPoolPageUsages")
1480  );
1481 
1482  $ilTabs->addSubTab(
1483  "all_usages",
1484  $lng->txt("cont_all_usages"),
1485  $ilCtrl->getLinkTarget($this, "showAllMediaPoolPageUsages")
1486  );
1487 
1488  if ($a_all) {
1489  $ilTabs->activateSubTab("all_usages");
1490  $cmd = "showAllMediaPoolPageUsages";
1491  } else {
1492  $ilTabs->activateSubTab("current_usages");
1493  $cmd = "showMediaPoolPageUsages";
1494  }
1495 
1496 
1497  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPageGUI.php");
1498  $mep_page_gui = new ilMediaPoolPageGUI($_GET["mepitem_id"], $_GET["old_nr"]);
1499  $mep_page_gui->getTabs();
1500 
1501  $this->setMediaPoolPageTabs();
1502 
1503  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
1504  $page = new ilMediaPoolPage((int) $_GET["mepitem_id"]);
1505 
1506  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPageUsagesTableGUI.php");
1507  $table = new ilMediaPoolPageUsagesTableGUI($this, $cmd, $page, $a_all);
1508 
1509  $tpl->setContent($table->getHTML());
1510  }
1511 
1512 
1516 
1522  public function setContentSubTabs($a_active)
1523  {
1524  $ilAccess = $this->access;
1525  $ilTabs = $this->tabs;
1526  $ilCtrl = $this->ctrl;
1527 
1528  $ilTabs->addSubTab("content", $this->lng->txt("objs_fold"), $this->ctrl->getLinkTarget($this, ""));
1529 
1530  $ilCtrl->setParameter($this, "mepitem_id", "");
1531  $ilTabs->addSubTab("mep_all_mobs", $this->lng->txt("mep_all_mobs"), $this->ctrl->getLinkTarget($this, "allMedia"));
1532  $ilCtrl->setParameter($this, "mepitem_id", $_GET["mepitem_id"]);
1533 
1534  if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
1535  $ilTabs->addSubtab(
1536  "srt_files",
1537  $this->lng->txt("mep_media_subtitles"),
1538  $ilCtrl->getLinkTargetByClass("ilmobmultisrtuploadgui", "")
1539  );
1540  }
1541 
1542  $ilTabs->activateSubTab($a_active);
1543  }
1544 
1545 
1549  public function setTabs()
1550  {
1551  $ilAccess = $this->access;
1552  $ilTabs = $this->tabs;
1553  $ilCtrl = $this->ctrl;
1554  $ilHelp = $this->help;
1555 
1556  $ilHelp->setScreenIdComponent("mep");
1557 
1558  if ($ilAccess->checkAccess('read', '', $this->ref_id) ||
1559  $ilAccess->checkAccess('write', '', $this->ref_id)) {
1560  $ilTabs->addTab("content", $this->lng->txt("mep_content"), $this->ctrl->getLinkTarget($this, ""));
1561  }
1562 
1563  // info tab
1564  if ($ilAccess->checkAccess('visible', '', $this->ref_id) ||
1565  $ilAccess->checkAccess('read', '', $this->ref_id) ||
1566  $ilAccess->checkAccess('write', '', $this->ref_id)) {
1567  $force_active = ($this->ctrl->getNextClass() == "ilinfoscreengui"
1568  || strtolower($_GET["cmdClass"]) == "ilnotegui")
1569  ? true
1570  : false;
1571  $ilTabs->addTarget(
1572  "info_short",
1573  $this->ctrl->getLinkTargetByClass(
1574  array("ilobjmediapoolgui", "ilinfoscreengui"),
1575  "showSummary"
1576  ),
1577  array("showSummary", "infoScreen"),
1578  "",
1579  "",
1580  $force_active
1581  );
1582  }
1583 
1584  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
1585  $ilTabs->addTarget(
1586  "settings",
1587  $this->ctrl->getLinkTarget($this, "edit"),
1588  "edit",
1589  array("", "ilobjmediapoolgui")
1590  );
1591  }
1592 
1593  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
1594  $ilTabs->addTarget(
1595  "clipboard",
1596  $this->ctrl->getLinkTarget($this, "openClipboard"),
1597  "view",
1598  "ileditclipboardgui"
1599  );
1600  }
1601 
1602  // properties
1603  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
1604  // meta data
1605  include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
1606  $mdgui = new ilObjectMetaDataGUI($this->object, "mob");
1607  $mdtab = $mdgui->getTab();
1608  if ($mdtab) {
1609  $ilTabs->addTarget(
1610  "meta_data",
1611  $mdtab,
1612  "",
1613  "ilobjectmetadatagui"
1614  );
1615  }
1616  }
1617 
1618  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
1619  $ilTabs->addTarget(
1620  "export",
1621  $this->ctrl->getLinkTargetByClass("ilexportgui", ""),
1622  "",
1623  "ilexportgui"
1624  );
1625 
1626  $ilTabs->addTarget(
1627  "import",
1628  $this->ctrl->getLinkTargetByClass("ilmediapoolimportgui", ""),
1629  "",
1630  "ilmediapoolimportgui"
1631  );
1632  }
1633 
1634  if ($ilAccess->checkAccess("edit_permission", "", $this->object->getRefId())) {
1635  $ilTabs->addTarget(
1636  "perm_settings",
1637  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
1638  array("perm","info","owner"),
1639  'ilpermissiongui'
1640  );
1641  }
1642  }
1643 
1650  public function setSettingsSubTabs($a_active)
1651  {
1652  $ilTabs = $this->tabs;
1653  $lng = $this->lng;
1654  $ilAccess = $this->access;
1655 
1656  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
1657  $ilTabs->addSubTab(
1658  "settings",
1659  $lng->txt("settings"),
1660  $this->ctrl->getLinkTarget($this, "edit")
1661  );
1662 
1663  $mset = new ilSetting("mobs");
1664  if ($mset->get("mep_activate_pages")) {
1665  $ilTabs->addSubTabTarget(
1666  "obj_multilinguality",
1667  $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", "")
1668  );
1669  }
1670  }
1671 
1672  $ilTabs->setSubTabActive($a_active);
1673  }
1674 
1675 
1679  public static function _goto($a_target)
1680  {
1681  global $DIC;
1682 
1683  $ilAccess = $DIC->access();
1684  $ilErr = $DIC["ilErr"];
1685  $lng = $DIC->language();
1686 
1687  $targets = explode('_', $a_target);
1688  if (count((array) $targets) > 1) {
1689  $ref_id = $targets[0];
1690  $subitem_id = $targets[1];
1691  } else {
1692  $ref_id = $targets[0];
1693  }
1694 
1695  if ($ilAccess->checkAccess("read", "", $ref_id)) {
1696  $_GET["baseClass"] = "ilMediaPoolPresentationGUI";
1697  $_GET["ref_id"] = $ref_id;
1698  $_GET['mepitem_id'] = $subitem_id;
1699  include("ilias.php");
1700  exit;
1701  } elseif ($ilAccess->checkAccess("visible", "", $ref_id)) {
1702  $_GET["baseClass"] = "ilMediaPoolPresentationGUI";
1703  $_GET["ref_id"] = $ref_id;
1704  $_GET["cmd"] = "infoScreen";
1705  include("ilias.php");
1706  exit;
1707  } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1708  ilUtil::sendFailure(sprintf(
1709  $lng->txt("msg_no_perm_read_item"),
1711  ), true);
1713  }
1714 
1715  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1716  }
1717 
1723  public function infoScreenObject()
1724  {
1725  $this->ctrl->setCmd("showSummary");
1726  $this->ctrl->setCmdClass("ilinfoscreengui");
1727  $this->infoScreen();
1728  }
1729 
1733  public function infoScreen()
1734  {
1735  $this->tabs->activateTab("info_short");
1736  $ilAccess = $this->access;
1737  $ilErr = $this->error;
1738 
1739  if (!$ilAccess->checkAccess("visible", "", $this->ref_id) &&
1740  !$ilAccess->checkAccess("read", "", $this->ref_id) &&
1741  !$ilAccess->checkAccess("write", "", $this->ref_id)) {
1742  $ilErr->raiseError($this->lng->txt("msg_no_perm_read"), $ilErr->MESSAGE);
1743  }
1744 
1745  if ($this->ctrl->getCmd() == "infoScreen") {
1746  $this->ctrl->setCmd("showSummary");
1747  $this->ctrl->setCmdClass("ilinfoscreengui");
1748  }
1749 
1750  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1751  $info = new ilInfoScreenGUI($this);
1752 
1753  $info->enablePrivateNotes();
1754 
1755 
1756  // standard meta data
1757  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
1758 
1759  // forward the command
1760  $this->ctrl->forwardCommand($info);
1761  }
1762 
1763 
1767 
1771  public function selectUploadDirFiles($a_files = null)
1772  {
1773  $tpl = $this->tpl;
1774  $ilTabs = $this->tabs;
1775  $lng = $this->lng;
1776  $ilCtrl = $this->ctrl;
1777  $ilToolbar = $this->toolbar;
1778 
1779  if (!$a_files) {
1780  $a_files = $_POST["file"];
1781  }
1782 
1783  $ilTabs->clearTargets();
1784  $ilTabs->setBackTarget(
1785  $lng->txt("back"),
1786  $ilCtrl->getLinkTarget($this, "listMedia")
1787  );
1788 
1789  $this->checkPermission("write");
1790 
1792 
1793  // action type
1794  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
1795  $options = array(
1796  "rename" => $lng->txt("mep_up_dir_move"),
1797  "copy" => $lng->txt("mep_up_dir_copy"),
1798  );
1799  $si = new ilSelectInputGUI("", "action");
1800  $si->setOptions($options);
1801  $ilToolbar->addInputItem($si);
1802  $ilToolbar->setCloseFormTag(false);
1803  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
1804  $ilToolbar->setFormName("mep_up_form");
1805 
1806  include_once("./Modules/MediaPool/classes/class.ilUploadDirFilesTableGUI.php");
1808  $this,
1809  "selectUploadDirFiles",
1810  $a_files
1811  );
1812  $tab->setFormName("mep_up_form");
1813  $tpl->setContent($tab->getHTML());
1814  }
1815  }
1816 
1820  public function createMediaFromUploadDir()
1821  {
1822  $this->checkPermission("write");
1823 
1824  $mset = new ilSetting("mobs");
1825  $upload_dir = trim($mset->get("upload_dir"));
1826 
1827  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1828 
1829  if (is_array($_POST["file"]) && ilMainMenuGUI::_checkAdministrationPermission()) {
1830  foreach ($_POST["file"] as $f) {
1831  $f = str_replace("..", "", $f);
1832  $fullpath = $upload_dir . "/" . $f;
1833  $mob = new ilObjMediaObject();
1834  $mob->setTitle(basename($fullpath));
1835  $mob->setDescription("");
1836  $mob->create();
1837 
1838  // determine and create mob directory, move uploaded file to directory
1839  //$mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$a_mob->getId();
1840  $mob->createDirectory();
1841  $mob_dir = ilObjMediaObject::_getDirectory($mob->getId());
1842 
1843  $media_item = new ilMediaItem();
1844  $mob->addMediaItem($media_item);
1845  $media_item->setPurpose("Standard");
1846 
1847  $file = $mob_dir . "/" . basename($fullpath);
1848 
1849  // virus handling
1850  $vir = ilUtil::virusHandling($fullpath, basename($fullpath));
1851  if (!$vir[0]) {
1852  ilUtil::sendFailure($this->lng->txt("file_is_infected") . "<br />" . $vir[1], true);
1853  ilUtil::redirect("ilias.php?baseClass=ilMediaPoolPresentationGUI&cmd=listMedia&ref_id=" .
1854  $_GET["ref_id"] . "&mepitem_id=" . $_GET["mepitem_id"]);
1855  }
1856 
1857  switch ($_POST["action"]) {
1858  case "rename":
1859  rename($fullpath, $file);
1860  break;
1861 
1862  case "copy":
1863  copy($fullpath, $file);
1864  break;
1865  }
1866 
1867  // get mime type
1869  $location = basename($fullpath);
1870 
1871  // set real meta and object data
1872  $media_item->setFormat($format);
1873  $media_item->setLocation($location);
1874  $media_item->setLocationType("LocalFile");
1875 
1876  $mob->setDescription($format);
1877 
1878  // determine width and height of known image types
1880  $format,
1881  "File",
1882  $mob_dir . "/" . $location,
1883  $media_item->getLocation(),
1884  true,
1885  true,
1886  "",
1887  ""
1888  );
1889  $media_item->setWidth($wh["width"]);
1890  $media_item->setHeight($wh["height"]);
1891  if ($wh["info"] != "") {
1892  // ilUtil::sendInfo($wh["info"], true);
1893  }
1894 
1895  $media_item->setHAlign("Left");
1896  ilUtil::renameExecutables($mob_dir);
1897  $mob->update();
1898 
1899 
1900  // put it into current folder
1901  $mep_item = new ilMediaPoolItem();
1902  $mep_item->setTitle($mob->getTitle());
1903  $mep_item->setType("mob");
1904  $mep_item->setForeignId($mob->getId());
1905  $mep_item->create();
1906 
1907  $tree = $this->object->getTree();
1908  $parent = ($_GET["mepitem_id"] == "")
1909  ? $tree->getRootId()
1910  : $_GET["mepitem_id"];
1911  $tree->insertNode($mep_item->getId(), $parent);
1912  }
1913  }
1914  ilUtil::redirect("ilias.php?baseClass=ilMediaPoolPresentationGUI&cmd=listMedia&ref_id=" .
1915  $_GET["ref_id"] . "&mepitem_id=" . $_GET["mepitem_id"]);
1916  }
1917 
1921  public static function getPreviewModalHTML($a_mpool_ref_id, $a_tpl)
1922  {
1923  global $DIC;
1924 
1925  $tpl = $DIC["tpl"];
1926  $ilCtrl = $DIC->ctrl();
1927  $lng = $DIC->language();
1928 
1929  require_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1931 
1932  $tpl->addJavaScript("./Modules/MediaPool/js/ilMediaPool.js");
1933 
1934  $ilCtrl->setParameterByClass("ilobjmediapoolgui", "mepitem_id", "");
1935  $ilCtrl->setParameterByClass("ilobjmediapoolgui", "ref_id", $a_mpool_ref_id);
1936  $tpl->addOnloadCode("il.MediaPool.setPreviewUrl('" . $ilCtrl->getLinkTargetByClass(array("ilmediapoolpresentationgui", "ilobjmediapoolgui"), "showPreview", "", false, false) . "');");
1937  $ilCtrl->setParameterByClass("ilobjmediapoolgui", "mepitem_id", $_GET["mepitem_id"]);
1938  $ilCtrl->setParameterByClass("ilobjmediapoolgui", "ref_id", $_GET["red_id"]);
1939 
1940  include_once("./Services/UIComponent/Modal/classes/class.ilModalGUI.php");
1941  $modal = ilModalGUI::getInstance();
1942  $modal->setHeading($lng->txt("preview"));
1943  $modal->setId("ilMepPreview");
1944  $modal->setType(ilModalGUI::TYPE_LARGE);
1945  $modal->setBody("<iframe id='ilMepPreviewContent'></iframe>");
1946 
1947  return $modal->getHTML();
1948  }
1949 
1953  public function export()
1954  {
1955  $ot = ilObjectTranslation::getInstance($this->object->getId());
1956  $opt = "";
1957  if ($ot->getContentActivated()) {
1958  $format = explode("_", $_POST["format"]);
1959  $opt = ilUtil::stripSlashes($format[1]);
1960  }
1961 
1962  $this->object->exportXML($opt);
1963  }
1964 
1965  //
1966  // BULK UPLOAD
1967  //
1968 
1972  protected function bulkUpload()
1973  {
1974  $this->checkPermission("write");
1975 
1977 
1978  $form = $this->initBulkUploadForm();
1979  $main_tpl->setContent($form->getHTML());
1980  }
1981 
1985  public function initBulkUploadForm()
1986  {
1987  $ctrl = $this->ctrl;
1988  $lng = $this->lng;
1989 
1990  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1991  $form = new ilPropertyFormGUI();
1992 
1993  $form->setFormAction($ctrl->getFormAction($this));
1994  $form->setPreventDoubleSubmission(false);
1995 
1996  $item = new ilFileStandardDropzoneInputGUI(
1997  'cancel',
1998  $lng->txt("mep_media_files"),
1999  'media_files'
2000  );
2001  $item->setUploadUrl($ctrl->getLinkTarget($this, "performBulkUpload", "", true, true));
2002  $item->setMaxFiles(20);
2003  $form->addItem($item);
2004 
2005  $form->addCommandButton("performBulkUpload", $lng->txt("upload"));
2006 
2007  $form->setTitle($lng->txt("mep_bulk_upload"));
2008 
2009  return $form;
2010  }
2011 
2015  public function performBulkUpload()
2016  {
2017  $this->checkPermission("write");
2018 
2019  $ctrl = $this->ctrl;
2020  $lng = $this->lng;
2023  $log = $this->mep_log;
2024 
2025  $form = $this->initBulkUploadForm();
2026  if ($form->checkInput()) {
2027  $mep_item_ids = [];
2028  // Check if this is a request to upload a file
2029  $log->debug("checking for uploads...");
2030  if ($upload->hasUploads()) {
2031  $log->debug("has upload...");
2032  try {
2033  $upload->process();
2034  $log->debug("nr of results: " . count($upload->getResults()));
2035  foreach ($upload->getResults() as $result) {
2036  $title = $result->getName();
2037 
2038  $mob = new ilObjMediaObject();
2039  $mob->setTitle($title);
2040  $mob->setDescription("");
2041  $mob->create();
2042 
2043  $mob->createDirectory();
2044  $media_item = new ilMediaItem();
2045  $mob->addMediaItem($media_item);
2046  $media_item->setPurpose("Standard");
2047 
2048  $mob_dir = ilObjMediaObject::_getRelativeDirectory($mob->getId());
2049  $file_name = ilObjMediaObject::fixFilename($title);
2050  $file = $mob_dir . "/" . $file_name;
2051 
2052  $upload->moveOneFileTo(
2053  $result,
2054  $mob_dir,
2055  Location::WEB,
2056  $file_name,
2057  true
2058  );
2059 
2060  $mep_item = new ilMediaPoolItem();
2061  $mep_item->setTitle($title);
2062  $mep_item->setType("mob");
2063  $mep_item->setForeignId($mob->getId());
2064  $mep_item->create();
2065 
2066  $tree = $this->object->getTree();
2067  $parent = ($_GET["mepitem_id"] == "")
2068  ? $tree->getRootId()
2069  : $_GET["mepitem_id"];
2070  $tree->insertNode($mep_item->getId(), $parent);
2071 
2072  // get mime type
2074  $location = $file_name;
2075 
2076  // set real meta and object data
2077  $media_item->setFormat($format);
2078  $media_item->setLocation($location);
2079  $media_item->setLocationType("LocalFile");
2080  $media_item->setUploadHash(ilUtil::stripSlashes($_POST["ilfilehash"]));
2081  $mob->update();
2082  $mep_item_ids[] = $mob->getId();
2083  }
2084  } catch (Exception $e) {
2085  $log->debug("Got exception: " . $e->getMessage());
2086  echo json_encode(array( 'success' => false, 'message' => $e->getMessage()));
2087  }
2088  $log->debug("end of 'has_uploads'");
2089  }
2090  $log->debug("has no upload...");
2091 
2092  $log->debug("calling redirect... (" . $_POST["ilfilehash"] . ")");
2093  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
2094  $ctrl->setParameter($this, "mep_hash", $_POST["ilfilehash"]);
2095  $ctrl->redirect($this, "editTitlesAndDescriptions");
2096  }
2097 
2098  $form->setValuesByPost();
2099  $main_tpl->setContent($form->getHtml());
2100  }
2101 
2105  protected function editTitlesAndDescriptions()
2106  {
2107  $ctrl = $this->ctrl;
2108  $lng = $this->lng;
2109 
2110  $this->checkPermission("write");
2111  $ctrl->saveParameter($this, "mep_hash");
2112 
2114 
2115  include_once("./Services/MediaObjects/classes/class.ilMediaItem.php");
2116  $media_items = ilMediaItem::getMediaItemsForUploadHash($_GET["mep_hash"]);
2117 
2118  include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
2119 
2120  $tb = new ilToolbarGUI();
2121  $tb->setFormAction($ctrl->getFormAction($this));
2122  $tb->addFormButton($lng->txt("save"), "saveTitlesAndDescriptions");
2123  $tb->setOpenFormTag(true);
2124  $tb->setCloseFormTag(false);
2125  $tb->setId("tb_top");
2126 
2127  $html = $tb->getHTML();
2128  foreach ($media_items as $mi) {
2129  $acc = new ilAccordionGUI();
2130  $acc->setBehaviour(ilAccordionGUI::ALL_CLOSED);
2131  $acc->setId("acc_" . $mi["mob_id"]);
2132 
2133  $mob = new ilObjMediaObject($mi["mob_id"]);
2134  $form = $this->initMediaBulkForm($mi["mob_id"], $mob->getTitle());
2135  $acc->addItem($mob->getTitle(), $form->getHTML());
2136 
2137  $html .= $acc->getHTML();
2138  }
2139 
2140  $html .= $tb->getHTML();
2141  $tb->setOpenFormTag(false);
2142  $tb->setCloseFormTag(true);
2143  $tb->setId("tb_bottom");
2144 
2145  $main_tpl->setContent($html);
2146  }
2147 
2151  public function initMediaBulkForm($a_id, $a_title)
2152  {
2153  $lng = $this->lng;
2154 
2155  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
2156  $form = new ilPropertyFormGUI();
2157  $form->setOpenTag(false);
2158  $form->setCloseTag(false);
2159 
2160  // title
2161  $ti = new ilTextInputGUI($lng->txt("title"), "title_" . $a_id);
2162  $ti->setValue($a_title);
2163  $form->addItem($ti);
2164 
2165  // description
2166  $ti = new ilTextAreaInputGUI($lng->txt("description"), "description_" . $a_id);
2167  $form->addItem($ti);
2168 
2169  return $form;
2170  }
2171 
2175  protected function saveTitlesAndDescriptions()
2176  {
2177  $lng = $this->lng;
2178  $ctrl = $this->ctrl;
2179 
2180  $this->checkPermission("write");
2181  //var_dump(_$POST); exit;
2182 
2183  $media_items = ilMediaItem::getMediaItemsForUploadHash($_GET["mep_hash"]);
2184  include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
2185 
2186  foreach ($media_items as $mi) {
2187  $mob = new ilObjMediaObject($mi["mob_id"]);
2188  $form = $this->initMediaBulkForm($mi["mob_id"], $mob->getTitle());
2189  $form->checkInput();
2190  $title = $form->getInput("title_" . $mi["mob_id"]);
2191  $desc = $form->getInput("description_" . $mi["mob_id"]);
2192  if (trim($title) != "") {
2193  $mob->setTitle($title);
2194  }
2195  $mob->setDescription($desc);
2196  $mob->update();
2197  }
2198  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
2199  $ctrl->redirect($this, "listMedia");
2200  }
2201 }
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.
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
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.
global $ilCtrl
Definition: ilias.php:18
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.
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.
cancelRemove()
cancel deletion of media objects/folders
Class ilMediaItem.
listMedia()
list media objects
$format
Definition: metadata.php:218
$ilUser
Definition: imgupload.php:18
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.
$DIC
Definition: xapitoken.php:46
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.
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.