00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00037 include_once("classes/class.ilObjectGUI.php");
00038 include_once("content/classes/class.ilObjMediaPool.php");
00039 include_once("classes/class.ilTableGUI.php");
00040 include_once("classes/class.ilObjFolderGUI.php");
00041 include_once("content/classes/Media/class.ilObjMediaObjectGUI.php");
00042 include_once("content/classes/Media/class.ilObjMediaObject.php");
00043 include_once ("content/classes/class.ilEditClipboardGUI.php");
00044
00045 class ilObjMediaPoolGUI extends ilObjectGUI
00046 {
00047 var $output_prepared;
00048
00054 function ilObjMediaPoolGUI($a_data,$a_id = 0,$a_call_by_reference = true, $a_prepare_output = false)
00055 {
00056 global $lng, $ilCtrl;
00057
00058
00059
00060 $this->ctrl =& $ilCtrl;
00061 $this->ctrl->saveParameter($this, array("ref_id", "obj_id"));
00062 $this->type = "mep";
00063 $lng->loadLanguageModule("content");
00064 parent::ilObjectGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
00065
00066 $this->output_prepared = $a_prepare_output;
00067
00068
00069
00070
00071
00072
00073 }
00074
00078 function &executeCommand()
00079 {
00080 if ($this->ctrl->getRedirectSource() == "ilinternallinkgui")
00081 {
00082 $this->explorer();
00083 return;
00084 }
00085
00086
00087 if (!$this->creation_mode)
00088 {
00089 $tree =& $this->object->getTree();
00090 }
00091 $next_class = $this->ctrl->getNextClass($this);
00092 $cmd = $this->ctrl->getCmd();
00093
00094 if ($cmd == "create")
00095 {
00096 switch($_POST["new_type"])
00097 {
00098 case "mob":
00099 $this->ctrl->redirectByClass("ilobjmediaobjectgui", "create");
00100 break;
00101
00102 case "fold":
00103 $this->ctrl->redirectByClass("ilobjfoldergui", "create");
00104 break;
00105 }
00106 }
00107
00108 switch($next_class)
00109 {
00110 case "ilobjmediaobjectgui":
00111
00112
00113 if ($cmd == "create")
00114 {
00115 $ret_obj = $_GET["obj_id"];
00116 $ilObjMediaObjectGUI =& new ilObjMediaObjectGUI("", 0, false, false);
00117 }
00118 else
00119 {
00120 $ret_obj = $tree->getParentId($_GET["obj_id"]);
00121 $ilObjMediaObjectGUI =& new ilObjMediaObjectGUI("", $_GET["obj_id"], false, false);
00122 }
00123 if ($this->ctrl->getCmdClass() == "ilinternallinkgui")
00124 {
00125 $this->ctrl->setReturn($this, "explorer");
00126 }
00127 else
00128 {
00129 $this->ctrl->setParameter($this, "obj_id", $ret_obj);
00130 $this->ctrl->setReturn($this, "listMedia");
00131 $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
00132 }
00133 $this->getTemplate();
00134 $ilObjMediaObjectGUI->setAdminTabs();
00135 $this->setLocator();
00136
00137
00138
00139 $ret =& $this->ctrl->forwardCommand($ilObjMediaObjectGUI);
00140
00141 switch($cmd)
00142 {
00143 case "save":
00144 $parent = ($_GET["obj_id"] == "")
00145 ? $tree->getRootId()
00146 : $_GET["obj_id"];
00147 $tree->insertNode($ret->getId(), $parent);
00148 ilUtil::redirect("mep_edit.php?cmd=listMedia&ref_id=".
00149 $_GET["ref_id"]."&obj_id=".$_GET["obj_id"]);
00150 break;
00151
00152 default:
00153 $this->tpl->show();
00154 break;
00155 }
00156 break;
00157
00158 case "ilobjfoldergui":
00159 $folder_gui = new ilObjFolderGUI("", 0, false, false);
00160 $this->ctrl->setReturn($this, "listMedia");
00161 $cmd.="Object";
00162
00163 switch($cmd)
00164 {
00165 case "createObject":
00166 $this->prepareOutput();
00167 $folder_gui =& new ilObjFolderGUI("", 0, false, false);
00168 $folder_gui->setFormAction("save",
00169 $this->ctrl->getFormActionByClass("ilobjfoldergui"));
00170 $folder_gui->createObject();
00171 $this->tpl->show();
00172 break;
00173
00174 case "saveObject":
00175
00176 $parent = ($_GET["obj_id"] == "")
00177 ? $tree->getRootId()
00178 : $_GET["obj_id"];
00179 $folder_gui->setFolderTree($tree);
00180 $folder_gui->saveObject($parent);
00181
00182 break;
00183
00184 case "editObject":
00185 $this->prepareOutput();
00186 $folder_gui =& new ilObjFolderGUI("", $_GET["obj_id"], false, false);
00187 $this->ctrl->setParameter($this, "foldereditmode", "1");
00188 $folder_gui->setFormAction("update", $this->ctrl->getFormActionByClass("ilobjfoldergui"));
00189 $folder_gui->editObject();
00190 $this->tpl->show();
00191 break;
00192
00193 case "updateObject":
00194 $folder_gui =& new ilObjFolderGUI("", $_GET["obj_id"], false, false);
00195 $this->ctrl->setParameter($this, "obj_id", $this->getParentFolderId());
00196 $this->ctrl->setReturn($this, "listMedia");
00197 $folder_gui->updateObject(true);
00198 break;
00199
00200 case "cancelObject":
00201 sendInfo($this->lng->txt("action_aborted"), true);
00202 if ($_GET["foldereditmode"])
00203 {
00204 $this->ctrl->setParameter($this, "obj_id", $this->getParentFolderId());
00205 }
00206 $this->ctrl->redirect($this, "listMedia");
00207 break;
00208 }
00209 break;
00210
00211 case "ileditclipboardgui":
00212 $this->prepareOutput();
00213 $this->ctrl->setReturn($this, "listMedia");
00214 $clip_gui = new ilEditClipboardGUI();
00215 $clip_gui->setMultipleSelections(true);
00216
00217 $ret =& $this->ctrl->forwardCommand($clip_gui);
00218 $this->tpl->show();
00219 break;
00220
00221 case 'ilpermissiongui':
00222 $this->prepareOutput();
00223 include_once("./classes/class.ilPermissionGUI.php");
00224 $perm_gui =& new ilPermissionGUI($this);
00225 $ret =& $this->ctrl->forwardCommand($perm_gui);
00226 $this->tpl->show();
00227 break;
00228
00229 default:
00230 $this->prepareOutput();
00231 $cmd = $this->ctrl->getCmd("frameset");
00232 if ($this->creation_mode)
00233 {
00234 $cmd.= "Object";
00235 }
00236 $this->$cmd();
00237 break;
00238 }
00239 }
00240
00241 function createObject()
00242 {
00243 parent::createObject();
00244 $this->tpl->setVariable("TARGET", ' target="'.
00245 ilFrameTargetInfo::_getFrame("MainContent").'" ');
00246 }
00247
00248
00249 function view()
00250 {
00251 $this->viewObject();
00252 }
00253
00258 function saveObject()
00259 {
00260 global $rbacadmin;
00261
00262
00263 $newObj = parent::saveObject();
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274 sendInfo($this->lng->txt("object_added"),true);
00275
00276
00277 ilUtil::redirect("content/mep_edit.php?ref_id=".$newObj->getRefId());
00278
00279 }
00280
00286 function editObject()
00287 {
00288 global $ilAccess, $tree, $tpl;
00289
00290 if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()))
00291 {
00292 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00293 }
00294
00295
00296 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00297
00298 if (!defined("ILIAS_MODULE"))
00299 {
00300 $this->tpl->setCurrentBlock("btn_cell");
00301 $this->tpl->setVariable("BTN_LINK","content/mep_edit.php?ref_id=".$this->object->getRefID());
00302 $this->tpl->setVariable("BTN_TARGET"," target=\"".
00303 ilFrameTargetInfo::_getFrame("MainContent")."\" ");
00304 $this->tpl->setVariable("BTN_TXT",$this->lng->txt("edit"));
00305 $this->tpl->parseCurrentBlock();
00306 }
00307
00308 parent::editObject();
00309 }
00310
00314 function edit()
00315 {
00316
00317 $this->setFormAction("update", "mep_edit.php?cmd=post&ref_id=".$_GET["ref_id"].
00318 "&obj_id=".$_GET["obj_id"]);
00319 $this->editObject();
00320 $this->tpl->show();
00321 }
00322
00326 function cancel()
00327 {
00328
00329
00330
00331 $this->ctrl->redirect($this, "listMedia");
00332 }
00333
00339 function cancelObject($in_rep = false)
00340 {
00341 sendInfo($this->lng->txt("msg_cancel"),true);
00342 ilUtil::redirect("repository.php?cmd=frameset&ref_id=".$_GET["ref_id"]);
00343
00344 }
00345
00346
00350 function update()
00351 {
00352 global $ilAccess;
00353
00354 if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()))
00355 {
00356 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00357 }
00358
00359 $this->updateObject();
00360 }
00361
00362 function afterUpdate()
00363 {
00364 $this->ctrl->redirect($this, "listMedia");
00365 }
00366
00370 function info()
00371 {
00372
00373 $this->infoObject();
00374 $this->tpl->show();
00375 }
00376
00380 function permSave()
00381 {
00382 $this->setReturnLocation("permSave",
00383 "mep_edit.php?ref_id=".$_GET["ref_id"]."&obj_id=".$_GET["obj_id"]."&cmd=perm");
00384 $this->permSaveObject();
00385 }
00386
00390 function addRole()
00391 {
00392 $this->setReturnLocation("addRole",
00393 "mep_edit.php?ref_id=".$_GET["ref_id"]."&obj_id=".$_GET["obj_id"]."&cmd=perm");
00394 $this->addRoleObject();
00395 }
00396
00397
00401 function listMedia()
00402 {
00403 global $tree, $ilAccess;
00404
00405 if (!$ilAccess->checkAccess("read", "", $this->object->getRefId()))
00406 {
00407 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00408 }
00409
00410
00411 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00412
00413 $obj_id = ($_GET["obj_id"] == "")
00414 ? $obj_id = $this->object->tree->getRootId()
00415 : $_GET["obj_id"];
00416
00417
00418 require_once("classes/class.ilTableGUI.php");
00419 $tbl = new ilTableGUI();
00420
00421
00422 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
00423
00424
00425 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.mep_list_row.html", true);
00426
00427 $num = 0;
00428
00429 $this->tpl->setVariable("FORMACTION", "mep_edit.php?ref_id=".$_GET["ref_id"].
00430 "&obj_id=".$_GET["obj_id"]."&cmd=post");
00431
00432 $tbl->setHeaderNames(array("", "", $this->lng->txt("title")));
00433
00434 $cols = array("", "", "title");
00435 $header_params = array("ref_id" => $_GET["ref_id"],
00436 "obj_id" => $_GET["obj_id"], "cmd" => "listMedia");
00437 $tbl->setHeaderVars($cols, $header_params);
00438 $tbl->setColumnWidth(array("1%", "1%", "98%"));
00439
00440 if ($obj_id != $this->object->tree->getRootId())
00441 {
00442 $node = $this->object->tree->getNodeData($obj_id);
00443 $tbl->setTitle($node["title"]);
00444 }
00445 else
00446 {
00447 $tbl->setTitle($this->object->getTitle());
00448 }
00449
00450
00451 $tbl->setOrderColumn($_GET["sort_by"]);
00452 $tbl->setOrderDirection($_GET["sort_order"]);
00453 $tbl->setLimit($_GET["limit"]);
00454 $tbl->setOffset($_GET["offset"]);
00455 $tbl->setMaxCount($this->maxcount);
00456
00457 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
00458 {
00459 $this->tpl->setVariable("COLUMN_COUNTS", 3);
00460
00461
00462 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
00463 $this->tpl->setCurrentBlock("tbl_action_btn");
00464 $this->tpl->setVariable("BTN_NAME", "confirmRemove");
00465 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("remove"));
00466 $this->tpl->parseCurrentBlock();
00467
00468
00469 $this->tpl->setCurrentBlock("tbl_action_btn");
00470 $this->tpl->setVariable("BTN_NAME", "copyToClipboard");
00471 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("cont_copy_to_clipboard"));
00472 $this->tpl->parseCurrentBlock();
00473
00474
00475 $this->tpl->setCurrentBlock("tbl_action_btn");
00476 $this->tpl->setVariable("BTN_NAME", "pasteFromClipboard");
00477 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("cont_paste_from_clipboard"));
00478 $this->tpl->parseCurrentBlock();
00479 }
00480
00481
00482 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00483
00484
00485
00486 $fobjs = $this->object->getChilds($_GET["obj_id"], "fold");
00487 $f2objs = array();
00488 foreach ($fobjs as $obj)
00489 {
00490 $f2objs[$obj["title"].":".$obj["id"]] = $obj;
00491 }
00492 ksort($f2objs);
00493
00494
00495 $mobjs = $this->object->getChilds($_GET["obj_id"], "mob");
00496 $m2objs = array();
00497 foreach ($mobjs as $obj)
00498 {
00499 $m2objs[$obj["title"].":".$obj["id"]] = $obj;
00500 }
00501 ksort($m2objs);
00502
00503
00504 $objs = array_merge($f2objs, $m2objs);
00505
00506
00507 $tbl->setMaxCount(count($objs));
00508 $objs = array_slice($objs, $_GET["offset"], $_GET["limit"]);
00509
00510 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
00511 {
00512 $subobj = array(
00513 "mob" => $this->lng->txt("mob"),
00514 "fold" => $this->lng->txt("fold"));
00515 $opts = ilUtil::formSelect("", "new_type", $subobj, false, true);
00516 $this->tpl->setCurrentBlock("add_object");
00517 $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
00518 $this->tpl->setVariable("BTN_NAME", "create");
00519 $this->tpl->setVariable("TXT_ADD", $this->lng->txt("add"));
00520 $this->tpl->parseCurrentBlock();
00521 }
00522 $tbl->disable("sort");
00523
00524 $tbl->disable("header");
00525 if(count($objs) == 0)
00526 {
00527
00528 }
00529 $tbl->render();
00530 if(count($objs) > 0)
00531 {
00532 $i=0;
00533 foreach($objs as $obj)
00534 {
00535 $this->tpl->setCurrentBlock("link");
00536 $this->tpl->setVariable("TXT_TITLE", $obj["title"]);
00537 switch($obj["type"])
00538 {
00539 case "fold":
00540 $this->ctrl->setParameter($this, "obj_id", $obj["obj_id"]);
00541 $this->tpl->setVariable("LINK_VIEW",
00542 $this->ctrl->getLinkTarget($this, "listMedia"));
00543 $this->tpl->parseCurrentBlock();
00544
00545 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
00546 {
00547 $this->tpl->setCurrentBlock("edit");
00548 $this->tpl->setVariable("TXT_EDIT", $this->lng->txt("edit"));
00549 $this->ctrl->setParameterByClass("ilobjfoldergui", "obj_id", $obj["obj_id"]);
00550 $this->tpl->setVariable("EDIT_LINK",
00551 $this->ctrl->getLinkTargetByClass("ilobjfoldergui", "edit"));
00552 $this->tpl->parseCurrentBlock();
00553 }
00554
00555 $this->tpl->setCurrentBlock("tbl_content");
00556 $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_".$obj["type"].".gif"));
00557 break;
00558
00559 case "mob":
00560 $this->tpl->touchBlock("nf");
00561 $this->ctrl->setParameterByClass("ilobjmediaobjectgui", "obj_id", $obj["obj_id"]);
00562 $this->ctrl->setParameter($this, "mob_id", $obj["obj_id"]);
00563 $this->tpl->setVariable("LINK_VIEW",
00564 $this->ctrl->getLinkTarget($this, "showMedia"));
00565
00566
00567 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
00568 {
00569 $this->tpl->setCurrentBlock("edit");
00570 $this->tpl->setVariable("TXT_EDIT", $this->lng->txt("edit"));
00571 $this->tpl->setVariable("EDIT_LINK",
00572 $this->ctrl->getLinkTargetByClass("ilobjmediaobjectgui", "edit"));
00573 $this->tpl->parseCurrentBlock();
00574 }
00575
00576
00577
00578
00579
00580
00581
00582 $this->tpl->setCurrentBlock("link");
00583
00584 $this->tpl->setCurrentBlock("tbl_content");
00585
00586
00587 $mob =& new ilObjMediaObject($obj["obj_id"]);
00588 $med =& $mob->getMediaItem("Standard");
00589 $target = $med->getThumbnailTarget();
00590 if ($target != "")
00591 {
00592 $this->tpl->setVariable("IMG_OBJ", $target);
00593 }
00594 else
00595 {
00596 $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_".$obj["type"].".gif"));
00597 }
00598
00599
00600 include_once("content/classes/Media/class.ilObjMediaObjectGUI.php");
00601 $this->tpl->setVariable("MEDIA_INFO",
00602 ilObjMediaObjectGUI::_getMediaInfoHTML($mob));
00603
00604 break;
00605 }
00606
00607 $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
00608
00609 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
00610 {
00611 $this->tpl->setCurrentBlock("chbox");
00612 $this->tpl->setVariable("CHECKBOX_ID", $obj["obj_id"]);
00613 $this->tpl->parseCurrentBlock();
00614 $this->tpl->setCurrentBlock("tbl_content");
00615 }
00616 $this->tpl->setVariable("CSS_ROW", $css_row);
00617 $this->tpl->parseCurrentBlock();
00618
00619 $this->tpl->setCurrentBlock("mob_row");
00620 $this->tpl->parseCurrentBlock();
00621 }
00622 $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
00623 }
00624 else
00625 {
00626 $this->tpl->setCurrentBlock("no_row");
00627 $this->tpl->setVariable("CSS_ROW", "tblrow1");
00628 $this->tpl->setVariable("TXT_EMPTY_FOLDER",
00629 $this->lng->txt("cont_empty_mep_folder"));
00630 $this->tpl->parseCurrentBlock();
00631 }
00632
00633 $this->tpl->parseCurrentBlock();
00634 $this->tpl->show();
00635 }
00636
00637 function getTemplate()
00638 {
00639 $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00640 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00641 }
00642
00643
00644 function getParentFolderId()
00645 {
00646 if ($_GET["obj_id"] == "")
00647 {
00648 return "";
00649 }
00650 $par_id = $this->object->tree->getParentId($_GET["obj_id"]);
00651 if ($par_id != $this->object->tree->getRootId())
00652 {
00653 return $par_id;
00654 }
00655 else
00656 {
00657 return "";
00658 }
00659 }
00660
00665 function showUpperIcon()
00666 {
00667 global $tpl;
00668
00669 parent::showUpperIcon();
00670
00671 if ($_GET["obj_id"] != "")
00672 {
00673 $this->ctrl->setParameter($this, "obj_id",
00674 $this->getParentFolderId());
00675 $tpl->setUpperIcon($this->ctrl->getLinkTarget($this, "listMedia"));
00676 $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
00677 }
00678 }
00679
00685 function frameset()
00686 {
00687 include_once("Services/Frameset/classes/class.ilFramesetGUI.php");
00688 $fs_gui = new ilFramesetGUI();
00689 $fs_gui->setMainFrameName("content");
00690 $fs_gui->setSideFrameName("tree");
00691 $fs_gui->setMainFrameSource(
00692 "mep_edit.php?cmd=listMedia&ref_id=".$this->ref_id);
00693 $fs_gui->setSideFrameSource(
00694 "mep_edit.php?cmd=explorer&expand=1&ref_id=".$this->ref_id);
00695 $fs_gui->setFramesetTitle($this->object->getTitle());
00696 $fs_gui->show();
00697 exit;
00698 }
00699
00703 function explorer()
00704 {
00705 $this->tpl = new ilTemplate("tpl.main.html", true, true);
00706
00707 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
00708
00709 $this->tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
00710 $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.gif", false));
00711
00712 require_once ("content/classes/class.ilMediaPoolExplorer.php");
00713 $exp = new ilMediaPoolExplorer($this->ctrl->getLinkTarget($this, "listMedia"), $this->object);
00714 $exp->setTargetGet("obj_id");
00715
00716 $exp->setExpandTarget($this->ctrl->getLinkTarget($this, "explorer"));
00717
00718 $exp->addFilter("root");
00719 $exp->addFilter("fold");
00720 $exp->setFiltered(true);
00721 $exp->setFilterMode(IL_FM_POSITIVE);
00722
00723
00724 if ($_GET["mepexpand"] == "")
00725 {
00726 $mep_tree =& $this->object->getTree();
00727 $expanded = $mep_tree->readRootId();
00728 }
00729 else
00730 {
00731 $expanded = $_GET["mepexpand"];
00732 }
00733
00734 $exp->setExpand($expanded);
00735
00736
00737 $exp->setOutput(0);
00738 $output = $exp->getOutput();
00739
00740 $this->tpl->setCurrentBlock("content");
00741 $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_mep_structure"));
00742 $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
00743 $this->tpl->setVariable("EXPLORER",$output);
00744 $this->tpl->setVariable("ACTION", "mep_edit.php?cmd=explorer&ref_id=".$this->ref_id."&mepexpand=".$_GET["mepexpand"]);
00745 $this->tpl->parseCurrentBlock();
00746 $this->tpl->show(false);
00747
00748 }
00749
00753 function showMedia()
00754 {
00755 global $ilAccess;
00756
00757 if (!$ilAccess->checkAccess("read", "", $this->object->getRefId()))
00758 {
00759 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00760 }
00761
00762 $this->tpl =& new ilTemplate("tpl.fullscreen.html", true, true, "content");
00763 include_once("classes/class.ilObjStyleSheet.php");
00764 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
00765 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
00766 ilObjStyleSheet::getContentStylePath(0));
00767
00768
00769 $med_links = ilMediaItem::_getMapAreasIntLinks($_GET["mob_id"]);
00770
00771
00772
00773
00774 $link_xlm = "";
00775
00776 require_once("content/classes/Media/class.ilObjMediaObject.php");
00777 $media_obj =& new ilObjMediaObject($_GET["mob_id"]);
00778
00779 $xml = "<dummy>";
00780
00781
00782 $xml.= $media_obj->getXML(IL_MODE_ALIAS);
00783 $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
00784 $xml.= $link_xml;
00785 $xml.="</dummy>";
00786
00787 $xsl = file_get_contents("./content/page.xsl");
00788 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
00789 $xh = xslt_create();
00790
00791 $wb_path = ilUtil::getWebspaceDir("output");
00792
00793 $mode = ($_GET["cmd"] != "showMedia")
00794 ? "fullscreen"
00795 : "media";
00796 $enlarge_path = ilUtil::getImagePath("enlarge.gif", false, "output");
00797 $fullscreen_link =
00798 $this->ctrl->getLinkTarget($this, "showFullscreen");
00799 $params = array ('mode' => $mode, 'enlarge_path' => $enlarge_path,
00800 'link_params' => "ref_id=".$_GET["ref_id"],'fullscreen_link' => $fullscreen_link,
00801 'ref_id' => $_GET["ref_id"], 'pg_frame' => $pg_frame, 'webspace_path' => $wb_path);
00802 $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
00803 echo xslt_error($xh);
00804 xslt_free($xh);
00805
00806
00807 $this->tpl->setVariable("MEDIA_CONTENT", $output);
00808
00809 $this->tpl->parseCurrentBlock();
00810 $this->tpl->show();
00811
00812 }
00813
00817 function showFullscreen()
00818 {
00819 $this->showMedia();
00820 }
00821
00825 function confirmRemove()
00826 {
00827 global $ilAccess;
00828
00829 if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()))
00830 {
00831 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00832 }
00833
00834 if(!isset($_POST["id"]))
00835 {
00836 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00837 }
00838
00839
00840
00841
00842 $_SESSION["ilMepRemove"] = $_POST["id"];
00843
00844 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.confirm_deletion.html", true);
00845
00846 sendInfo($this->lng->txt("info_delete_sure"));
00847
00848 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00849
00850
00851 $this->tpl->setCurrentBlock("table_header");
00852 $this->tpl->setVariable("TEXT",$this->lng->txt("objects"));
00853 $this->tpl->parseCurrentBlock();
00854
00855
00856 $counter = 0;
00857 foreach($_POST["id"] as $obj_id)
00858 {
00859 $type = ilObject::_lookupType($obj_id);
00860 $title = ilObject::_lookupTitle($obj_id);
00861 $this->tpl->setCurrentBlock("table_row");
00862 $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor(++$counter,"tblrow1","tblrow2"));
00863 $this->tpl->setVariable("TEXT_CONTENT", $title);
00864 $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_".$type.".gif"));
00865 $this->tpl->parseCurrentBlock();
00866 }
00867
00868
00869 $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
00870 $buttons = array( "cancelRemove" => $this->lng->txt("cancel"),
00871 "remove" => $this->lng->txt("confirm"));
00872 foreach ($buttons as $name => $value)
00873 {
00874 $this->tpl->setCurrentBlock("operation_btn");
00875 $this->tpl->setVariable("BTN_NAME",$name);
00876 $this->tpl->setVariable("BTN_VALUE",$value);
00877 $this->tpl->parseCurrentBlock();
00878 }
00879 $this->tpl->show();
00880 }
00881
00885 function pasteFromClipboard()
00886 {
00887 global $ilCtrl, $ilAccess;
00888
00889 if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()))
00890 {
00891 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00892 }
00893
00894 $ilCtrl->setParameterByClass("ileditclipboardgui", "returnCommand",
00895 rawurlencode($ilCtrl->getLinkTarget($this,
00896 "insertFromClipboard")));
00897
00898 $ilCtrl->redirectByClass("ilEditClipboardGUI", "getObject");
00899 }
00900
00901
00905 function insertFromClipboard()
00906 {
00907 global $ilAccess;
00908
00909 if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()))
00910 {
00911 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00912 }
00913
00914 include_once("content/classes/class.ilEditClipboardGUI.php");
00915 $ids = ilEditClipboardGUI::_getSelectedIDs();
00916 $not_inserted = array();
00917 if (is_array($ids))
00918 {
00919 foreach ($ids as $id)
00920 {
00921 if (!$this->object->insertInTree($id, $_GET["obj_id"]))
00922 {
00923 $not_inserted[] = ilObject::_lookupTitle($id)." [".
00924 $id."]";
00925 }
00926 }
00927 }
00928 if (count($not_inserted) > 0)
00929 {
00930 sendInfo($this->lng->txt("mep_not_insert_already_exist")."<br>".
00931 implode($not_inserted,"<br>"), true);
00932 }
00933 $this->ctrl->redirect($this, "listMedia");
00934 }
00935
00936
00940 function cancelRemove()
00941 {
00942 session_unregister("ilMepRemove");
00943 $this->ctrl->redirect($this, "listMedia");
00944 }
00945
00949 function remove()
00950 {
00951 global $ilAccess;
00952
00953 if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()))
00954 {
00955 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00956 }
00957
00958 foreach($_SESSION["ilMepRemove"] as $obj_id)
00959 {
00960 $this->object->deleteChild($obj_id);
00961 }
00962
00963 sendInfo($this->lng->txt("cont_obj_removed"),true);
00964 session_unregister("ilMepRemove");
00965 $this->ctrl->redirect($this, "listMedia");
00966 }
00967
00968
00972 function copyToClipboard()
00973 {
00974 global $ilUser, $ilAccess;
00975
00976 if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()))
00977 {
00978 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00979 }
00980
00981 if(!isset($_POST["id"]))
00982 {
00983 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00984 }
00985
00986 foreach ($_POST["id"] as $obj_id)
00987 {
00988 $type = ilObject::_lookupType($obj_id);
00989 if ($type == "fold")
00990 {
00991 $this->ilias->raiseError($this->lng->txt("cont_cant_copy_folders"), $this->ilias->error_obj->MESSAGE);
00992 }
00993 }
00994
00995 foreach ($_POST["id"] as $obj_id)
00996 {
00997 $ilUser->addObjectToClipboard($obj_id, "mob", "");
00998 }
00999
01000 sendInfo($this->lng->txt("copied_to_clipboard"),true);
01001 $this->ctrl->redirect($this, "listMedia");
01002 }
01003
01007 function addLocatorItems()
01008 {
01009 global $ilLocator;
01010
01011 if (!$this->getCreationMode())
01012 {
01013 $tree =& $this->object->getTree();
01014 $obj_id = ($_GET["obj_id"] == "")
01015 ? $tree->getRootId()
01016 : $_GET["obj_id"];
01017 $path = $tree->getPathFull($obj_id);
01018 foreach($path as $node)
01019 {
01020 if ($node["child"] == $tree->getRootId())
01021 {
01022 $this->ctrl->setParameter($this, "obj_id", "");
01023 $link = $this->ctrl->getLinkTarget($this, "listMedia");
01024 $title = $this->object->getTitle();
01025 }
01026 else
01027 {
01028 $this->ctrl->setParameter($this, "obj_id", $node["child"]);
01029 $link = $this->ctrl->getLinkTarget($this, "listMedia");
01030 $title = $node["title"];
01031 }
01032 $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
01033 $ilLocator->addItem($title, $link);
01034 }
01035 }
01036 }
01037
01041 function createFolderForm()
01042 {
01043 global $ilAccess;
01044
01045 if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()))
01046 {
01047 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
01048 }
01049
01050 $folder_gui =& new ilObjFolderGUI("", 0, false, false);
01051 $folder_gui->setFormAction("save", "mep_edit.php?cmd=post&cmdClass=ilObjFolderGUI&ref_id=".
01052 $_GET["ref_id"]."&obj_id=".$_GET["obj_id"]);
01053 $folder_gui->createObject();
01054
01055 }
01056
01060
01061
01062
01063
01064
01065
01066
01067
01068
01069
01070
01071
01072
01073
01074
01075
01076
01077
01078
01079
01080
01081
01082
01083
01084
01085
01086
01087
01088
01089
01093 function setTabs()
01094 {
01095
01096 #include_once("classes/class.ilTabsGUI.php");
01097 #$tabs_gui =& new ilTabsGUI();
01098 $this->getTabs($this->tabs_gui);
01099 #$this->tpl->setVariable("TABS", $tabs_gui->getHTML());
01100
01101 }
01102
01108 function getTabs(&$tabs_gui)
01109 {
01110 global $ilAccess;
01111
01112 $tabs_gui->addTarget("view_content", $this->ctrl->getLinkTarget($this, "listMedia"),
01113 "listMedia", "");
01114
01115 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
01116 {
01117 $tabs_gui->addTarget("edit_properties", $this->ctrl->getLinkTarget($this, "edit"),
01118 "edit", array("", "ilobjmediapoolgui"));
01119 }
01120
01121 if ($ilAccess->checkAccess("edit_permission", "", $this->object->getRefId()))
01122 {
01123 $tabs_gui->addTarget("perm_settings",
01124 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
01125 }
01126
01127 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
01128 {
01129 $tabs_gui->addTarget("clipboard", $this->ctrl->getLinkTargetByClass("ilEditClipboardGUI", "view"),
01130 "view", "ileditclipboardgui");
01131 }
01132 }
01133
01134
01135
01136 }
01137 ?>