ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilObjMediaPoolGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Services/Object/classes/class.ilObject2GUI.php");
5include_once("./Modules/MediaPool/classes/class.ilObjMediaPool.php");
6include_once("./Services/Table/classes/class.ilTableGUI.php");
7include_once("./Modules/Folder/classes/class.ilObjFolderGUI.php");
8include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
9include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
10include_once("./Services/Clipboard/classes/class.ilEditClipboardGUI.php");
11
26{
28
32 protected function afterConstructor()
33 {
34 global $lng;
35
36 $lng->loadLanguageModule("mep");
37
38 if ($this->ctrl->getCmd() == "explorer")
39 {
40 $this->ctrl->saveParameter($this, array("ref_id"));
41 }
42 else
43 {
44 $this->ctrl->saveParameter($this, array("ref_id", "mepitem_id"));
45 }
46 $this->ctrl->saveParameter($this, array("mep_mode"));
47
48 $lng->loadLanguageModule("content");
49 }
50
54 final function getType()
55 {
56 return "mep";
57 }
58
62 function &executeCommand()
63 {
64 global $ilTabs, $lng, $ilAccess, $tpl, $ilCtrl;
65
66 if ($this->ctrl->getRedirectSource() == "ilinternallinkgui")
67 {
68 $this->explorer();
69 return;
70 }
71
72 $next_class = $this->ctrl->getNextClass($this);
73 $cmd = $this->ctrl->getCmd();
74 $new_type = $_POST["new_type"]
75 ? $_POST["new_type"]
76 : $_GET["new_type"];
77
78 if ($new_type != "" && ($cmd != "confirmRemove" && $cmd != "copyToClipboard"
79 && $cmd != "pasteFromClipboard"))
80 {
81 $this->setCreationMode(true);
82 }
83
84 if (!$this->getCreationMode())
85 {
86 $tree =& $this->object->getTree();
87 if ($_GET["mepitem_id"] == "")
88 {
89 $_GET["mepitem_id"] = $tree->getRootId();
90 }
91 }
92 if ($cmd == "create")
93 {
94 switch($_POST["new_type"])
95 {
96 case "mob":
97 $this->ctrl->redirectByClass("ilobjmediaobjectgui", "create");
98 break;
99
100 case "fold":
101 $this->ctrl->redirectByClass("ilobjfoldergui", "create");
102 break;
103 }
104 }
105
106 switch($next_class)
107 {
108 case 'ilmediapoolpagegui':
109 $this->checkPermission("write");
110 $this->prepareOutput();
111 $this->addHeaderAction();
112 $this->setMediaPoolPageTabs();
113 include_once("./Modules/MediaPool/classes/class.ilMediaPoolPageGUI.php");
114 $mep_page_gui = new ilMediaPoolPageGUI($_GET["mepitem_id"], $_GET["old_nr"]);
115
116 if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()))
117 {
118 $mep_page_gui->setEnableEditing(false);
119 }
120 $ret = $this->ctrl->forwardCommand($mep_page_gui);
121 if ($ret != "")
122 {
123 $tpl->setContent($ret);
124 }
125 $this->tpl->show();
126 break;
127
128 case "ilobjmediaobjectgui":
129 $this->checkPermission("write");
130 //$cmd.="Object";
131 if ($cmd == "create" || $cmd == "save" || $cmd == "cancel")
132 {
133 $ret_obj = $_GET["mepitem_id"];
134 $ilObjMediaObjectGUI =& new ilObjMediaObjectGUI("", 0, false, false);
135 $ilObjMediaObjectGUI->setWidthPreset($this->object->getDefaultWidth());
136 $ilObjMediaObjectGUI->setHeightPreset($this->object->getDefaultHeight());
137 }
138 else
139 {
140 $ret_obj = $tree->getParentId($_GET["mepitem_id"]);
141 $ilObjMediaObjectGUI =& new ilObjMediaObjectGUI("", ilMediaPoolItem::lookupForeignId($_GET["mepitem_id"]), false, false);
142 $this->ctrl->setParameter($this, "mepitem_id", $this->getParentFolderId());
143 $ilTabs->setBackTarget($lng->txt("back"),
144 $this->ctrl->getLinkTarget($this,
145 $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia"));
146 }
147 if ($this->ctrl->getCmdClass() == "ilinternallinkgui")
148 {
149 $this->ctrl->setReturn($this, "explorer");
150 }
151 else
152 {
153 $this->ctrl->setParameter($this, "mepitem_id", $ret_obj);
154 $this->ctrl->setReturn($this,
155 $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
156 $this->ctrl->setParameter($this, "mepitem_id", $_GET["mepitem_id"]);
157 }
158 $this->getTemplate();
159 $ilObjMediaObjectGUI->setTabs();
160 $this->setLocator();
161
162 //$ret =& $ilObjMediaObjectGUI->executeCommand();
163 $ret = $this->ctrl->forwardCommand($ilObjMediaObjectGUI);
164
165 if ($cmd == "save" && $ret != false)
166 {
167 $mep_item = new ilMediaPoolItem();
168 $mep_item->setTitle($ret->getTitle());
169 $mep_item->setType("mob");
170 $mep_item->setForeignId($ret->getId());
171 $mep_item->create();
172
173 $parent = ($_GET["mepitem_id"] == "")
174 ? $tree->getRootId()
175 : $_GET["mepitem_id"];
176 $tree->insertNode($mep_item->getId(), $parent);
177 ilUtil::redirect("ilias.php?baseClass=ilMediaPoolPresentationGUI&cmd=listMedia&ref_id=".
178 $_GET["ref_id"]."&mepitem_id=".$_GET["mepitem_id"]);
179 }
180 else
181 {
182 $this->tpl->show();
183 }
184 break;
185
186 case "ilobjfoldergui":
187 $this->checkPermission("write");
188 $this->addHeaderAction();
189 $folder_gui = new ilObjFolderGUI("", 0, false, false);
190 $this->ctrl->setReturn($this, "listMedia");
191 $cmd.="Object";
192 switch($cmd)
193 {
194 case "createObject":
195 $this->prepareOutput();
196 $folder_gui =& new ilObjFolderGUI("", 0, false, false);
197 $folder_gui->setFormAction("save",
198 $this->ctrl->getFormActionByClass("ilobjfoldergui"));
199 $folder_gui->createObject();
200 $this->tpl->show();
201 break;
202
203 case "saveObject":
204 //$folder_gui->setReturnLocation("save", $this->ctrl->getLinkTarget($this, "listMedia"));
205 $parent = ($_GET["mepitem_id"] == "")
206 ? $tree->getRootId()
207 : $_GET["mepitem_id"];
208 $folder_gui->setFolderTree($tree);
209 $folder_gui->saveObject($parent);
210 //$this->ctrl->redirect($this, "listMedia");
211 break;
212
213 case "editObject":
214 $this->prepareOutput();
215 $folder_gui =& new ilObjFolderGUI("", ilMediaPoolItem::lookupForeignId($_GET["mepitem_id"]), false, false);
216 $this->ctrl->setParameter($this, "foldereditmode", "1");
217 $folder_gui->setFormAction("update", $this->ctrl->getFormActionByClass("ilobjfoldergui"));
218 $folder_gui->editObject();
219 $this->tpl->show();
220 break;
221
222 case "updateObject":
223 $folder_gui =& new ilObjFolderGUI("", ilMediaPoolItem::lookupForeignId($_GET["mepitem_id"]), false, false);
224 $this->ctrl->setParameter($this, "mepitem_id", $this->getParentFolderId());
225 $this->ctrl->setReturn($this, "listMedia");
226 $folder_gui->updateObject(true); // this returns to parent
227 break;
228
229 case "cancelObject":
230 if ($_GET["foldereditmode"])
231 {
232 $this->ctrl->setParameter($this, "mepitem_id", $this->getParentFolderId());
233 }
234 $this->ctrl->redirect($this, "listMedia");
235 break;
236 }
237 break;
238
239 case "ileditclipboardgui":
240 $this->prepareOutput();
241 $this->addHeaderAction();
242 $this->ctrl->setReturn($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
243 $clip_gui = new ilEditClipboardGUI();
244 $clip_gui->setMultipleSelections(true);
245 $clip_gui->setInsertButtonTitle($lng->txt("mep_copy_to_mep"));
246 $ilTabs->setTabActive("clipboard");
247 //$ret =& $clip_gui->executeCommand();
248 $ret =& $this->ctrl->forwardCommand($clip_gui);
249 $this->tpl->show();
250 break;
251
252 case 'ilinfoscreengui':
253 $this->prepareOutput();
254 $this->addHeaderAction();
255 $this->infoScreen();
256 $this->tpl->show();
257 break;
258
259 case 'ilpermissiongui':
260 $this->checkPermission("edit_permission");
261 $this->prepareOutput();
262 $this->addHeaderAction();
263 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
264 $perm_gui =& new ilPermissionGUI($this);
265 $ret =& $this->ctrl->forwardCommand($perm_gui);
266 $this->tpl->show();
267 break;
268
269 case "ilexportgui":
270 $this->checkPermission("write");
271 $this->prepareOutput();
272 $this->addHeaderAction();
273 include_once("./Services/Export/classes/class.ilExportGUI.php");
274 $exp_gui = new ilExportGUI($this);
275 $exp_gui->addFormat("xml");
276 include_once("./Services/Object/classes/class.ilObjectTranslation.php");
277 $ot = ilObjectTranslation::getInstance($this->object->getId());
278 if ($ot->getContentActivated())
279 {
280 $exp_gui->addFormat("xml_master", "XML (".$lng->txt("mep_master_language_only").")", $this, "export");
281 }
282 $ret = $this->ctrl->forwardCommand($exp_gui);
283 $this->tpl->show();
284 break;
285
286 case "ilfilesystemgui":
287 $this->checkPermission("write");
288 $this->prepareOutput();
289 $this->addHeaderAction();
290 $ilTabs->clearTargets();
291 $ilTabs->setBackTarget($lng->txt("back"),
292 $ilCtrl->getLinkTarget($this, "listMedia"));
293 $mset = new ilSetting("mobs");
294 if (trim($mset->get("upload_dir")) != "")
295 {
296 include_once("./Services/FileSystem/classes/class.ilFileSystemGUI.php");
297 $fs_gui = new ilFileSystemGUI($mset->get("upload_dir"));
298 $fs_gui->setPostDirPath(true);
299 $fs_gui->setTableId("mepud".$this->object->getId());
300 $fs_gui->setAllowFileCreation(false);
301 $fs_gui->setAllowDirectoryCreation(false);
302 $fs_gui->clearCommands();
303 $fs_gui->addCommand($this, "selectUploadDirFiles", $this->lng->txt("mep_sel_upload_dir_files"),
304 false, true);
305 //$fs_gui->addCommand($this, "assignFullscreenObject", $this->lng->txt("cont_assign_full"));
306 $ret =& $this->ctrl->forwardCommand($fs_gui);
307 }
308 $this->tpl->show();
309 break;
310
311 case "ilcommonactiondispatchergui":
312 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
314 $this->ctrl->forwardCommand($gui);
315 break;
316
317 case 'ilobjecttranslationgui':
318 $this->prepareOutput();
319 $this->addHeaderAction();
320 //$this->setTabs("settings");
321 $ilTabs->activateTab("settings");
322 $this->setSettingsSubTabs("obj_multilinguality");
323 include_once("./Services/Object/classes/class.ilObjectTranslationGUI.php");
324 $transgui = new ilObjectTranslationGUI($this);
325 $transgui->setTitleDescrOnlyMode(false);
326 $this->ctrl->forwardCommand($transgui);
327 $this->tpl->show();
328 break;
329
330 case "ilmediapoolimportgui":
331 $this->prepareOutput();
332 $this->addHeaderAction();
333 $ilTabs->activateTab("import");
334 include_once("./Modules/MediaPool/classes/class.ilMediaPoolImportGUI.php");
335 $gui = new ilMediaPoolImportGUI($this->object);
336 $this->ctrl->forwardCommand($gui);
337 $this->tpl->show();
338 break;
339
340 default:
341 $this->prepareOutput();
342 $this->addHeaderAction();
343 $cmd = $this->ctrl->getCmd("listMedia");
344 $this->$cmd();
345 if (!$this->getCreationMode())
346 {
347 $this->tpl->show();
348 }
349 break;
350 }
351 }
352
357 {
358 $this->ctrl->redirectByClass("ilobjmediaobjectgui", "create");
359 }
360
361 protected function initCreationForms($a_new_type)
362 {
363 $forms = array(self::CFORM_NEW => $this->initCreateForm($a_new_type),
364 self::CFORM_IMPORT => $this->initImportForm($a_new_type));
365
366 return $forms;
367 }
368
372 function afterSave($newObj)
373 {
374 // always send a message
375 ilUtil::sendSuccess($this->lng->txt("object_added"),true);
376
377 //ilUtil::redirect($this->getReturnLocation("save","adm_object.php?".$this->link_params));
378 ilUtil::redirect("ilias.php?baseClass=ilMediaPoolPresentationGUI&ref_id=".$newObj->getRefId()."&cmd=listMedia");
379 }
380
381 protected function initEditCustomForm(ilPropertyFormGUI $a_form)
382 {
383 // default width
384 $ni = new ilNumberInputGUI($this->lng->txt("mep_default_width"), "default_width");
385 $ni->setMinValue(0);
386 $ni->setSuffix("px");
387 $ni->setMaxLength(5);
388 $ni->setSize(5);
389 $a_form->addItem($ni);
390
391 // default height
392 $ni = new ilNumberInputGUI($this->lng->txt("mep_default_height"), "default_height");
393 $ni->setSuffix("px");
394 $ni->setMinValue(0);
395 $ni->setMaxLength(5);
396 $ni->setSize(5);
397 $ni->setInfo($this->lng->txt("mep_default_width_height_info"));
398 $a_form->addItem($ni);
399 }
400
407 function edit()
408 {
409 $this->setSettingsSubTabs("settings");
410 parent::edit();
411 }
412
413
414 protected function getEditFormCustomValues(array &$a_values)
415 {
416 if ($this->object->getDefaultWidth() > 0)
417 {
418 $a_values["default_width"] = $this->object->getDefaultWidth();
419 }
420 if ($this->object->getDefaultHeight() > 0)
421 {
422 $a_values["default_height"] = $this->object->getDefaultHeight();
423 }
424 }
425
426 protected function updateCustom(ilPropertyFormGUI $a_form)
427 {
428 $this->object->setDefaultWidth($a_form->getInput("default_width"));
429 $this->object->setDefaultHeight($a_form->getInput("default_height"));
430 }
431
435 function listMedia()
436 {
437 global $tree, $ilAccess, $tpl, $ilTabs, $ilCtrl, $ilToolbar, $lng, $ilErr;
438
439 $ilCtrl->setParameter($this, "mep_mode", "listMedia");
440
441 $this->checkPermission("read");
442
443 $ilTabs->setTabActive("objs_fold");
444
445 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
446 {
447 $ilToolbar->addButton($lng->txt("mep_create_mob"),
448 $ilCtrl->getLinkTarget($this, "createMediaObject"));
449
450 $mset = new ilSetting("mobs");
451 if ($mset->get("mep_activate_pages"))
452 {
453 $ilToolbar->addButton($lng->txt("mep_create_content_snippet"),
454 $ilCtrl->getLinkTarget($this, "createMediaPoolPage"));
455 }
456
457 $ilToolbar->addButton($lng->txt("mep_create_folder"),
458 $ilCtrl->getLinkTarget($this, "createFolderForm"));
459
460 if (trim($mset->get("upload_dir")) != "" && ilMainMenuGUI::_checkAdministrationPermission())
461 {
462 $ilToolbar->addButton($lng->txt("mep_create_from_upload_dir"),
463 $ilCtrl->getLinkTargetByClass("ilfilesystemgui", "listFiles"));
464 }
465 }
466
467 // tree
468 include_once("./Modules/MediaPool/classes/class.ilMediaPoolExplorerGUI.php");
469 $exp = new ilMediaPoolExplorerGUI($this, "listMedia", $this->object);
470 if (!$exp->handleCommand())
471 {
472 $this->tpl->setLeftNavContent($exp->getHTML());
473 }
474 else
475 {
476 return;
477 }
478
479 include_once("./Modules/MediaPool/classes/class.ilMediaPoolTableGUI.php");
480 $mep_table_gui = new ilMediaPoolTableGUI($this, "listMedia", $this->object, "mepitem_id");
481 $tpl->setContent($mep_table_gui->getHTML());
482// $this->tpl->show();
483 }
484
488 function allMedia()
489 {
490 global $tree, $ilAccess, $tpl, $ilTabs, $ilCtrl,$ilUser;
491
492 $ilCtrl->setParameter($this, "mep_mode", "allMedia");
493
494 $this->checkPermission("read");
495 $ilTabs->setTabActive("mep_all_mobs");
496
497
498 include_once("./Modules/MediaPool/classes/class.ilMediaPoolTableGUI.php");
499 $mep_table_gui = new ilMediaPoolTableGUI($this, "allMedia", $this->object,
500 "mepitem_id", ilMediaPoolTableGUI::IL_MEP_EDIT, true);
501
502
503 if(isset($_GET['force_filter']) and $_GET['force_filter'])
504 {
505 $_POST['title'] = ilMediaPoolItem::lookupTitle((int) $_GET['force_filter']);
506
507 include_once("./Services/Table/classes/class.ilTablePropertiesStorage.php");
508 $tprop = new ilTablePropertiesStorage();
509 $tprop->storeProperty(
510 $mep_table_gui->getId(),
511 $ilUser->getId(),
512 'filter',
513 1
514 );
515 $mep_table_gui->resetFilter();
516 $mep_table_gui->resetOffset();
517 $mep_table_gui->writeFilterToSession();
518
519 // Read again
520 $mep_table_gui = new ilMediaPoolTableGUI($this, "allMedia", $this->object,
521 "mepitem_id", ilMediaPoolTableGUI::IL_MEP_EDIT, true);
522 }
523
524 $tpl->setContent($mep_table_gui->getHTML());
525// $this->tpl->show();
526 }
527
531 function applyFilter()
532 {
533 include_once("./Modules/MediaPool/classes/class.ilMediaPoolTableGUI.php");
534 $mtab = new ilMediaPoolTableGUI($this, "allMedia", $this->object,
535 "mepitem_id", ilMediaPoolTableGUI::IL_MEP_EDIT, true);
536 $mtab->writeFilterToSession();
537 $mtab->resetOffset();
538 $this->allMedia();
539 }
540
544 function resetFilter()
545 {
546 include_once("./Modules/MediaPool/classes/class.ilMediaPoolTableGUI.php");
547 $mtab = new ilMediaPoolTableGUI($this, "allMedia", $this->object,
548 "mepitem_id", ilMediaPoolTableGUI::IL_MEP_EDIT, true);
549 $mtab->resetFilter();
550 $mtab->resetOffset();
551 $this->allMedia();
552 }
553
557 function getTemplate()
558 {
559 $this->tpl->getStandardTemplate();
560 }
561
562
567 {
568 if ($_GET["mepitem_id"] == "")
569 {
570 return "";
571 }
572 $par_id = $this->object->tree->getParentId($_GET["mepitem_id"]);
573 if ($par_id != $this->object->tree->getRootId())
574 {
575 return $par_id;
576 }
577 else
578 {
579 return "";
580 }
581 }
582
586 protected function showMedia()
587 {
588 global $ilAccess;
589
590 $this->checkPermission("read");
591
592 $item = new ilMediaPoolItem((int) $_GET["mepitem_id"]);
593 $mob_id = $item->getForeignId();
594
595 $this->tpl = new ilTemplate("tpl.fullscreen.html", true, true, "Services/COPage");
596 include_once("Services/Style/classes/class.ilObjStyleSheet.php");
597 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
598 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
600
601
602 require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
603 require_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
605 $media_obj = new ilObjMediaObject((int) $mob_id);
606
607
608 $this->tpl->setVariable("TITLE", " - ".$media_obj->getTitle());
609
610 $xml = "<dummy>";
611 // todo: we get always the first alias now (problem if mob is used multiple
612 // times in page)
613 $xml.= $media_obj->getXML(IL_MODE_ALIAS);
614 $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
615 $xml.= $link_xml;
616 $xml.="</dummy>";
617
618 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
619 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
620 $xh = xslt_create();
621
622 $wb_path = ilUtil::getWebspaceDir("output")."/";
623
624 $mode = ($_GET["cmd"] != "showPreview")
625 ? "fullscreen"
626 : "media";
627 $enlarge_path = ilUtil::getImagePath("enlarge.svg", false, "output");
628 $fullscreen_link =
629 $this->ctrl->getLinkTarget($this, "showFullscreen", "", false, false);
630 $params = array ('mode' => $mode, 'enlarge_path' => $enlarge_path,
631 'link_params' => "ref_id=".$_GET["ref_id"],'fullscreen_link' => $fullscreen_link,
632 'ref_id' => $_GET["ref_id"], 'pg_frame' => $pg_frame, 'webspace_path' => $wb_path);
633 $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
634 echo xslt_error($xh);
635 xslt_free($xh);
636 // unmask user html
637 $this->tpl->setVariable("MEDIA_CONTENT", $output);
638 }
639
646 function showPage()
647 {
648 global $tpl;
649
650 $tpl = new ilTemplate("tpl.main.html", true, true);
651
652 include_once("./Services/Container/classes/class.ilContainerPage.php");
653 include_once("./Services/Container/classes/class.ilContainerPageGUI.php");
654
655 include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
656 $tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
657 $tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
659 $tpl->setCurrentBlock("SyntaxStyle");
660 $tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
662 $tpl->parseCurrentBlock();
663
664 // get page object
665 //include_once("./Services/Object/classes/class.ilObjectTranslation.php");
666 //$ot = ilObjectTranslation::getInstance($this->object->getId());
667 //$lang = $ot->getEffectiveContentLang($ilUser->getCurrentLanguage(), "cont");
668 include_once("./Modules/MediaPool/classes/class.ilMediaPoolPageGUI.php");
669 $page_gui = new ilMediaPoolPageGUI((int) $_GET["mepitem_id"]);
670 include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
671 //$page_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
672 // $this->object->getStyleSheetId(), $this->object->getType()));
673
674 $page_gui->setTemplateOutput(false);
675 $page_gui->setHeader("");
676 $ret = $page_gui->showPage(true);
677
678 $tpl->setBodyClass("ilMediaPoolPagePreviewBody");
679 $tpl->setVariable("CONTENT", $ret);
680 //$ret = "<div style='background-color: white; padding:5px; margin-bottom: 30px;'>".$ret."</div>";
681
682 //$ret =& $page_gui->executeCommand();
683 $tpl->show();
684 exit;
685 }
686
687
691 function showPreview()
692 {
693 $this->checkPermission("read");
694
695 $item = new ilMediaPoolItem((int) $_GET["mepitem_id"]);
696
697 switch ($item->getType())
698 {
699 case "mob":
700 $this->showMedia();
701 break;
702
703 case "pg":
704 $this->showPage();
705 break;
706 }
707 }
708
709
713 function showFullscreen()
714 {
715 $this->showMedia();
716 }
717
721 function confirmRemove()
722 {
723 global $ilAccess, $ilCtrl, $lng;
724
725 $this->checkPermission("write");
726
727 if(!isset($_POST["id"]))
728 {
729 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
730 }
731
732 // display confirmation message
733 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
734 $cgui = new ilConfirmationGUI();
735 $cgui->setFormAction($this->ctrl->getFormAction($this));
736 $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
737 $cgui->setCancel($this->lng->txt("cancel"), "cancelRemove");
738 $cgui->setConfirm($this->lng->txt("confirm"), "remove");
739
740 foreach($_POST["id"] as $obj_id)
741 {
744
745 // check whether page can be removed
746 $add = "";
747 if ($type == "pg")
748 {
749 include_once("./Services/COPage/classes/class.ilPageContentUsage.php");
750 $usages = ilPageContentUsage::getUsages("incl", $obj_id, false);
751 if (count($usages) > 0)
752 {
753 ilUtil::sendFailure(sprintf($lng->txt("mep_content_snippet_in_use"), $title), true);
754 $ilCtrl->redirect($this, "listMedia");
755 }
756 else
757 {
758 // check whether the snippet is used in older versions of pages
759 $usages = ilPageContentUsage::getUsages("incl", $obj_id, true);
760 if (count($usages) > 0)
761 {
762 $add = "<div class='small'>".$lng->txt("mep_content_snippet_used_in_older_versions")."</div>";
763 }
764 }
765 }
766
767 $caption = ilUtil::getImageTagByType($type, $this->tpl->tplPath).
768 " ".$title.$add;
769
770 $cgui->addItem("id[]", $obj_id, $caption);
771 }
772
773 $this->tpl->setContent($cgui->getHTML());
774 }
775
779 function openClipboard()
780 {
781 global $ilCtrl, $ilAccess;
782
783 $this->checkPermission("write");
784
785 $ilCtrl->setParameterByClass("ileditclipboardgui", "returnCommand",
786 rawurlencode($ilCtrl->getLinkTarget($this,
787 "insertFromClipboard", "", false, false)));
788 $ilCtrl->redirectByClass("ilEditClipboardGUI", "getObject");
789 }
790
791
796 {
797 global $ilAccess;
798
799 $this->checkPermission("write");
800
801 include_once("./Services/Clipboard/classes/class.ilEditClipboardGUI.php");
803 $not_inserted = array();
804 if (is_array($ids))
805 {
806 foreach ($ids as $id2)
807 {
808 $id = explode(":", $id2);
809 $type = $id[0];
810 $id = $id[1];
811
812 if ($type == "mob") // media object
813 {
814 if (ilObjMEdiaPool::isForeignIdInTree($this->object->getId(), $id))
815 {
816 $not_inserted[] = ilObject::_lookupTitle($id)." [".
817 $id."]";
818 }
819 else
820 {
821 $item = new ilMediaPoolItem();
822 $item->setType("mob");
823 $item->setForeignId($id);
824 $item->setTitle(ilObject::_lookupTitle($id));
825 $item->create();
826 if ($item->getId() > 0)
827 {
828 $this->object->insertInTree($item->getId(), $_GET["mepitem_id"]);
829 }
830 }
831 }
832 if ($type == "incl") // content snippet
833 {
834 include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
835 include_once("./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
836 if (ilObjMEdiaPool::isItemIdInTree($this->object->getId(), $id))
837 {
838 $not_inserted[] = ilMediaPoolPage::lookupTitle($id)." [".
839 $id."]";
840 }
841 else
842 {
843 $original = new ilMediaPoolPage($id);
844
845 // copy the page into the pool
846 $item = new ilMediaPoolItem();
847 $item->setType("pg");
848 $item->setTitle(ilMediaPoolItem::lookupTitle($id));
849 $item->create();
850 if ($item->getId() > 0)
851 {
852 $this->object->insertInTree($item->getId(), $_GET["mepitem_id"]);
853
854 // create page
855 include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
856 $page = new ilMediaPoolPage();
857 $page->setId($item->getId());
858 $page->setParentId($this->object->getId());
859 $page->create();
860
861 // copy content
862 $original->copy($page->getId(), $page->getParentType(), $page->getParentId(), true);
863
864 //$page->setXMLContent($original->copyXMLContent());
865 //$page->buildDom();
866 //$page->update();
867 }
868 }
869 }
870 }
871 }
872 if (count($not_inserted) > 0)
873 {
874 ilUtil::sendInfo($this->lng->txt("mep_not_insert_already_exist")."<br>".
875 implode($not_inserted,"<br>"), true);
876 }
877 $this->ctrl->redirect($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
878 }
879
880
884 function cancelRemove()
885 {
886 $this->ctrl->redirect($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
887 }
888
892 function remove()
893 {
894 global $ilAccess;
895
896 $this->checkPermission("write");
897
898 foreach($_POST["id"] as $obj_id)
899 {
900 $this->object->deleteChild($obj_id);
901 }
902
903 ilUtil::sendSuccess($this->lng->txt("cont_obj_removed"),true);
904 $this->ctrl->redirect($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
905 }
906
907
912 {
913 global $ilUser, $ilAccess;
914
915 $this->checkPermission("write");
916
917 if(!isset($_POST["id"]))
918 {
919 ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
920 $this->ctrl->redirect($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
921 }
922
923 foreach ($_POST["id"] as $obj_id)
924 {
926 if ($type == "fold")
927 {
928 ilUtil::sendFailure($this->lng->txt("cont_cant_copy_folders"), true);
929 $this->ctrl->redirect($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
930 }
931 }
932 foreach ($_POST["id"] as $obj_id)
933 {
936 if ($type == "mob")
937 {
938 $ilUser->addObjectToClipboard($fid, "mob", "");
939 }
940 if ($type == "pg")
941 {
942 $ilUser->addObjectToClipboard($obj_id, "incl", "");
943 }
944 }
945 ilUtil::sendSuccess($this->lng->txt("copied_to_clipboard"),true);
946 $this->ctrl->redirect($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia");
947 }
948
953 {
954 global $ilLocator, $ilAccess;
955
956 if (!$this->getCreationMode() && $this->ctrl->getCmd() != "explorer")
957 {
958 $tree =& $this->object->getTree();
959 $obj_id = ($_GET["mepitem_id"] == "")
960 ? $tree->getRootId()
961 : $_GET["mepitem_id"];
962 $path = $tree->getPathFull($obj_id);
963 foreach($path as $node)
964 {
965 if ($node["child"] == $tree->getRootId())
966 {
967 $this->ctrl->setParameter($this, "mepitem_id", "");
968 if ($ilAccess->checkAccess("read", "", $this->object->getRefId()))
969 {
970 $link = $this->ctrl->getLinkTarget($this, "listMedia");
971 }
972 else if ($ilAccess->checkAccess("visible", "", $this->object->getRefId()))
973 {
974 $link = $this->ctrl->getLinkTarget($this, "infoScreen");
975 }
976 $title = $this->object->getTitle();
977 $this->ctrl->setParameter($this, "mepitem_id", $_GET["mepitem_id"]);
978 $ilLocator->addItem($title, $link, "", $_GET["ref_id"]);
979 }
980 }
981 }
982 }
983
987
992 {
993 global $ilAccess, $tpl;
994
995 $this->checkPermission("write");
996
997 $this->initFolderForm("create");
998 $tpl->setContent($this->form->getHTML());
999
1000/* $folder_gui =& new ilObjFolderGUI("", 0, false, false);
1001 $this->ctrl->setParameterByClass("ilobjfoldergui", "obj_id", $_GET["obj_id"]);
1002 $folder_gui->setFormAction("save",
1003 $this->ctrl->getFormActionByClass("ilobjfoldergui"));
1004 $folder_gui->createObject();*/
1005// $this->tpl->show();
1006 }
1007
1014 function editFolder()
1015 {
1016 global $tpl;
1017
1018 $this->checkPermission("write");
1019
1020 $this->initFolderForm();
1021 $this->getFolderValues();
1022 $tpl->setContent($this->form->getHTML());
1023 }
1024
1028 public function getFolderValues()
1029 {
1030 $values = array();
1031
1032 $values["title"] = ilMediaPoolItem::lookupTitle($_GET["mepitem_id"]);
1033
1034 $this->form->setValuesByArray($values);
1035 }
1036
1040 public function saveFolder()
1041 {
1042 global $tpl, $lng, $ilCtrl;
1043
1044 $this->checkPermission("write");
1045
1046 $this->initFolderForm("create");
1047 if ($this->form->checkInput())
1048 {
1049 if ($this->object->createFolder($_POST["title"], (int) $_GET["mepitem_id"]))
1050 {
1051 ilUtil::sendSuccess($lng->txt("mep_folder_created"), true);
1052 }
1053 $ilCtrl->redirect($this, "listMedia");
1054 }
1055
1056 $this->form->setValuesByPost();
1057 $tpl->setContent($this->form->getHtml());
1058 }
1059
1063 function updateFolder()
1064 {
1065 global $lng, $ilCtrl, $tpl;
1066
1067 $this->checkPermission("write");
1068
1069 $this->initFolderForm("edit");
1070 if ($this->form->checkInput())
1071 {
1072 $item = new ilMediaPoolItem($_GET["mepitem_id"]);
1073 $item->setTitle($_POST["title"]);
1074 $item->update();
1075 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1076 $ilCtrl->setParameter($this, "mepitem_id",
1077 $this->object->getTree()->getParentId($_GET["mepitem_id"]));
1078 $ilCtrl->redirect($this, "listMedia");
1079 }
1080
1081 $this->form->setValuesByPost();
1082 $tpl->setContent($this->form->getHtml());
1083 }
1084
1090 public function initFolderForm($a_mode = "edit")
1091 {
1092 global $lng, $ilCtrl;
1093
1094 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1095 $this->form = new ilPropertyFormGUI();
1096
1097 // desc
1098 $ti = new ilTextInputGUI($lng->txt("title"), "title");
1099 $ti->setMaxLength(128);
1100 $ti->setRequired(true);
1101 $this->form->addItem($ti);
1102
1103 // save and cancel commands
1104 if ($a_mode == "create")
1105 {
1106 $this->form->addCommandButton("saveFolder", $lng->txt("save"));
1107 $this->form->addCommandButton("cancelSave", $lng->txt("cancel"));
1108 $this->form->setTitle($lng->txt("mep_new_folder"));
1109 }
1110 else
1111 {
1112 $this->form->addCommandButton("updateFolder", $lng->txt("save"));
1113 $this->form->addCommandButton("cancelFolderUpdate", $lng->txt("cancel"));
1114 $this->form->setTitle($lng->txt("mep_edit_folder"));
1115 }
1116
1117 $this->form->setFormAction($ilCtrl->getFormAction($this));
1118 }
1119
1124 {
1125 global $ilCtrl;
1126 $ilCtrl->setParameter($this, "mepitem_id",
1127 $this->object->getTree()->getParentId($_GET["mepitem_id"]));
1128 $ilCtrl->redirect($this, "listMedia");
1129 }
1130
1134 function cancelSave()
1135 {
1136 global $ilCtrl;
1137 $ilCtrl->redirect($this, "listMedia");
1138 }
1139
1143
1148 {
1149 global $tpl;
1150
1151 $this->checkPermission("write");
1152
1153 $this->initMediaPoolPageForm("create");
1154 $tpl->setContent($this->form->getHTML());
1155 }
1156
1164 {
1165 global $tpl;
1166
1167 $this->checkPermission("write");
1168
1169 $this->setMediaPoolPageTabs();
1170
1171 include_once("./Modules/MediaPool/classes/class.ilMediaPoolPageGUI.php");
1172 $mep_page_gui = new ilMediaPoolPageGUI($_GET["mepitem_id"], $_GET["old_nr"]);
1173 $mep_page_gui->getTabs();
1174
1175 $this->initMediaPoolPageForm("edit");
1176 $this->getMediaPoolPageValues();
1177 $tpl->setContent($this->form->getHTML());
1178 }
1179
1183 public function saveMediaPoolPage()
1184 {
1185 global $tpl, $lng, $ilCtrl;
1186
1187 $this->checkPermission("write");
1188
1189 $this->initMediaPoolPageForm("create");
1190 if ($this->form->checkInput())
1191 {
1192 // create media pool item
1193 include_once("./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
1194 $item = new ilMediaPoolItem();
1195 $item->setTitle($_POST["title"]);
1196 $item->setType("pg");
1197 $item->create();
1198
1199 if ($item->getId() > 0)
1200 {
1201 // put in tree
1202 $tree = $this->object->getTree();
1203 $parent = $_GET["mepitem_id"] > 0
1204 ? $_GET["mepitem_id"]
1205 : $tree->getRootId();
1206 $this->object->insertInTree($item->getId(), $parent);
1207
1208 // create page
1209 include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
1210 $page = new ilMediaPoolPage();
1211 $page->setId($item->getId());
1212 $page->setParentId($this->object->getId());
1213 $page->create();
1214
1215 $ilCtrl->setParameterByClass("ilmediapoolpagegui", "mepitem_id", $item->getId());
1216 $ilCtrl->redirectByClass("ilmediapoolpagegui", "edit");
1217
1218 }
1219 $ilCtrl->redirect($this, "listMedia");
1220 }
1221
1222 $this->form->setValuesByPost();
1223 $tpl->setContent($this->form->getHtml());
1224 }
1225
1230 {
1231 global $lng, $ilCtrl, $tpl;
1232
1233 $this->checkPermission("write");
1234
1235 $this->initMediaPoolPageForm("edit");
1236 if ($this->form->checkInput())
1237 {
1238 $item = new ilMediaPoolItem($_GET["mepitem_id"]);
1239 $item->setTitle($_POST["title"]);
1240 $item->update();
1241 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1242 $ilCtrl->redirect($this, "editMediaPoolPage");
1243 }
1244
1245 $this->form->setValuesByPost();
1246 $tpl->setContent($this->form->getHtml());
1247 }
1253 public function initMediaPoolPageForm($a_mode = "edit")
1254 {
1255 global $lng, $ilCtrl;
1256
1257 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1258 $this->form = new ilPropertyFormGUI();
1259
1260 // title
1261 $ti = new ilTextInputGUI($lng->txt("title"), "title");
1262 $ti->setMaxLength(128);
1263 $ti->setRequired(true);
1264 $this->form->addItem($ti);
1265
1266 // save and cancel commands
1267 if ($a_mode == "create")
1268 {
1269 $this->form->addCommandButton("saveMediaPoolPage", $lng->txt("save"));
1270 $this->form->addCommandButton("cancelSave", $lng->txt("cancel"));
1271 $this->form->setTitle($lng->txt("mep_new_content_snippet"));
1272 }
1273 else
1274 {
1275 $this->form->addCommandButton("updateMediaPoolPage", $lng->txt("save"));
1276 $this->form->setTitle($lng->txt("mep_edit_content_snippet"));
1277 }
1278
1279 $this->form->setFormAction($ilCtrl->getFormAction($this));
1280 }
1281
1285 public function getMediaPoolPageValues()
1286 {
1287 $values = array();
1288
1289 include_once("./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
1290 $values["title"] = ilMediaPoolItem::lookupTitle($_GET["mepitem_id"]);
1291
1292 $this->form->setValuesByArray($values);
1293 }
1294
1302 {
1303 global $ilTabs, $ilCtrl, $lng;
1304
1305 $ilTabs->clearTargets();
1306 //$ilTabs->addTab("mep_pg_prop", $lng->txt("mep_page_properties"),
1307 // $ilCtrl->getLinkTarget($this, "editMediaPoolPage"));
1308 $ilTabs->addTarget("mep_page_properties", $ilCtrl->getLinkTarget($this, "editMediaPoolPage"),
1309 "editMediaPoolPage", get_class($this));
1310 $ilTabs->addTarget("cont_usage", $ilCtrl->getLinkTarget($this, "showMediaPoolPageUsages"),
1311 array("showMediaPoolPageUsages", "showAllMediaPoolPageUsages"), get_class($this));
1312 $ilCtrl->setParameter($this, "mepitem_id", $this->object->tree->getParentId($_GET["mepitem_id"]));
1313 $ilTabs->setBackTarget($lng->txt("mep_folder"), $ilCtrl->getLinkTarget($this, "listMedia"));
1314 $ilCtrl->setParameter($this, "mepitem_id", $_GET["mepitem_id"]);
1315 }
1316
1321 {
1322 $this->showMediaPoolPageUsages(true);
1323 }
1324
1325
1329 function showMediaPoolPageUsages($a_all = false)
1330 {
1331 global $ilTabs, $ilCtrl, $lng, $tpl;
1332
1333 $this->checkPermission("write");
1334
1335 $this->setMediaPoolPageTabs();
1336
1337 $ilTabs->addSubTab("current_usages", $lng->txt("cont_current_usages"),
1338 $ilCtrl->getLinkTarget($this, "showMediaPoolPageUsages"));
1339
1340 $ilTabs->addSubTab("all_usages", $lng->txt("cont_all_usages"),
1341 $ilCtrl->getLinkTarget($this, "showAllMediaPoolPageUsages"));
1342
1343 if ($a_all)
1344 {
1345 $ilTabs->activateSubTab("all_usages");
1346 $cmd = "showAllMediaPoolPageUsages";
1347 }
1348 else
1349 {
1350 $ilTabs->activateSubTab("current_usages");
1351 $cmd = "showMediaPoolPageUsages";
1352 }
1353
1354
1355 include_once("./Modules/MediaPool/classes/class.ilMediaPoolPageGUI.php");
1356 $mep_page_gui = new ilMediaPoolPageGUI($_GET["mepitem_id"], $_GET["old_nr"]);
1357 $mep_page_gui->getTabs();
1358
1359 include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
1360 $page = new ilMediaPoolPage((int) $_GET["mepitem_id"]);
1361
1362 include_once("./Modules/MediaPool/classes/class.ilMediaPoolPageUsagesTableGUI.php");
1363 $table = new ilMediaPoolPageUsagesTableGUI($this, $cmd, $page, $a_all);
1364
1365 $tpl->setContent($table->getHTML());
1366
1367 }
1368
1369
1373
1377 function setTabs()
1378 {
1379 global $ilAccess, $ilTabs, $ilCtrl, $ilHelp;
1380
1381 $ilHelp->setScreenIdComponent("mep");
1382
1383 if ($ilAccess->checkAccess('read', '', $this->ref_id) ||
1384 $ilAccess->checkAccess('write', '', $this->ref_id))
1385 {
1386 $ilTabs->addTarget("objs_fold", $this->ctrl->getLinkTarget($this, ""),
1387 "listMedia", "", "_top");
1388
1389 $ilCtrl->setParameter($this, "mepitem_id", "");
1390 $ilTabs->addTarget("mep_all_mobs", $this->ctrl->getLinkTarget($this, "allMedia"),
1391 "allMedia", "", "_top");
1392 $ilCtrl->setParameter($this, "mepitem_id", $_GET["mepitem_id"]);
1393 }
1394
1395 // info tab
1396 if ($ilAccess->checkAccess('visible', '', $this->ref_id) ||
1397 $ilAccess->checkAccess('read', '', $this->ref_id) ||
1398 $ilAccess->checkAccess('write', '', $this->ref_id))
1399 {
1400 $force_active = ($this->ctrl->getNextClass() == "ilinfoscreengui"
1401 || strtolower($_GET["cmdClass"]) == "ilnotegui")
1402 ? true
1403 : false;
1404 //echo "-$force_active-";
1405 $ilTabs->addTarget("info_short",
1406 $this->ctrl->getLinkTargetByClass(
1407 array("ilobjmediapoolgui", "ilinfoscreengui"), "showSummary"),
1408 array("showSummary", "infoScreen"),
1409 "", "", $force_active);
1410 }
1411
1412 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
1413 {
1414 $ilTabs->addTarget("settings", $this->ctrl->getLinkTarget($this, "edit"),
1415 "edit", array("", "ilobjmediapoolgui"));
1416 }
1417
1418 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
1419 {
1420 $ilTabs->addTarget("clipboard", $this->ctrl->getLinkTarget($this, "openClipboard"),
1421 "view", "ileditclipboardgui");
1422 }
1423
1424 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
1425 {
1426 $ilTabs->addTarget("export", $this->ctrl->getLinkTargetByClass("ilexportgui", ""),
1427 "", "ilexportgui");
1428
1429 $ilTabs->addTarget("import", $this->ctrl->getLinkTargetByClass("ilmediapoolimportgui", ""),
1430 "", "ilmediapoolimportgui");
1431 }
1432
1433 if ($ilAccess->checkAccess("edit_permission", "", $this->object->getRefId()))
1434 {
1435 $ilTabs->addTarget("perm_settings",
1436 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
1437 }
1438
1439 }
1440
1447 function setSettingsSubTabs($a_active)
1448 {
1449 global $ilTabs, $lng, $ilAccess;
1450
1451 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
1452 {
1453 $ilTabs->addSubTab("settings",
1454 $lng->txt("settings"),
1455 $this->ctrl->getLinkTarget($this, "edit"));
1456
1457 $mset = new ilSetting("mobs");
1458 if ($mset->get("mep_activate_pages"))
1459 {
1460 $ilTabs->addSubTabTarget("obj_multilinguality",
1461 $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", ""));
1462 }
1463 }
1464
1465 $ilTabs->setSubTabActive($a_active);
1466 }
1467
1468
1472 public static function _goto($a_target)
1473 {
1474 global $ilAccess, $ilErr, $lng;
1475
1476 $targets = explode('_',$a_target);
1477 if(count((array) $targets) > 1)
1478 {
1479 $ref_id = $targets[0];
1480 $subitem_id = $targets[1];
1481 }
1482 else
1483 {
1484 $ref_id = $targets[0];
1485 }
1486
1487 if ($ilAccess->checkAccess("read", "", $ref_id))
1488 {
1489 $_GET["baseClass"] = "ilMediaPoolPresentationGUI";
1490 $_GET["ref_id"] = $ref_id;
1491 $_GET['mepitem_id'] = $subitem_id;
1492 include("ilias.php");
1493 exit;
1494 } else if ($ilAccess->checkAccess("visible", "", $ref_id))
1495 {
1496 $_GET["baseClass"] = "ilMediaPoolPresentationGUI";
1497 $_GET["ref_id"] = $ref_id;
1498 $_GET["cmd"] = "infoScreen";
1499 include("ilias.php");
1500 exit;
1501 }
1502 else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
1503 {
1504 ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
1507 }
1508
1509 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1510 }
1511
1518 {
1519 $this->ctrl->setCmd("showSummary");
1520 $this->ctrl->setCmdClass("ilinfoscreengui");
1521 $this->infoScreen();
1522 }
1523
1527 function infoScreen()
1528 {
1529 global $ilAccess;
1530
1531 if (!$ilAccess->checkAccess("visible", "", $this->ref_id) &&
1532 !$ilAccess->checkAccess("read", "", $this->ref_id) &&
1533 !$ilAccess->checkAccess("write", "", $this->ref_id))
1534 {
1535 $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
1536 }
1537
1538 if ($this->ctrl->getCmd() == "infoScreen")
1539 {
1540 $this->ctrl->setCmd("showSummary");
1541 $this->ctrl->setCmdClass("ilinfoscreengui");
1542 }
1543
1544 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1545 $info = new ilInfoScreenGUI($this);
1546
1547 $info->enablePrivateNotes();
1548
1549 if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
1550 {
1551 //$info->enableNews();
1552 }
1553
1554 // no news editing for files, just notifications
1555// $info->enableNewsEditing(false);
1556 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
1557 {
1558// $news_set = new ilSetting("news");
1559// $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1560
1561// if ($enable_internal_rss)
1562// {
1563// $info->setBlockProperty("news", "settings", true);
1564// $info->setBlockProperty("news", "public_notifications_option", true);
1565// }
1566 }
1567
1568
1569 // standard meta data
1570 $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
1571
1572 // forward the command
1573 $this->ctrl->forwardCommand($info);
1574
1575// $this->tpl->show();
1576 }
1577
1578
1582
1586 function selectUploadDirFiles($a_files = null)
1587 {
1588 global $tpl, $ilTabs, $lng, $ilCtrl, $ilToolbar;
1589
1590 if(!$a_files)
1591 {
1592 $a_files = $_POST["file"];
1593 }
1594
1595 $ilTabs->clearTargets();
1596 $ilTabs->setBackTarget($lng->txt("back"),
1597 $ilCtrl->getLinkTarget($this, "listMedia"));
1598
1599 $this->checkPermission("write");
1600
1602 {
1603
1604 // action type
1605 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
1606 $options = array(
1607 "rename" => $lng->txt("mep_up_dir_move"),
1608 "copy" => $lng->txt("mep_up_dir_copy"),
1609 );
1610 $si = new ilSelectInputGUI("", "action");
1611 $si->setOptions($options);
1612 $ilToolbar->addInputItem($si);
1613 $ilToolbar->setCloseFormTag(false);
1614 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
1615 $ilToolbar->setFormName("mep_up_form");
1616
1617 include_once("./Modules/MediaPool/classes/class.ilUploadDirFilesTableGUI.php");
1618 $tab = new ilUploadDirFilesTableGUI($this, "selectUploadDirFiles",
1619 $a_files);
1620 $tab->setFormName("mep_up_form");
1621 $tpl->setContent($tab->getHTML());
1622 }
1623 }
1624
1629 {
1630 $this->checkPermission("write");
1631
1632 $mset = new ilSetting("mobs");
1633 $upload_dir = trim($mset->get("upload_dir"));
1634
1635 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1636
1637 if (is_array($_POST["file"]) && ilMainMenuGUI::_checkAdministrationPermission())
1638 {
1639 foreach ($_POST["file"] as $f)
1640 {
1641 $f = str_replace("..", "", $f);
1642 $fullpath = $upload_dir."/".$f;
1643 $mob = new ilObjMediaObject();
1644 $mob->setTitle(basename($fullpath));
1645 $mob->setDescription("");
1646 $mob->create();
1647
1648 // determine and create mob directory, move uploaded file to directory
1649 //$mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$a_mob->getId();
1650 $mob->createDirectory();
1651 $mob_dir = ilObjMediaObject::_getDirectory($mob->getId());
1652
1653 $media_item = new ilMediaItem();
1654 $mob->addMediaItem($media_item);
1655 $media_item->setPurpose("Standard");
1656
1657 $file = $mob_dir."/".basename($fullpath);
1658 ilUtil::moveUploadedFile($fullpath,
1659 basename($fullpath), $file, false, $_POST["action"]);
1660
1661 // get mime type
1663 $location = basename($fullpath);
1664
1665 // set real meta and object data
1666 $media_item->setFormat($format);
1667 $media_item->setLocation($location);
1668 $media_item->setLocationType("LocalFile");
1669
1670 $mob->setDescription($format);
1671
1672 // determine width and height of known image types
1674 "File", $mob_dir."/".$location, $media_item->getLocation(),
1675 true, true, "", "");
1676 $media_item->setWidth($wh["width"]);
1677 $media_item->setHeight($wh["height"]);
1678 if ($wh["info"] != "")
1679 {
1680 // ilUtil::sendInfo($wh["info"], true);
1681 }
1682
1683 $media_item->setHAlign("Left");
1684 ilUtil::renameExecutables($mob_dir);
1685 $mob->update();
1686
1687
1688 // put it into current folder
1689 $mep_item = new ilMediaPoolItem();
1690 $mep_item->setTitle($mob->getTitle());
1691 $mep_item->setType("mob");
1692 $mep_item->setForeignId($mob->getId());
1693 $mep_item->create();
1694
1695 $tree = $this->object->getTree();
1696 $parent = ($_GET["mepitem_id"] == "")
1697 ? $tree->getRootId()
1698 : $_GET["mepitem_id"];
1699 $tree->insertNode($mep_item->getId(), $parent);
1700 }
1701 }
1702 ilUtil::redirect("ilias.php?baseClass=ilMediaPoolPresentationGUI&cmd=listMedia&ref_id=".
1703 $_GET["ref_id"]."&mepitem_id=".$_GET["mepitem_id"]);
1704
1705 }
1706
1710 static function getPreviewModalHTML($a_mpool_ref_id, $a_tpl)
1711 {
1712 global $tpl, $ilCtrl, $lng;
1713
1714 require_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1716
1717 $tpl->addJavaScript("./Modules/MediaPool/js/ilMediaPool.js");
1718
1719 $ilCtrl->setParameterByClass("ilobjmediapoolgui", "mepitem_id", "");
1720 $ilCtrl->setParameterByClass("ilobjmediapoolgui", "ref_id", $a_mpool_ref_id);
1721 $tpl->addOnloadCode("il.MediaPool.setPreviewUrl('".$ilCtrl->getLinkTargetByClass(array("ilmediapoolpresentationgui", "ilobjmediapoolgui"), "showPreview", "", false, false)."');");
1722 $ilCtrl->setParameterByClass("ilobjmediapoolgui", "mepitem_id", $_GET["mepitem_id"]);
1723 $ilCtrl->setParameterByClass("ilobjmediapoolgui", "ref_id", $_GET["red_id"]);
1724
1725 include_once("./Services/UIComponent/Modal/classes/class.ilModalGUI.php");
1726 $modal = ilModalGUI::getInstance();
1727 $modal->setHeading($lng->txt("preview"));
1728 $modal->setId("ilMepPreview");
1729 $modal->setType(ilModalGUI::TYPE_LARGE);
1730 $modal->setBody("<iframe id='ilMepPreviewContent'></iframe>");
1731
1732 return $modal->getHTML();
1733 }
1734
1738 function export()
1739 {
1740 $ot = ilObjectTranslation::getInstance($this->object->getId());
1741 $opt = "";
1742 if ($ot->getContentActivated())
1743 {
1744 $format = explode("_", $_POST["format"]);
1745 $opt = ilUtil::stripSlashes($format[1]);
1746 }
1747
1748 $this->object->exportXML(($opt == "master"));
1749 }
1750
1751}
1752?>
print $file
$location
Definition: buildRTE.php:44
$_GET["client_id"]
const IL_MODE_ALIAS
const IL_MODE_OUTPUT
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Confirmation screen class.
Class ilEditClipboardGUI.
Export User Interface Class.
File System Explorer GUI class.
Class ilInfoScreenGUI.
Class ilMediaItem.
Media pool explorer GUI class.
Import related features for media pools (currently used for translation imports)
static lookupForeignId($a_id)
Lookup Foreign Id.
static lookupType($a_id)
Lookup type.
static lookupTitle($a_id)
Lookup title.
Class ilMediaPoolPage GUI class.
TableGUI class for media pool page usages listing.
Class ilMediaPoolPage.
static lookupTitle($a_page_id)
Lookup title.
TableGUI class for recent changes in wiki.
static getInstance()
Get instance.
This class represents a number property in a property form.
Class ilObjFolderGUI.
Class ilObjMediaObjectGUI.
includePresentationJS($a_tpl=null)
Include media object presentation JS.
Class ilObjMediaObject.
_getDirectory($a_mob_id)
get directory for files of media object (static)
static getMimeType($a_file, $a_external=false)
get mime type for file
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.
User Interface class for media pool objects.
cancelRemove()
cancel deletion of media objects/folders
getTemplate()
Get standard template.
afterSave($newObj)
save object
showMedia()
show media object
addLocatorItems()
add locator items for media pool
getFolderValues()
Get current values for folder from.
showFullscreen()
show fullscreen
allMedia()
list all objects
openClipboard()
paste from clipboard
createMediaFromUploadDir()
Create media object from upload directory.
getParentFolderId()
Get folder parent ID.
setSettingsSubTabs($a_active)
Set setting sub tabs.
confirmRemove()
confirm remove of mobs
saveMediaPoolPage()
Save media pool page.
getMediaPoolPageValues()
Get current values for media pool page from.
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
initMediaPoolPageForm($a_mode="edit")
Init page form.
static _goto($a_target)
goto target media pool
showMediaPoolPageUsages($a_all=false)
List usages of the contnet snippet.
showPreview()
Show content snippet.
saveFolder()
Save folder form.
initFolderForm($a_mode="edit")
Init folder form.
updateCustom(ilPropertyFormGUI $a_form)
Insert custom update form values into object.
setMediaPoolPageTabs()
Set media pool page tabs.
editMediaPoolPage()
Edit media pool page.
getEditFormCustomValues(array &$a_values)
Add values to custom edit fields.
initEditCustomForm(ilPropertyFormGUI $a_form)
Add custom fields to update form.
infoScreen()
show information screen
& executeCommand()
execute command
initCreationForms($a_new_type)
Init creation froms.
createFolderForm()
create folder form
export()
export content object
showAllMediaPoolPageUsages()
List usages of the contnet snippet.
selectUploadDirFiles($a_files=null)
Select files from upload directory.
static getPreviewModalHTML($a_mpool_ref_id, $a_tpl)
Get preview modal html.
insertFromClipboard()
insert media object from clipboard
copyToClipboard()
copy media objects to clipboard
updateMediaPoolPage()
Update media pool page.
listMedia()
list media objects
afterConstructor()
Initialisation.
createMediaPoolPage()
Create new content snippet.
getContentStylePath($a_style_id)
get content style path
getSyntaxStylePath()
get syntax style path
New implementation of ilObjectGUI.
prepareOutput()
prepare output
checkPermission($a_perm, $a_cmd="")
setCreationMode($a_mode=true)
if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class!...
getCreationMode()
get creation mode
setLocator()
set Locator
initImportForm($a_new_type)
Init object import form.
initCreateForm($a_new_type)
Init object creation form.
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
addHeaderAction()
Add header action menu.
GUI class for object translation handling.
static getInstance($a_obj_id)
Get instance.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
getUsages($a_pc_type, $a_pc_id, $a_incl_hist=true)
Get usages.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a property form user interface.
addItem($a_item)
Add Item (Property, SectionHeader).
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
This class represents a selection list property in a property form.
ILIAS Setting Class.
Saves (mostly asynchronously) user properties of tables (e.g.
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
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...
static getWebspaceDir($mode="filesystem")
get webspace directory
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static redirect($a_script)
http redirect to other script
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
$_POST['username']
Definition: cron.php:12
$params
Definition: example_049.php:96
$info
Definition: example_052.php:80
global $ilCtrl
Definition: ilias.php:18
xslt_error(&$proc)
xslt_free(&$proc)
xslt_create()
exit
Definition: login.php:54
redirection script todo: (a better solution should control the processing via a xml file)
$cmd
Definition: sahs_server.php:35
$path
Definition: index.php:22
if(!is_array($argv)) $options
global $ilUser
Definition: imgupload.php:15