ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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->show();
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->show();
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->show();
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->show();
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->show();
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->show();
309  break;
310 
311  case 'ilinfoscreengui':
312  $this->prepareOutput();
313  $this->addHeaderAction();
314  $this->infoScreen();
315  $this->tpl->show();
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->show();
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->show();
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->show();
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->show();
392  break;
393 
394  case "ilmediapoolimportgui":
395  $this->prepareOutput();
396  $this->addHeaderAction();
397  $ilTabs->activateTab("import");
398  include_once("./Modules/MediaPool/classes/class.ilMediaPoolImportGUI.php");
399  $gui = new ilMediaPoolImportGUI($this->object);
400  $this->ctrl->forwardCommand($gui);
401  $this->tpl->show();
402  break;
403 
404  case "ilmobmultisrtuploadgui":
405  $this->checkPermission("write");
406  $this->prepareOutput();
407  $this->addHeaderAction();
408  //$this->setTabs("content");
409  $this->setContentSubTabs("srt_files");
410  include_once("./Services/MediaObjects/classes/class.ilMobMultiSrtUploadGUI.php");
411  include_once("./Modules/MediaPool/classes/class.ilMepMultiSrt.php");
412  $gui = new ilMobMultiSrtUploadGUI(new ilMepMultiSrt($this->object));
413  $this->ctrl->forwardCommand($gui);
414  $this->tpl->show();
415  break;
416 
417 
418  default:
419  $this->prepareOutput();
420  $this->addHeaderAction();
421  $cmd = $this->ctrl->getCmd("listMedia");
422  $this->$cmd();
423  if (!$this->getCreationMode()) {
424  $this->tpl->show();
425  }
426  break;
427  }
428  }
429 
433  public function createMediaObject()
434  {
435  $this->ctrl->redirectByClass("ilobjmediaobjectgui", "create");
436  }
437 
438  protected function initCreationForms($a_new_type)
439  {
440  $forms = array(self::CFORM_NEW => $this->initCreateForm($a_new_type),
441  self::CFORM_IMPORT => $this->initImportForm($a_new_type));
442 
443  return $forms;
444  }
445 
449  public function afterSave(ilObject $newObj)
450  {
451  // always send a message
452  ilUtil::sendSuccess($this->lng->txt("object_added"), true);
453 
454  //ilUtil::redirect($this->getReturnLocation("save","adm_object.php?".$this->link_params));
455  ilUtil::redirect("ilias.php?baseClass=ilMediaPoolPresentationGUI&ref_id=" . $newObj->getRefId() . "&cmd=listMedia");
456  }
457 
458  protected function initEditCustomForm(ilPropertyFormGUI $a_form)
459  {
460  $obj_service = $this->object_service;
461 
462  // default width
463  $ni = new ilNumberInputGUI($this->lng->txt("mep_default_width"), "default_width");
464  $ni->setMinValue(0);
465  $ni->setSuffix("px");
466  $ni->setMaxLength(5);
467  $ni->setSize(5);
468  $a_form->addItem($ni);
469 
470  // default height
471  $ni = new ilNumberInputGUI($this->lng->txt("mep_default_height"), "default_height");
472  $ni->setSuffix("px");
473  $ni->setMinValue(0);
474  $ni->setMaxLength(5);
475  $ni->setSize(5);
476  $ni->setInfo($this->lng->txt("mep_default_width_height_info"));
477  $a_form->addItem($ni);
478 
479  // presentation
480  $pres = new ilFormSectionHeaderGUI();
481  $pres->setTitle($this->lng->txt('obj_presentation'));
482  $a_form->addItem($pres);
483 
484  // tile image
485  $obj_service->commonSettings()->legacyForm($a_form, $this->object)->addTileImage();
486 
487  // additional features
488  $feat = new ilFormSectionHeaderGUI();
489  $feat->setTitle($this->lng->txt('obj_features'));
490  $a_form->addItem($feat);
491 
492  include_once './Services/Container/classes/class.ilContainer.php';
493  include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
495  $this->object->getId(),
496  $a_form,
497  array(
499  )
500  );
501  }
502 
508  public function edit()
509  {
510  $tpl = $this->tpl;
511  $ilTabs = $this->tabs_gui;
513 
514  $this->setSettingsSubTabs("settings");
515 
516  if (!$this->checkPermissionBool("write")) {
517  $ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $ilErr->MESSAGE);
518  }
519 
520  $ilTabs->activateTab("settings");
521 
522  $form = $this->initEditForm();
523  $values = $this->getEditFormValues();
524  if ($values) {
525  $form->setValuesByArray($values, true);
526  }
527 
529 
530  $tpl->setContent($form->getHTML());
531  }
532 
533 
534  protected function getEditFormCustomValues(array &$a_values)
535  {
536  if ($this->object->getDefaultWidth() > 0) {
537  $a_values["default_width"] = $this->object->getDefaultWidth();
538  }
539  if ($this->object->getDefaultHeight() > 0) {
540  $a_values["default_height"] = $this->object->getDefaultHeight();
541  }
542  }
543 
544  protected function updateCustom(ilPropertyFormGUI $a_form)
545  {
546  $obj_service = $this->object_service;
547 
548  $this->object->setDefaultWidth($a_form->getInput("default_width"));
549  $this->object->setDefaultHeight($a_form->getInput("default_height"));
550 
551 
552  // additional features
553  include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
555  $this->object->getId(),
556  $a_form,
557  array(
559  )
560  );
561 
562  // tile image
563  $obj_service->commonSettings()->legacyForm($a_form, $this->object)->saveTileImage();
564  }
565 
569  public function listMedia()
570  {
571  $ilAccess = $this->access;
572  $tpl = $this->tpl;
573  $ilTabs = $this->tabs;
575  $ilToolbar = $this->toolbar;
576  $lng = $this->lng;
577 
578  $ilCtrl->setParameter($this, "mep_mode", "listMedia");
579 
580  $this->checkPermission("read");
581 
582  $ilTabs->setTabActive("content");
583  $this->setContentSubTabs("content");
584 
585  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
586  $ilToolbar->addButton(
587  $lng->txt("mep_create_mob"),
588  $ilCtrl->getLinkTarget($this, "createMediaObject")
589  );
590 
591  $mset = new ilSetting("mobs");
592  if ($mset->get("mep_activate_pages")) {
593  $ilToolbar->addButton(
594  $lng->txt("mep_create_content_snippet"),
595  $ilCtrl->getLinkTarget($this, "createMediaPoolPage")
596  );
597  }
598 
599  $ilToolbar->addButton(
600  $lng->txt("mep_create_folder"),
601  $ilCtrl->getLinkTarget($this, "createFolderForm")
602  );
603 
604  if (trim($mset->get("upload_dir")) != "" && ilMainMenuGUI::_checkAdministrationPermission()) {
605  $ilToolbar->addButton(
606  $lng->txt("mep_create_from_upload_dir"),
607  $ilCtrl->getLinkTargetByClass("ilfilesystemgui", "listFiles")
608  );
609  }
610 
611  $ilToolbar->addButton(
612  $lng->txt("mep_bulk_upload"),
613  $ilCtrl->getLinkTarget($this, "bulkUpload")
614  );
615  }
616 
617  // tree
618  include_once("./Modules/MediaPool/classes/class.ilMediaPoolExplorerGUI.php");
619  $exp = new ilMediaPoolExplorerGUI($this, "listMedia", $this->object);
620  if (!$exp->handleCommand()) {
621  $this->tpl->setLeftNavContent($exp->getHTML());
622  } else {
623  return;
624  }
625 
626  include_once("./Modules/MediaPool/classes/class.ilMediaPoolTableGUI.php");
627  $mep_table_gui = new ilMediaPoolTableGUI($this, "listMedia", $this->object, "mepitem_id");
628  $tpl->setContent($mep_table_gui->getHTML());
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->getStandardTemplate();
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 ilTemplate("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 ilTemplate("tpl.main.html", true, true);
819 
820  include_once("./Services/Container/classes/class.ilContainerPage.php");
821  include_once("./Services/Container/classes/class.ilContainerPageGUI.php");
822 
823  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
824  $tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
825  $tpl->setVariable(
826  "LOCATION_CONTENT_STYLESHEET",
828  );
829  $tpl->setCurrentBlock("SyntaxStyle");
830  $tpl->setVariable(
831  "LOCATION_SYNTAX_STYLESHEET",
833  );
834  $tpl->parseCurrentBlock();
835 
836  // get page object
837  //include_once("./Services/Object/classes/class.ilObjectTranslation.php");
838  //$ot = ilObjectTranslation::getInstance($this->object->getId());
839  //$lang = $ot->getEffectiveContentLang($ilUser->getCurrentLanguage(), "cont");
840  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPageGUI.php");
841  $page_gui = new ilMediaPoolPageGUI((int) $_GET["mepitem_id"]);
842  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
843  //$page_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
844  // $this->object->getStyleSheetId(), $this->object->getType()));
845 
846  $page_gui->setTemplateOutput(false);
847  $page_gui->setHeader("");
848  $ret = $page_gui->showPage(true);
849 
850  $tpl->setBodyClass("ilMediaPoolPagePreviewBody");
851  $tpl->setVariable("CONTENT", $ret);
852  //$ret = "<div style='background-color: white; padding:5px; margin-bottom: 30px;'>".$ret."</div>";
853 
854 
855  $tpl->show();
856  exit;
857  }
858 
859 
863  public function showPreview()
864  {
865  $this->checkPermission("read");
866 
867  $item = new ilMediaPoolItem((int) $_GET["mepitem_id"]);
868 
869  switch ($item->getType()) {
870  case "mob":
871  $this->showMedia();
872  break;
873 
874  case "pg":
875  $this->showPage();
876  break;
877  }
878  }
879 
880 
884  public function showFullscreen()
885  {
886  $this->showMedia();
887  }
888 
892  public function confirmRemove()
893  {
895  $lng = $this->lng;
897 
898  $this->checkPermission("write");
899 
900  if (!isset($_POST["id"])) {
901  $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
902  }
903 
904  // display confirmation message
905  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
906  $cgui = new ilConfirmationGUI();
907  $cgui->setFormAction($this->ctrl->getFormAction($this));
908  $cgui->setHeaderText($this->lng->txt("info_remove_sure"));
909  $cgui->setCancel($this->lng->txt("cancel"), "cancelRemove");
910  $cgui->setConfirm($this->lng->txt("confirm"), "remove");
911 
912  foreach ($_POST["id"] as $obj_id) {
915 
916  // check whether page can be removed
917  $add = "";
918  if ($type == "pg") {
919  include_once("./Services/COPage/classes/class.ilPageContentUsage.php");
920  $usages = ilPageContentUsage::getUsages("incl", $obj_id, false);
921  if (count($usages) > 0) {
922  ilUtil::sendFailure(sprintf($lng->txt("mep_content_snippet_in_use"), $title), true);
923  $ilCtrl->redirect($this, "listMedia");
924  } else {
925  // check whether the snippet is used in older versions of pages
926  $usages = ilPageContentUsage::getUsages("incl", $obj_id, true);
927  if (count($usages) > 0) {
928  $add = "<div class='small'>" . $lng->txt("mep_content_snippet_used_in_older_versions") . "</div>";
929  }
930  }
931  }
932 
933  $caption = ilUtil::getImageTagByType($type, $this->tpl->tplPath) .
934  " " . $title . $add;
935 
936  $cgui->addItem("id[]", $obj_id, $caption);
937  }
938 
939  $this->tpl->setContent($cgui->getHTML());
940  }
941 
945  public function openClipboard()
946  {
948  $ilAccess = $this->access;
949 
950  $this->checkPermission("write");
951 
952  $ilCtrl->setParameterByClass(
953  "ileditclipboardgui",
954  "returnCommand",
955  rawurlencode($ilCtrl->getLinkTarget(
956  $this,
957  "insertFromClipboard",
958  "",
959  false,
960  false
961  ))
962  );
963  $ilCtrl->redirectByClass("ilEditClipboardGUI", "getObject");
964  }
965 
966 
970  public function insertFromClipboard()
971  {
972  $ilAccess = $this->access;
973 
974  $this->checkPermission("write");
975 
976  include_once("./Services/Clipboard/classes/class.ilEditClipboardGUI.php");
978  $not_inserted = array();
979  if (is_array($ids)) {
980  foreach ($ids as $id2) {
981  $id = explode(":", $id2);
982  $type = $id[0];
983  $id = $id[1];
984 
985  if ($type == "mob") { // media object
986  if (ilObjMEdiaPool::isForeignIdInTree($this->object->getId(), $id)) {
987  $not_inserted[] = ilObject::_lookupTitle($id) . " [" .
988  $id . "]";
989  } else {
990  $item = new ilMediaPoolItem();
991  $item->setType("mob");
992  $item->setForeignId($id);
993  $item->setTitle(ilObject::_lookupTitle($id));
994  $item->create();
995  if ($item->getId() > 0) {
996  $this->object->insertInTree($item->getId(), $_GET["mepitem_id"]);
997  }
998  }
999  }
1000  if ($type == "incl") { // content snippet
1001  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
1002  include_once("./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
1003  if (ilObjMEdiaPool::isItemIdInTree($this->object->getId(), $id)) {
1004  $not_inserted[] = ilMediaPoolPage::lookupTitle($id) . " [" .
1005  $id . "]";
1006  } else {
1007  $original = new ilMediaPoolPage($id);
1008 
1009  // copy the page into the pool
1010  $item = new ilMediaPoolItem();
1011  $item->setType("pg");
1012  $item->setTitle(ilMediaPoolItem::lookupTitle($id));
1013  $item->create();
1014  if ($item->getId() > 0) {
1015  $this->object->insertInTree($item->getId(), $_GET["mepitem_id"]);
1016 
1017  // create page
1018  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
1019  $page = new ilMediaPoolPage();
1020  $page->setId($item->getId());
1021  $page->setParentId($this->object->getId());
1022  $page->create();
1023 
1024  // copy content
1025  $original->copy($page->getId(), $page->getParentType(), $page->getParentId(), true);
1026  }
1027  }
1028  }
1029  }
1030  }
1031  if (count($not_inserted) > 0) {
1032  ilUtil::sendInfo($this->lng->txt("mep_not_insert_already_exist") . "<br>" .
1033  implode($not_inserted, "<br>"), true);
1034  }
1035  $this->ctrl->redirect($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
1036  }
1037 
1038 
1042  public function cancelRemove()
1043  {
1044  $this->ctrl->redirect($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
1045  }
1046 
1050  public function remove()
1051  {
1052  $ilAccess = $this->access;
1053 
1054  $this->checkPermission("write");
1055 
1056  foreach ($_POST["id"] as $obj_id) {
1057  $this->object->deleteChild($obj_id);
1058  }
1059 
1060  ilUtil::sendSuccess($this->lng->txt("cont_obj_removed"), true);
1061  $this->ctrl->redirect($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
1062  }
1063 
1064 
1068  public function copyToClipboard()
1069  {
1070  $ilUser = $this->user;
1071  $ilAccess = $this->access;
1072 
1073  $this->checkPermission("write");
1074 
1075  if (!isset($_POST["id"])) {
1076  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1077  $this->ctrl->redirect($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
1078  }
1079 
1080  foreach ($_POST["id"] as $obj_id) {
1082  if ($type == "fold") {
1083  ilUtil::sendFailure($this->lng->txt("cont_cant_copy_folders"), true);
1084  $this->ctrl->redirect($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
1085  }
1086  }
1087  foreach ($_POST["id"] as $obj_id) {
1088  $fid = ilMediaPoolItem::lookupForeignId($obj_id);
1090  if ($type == "mob") {
1091  $ilUser->addObjectToClipboard($fid, "mob", "");
1092  }
1093  if ($type == "pg") {
1094  $ilUser->addObjectToClipboard($obj_id, "incl", "");
1095  }
1096  }
1097  ilUtil::sendSuccess($this->lng->txt("copied_to_clipboard"), true);
1098  $this->ctrl->redirect($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
1099  }
1100 
1104  public function addLocatorItems()
1105  {
1106  $ilLocator = $this->locator;
1107  $ilAccess = $this->access;
1108 
1109  if (!$this->getCreationMode() && $this->ctrl->getCmd() != "explorer") {
1110  $tree = $this->object->getTree();
1111  $obj_id = ($_GET["mepitem_id"] == "")
1112  ? $tree->getRootId()
1113  : $_GET["mepitem_id"];
1114  $path = $tree->getPathFull($obj_id);
1115  foreach ($path as $node) {
1116  if ($node["child"] == $tree->getRootId()) {
1117  $this->ctrl->setParameter($this, "mepitem_id", "");
1118  if ($ilAccess->checkAccess("read", "", $this->object->getRefId())) {
1119  $link = $this->ctrl->getLinkTarget($this, "listMedia");
1120  } elseif ($ilAccess->checkAccess("visible", "", $this->object->getRefId())) {
1121  $link = $this->ctrl->getLinkTarget($this, "infoScreen");
1122  }
1123  $title = $this->object->getTitle();
1124  $this->ctrl->setParameter($this, "mepitem_id", $_GET["mepitem_id"]);
1125  $ilLocator->addItem($title, $link, "", $_GET["ref_id"]);
1126  }
1127  }
1128  }
1129  }
1130 
1134 
1138  public function createFolderForm()
1139  {
1140  $ilAccess = $this->access;
1141  $tpl = $this->tpl;
1142 
1143  $this->checkPermission("write");
1144 
1145  $this->initFolderForm("create");
1146  $tpl->setContent($this->form->getHTML());
1147  }
1148 
1155  public function editFolder()
1156  {
1157  $tpl = $this->tpl;
1158 
1159  $this->checkPermission("write");
1160 
1161  $this->initFolderForm();
1162  $this->getFolderValues();
1163  $tpl->setContent($this->form->getHTML());
1164  }
1165 
1169  public function getFolderValues()
1170  {
1171  $values = array();
1172 
1173  $values["title"] = ilMediaPoolItem::lookupTitle($_GET["mepitem_id"]);
1174 
1175  $this->form->setValuesByArray($values);
1176  }
1177 
1181  public function saveFolder()
1182  {
1183  $tpl = $this->tpl;
1184  $lng = $this->lng;
1185  $ilCtrl = $this->ctrl;
1186 
1187  $this->checkPermission("write");
1188 
1189  $this->initFolderForm("create");
1190  if ($this->form->checkInput()) {
1191  if ($this->object->createFolder($_POST["title"], (int) $_GET["mepitem_id"])) {
1192  ilUtil::sendSuccess($lng->txt("mep_folder_created"), true);
1193  }
1194  $ilCtrl->redirect($this, "listMedia");
1195  }
1196 
1197  $this->form->setValuesByPost();
1198  $tpl->setContent($this->form->getHtml());
1199  }
1200 
1204  public function updateFolder()
1205  {
1206  $lng = $this->lng;
1207  $ilCtrl = $this->ctrl;
1208  $tpl = $this->tpl;
1209 
1210  $this->checkPermission("write");
1211 
1212  $this->initFolderForm("edit");
1213  if ($this->form->checkInput()) {
1214  $item = new ilMediaPoolItem($_GET["mepitem_id"]);
1215  $item->setTitle($_POST["title"]);
1216  $item->update();
1217  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1218  $ilCtrl->setParameter(
1219  $this,
1220  "mepitem_id",
1221  $this->object->getTree()->getParentId($_GET["mepitem_id"])
1222  );
1223  $ilCtrl->redirect($this, "listMedia");
1224  }
1225 
1226  $this->form->setValuesByPost();
1227  $tpl->setContent($this->form->getHtml());
1228  }
1229 
1235  public function initFolderForm($a_mode = "edit")
1236  {
1237  $lng = $this->lng;
1238  $ilCtrl = $this->ctrl;
1239 
1240  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1241  $this->form = new ilPropertyFormGUI();
1242 
1243  // desc
1244  $ti = new ilTextInputGUI($lng->txt("title"), "title");
1245  $ti->setMaxLength(128);
1246  $ti->setRequired(true);
1247  $this->form->addItem($ti);
1248 
1249  // save and cancel commands
1250  if ($a_mode == "create") {
1251  $this->form->addCommandButton("saveFolder", $lng->txt("save"));
1252  $this->form->addCommandButton("cancelSave", $lng->txt("cancel"));
1253  $this->form->setTitle($lng->txt("mep_new_folder"));
1254  } else {
1255  $this->form->addCommandButton("updateFolder", $lng->txt("save"));
1256  $this->form->addCommandButton("cancelFolderUpdate", $lng->txt("cancel"));
1257  $this->form->setTitle($lng->txt("mep_edit_folder"));
1258  }
1259 
1260  $this->form->setFormAction($ilCtrl->getFormAction($this));
1261  }
1262 
1266  public function cancelFolderUpdate()
1267  {
1268  $ilCtrl = $this->ctrl;
1269  $ilCtrl->setParameter(
1270  $this,
1271  "mepitem_id",
1272  $this->object->getTree()->getParentId($_GET["mepitem_id"])
1273  );
1274  $ilCtrl->redirect($this, "listMedia");
1275  }
1276 
1280  public function cancelSave()
1281  {
1282  $ilCtrl = $this->ctrl;
1283  $ilCtrl->redirect($this, "listMedia");
1284  }
1285 
1289 
1293  public function createMediaPoolPage()
1294  {
1295  $tpl = $this->tpl;
1296 
1297  $this->checkPermission("write");
1298 
1299  $this->initMediaPoolPageForm("create");
1300  $tpl->setContent($this->form->getHTML());
1301  }
1302 
1309  public function editMediaPoolPage()
1310  {
1311  $tpl = $this->tpl;
1312  $ilTabs = $this->tabs;
1313 
1314  $this->checkPermission("write");
1315 
1316  $ilTabs->clearTargets();
1317 
1318  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPageGUI.php");
1319  $mep_page_gui = new ilMediaPoolPageGUI($_GET["mepitem_id"], $_GET["old_nr"]);
1320  $mep_page_gui->getTabs();
1321 
1322  $this->setMediaPoolPageTabs();
1323 
1324  $this->initMediaPoolPageForm("edit");
1325  $this->getMediaPoolPageValues();
1326  $tpl->setContent($this->form->getHTML());
1327  }
1328 
1332  public function saveMediaPoolPage()
1333  {
1334  $tpl = $this->tpl;
1335  $lng = $this->lng;
1336  $ilCtrl = $this->ctrl;
1337 
1338  $this->checkPermission("write");
1339 
1340  $this->initMediaPoolPageForm("create");
1341  if ($this->form->checkInput()) {
1342  // create media pool item
1343  include_once("./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
1344  $item = new ilMediaPoolItem();
1345  $item->setTitle($_POST["title"]);
1346  $item->setType("pg");
1347  $item->create();
1348 
1349  if ($item->getId() > 0) {
1350  // put in tree
1351  $tree = $this->object->getTree();
1352  $parent = $_GET["mepitem_id"] > 0
1353  ? $_GET["mepitem_id"]
1354  : $tree->getRootId();
1355  $this->object->insertInTree($item->getId(), $parent);
1356 
1357  // create page
1358  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
1359  $page = new ilMediaPoolPage();
1360  $page->setId($item->getId());
1361  $page->setParentId($this->object->getId());
1362  $page->create();
1363 
1364  $ilCtrl->setParameterByClass("ilmediapoolpagegui", "mepitem_id", $item->getId());
1365  $ilCtrl->redirectByClass("ilmediapoolpagegui", "edit");
1366  }
1367  $ilCtrl->redirect($this, "listMedia");
1368  }
1369 
1370  $this->form->setValuesByPost();
1371  $tpl->setContent($this->form->getHtml());
1372  }
1373 
1377  public function updateMediaPoolPage()
1378  {
1379  $lng = $this->lng;
1380  $ilCtrl = $this->ctrl;
1381  $tpl = $this->tpl;
1382 
1383  $this->checkPermission("write");
1384 
1385  $this->initMediaPoolPageForm("edit");
1386  if ($this->form->checkInput()) {
1387  $item = new ilMediaPoolItem($_GET["mepitem_id"]);
1388  $item->setTitle($_POST["title"]);
1389  $item->update();
1390  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1391  $ilCtrl->redirect($this, "editMediaPoolPage");
1392  }
1393 
1394  $this->form->setValuesByPost();
1395  $tpl->setContent($this->form->getHtml());
1396  }
1402  public function initMediaPoolPageForm($a_mode = "edit")
1403  {
1404  $lng = $this->lng;
1405  $ilCtrl = $this->ctrl;
1406 
1407  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1408  $this->form = new ilPropertyFormGUI();
1409 
1410  // title
1411  $ti = new ilTextInputGUI($lng->txt("title"), "title");
1412  $ti->setMaxLength(128);
1413  $ti->setRequired(true);
1414  $this->form->addItem($ti);
1415 
1416  // save and cancel commands
1417  if ($a_mode == "create") {
1418  $this->form->addCommandButton("saveMediaPoolPage", $lng->txt("save"));
1419  $this->form->addCommandButton("cancelSave", $lng->txt("cancel"));
1420  $this->form->setTitle($lng->txt("mep_new_content_snippet"));
1421  } else {
1422  $this->form->addCommandButton("updateMediaPoolPage", $lng->txt("save"));
1423  $this->form->setTitle($lng->txt("mep_edit_content_snippet"));
1424  }
1425 
1426  $this->form->setFormAction($ilCtrl->getFormAction($this));
1427  }
1428 
1432  public function getMediaPoolPageValues()
1433  {
1434  $values = array();
1435 
1436  include_once("./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
1437  $values["title"] = ilMediaPoolItem::lookupTitle($_GET["mepitem_id"]);
1438 
1439  $this->form->setValuesByArray($values);
1440  }
1441 
1448  public function setMediaPoolPageTabs()
1449  {
1450  $ilTabs = $this->tabs;
1451  $ilCtrl = $this->ctrl;
1452  $lng = $this->lng;
1453 
1454  $ilTabs->addTarget(
1455  "cont_usage",
1456  $ilCtrl->getLinkTarget($this, "showMediaPoolPageUsages"),
1457  array("showMediaPoolPageUsages", "showAllMediaPoolPageUsages"),
1458  get_class($this)
1459  );
1460  $ilTabs->addTarget(
1461  "settings",
1462  $ilCtrl->getLinkTarget($this, "editMediaPoolPage"),
1463  "editMediaPoolPage",
1464  get_class($this)
1465  );
1466  $ilCtrl->setParameter($this, "mepitem_id", $this->object->getPoolTree()->getParentId($_GET["mepitem_id"]));
1467  $ilTabs->setBackTarget($lng->txt("mep_folder"), $ilCtrl->getLinkTarget($this, "listMedia"));
1468  $ilCtrl->setParameter($this, "mepitem_id", $_GET["mepitem_id"]);
1469  }
1470 
1474  public function showAllMediaPoolPageUsages()
1475  {
1476  $this->showMediaPoolPageUsages(true);
1477  }
1478 
1479 
1483  public function showMediaPoolPageUsages($a_all = false)
1484  {
1485  $ilTabs = $this->tabs;
1486  $ilCtrl = $this->ctrl;
1487  $lng = $this->lng;
1488  $tpl = $this->tpl;
1489 
1490  $this->checkPermission("write");
1491 
1492  $ilTabs->clearTargets();
1493 
1494  $ilTabs->addSubTab(
1495  "current_usages",
1496  $lng->txt("cont_current_usages"),
1497  $ilCtrl->getLinkTarget($this, "showMediaPoolPageUsages")
1498  );
1499 
1500  $ilTabs->addSubTab(
1501  "all_usages",
1502  $lng->txt("cont_all_usages"),
1503  $ilCtrl->getLinkTarget($this, "showAllMediaPoolPageUsages")
1504  );
1505 
1506  if ($a_all) {
1507  $ilTabs->activateSubTab("all_usages");
1508  $cmd = "showAllMediaPoolPageUsages";
1509  } else {
1510  $ilTabs->activateSubTab("current_usages");
1511  $cmd = "showMediaPoolPageUsages";
1512  }
1513 
1514 
1515  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPageGUI.php");
1516  $mep_page_gui = new ilMediaPoolPageGUI($_GET["mepitem_id"], $_GET["old_nr"]);
1517  $mep_page_gui->getTabs();
1518 
1519  $this->setMediaPoolPageTabs();
1520 
1521  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
1522  $page = new ilMediaPoolPage((int) $_GET["mepitem_id"]);
1523 
1524  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPageUsagesTableGUI.php");
1525  $table = new ilMediaPoolPageUsagesTableGUI($this, $cmd, $page, $a_all);
1526 
1527  $tpl->setContent($table->getHTML());
1528  }
1529 
1530 
1534 
1540  public function setContentSubTabs($a_active)
1541  {
1542  $ilAccess = $this->access;
1543  $ilTabs = $this->tabs;
1544  $ilCtrl = $this->ctrl;
1545 
1546  $ilTabs->addSubTab("content", $this->lng->txt("objs_fold"), $this->ctrl->getLinkTarget($this, ""));
1547 
1548  $ilCtrl->setParameter($this, "mepitem_id", "");
1549  $ilTabs->addSubTab("mep_all_mobs", $this->lng->txt("mep_all_mobs"), $this->ctrl->getLinkTarget($this, "allMedia"));
1550  $ilCtrl->setParameter($this, "mepitem_id", $_GET["mepitem_id"]);
1551 
1552  if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
1553  $ilTabs->addSubtab(
1554  "srt_files",
1555  $this->lng->txt("mep_media_subtitles"),
1556  $ilCtrl->getLinkTargetByClass("ilmobmultisrtuploadgui", "")
1557  );
1558  }
1559 
1560  $ilTabs->activateSubTab($a_active);
1561  }
1562 
1563 
1567  public function setTabs()
1568  {
1569  $ilAccess = $this->access;
1570  $ilTabs = $this->tabs;
1571  $ilCtrl = $this->ctrl;
1572  $ilHelp = $this->help;
1573 
1574  $ilHelp->setScreenIdComponent("mep");
1575 
1576  if ($ilAccess->checkAccess('read', '', $this->ref_id) ||
1577  $ilAccess->checkAccess('write', '', $this->ref_id)) {
1578  $ilTabs->addTab("content", $this->lng->txt("mep_content"), $this->ctrl->getLinkTarget($this, ""));
1579  }
1580 
1581  // info tab
1582  if ($ilAccess->checkAccess('visible', '', $this->ref_id) ||
1583  $ilAccess->checkAccess('read', '', $this->ref_id) ||
1584  $ilAccess->checkAccess('write', '', $this->ref_id)) {
1585  $force_active = ($this->ctrl->getNextClass() == "ilinfoscreengui"
1586  || strtolower($_GET["cmdClass"]) == "ilnotegui")
1587  ? true
1588  : false;
1589  $ilTabs->addTarget(
1590  "info_short",
1591  $this->ctrl->getLinkTargetByClass(
1592  array("ilobjmediapoolgui", "ilinfoscreengui"),
1593  "showSummary"
1594  ),
1595  array("showSummary", "infoScreen"),
1596  "",
1597  "",
1598  $force_active
1599  );
1600  }
1601 
1602  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
1603  $ilTabs->addTarget(
1604  "settings",
1605  $this->ctrl->getLinkTarget($this, "edit"),
1606  "edit",
1607  array("", "ilobjmediapoolgui")
1608  );
1609  }
1610 
1611  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
1612  $ilTabs->addTarget(
1613  "clipboard",
1614  $this->ctrl->getLinkTarget($this, "openClipboard"),
1615  "view",
1616  "ileditclipboardgui"
1617  );
1618  }
1619 
1620  // properties
1621  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
1622  // meta data
1623  include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
1624  $mdgui = new ilObjectMetaDataGUI($this->object, "mob");
1625  $mdtab = $mdgui->getTab();
1626  if ($mdtab) {
1627  $ilTabs->addTarget(
1628  "meta_data",
1629  $mdtab,
1630  "",
1631  "ilobjectmetadatagui"
1632  );
1633  }
1634  }
1635 
1636  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
1637  $ilTabs->addTarget(
1638  "export",
1639  $this->ctrl->getLinkTargetByClass("ilexportgui", ""),
1640  "",
1641  "ilexportgui"
1642  );
1643 
1644  $ilTabs->addTarget(
1645  "import",
1646  $this->ctrl->getLinkTargetByClass("ilmediapoolimportgui", ""),
1647  "",
1648  "ilmediapoolimportgui"
1649  );
1650  }
1651 
1652  if ($ilAccess->checkAccess("edit_permission", "", $this->object->getRefId())) {
1653  $ilTabs->addTarget(
1654  "perm_settings",
1655  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
1656  array("perm","info","owner"),
1657  'ilpermissiongui'
1658  );
1659  }
1660  }
1661 
1668  public function setSettingsSubTabs($a_active)
1669  {
1670  $ilTabs = $this->tabs;
1671  $lng = $this->lng;
1672  $ilAccess = $this->access;
1673 
1674  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
1675  $ilTabs->addSubTab(
1676  "settings",
1677  $lng->txt("settings"),
1678  $this->ctrl->getLinkTarget($this, "edit")
1679  );
1680 
1681  $mset = new ilSetting("mobs");
1682  if ($mset->get("mep_activate_pages")) {
1683  $ilTabs->addSubTabTarget(
1684  "obj_multilinguality",
1685  $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", "")
1686  );
1687  }
1688  }
1689 
1690  $ilTabs->setSubTabActive($a_active);
1691  }
1692 
1693 
1697  public static function _goto($a_target)
1698  {
1699  global $DIC;
1700 
1701  $ilAccess = $DIC->access();
1702  $ilErr = $DIC["ilErr"];
1703  $lng = $DIC->language();
1704 
1705  $targets = explode('_', $a_target);
1706  if (count((array) $targets) > 1) {
1707  $ref_id = $targets[0];
1708  $subitem_id = $targets[1];
1709  } else {
1710  $ref_id = $targets[0];
1711  }
1712 
1713  if ($ilAccess->checkAccess("read", "", $ref_id)) {
1714  $_GET["baseClass"] = "ilMediaPoolPresentationGUI";
1715  $_GET["ref_id"] = $ref_id;
1716  $_GET['mepitem_id'] = $subitem_id;
1717  include("ilias.php");
1718  exit;
1719  } elseif ($ilAccess->checkAccess("visible", "", $ref_id)) {
1720  $_GET["baseClass"] = "ilMediaPoolPresentationGUI";
1721  $_GET["ref_id"] = $ref_id;
1722  $_GET["cmd"] = "infoScreen";
1723  include("ilias.php");
1724  exit;
1725  } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1726  ilUtil::sendFailure(sprintf(
1727  $lng->txt("msg_no_perm_read_item"),
1729  ), true);
1731  }
1732 
1733  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1734  }
1735 
1741  public function infoScreenObject()
1742  {
1743  $this->ctrl->setCmd("showSummary");
1744  $this->ctrl->setCmdClass("ilinfoscreengui");
1745  $this->infoScreen();
1746  }
1747 
1751  public function infoScreen()
1752  {
1753  $this->tabs->activateTab("info_short");
1754  $ilAccess = $this->access;
1755  $ilErr = $this->error;
1756 
1757  if (!$ilAccess->checkAccess("visible", "", $this->ref_id) &&
1758  !$ilAccess->checkAccess("read", "", $this->ref_id) &&
1759  !$ilAccess->checkAccess("write", "", $this->ref_id)) {
1760  $ilErr->raiseError($this->lng->txt("msg_no_perm_read"), $ilErr->MESSAGE);
1761  }
1762 
1763  if ($this->ctrl->getCmd() == "infoScreen") {
1764  $this->ctrl->setCmd("showSummary");
1765  $this->ctrl->setCmdClass("ilinfoscreengui");
1766  }
1767 
1768  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1769  $info = new ilInfoScreenGUI($this);
1770 
1771  $info->enablePrivateNotes();
1772 
1773 
1774  // standard meta data
1775  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
1776 
1777  // forward the command
1778  $this->ctrl->forwardCommand($info);
1779  }
1780 
1781 
1785 
1789  public function selectUploadDirFiles($a_files = null)
1790  {
1791  $tpl = $this->tpl;
1792  $ilTabs = $this->tabs;
1793  $lng = $this->lng;
1794  $ilCtrl = $this->ctrl;
1795  $ilToolbar = $this->toolbar;
1796 
1797  if (!$a_files) {
1798  $a_files = $_POST["file"];
1799  }
1800 
1801  $ilTabs->clearTargets();
1802  $ilTabs->setBackTarget(
1803  $lng->txt("back"),
1804  $ilCtrl->getLinkTarget($this, "listMedia")
1805  );
1806 
1807  $this->checkPermission("write");
1808 
1810 
1811  // action type
1812  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
1813  $options = array(
1814  "rename" => $lng->txt("mep_up_dir_move"),
1815  "copy" => $lng->txt("mep_up_dir_copy"),
1816  );
1817  $si = new ilSelectInputGUI("", "action");
1818  $si->setOptions($options);
1819  $ilToolbar->addInputItem($si);
1820  $ilToolbar->setCloseFormTag(false);
1821  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
1822  $ilToolbar->setFormName("mep_up_form");
1823 
1824  include_once("./Modules/MediaPool/classes/class.ilUploadDirFilesTableGUI.php");
1826  $this,
1827  "selectUploadDirFiles",
1828  $a_files
1829  );
1830  $tab->setFormName("mep_up_form");
1831  $tpl->setContent($tab->getHTML());
1832  }
1833  }
1834 
1838  public function createMediaFromUploadDir()
1839  {
1840  $this->checkPermission("write");
1841 
1842  $mset = new ilSetting("mobs");
1843  $upload_dir = trim($mset->get("upload_dir"));
1844 
1845  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1846 
1847  if (is_array($_POST["file"]) && ilMainMenuGUI::_checkAdministrationPermission()) {
1848  foreach ($_POST["file"] as $f) {
1849  $f = str_replace("..", "", $f);
1850  $fullpath = $upload_dir . "/" . $f;
1851  $mob = new ilObjMediaObject();
1852  $mob->setTitle(basename($fullpath));
1853  $mob->setDescription("");
1854  $mob->create();
1855 
1856  // determine and create mob directory, move uploaded file to directory
1857  //$mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$a_mob->getId();
1858  $mob->createDirectory();
1859  $mob_dir = ilObjMediaObject::_getDirectory($mob->getId());
1860 
1861  $media_item = new ilMediaItem();
1862  $mob->addMediaItem($media_item);
1863  $media_item->setPurpose("Standard");
1864 
1865  $file = $mob_dir . "/" . basename($fullpath);
1866 
1867  // virus handling
1868  $vir = ilUtil::virusHandling($fullpath, basename($fullpath));
1869  if (!$vir[0]) {
1870  ilUtil::sendFailure($this->lng->txt("file_is_infected") . "<br />" . $vir[1], true);
1871  ilUtil::redirect("ilias.php?baseClass=ilMediaPoolPresentationGUI&cmd=listMedia&ref_id=" .
1872  $_GET["ref_id"] . "&mepitem_id=" . $_GET["mepitem_id"]);
1873  }
1874 
1875  switch ($_POST["action"]) {
1876  case "rename":
1877  rename($fullpath, $file);
1878  break;
1879 
1880  case "copy":
1881  copy($fullpath, $file);
1882  break;
1883  }
1884 
1885  // get mime type
1887  $location = basename($fullpath);
1888 
1889  // set real meta and object data
1890  $media_item->setFormat($format);
1891  $media_item->setLocation($location);
1892  $media_item->setLocationType("LocalFile");
1893 
1894  $mob->setDescription($format);
1895 
1896  // determine width and height of known image types
1898  $format,
1899  "File",
1900  $mob_dir . "/" . $location,
1901  $media_item->getLocation(),
1902  true,
1903  true,
1904  "",
1905  ""
1906  );
1907  $media_item->setWidth($wh["width"]);
1908  $media_item->setHeight($wh["height"]);
1909  if ($wh["info"] != "") {
1910  // ilUtil::sendInfo($wh["info"], true);
1911  }
1912 
1913  $media_item->setHAlign("Left");
1914  ilUtil::renameExecutables($mob_dir);
1915  $mob->update();
1916 
1917 
1918  // put it into current folder
1919  $mep_item = new ilMediaPoolItem();
1920  $mep_item->setTitle($mob->getTitle());
1921  $mep_item->setType("mob");
1922  $mep_item->setForeignId($mob->getId());
1923  $mep_item->create();
1924 
1925  $tree = $this->object->getTree();
1926  $parent = ($_GET["mepitem_id"] == "")
1927  ? $tree->getRootId()
1928  : $_GET["mepitem_id"];
1929  $tree->insertNode($mep_item->getId(), $parent);
1930  }
1931  }
1932  ilUtil::redirect("ilias.php?baseClass=ilMediaPoolPresentationGUI&cmd=listMedia&ref_id=" .
1933  $_GET["ref_id"] . "&mepitem_id=" . $_GET["mepitem_id"]);
1934  }
1935 
1939  public static function getPreviewModalHTML($a_mpool_ref_id, $a_tpl)
1940  {
1941  global $DIC;
1942 
1943  $tpl = $DIC["tpl"];
1944  $ilCtrl = $DIC->ctrl();
1945  $lng = $DIC->language();
1946 
1947  require_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1949 
1950  $tpl->addJavaScript("./Modules/MediaPool/js/ilMediaPool.js");
1951 
1952  $ilCtrl->setParameterByClass("ilobjmediapoolgui", "mepitem_id", "");
1953  $ilCtrl->setParameterByClass("ilobjmediapoolgui", "ref_id", $a_mpool_ref_id);
1954  $tpl->addOnloadCode("il.MediaPool.setPreviewUrl('" . $ilCtrl->getLinkTargetByClass(array("ilmediapoolpresentationgui", "ilobjmediapoolgui"), "showPreview", "", false, false) . "');");
1955  $ilCtrl->setParameterByClass("ilobjmediapoolgui", "mepitem_id", $_GET["mepitem_id"]);
1956  $ilCtrl->setParameterByClass("ilobjmediapoolgui", "ref_id", $_GET["red_id"]);
1957 
1958  include_once("./Services/UIComponent/Modal/classes/class.ilModalGUI.php");
1959  $modal = ilModalGUI::getInstance();
1960  $modal->setHeading($lng->txt("preview"));
1961  $modal->setId("ilMepPreview");
1962  $modal->setType(ilModalGUI::TYPE_LARGE);
1963  $modal->setBody("<iframe id='ilMepPreviewContent'></iframe>");
1964 
1965  return $modal->getHTML();
1966  }
1967 
1971  public function export()
1972  {
1973  $ot = ilObjectTranslation::getInstance($this->object->getId());
1974  $opt = "";
1975  if ($ot->getContentActivated()) {
1976  $format = explode("_", $_POST["format"]);
1977  $opt = ilUtil::stripSlashes($format[1]);
1978  }
1979 
1980  $this->object->exportXML($opt);
1981  }
1982 
1983  //
1984  // BULK UPLOAD
1985  //
1986 
1990  protected function bulkUpload()
1991  {
1992  $this->checkPermission("write");
1993 
1995 
1996  $form = $this->initBulkUploadForm();
1997  $main_tpl->setContent($form->getHTML());
1998  }
1999 
2003  public function initBulkUploadForm()
2004  {
2005  $ctrl = $this->ctrl;
2006  $lng = $this->lng;
2007 
2008  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
2009  $form = new ilPropertyFormGUI();
2010 
2011  $form->setFormAction($ctrl->getFormAction($this));
2012  $form->setPreventDoubleSubmission(false);
2013 
2014  $item = new ilFileStandardDropzoneInputGUI(
2015  'cancel',
2016  $lng->txt("mep_media_files"),
2017  'media_files'
2018  );
2019  $item->setUploadUrl($ctrl->getLinkTarget($this, "performBulkUpload", "", true, true));
2020  $item->setMaxFiles(20);
2021  $form->addItem($item);
2022 
2023  $form->addCommandButton("performBulkUpload", $lng->txt("upload"));
2024 
2025  $form->setTitle($lng->txt("mep_bulk_upload"));
2026 
2027  return $form;
2028  }
2029 
2033  public function performBulkUpload()
2034  {
2035  $this->checkPermission("write");
2036 
2037  $ctrl = $this->ctrl;
2038  $lng = $this->lng;
2041  $log = $this->mep_log;
2042 
2043  $form = $this->initBulkUploadForm();
2044  if ($form->checkInput()) {
2045  $mep_item_ids = [];
2046  // Check if this is a request to upload a file
2047  $log->debug("checking for uploads...");
2048  if ($upload->hasUploads()) {
2049  $log->debug("has upload...");
2050  try {
2051  $upload->process();
2052  $log->debug("nr of results: " . count($upload->getResults()));
2053  foreach ($upload->getResults() as $result) {
2054  $title = $result->getName();
2055 
2056  $mob = new ilObjMediaObject();
2057  $mob->setTitle($title);
2058  $mob->setDescription("");
2059  $mob->create();
2060 
2061  $mob->createDirectory();
2062  $media_item = new ilMediaItem();
2063  $mob->addMediaItem($media_item);
2064  $media_item->setPurpose("Standard");
2065 
2066  $mob_dir = ilObjMediaObject::_getRelativeDirectory($mob->getId());
2067  $file_name = ilObjMediaObject::fixFilename($title);
2068  $file = $mob_dir . "/" . $file_name;
2069 
2070  $upload->moveOneFileTo(
2071  $result,
2072  $mob_dir,
2073  Location::WEB,
2074  $file_name,
2075  true
2076  );
2077 
2078  $mep_item = new ilMediaPoolItem();
2079  $mep_item->setTitle($title);
2080  $mep_item->setType("mob");
2081  $mep_item->setForeignId($mob->getId());
2082  $mep_item->create();
2083 
2084  $tree = $this->object->getTree();
2085  $parent = ($_GET["mepitem_id"] == "")
2086  ? $tree->getRootId()
2087  : $_GET["mepitem_id"];
2088  $tree->insertNode($mep_item->getId(), $parent);
2089 
2090  // get mime type
2092  $location = $file_name;
2093 
2094  // set real meta and object data
2095  $media_item->setFormat($format);
2096  $media_item->setLocation($location);
2097  $media_item->setLocationType("LocalFile");
2098  $media_item->setUploadHash(ilUtil::stripSlashes($_POST["ilfilehash"]));
2099  $mob->update();
2100  $mep_item_ids[] = $mob->getId();
2101  }
2102  } catch (Exception $e) {
2103  $log->debug("Got exception: " . $e->getMessage());
2104  echo json_encode(array( 'success' => false, 'message' => $e->getMessage()));
2105  }
2106  $log->debug("end of 'has_uploads'");
2107  }
2108  $log->debug("has no upload...");
2109 
2110  $log->debug("calling redirect... (" . $_POST["ilfilehash"] . ")");
2111  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
2112  $ctrl->setParameter($this, "mep_hash", $_POST["ilfilehash"]);
2113  $ctrl->redirect($this, "editTitlesAndDescriptions");
2114  }
2115 
2116  $form->setValuesByPost();
2117  $main_tpl->setContent($form->getHtml());
2118  }
2119 
2123  protected function editTitlesAndDescriptions()
2124  {
2125  $ctrl = $this->ctrl;
2126  $lng = $this->lng;
2127 
2128  $this->checkPermission("write");
2129  $ctrl->saveParameter($this, "mep_hash");
2130 
2132 
2133  include_once("./Services/MediaObjects/classes/class.ilMediaItem.php");
2134  $media_items = ilMediaItem::getMediaItemsForUploadHash($_GET["mep_hash"]);
2135 
2136  include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
2137 
2138  $tb = new ilToolbarGUI();
2139  $tb->setFormAction($ctrl->getFormAction($this));
2140  $tb->addFormButton($lng->txt("save"), "saveTitlesAndDescriptions");
2141  $tb->setOpenFormTag(true);
2142  $tb->setCloseFormTag(false);
2143  $tb->setId("tb_top");
2144 
2145  $html = $tb->getHTML();
2146  foreach ($media_items as $mi) {
2147  $acc = new ilAccordionGUI();
2148  $acc->setBehaviour(ilAccordionGUI::ALL_CLOSED);
2149  $acc->setId("acc_" . $mi["mob_id"]);
2150 
2151  $mob = new ilObjMediaObject($mi["mob_id"]);
2152  $form = $this->initMediaBulkForm($mi["mob_id"], $mob->getTitle());
2153  $acc->addItem($mob->getTitle(), $form->getHTML());
2154 
2155  $html .= $acc->getHTML();
2156  }
2157 
2158  $html .= $tb->getHTML();
2159  $tb->setOpenFormTag(false);
2160  $tb->setCloseFormTag(true);
2161  $tb->setId("tb_bottom");
2162 
2163  $main_tpl->setContent($html);
2164  }
2165 
2169  public function initMediaBulkForm($a_id, $a_title)
2170  {
2171  $lng = $this->lng;
2172 
2173  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
2174  $form = new ilPropertyFormGUI();
2175  $form->setOpenTag(false);
2176  $form->setCloseTag(false);
2177 
2178  // title
2179  $ti = new ilTextInputGUI($lng->txt("title"), "title_" . $a_id);
2180  $ti->setValue($a_title);
2181  $form->addItem($ti);
2182 
2183  // description
2184  $ti = new ilTextAreaInputGUI($lng->txt("description"), "description_" . $a_id);
2185  $form->addItem($ti);
2186 
2187  return $form;
2188  }
2189 
2193  protected function saveTitlesAndDescriptions()
2194  {
2195  $lng = $this->lng;
2196  $ctrl = $this->ctrl;
2197 
2198  $this->checkPermission("write");
2199  //var_dump(_$POST); exit;
2200 
2201  $media_items = ilMediaItem::getMediaItemsForUploadHash($_GET["mep_hash"]);
2202  include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
2203 
2204  foreach ($media_items as $mi) {
2205  $mob = new ilObjMediaObject($mi["mob_id"]);
2206  $form = $this->initMediaBulkForm($mi["mob_id"], $mob->getTitle());
2207  $form->checkInput();
2208  $title = $form->getInput("title_" . $mi["mob_id"]);
2209  $desc = $form->getInput("description_" . $mi["mob_id"]);
2210  if (trim($title) != "") {
2211  $mob->setTitle($title);
2212  }
2213  $mob->setDescription($desc);
2214  $mob->update();
2215  }
2216  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
2217  $ctrl->redirect($this, "listMedia");
2218  }
2219 }
showFullscreen()
show fullscreen
getFolderValues()
Get current values for folder from.
setLocator()
set Locator
xslt_create()
updateCustom(ilPropertyFormGUI $a_form)
initEditCustomForm(ilPropertyFormGUI $a_form)
static lookupType($a_id)
Lookup type.
Class ilObjectMetaDataGUI.
$path
Definition: aliased.php:25
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Class ilObjFolderGUI.
static getMimeType($a_file, $a_external=null)
get mime type for file
Class ilInfoScreenGUI.
$format
Definition: metadata.php:141
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
This class represents a selection list property in a property form.
$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.
$type
setSettingsSubTabs($a_active)
Set setting sub tabs.
global $DIC
Definition: saml.php:7
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
if(!array_key_exists('StateId', $_REQUEST)) $id
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.
$log
Definition: sabredav.php:21
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.
__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.
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.
if(isset($_POST['submit'])) $form
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.
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.
$values
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.
special template class to simplify handling of ITX/PEAR
cancelRemove()
cancel deletion of media objects/folders
Class ilMediaItem.
This class represents a text property in a property form.
listMedia()
list media objects
$ilUser
Definition: imgupload.php:18
Import related features for media pools (currently used for translation imports)
Class ilObjMediaObject.
setMaxLength($a_maxlength)
Set Max Length.
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.
static getContentStylePath($a_style_id, $add_random=true)
get content style path
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.
exit
Definition: backend.php:16
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.
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.
if(empty($password)) $table
Definition: pwgen.php:24
saveTitlesAndDescriptions()
Save titles and descriptions.
$info
Definition: index.php:5
setValue($a_value)
Set Value.
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"]
$html
Definition: example_001.php:87
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.