ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjMediaPoolGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 
25 include_once("./classes/class.ilObjectGUI.php");
26 include_once("./Modules/MediaPool/classes/class.ilObjMediaPool.php");
27 include_once("./Services/Table/classes/class.ilTableGUI.php");
28 include_once("./Modules/Folder/classes/class.ilObjFolderGUI.php");
29 include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
30 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
31 include_once("./Services/Clipboard/classes/class.ilEditClipboardGUI.php");
32 
33 
47 {
49 
55  function ilObjMediaPoolGUI($a_data,$a_id = 0,$a_call_by_reference = true, $a_prepare_output = false)
56  {
57  global $lng, $ilCtrl, $lng;
58 
59 //echo "<br>ilobjmediapoolgui-constructor-id-$a_id";
60 
61  $this->ctrl =& $ilCtrl;
62  $lng->loadLanguageModule("mep");
63 
64  if ($this->ctrl->getCmd() == "explorer")
65  {
66  $this->ctrl->saveParameter($this, array("ref_id"));
67  }
68  else
69  {
70  $this->ctrl->saveParameter($this, array("ref_id", "obj_id"));
71  }
72 
73  $this->type = "mep";
74  $lng->loadLanguageModule("content");
75  parent::ilObjectGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
76 
77  $this->output_prepared = $a_prepare_output;
78 
79  }
80 
84  function &executeCommand()
85  {
86  global $ilTabs, $lng;
87 
88  if ($this->ctrl->getRedirectSource() == "ilinternallinkgui")
89  {
90  $this->explorer();
91  return;
92  }
93 
94  $next_class = $this->ctrl->getNextClass($this);
95  $cmd = $this->ctrl->getCmd();
96 
97  $new_type = $_POST["new_type"]
98  ? $_POST["new_type"]
99  : $_GET["new_type"];
100 
101  if ($new_type != "" && ($cmd != "confirmRemove" && $cmd != "copyToClipboard"
102  && $cmd != "pasteFromClipboard"))
103  {
104  $this->setCreationMode(true);
105  }
106 
107  if (!$this->getCreationMode())
108  {
109  $tree =& $this->object->getTree();
110  if ($_GET["obj_id"] == "")
111  {
112  $_GET["obj_id"] = $tree->getRootId();
113  }
114  }
115 
116  if ($cmd == "create")
117  {
118  switch($_POST["new_type"])
119  {
120  case "mob":
121  $this->ctrl->redirectByClass("ilobjmediaobjectgui", "create");
122  break;
123 
124  case "fold":
125  $this->ctrl->redirectByClass("ilobjfoldergui", "create");
126  break;
127  }
128  }
129 
130  switch($next_class)
131  {
132  case "ilobjmediaobjectgui":
133 
134  //$cmd.="Object";
135  if ($cmd == "create" || $cmd == "save" || $cmd == "cancel")
136  {
137  $ret_obj = $_GET["obj_id"];
138  $ilObjMediaObjectGUI =& new ilObjMediaObjectGUI("", 0, false, false);
139  }
140  else
141  {
142  $ret_obj = $tree->getParentId($_GET["obj_id"]);
143  $ilObjMediaObjectGUI =& new ilObjMediaObjectGUI("", $_GET["obj_id"], false, false);
144  $this->ctrl->setParameter($this, "obj_id", $this->getParentFolderId());
145  $ilTabs->setBackTarget($lng->txt("back"),
146  $this->ctrl->getLinkTarget($this, "listMedia"));
147  }
148  if ($this->ctrl->getCmdClass() == "ilinternallinkgui")
149  {
150  $this->ctrl->setReturn($this, "explorer");
151  }
152  else
153  {
154  $this->ctrl->setParameter($this, "obj_id", $ret_obj);
155  $this->ctrl->setReturn($this, "listMedia");
156  $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
157  }
158  $this->getTemplate();
159  $ilObjMediaObjectGUI->setAdminTabs();
160  $this->setLocator();
161 
162 //echo ":".$tree->getParentId($_GET["obj_id"]).":";
163  //$ret =& $ilObjMediaObjectGUI->executeCommand();
164  $ret =& $this->ctrl->forwardCommand($ilObjMediaObjectGUI);
165 
166 //echo "<br>ilObjMediaPoolGUI:afterexecute:<br>"; exit;
167  switch($cmd)
168  {
169  case "save":
170  $parent = ($_GET["obj_id"] == "")
171  ? $tree->getRootId()
172  : $_GET["obj_id"];
173  $tree->insertNode($ret->getId(), $parent);
174  ilUtil::redirect("ilias.php?baseClass=ilMediaPoolPresentationGUI&cmd=listMedia&ref_id=".
175  $_GET["ref_id"]."&obj_id=".$_GET["obj_id"]);
176  break;
177 
178  default:
179  $this->tpl->show();
180  break;
181  }
182  break;
183 
184  case "ilobjfoldergui":
185  $folder_gui = new ilObjFolderGUI("", 0, false, false);
186  $this->ctrl->setReturn($this, "listMedia");
187  $cmd.="Object";
188 //echo "-$cmd-";
189  switch($cmd)
190  {
191  case "createObject":
192  $this->prepareOutput();
193  $folder_gui =& new ilObjFolderGUI("", 0, false, false);
194  $folder_gui->setFormAction("save",
195  $this->ctrl->getFormActionByClass("ilobjfoldergui"));
196  $folder_gui->createObject();
197  $this->tpl->show();
198  break;
199 
200  case "saveObject":
201  //$folder_gui->setReturnLocation("save", $this->ctrl->getLinkTarget($this, "listMedia"));
202  $parent = ($_GET["obj_id"] == "")
203  ? $tree->getRootId()
204  : $_GET["obj_id"];
205  $folder_gui->setFolderTree($tree);
206  $folder_gui->saveObject($parent);
207  //$this->ctrl->redirect($this, "listMedia");
208  break;
209 
210  case "editObject":
211  $this->prepareOutput();
212  $folder_gui =& new ilObjFolderGUI("", $_GET["obj_id"], false, false);
213  $this->ctrl->setParameter($this, "foldereditmode", "1");
214  $folder_gui->setFormAction("update", $this->ctrl->getFormActionByClass("ilobjfoldergui"));
215  $folder_gui->editObject();
216  $this->tpl->show();
217  break;
218 
219  case "updateObject":
220  $folder_gui =& new ilObjFolderGUI("", $_GET["obj_id"], false, false);
221  $this->ctrl->setParameter($this, "obj_id", $this->getParentFolderId());
222  $this->ctrl->setReturn($this, "listMedia");
223  $folder_gui->updateObject(true); // this returns to parent
224  break;
225 
226  case "cancelObject":
227  ilUtil::sendInfo($this->lng->txt("action_aborted"), true);
228  if ($_GET["foldereditmode"])
229  {
230  $this->ctrl->setParameter($this, "obj_id", $this->getParentFolderId());
231  }
232  $this->ctrl->redirect($this, "listMedia");
233  break;
234  }
235  break;
236 
237  case "ileditclipboardgui":
238  $this->prepareOutput();
239  $this->ctrl->setReturn($this, "listMedia");
240  $clip_gui = new ilEditClipboardGUI();
241  $clip_gui->setMultipleSelections(true);
242  $clip_gui->setInsertButtonTitle($lng->txt("mep_copy_to_mep"));
243  $ilTabs->setTabActive("clipboard");
244  //$ret =& $clip_gui->executeCommand();
245  $ret =& $this->ctrl->forwardCommand($clip_gui);
246  $this->tpl->show();
247  break;
248 
249  case 'ilinfoscreengui':
250  $this->prepareOutput();
251  $this->infoScreen();
252  break;
253 
254  case 'ilpermissiongui':
255  $this->prepareOutput();
256  include_once("./classes/class.ilPermissionGUI.php");
257  $perm_gui =& new ilPermissionGUI($this);
258  $ret =& $this->ctrl->forwardCommand($perm_gui);
259  $this->tpl->show();
260  break;
261 
262  default:
263  $this->prepareOutput();
264  $cmd = $this->ctrl->getCmd("frameset");
265  if ($this->creation_mode)
266  {
267  $cmd.= "Object";
268  }
269  $this->$cmd();
270  break;
271  }
272  }
273 
274  function createObject()
275  {
277  $this->tpl->setVariable("TARGET", ' target="'.
278  ilFrameTargetInfo::_getFrame("MainContent").'" ');
279  }
280 
281  function createMediaObject()
282  {
283  $this->ctrl->redirectByClass("ilobjmediaobjectgui", "create");
284  }
285 
286  // for admin compatiblity
287  function view()
288  {
289  $this->viewObject();
290  }
291 
296  function saveObject()
297  {
298  global $rbacadmin;
299 
300  // create and insert forum in objecttree
301  $newObj = parent::saveObject();
302 
303  // setup rolefolder & default local roles
304  //$roles = $newObj->initDefaultRoles();
305 
306  // ...finally assign role to creator of object
307  //$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "y");
308 
309  // put here object specific stuff
310 
311  // always send a message
312  ilUtil::sendInfo($this->lng->txt("object_added"),true);
313 
314  //ilUtil::redirect($this->getReturnLocation("save","adm_object.php?".$this->link_params));
315  ilUtil::redirect("ilias.php?baseClass=ilMediaPoolPresentationGUI&ref_id=".$newObj->getRefId());
316 
317  }
318 
324  function editObject()
325  {
326  global $ilAccess, $tree, $tpl;
327 
328  if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()))
329  {
330  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
331  }
332 
333  // edit button
334  $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
335 
337  }
338 
342  function edit()
343  {
344  $this->editObject();
345  $this->tpl->show();
346  }
347 
351  function cancel()
352  {
353  $this->ctrl->redirect($this, "listMedia");
354  }
355 
361  function cancelObject($in_rep = false)
362  {
363  ilUtil::sendInfo($this->lng->txt("msg_cancel"),true);
364  ilUtil::redirect("repository.php?cmd=frameset&ref_id=".$_GET["ref_id"]);
365  //$this->ctrl->redirectByClass("ilrepositorygui", "frameset");
366  }
367 
368 
372  function update()
373  {
374  global $ilAccess;
375 
376  if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()))
377  {
378  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
379  }
380 
381  $this->updateObject();
382  }
383 
384  function afterUpdate()
385  {
386  $this->ctrl->redirect($this, "listMedia");
387  }
388 
392  function listMedia()
393  {
394  global $tree, $ilAccess, $tpl;
395 
396  if (!$ilAccess->checkAccess("read", "", $this->object->getRefId()))
397  {
398  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
399  }
400 
401  include_once("./Modules/MediaPool/classes/class.ilMediaPoolTableGUI.php");
402  $mep_table_gui = new ilMediaPoolTableGUI($this, "listMedia", $this->object);
403  $tpl->setContent($mep_table_gui->getHTML());
404  $this->tpl->show();
405  }
406 
410  function getTemplate()
411  {
412  $this->tpl->getStandardTemplate();
413  }
414 
415 
419  function getParentFolderId()
420  {
421  if ($_GET["obj_id"] == "")
422  {
423  return "";
424  }
425  $par_id = $this->object->tree->getParentId($_GET["obj_id"]);
426  if ($par_id != $this->object->tree->getRootId())
427  {
428  return $par_id;
429  }
430  else
431  {
432  return "";
433  }
434  }
435 
440  function showUpperIcon()
441  {
442  global $tpl;
443 
444  if ($this->ctrl->getCmd() == "explorer")
445  {
446  return;
447  }
448 
450 
451  $mep_tree =& $this->object->getTree();
452  if ($_GET["obj_id"] != "" && $_GET["obj_id"] != $mep_tree->getRootId())
453  {
454  $this->ctrl->setParameter($this, "obj_id",
455  $this->getParentFolderId());
456  $tpl->setUpperIcon($this->ctrl->getLinkTarget($this, "listMedia"));
457  $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
458  }
459  }
460 
466  function frameset()
467  {
468  include_once("Services/Frameset/classes/class.ilFramesetGUI.php");
469  $fs_gui = new ilFramesetGUI();
470  $fs_gui->setMainFrameName("content");
471  $fs_gui->setSideFrameName("tree");
472  $fs_gui->setMainFrameSource(
473  $this->ctrl->getLinkTarget($this, "listMedia"));
474  $this->ctrl->setParameter($this, "expand", "1");
475  $fs_gui->setSideFrameSource(
476  $this->ctrl->getLinkTarget($this, "explorer"));
477  $fs_gui->setFramesetTitle($this->object->getTitle());
478  $fs_gui->show();
479  exit;
480  }
481 
488  {
489  include_once("Services/Frameset/classes/class.ilFramesetGUI.php");
490  $fs_gui = new ilFramesetGUI();
491  $fs_gui->setMainFrameName("content");
492  $fs_gui->setSideFrameName("tree");
493  $fs_gui->setMainFrameSource(
494  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"));
495  $this->ctrl->setParameter($this, "expand", "1");
496  $fs_gui->setSideFrameSource(
497  $this->ctrl->getLinkTarget($this, "explorer"));
498  $fs_gui->setFramesetTitle($this->object->getTitle());
499  $fs_gui->show();
500  exit;
501  }
502 
506  function explorer()
507  {
508  global $ilAccess;
509 
510  $_GET["obj_id"] = "";
511 
512  if (!$ilAccess->checkAccess("read", "", $this->object->getRefId()) ||
513  !$ilAccess->checkAccess("write", "", $this->object->getRefId()))
514  {
515  return;
516  }
517 
518  $this->tpl = new ilTemplate("tpl.main.html", true, true);
519 
520  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
521 
522  $this->tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
523  $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.gif", false));
524 
525  require_once ("./Modules/MediaPool/classes/class.ilMediaPoolExplorer.php");
526 //echo "-".$this->ctrl->getLinkTarget($this, "listMedia")."-";
527  $exp = new ilMediaPoolExplorer($this->ctrl->getLinkTarget($this, "listMedia"), $this->object);
528  $exp->setTargetGet("obj_id");
529  $exp->setExpandTarget($this->ctrl->getLinkTarget($this, "explorer"));
530 
531  $exp->addFilter("root");
532  $exp->addFilter("fold");
533  $exp->setFiltered(true);
534  $exp->setFilterMode(IL_FM_POSITIVE);
535 
536 
537  if ($_GET["mepexpand"] == "")
538  {
539  $mep_tree =& $this->object->getTree();
540  $expanded = $mep_tree->readRootId();
541  }
542  else
543  {
544  $expanded = $_GET["mepexpand"];
545  }
546 
547  $exp->setExpand($expanded);
548 
549  // build html-output
550  $exp->setOutput(0);
551  $output = $exp->getOutput();
552 
553  $this->tpl->setCurrentBlock("content");
554  $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_mep_structure"));
555  $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
556  $this->tpl->setVariable("EXPLORER",$output);
557  $this->ctrl->setParameter($this, "mepexpand", $_GET["mepexpand"]);
558  $this->tpl->setVariable("ACTION",
559  $this->ctrl->getLinkTarget($this, "explorer"));
560  $this->tpl->parseCurrentBlock();
561  $this->tpl->show(false);
562 
563  }
564 
568  function showMedia()
569  {
570  global $ilAccess;
571 
572  if (!$ilAccess->checkAccess("read", "", $this->object->getRefId()))
573  {
574  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
575  }
576 
577  $this->tpl =& new ilTemplate("tpl.fullscreen.html", true, true, "Services/COPage");
578  include_once("Services/Style/classes/class.ilObjStyleSheet.php");
579  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
580  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
582 
583  //$int_links = $page_object->getInternalLinks();
584  $med_links = ilMediaItem::_getMapAreasIntLinks($_GET["mob_id"]);
585 
586  // later
587  //$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets());
588 
589  $link_xlm = "";
590 
591  require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
592  $media_obj =& new ilObjMediaObject($_GET["mob_id"]);
593 
594  $xml = "<dummy>";
595  // todo: we get always the first alias now (problem if mob is used multiple
596  // times in page)
597  $xml.= $media_obj->getXML(IL_MODE_ALIAS);
598  $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
599  $xml.= $link_xml;
600  $xml.="</dummy>";
601 
602  $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
603  $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
604  $xh = xslt_create();
605 
606  $wb_path = ilUtil::getWebspaceDir("output");
607 
608  $mode = ($_GET["cmd"] != "showMedia")
609  ? "fullscreen"
610  : "media";
611  $enlarge_path = ilUtil::getImagePath("enlarge.gif", false, "output");
612  $fullscreen_link =
613  $this->ctrl->getLinkTarget($this, "showFullscreen");
614  $params = array ('mode' => $mode, 'enlarge_path' => $enlarge_path,
615  'link_params' => "ref_id=".$_GET["ref_id"],'fullscreen_link' => $fullscreen_link,
616  'ref_id' => $_GET["ref_id"], 'pg_frame' => $pg_frame, 'webspace_path' => $wb_path);
617  $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
618  echo xslt_error($xh);
619  xslt_free($xh);
620 
621  // unmask user html
622  $this->tpl->setVariable("MEDIA_CONTENT", $output);
623 
624  $this->tpl->parseCurrentBlock();
625  $this->tpl->show();
626  }
627 
631  function showFullscreen()
632  {
633  $this->showMedia();
634  }
635 
639  function confirmRemove()
640  {
641  global $ilAccess;
642 
643  if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()))
644  {
645  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
646  }
647 
648  if(!isset($_POST["id"]))
649  {
650  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
651  }
652 
653  //$this->prepareOutput();
654 
655  // SAVE POST VALUES
656  $_SESSION["ilMepRemove"] = $_POST["id"];
657 
658  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.confirm_deletion.html", "Modules/MediaPool");
659 
660  ilUtil::sendInfo($this->lng->txt("info_delete_sure"));
661 
662  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
663 
664  // BEGIN TABLE HEADER
665  $this->tpl->setCurrentBlock("table_header");
666  $this->tpl->setVariable("TEXT",$this->lng->txt("objects"));
667  $this->tpl->parseCurrentBlock();
668 
669  // BEGIN TABLE DATA
670  $counter = 0;
671  foreach($_POST["id"] as $obj_id)
672  {
673  $type = ilObject::_lookupType($obj_id);
674  $title = ilObject::_lookupTitle($obj_id);
675  $this->tpl->setCurrentBlock("table_row");
676  $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor(++$counter,"tblrow1","tblrow2"));
677  $this->tpl->setVariable("TEXT_CONTENT", $title);
678  $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_".$type.".gif"));
679  $this->tpl->parseCurrentBlock();
680  }
681 
682  // cancel/confirm button
683  $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
684  $buttons = array( "cancelRemove" => $this->lng->txt("cancel"),
685  "remove" => $this->lng->txt("confirm"));
686  foreach ($buttons as $name => $value)
687  {
688  $this->tpl->setCurrentBlock("operation_btn");
689  $this->tpl->setVariable("BTN_NAME",$name);
690  $this->tpl->setVariable("BTN_VALUE",$value);
691  $this->tpl->parseCurrentBlock();
692  }
693  $this->tpl->show();
694  }
695 
699  function openClipboard()
700  {
701  global $ilCtrl, $ilAccess;
702 
703  if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()))
704  {
705  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
706  }
707 
708  $ilCtrl->setParameterByClass("ileditclipboardgui", "returnCommand",
709  rawurlencode($ilCtrl->getLinkTarget($this,
710  "insertFromClipboard")));
711  $ilCtrl->redirectByClass("ilEditClipboardGUI", "getObject");
712  }
713 
714 
719  {
720  global $ilAccess;
721 
722  if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()))
723  {
724  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
725  }
726 
727  include_once("./Services/Clipboard/classes/class.ilEditClipboardGUI.php");
729  $not_inserted = array();
730  if (is_array($ids))
731  {
732  foreach ($ids as $id)
733  {
734  if (!$this->object->insertInTree($id, $_GET["obj_id"]))
735  {
736  $not_inserted[] = ilObject::_lookupTitle($id)." [".
737  $id."]";
738  }
739  }
740  }
741  if (count($not_inserted) > 0)
742  {
743  ilUtil::sendInfo($this->lng->txt("mep_not_insert_already_exist")."<br>".
744  implode($not_inserted,"<br>"), true);
745  }
746  $this->ctrl->redirect($this, "listMedia");
747  }
748 
749 
753  function cancelRemove()
754  {
755  session_unregister("ilMepRemove");
756  $this->ctrl->redirect($this, "listMedia");
757  }
758 
762  function remove()
763  {
764  global $ilAccess;
765 
766  if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()))
767  {
768  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
769  }
770 
771  foreach($_SESSION["ilMepRemove"] as $obj_id)
772  {
773  $this->object->deleteChild($obj_id);
774  }
775 
776  ilUtil::sendInfo($this->lng->txt("cont_obj_removed"),true);
777  session_unregister("ilMepRemove");
778  $this->ctrl->redirect($this, "listMedia");
779  }
780 
781 
785  function copyToClipboard()
786  {
787  global $ilUser, $ilAccess;
788 
789  if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()))
790  {
791  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
792  }
793 
794  if(!isset($_POST["id"]))
795  {
796  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
797  }
798 
799  foreach ($_POST["id"] as $obj_id)
800  {
801  $type = ilObject::_lookupType($obj_id);
802  if ($type == "fold")
803  {
804  $this->ilias->raiseError($this->lng->txt("cont_cant_copy_folders"), $this->ilias->error_obj->MESSAGE);
805  }
806  }
807 
808  foreach ($_POST["id"] as $obj_id)
809  {
810  $ilUser->addObjectToClipboard($obj_id, "mob", "");
811  }
812 
813  ilUtil::sendInfo($this->lng->txt("copied_to_clipboard"),true);
814  $this->ctrl->redirect($this, "listMedia");
815  }
816 
820  function addLocatorItems()
821  {
822  global $ilLocator;
823 
824  if (!$this->getCreationMode() && $this->ctrl->getCmd() != "explorer")
825  {
826  $tree =& $this->object->getTree();
827  $obj_id = ($_GET["obj_id"] == "")
828  ? $tree->getRootId()
829  : $_GET["obj_id"];
830  $path = $tree->getPathFull($obj_id);
831  foreach($path as $node)
832  {
833  if ($node["child"] == $tree->getRootId())
834  {
835  $this->ctrl->setParameter($this, "obj_id", "");
836  $link = $this->ctrl->getLinkTarget($this, "listMedia");
837  $title = $this->object->getTitle();
838  $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
839  $ilLocator->addItem($title, $link, "", $_GET["ref_id"]);
840  }
841  else
842  {
843  $this->ctrl->setParameter($this, "obj_id", $node["child"]);
844  $link = $this->ctrl->getLinkTarget($this, "listMedia");
845  $title = $node["title"];
846  $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
847  $ilLocator->addItem($title, $link);
848  }
849  }
850  }
851  }
852 
856  function createFolderForm()
857  {
858  global $ilAccess;
859 
860  if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()))
861  {
862  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
863  }
864 
865  $folder_gui =& new ilObjFolderGUI("", 0, false, false);
866  $this->ctrl->setParameterByClass("ilobjfoldergui", "obj_id", $_GET["obj_id"]);
867  $folder_gui->setFormAction("save",
868  $this->ctrl->getFormActionByClass("ilobjfoldergui"));
869  $folder_gui->createObject();
870  $this->tpl->show();
871  }
872 
873 
877  function setTabs()
878  {
879  $this->getTabs($this->tabs_gui);
880  }
881 
887  function getTabs(&$tabs_gui)
888  {
889  global $ilAccess;
890 
891  if ($ilAccess->checkAccess('read', '', $this->ref_id) ||
892  $ilAccess->checkAccess('write', '', $this->ref_id))
893  {
894  $tabs_gui->addTarget("view_content", $this->ctrl->getLinkTarget($this, "listMedia"),
895  "listMedia", "");
896  }
897 
898  // info tab
899  if ($ilAccess->checkAccess('visible', '', $this->ref_id))
900  {
901  $force_active = ($this->ctrl->getNextClass() == "ilinfoscreengui"
902  || strtolower($_GET["cmdClass"]) == "ilnotegui")
903  ? true
904  : false;
905  //echo "-$force_active-";
906  $tabs_gui->addTarget("info_short",
907  $this->ctrl->getLinkTargetByClass(
908  array("ilobjmediapoolgui", "ilinfoscreengui"), "showSummary"),
909  array("showSummary", "infoScreen"),
910  "", "", $force_active);
911  }
912 
913  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
914  {
915  $tabs_gui->addTarget("edit_properties", $this->ctrl->getLinkTarget($this, "edit"),
916  "edit", array("", "ilobjmediapoolgui"));
917  }
918 
919  if ($ilAccess->checkAccess("edit_permission", "", $this->object->getRefId()))
920  {
921  $tabs_gui->addTarget("perm_settings",
922  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
923  }
924 
925  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
926  {
927  $tabs_gui->addTarget("clipboard", $this->ctrl->getLinkTarget($this, "openClipboard"),
928  "view", "ileditclipboardgui");
929  }
930  }
931 
932 
936  function _goto($a_target)
937  {
938  global $ilAccess, $ilErr, $lng;
939 
940  if ($ilAccess->checkAccess("read", "", $a_target))
941  {
942  $_GET["cmd"] = "frameset";
943  $_GET["baseClass"] = "ilMediaPoolPresentationGUI";
944  $_GET["ref_id"] = $a_target;
945  include("ilias.php");
946  exit;
947  } else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
948  {
949  $_GET["cmd"] = "frameset";
950  $_GET["target"] = "";
951  $_GET["ref_id"] = ROOT_FOLDER_ID;
952  ilUtil::sendInfo(sprintf($lng->txt("msg_no_perm_read_item"),
954  include("repository.php");
955  exit;
956  }
957 
958  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
959  }
960 
966  function infoScreenObject()
967  {
968  $this->ctrl->setCmd("showSummary");
969  $this->ctrl->setCmdClass("ilinfoscreengui");
970  $this->infoScreen();
971  }
972 
976  function infoScreen()
977  {
978  global $ilAccess;
979 
980  if (!$ilAccess->checkAccess("visible", "", $this->ref_id))
981  {
982  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
983  }
984 
985  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
986  $info = new ilInfoScreenGUI($this);
987 
988  $info->enablePrivateNotes();
989 
990  if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
991  {
992  //$info->enableNews();
993  }
994 
995  // no news editing for files, just notifications
996 // $info->enableNewsEditing(false);
997  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
998  {
999 // $news_set = new ilSetting("news");
1000 // $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1001 
1002 // if ($enable_internal_rss)
1003 // {
1004 // $info->setBlockProperty("news", "settings", true);
1005 // $info->setBlockProperty("news", "public_notifications_option", true);
1006 // }
1007  }
1008 
1009 
1010  // standard meta data
1011  $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
1012 
1013  // forward the command
1014  $this->ctrl->forwardCommand($info);
1015 
1016  $this->tpl->show();
1017  }
1018 
1019 }
1020 ?>