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
00038 include_once("classes/class.ilObjectGUI.php");
00039 include_once("content/classes/class.ilObjMediaPool.php");
00040 include_once("classes/class.ilTableGUI.php");
00041 include_once("classes/class.ilObjFolderGUI.php");
00042 include_once("content/classes/Media/class.ilObjMediaObjectGUI.php");
00043 include_once("content/classes/Media/class.ilObjMediaObject.php");
00044 include_once ("content/classes/class.ilEditClipboardGUI.php");
00045
00046 class ilObjMediaPoolGUI extends ilObjectGUI
00047 {
00048 var $output_prepared;
00049
00055 function ilObjMediaPoolGUI($a_data,$a_id = 0,$a_call_by_reference = true, $a_prepare_output = true)
00056 {
00057 global $lng, $ilCtrl;
00058
00059 $this->ctrl =& $ilCtrl;
00060
00061 $this->ctrl->saveParameter($this, array("ref_id", "obj_id"));
00062
00063 $this->type = "mep";
00064 $lng->loadLanguageModule("content");
00065 parent::ilObjectGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
00066
00067 $this->output_prepared = $a_prepare_output;
00068
00069 if (defined("ILIAS_MODULE"))
00070 {
00071 $this->setTabTargetScript("mep_edit.php");
00072 }
00073 }
00074
00078 function executeCommand()
00079 {
00080 if ($this->ctrl->getRedirectSource() == "ilinternallinkgui")
00081 {
00082 $this->explorer();
00083 return;
00084 }
00085
00086 $tree =& $this->object->getTree();
00087 $next_class = $this->ctrl->getNextClass($this);
00088 $cmd = $this->ctrl->getCmd();
00089
00090 switch($next_class)
00091 {
00092 case "ilobjmediaobjectgui":
00093
00094
00095 if ($cmd == "create")
00096 {
00097 $ret_obj = $_GET["obj_id"];
00098 $ilObjMediaObjectGUI =& new ilObjMediaObjectGUI("", 0, false, false);
00099 }
00100 else
00101 {
00102 $ret_obj = $tree->getParentId($_GET["obj_id"]);
00103 $ilObjMediaObjectGUI =& new ilObjMediaObjectGUI("", $_GET["obj_id"], false, false);
00104 }
00105 if ($this->ctrl->getCmdClass() == "ilinternallinkgui")
00106 {
00107 $this->ctrl->setReturn($this, "explorer");
00108 }
00109 else
00110 {
00111 $this->ctrl->setParameter($this, "obj_id", $ret_obj);
00112 $this->ctrl->setReturn($this, "listMedia");
00113 $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
00114 }
00115 $this->getTemplate();
00116 $ilObjMediaObjectGUI->setAdminTabs();
00117 $this->setLocator();
00118
00119
00120
00121 $ret =& $this->ctrl->forwardCommand($ilObjMediaObjectGUI);
00122
00123 switch($cmd)
00124 {
00125 case "save":
00126 $parent = ($_GET["obj_id"] == "")
00127 ? $tree->getRootId()
00128 : $_GET["obj_id"];
00129 $tree->insertNode($ret->getId(), $parent);
00130 ilUtil::redirect("mep_edit.php?cmd=listMedia&ref_id=".
00131 $_GET["ref_id"]."&obj_id=".$_GET["obj_id"]);
00132 break;
00133
00134 default:
00135 $this->tpl->show();
00136 break;
00137 }
00138 break;
00139
00140 case "ilobjfoldergui":
00141 $folder_gui = new ilObjFolderGUI("", 0, false, false);
00142 $cmd.="Object";
00143 switch($cmd)
00144 {
00145 case "createObject":
00146 $this->prepareOutput();
00147 $folder_gui =& new ilObjFolderGUI("", 0, false, false);
00148 $folder_gui->setFormAction("save",
00149 $this->ctrl->getFormActionByClass("ilobjfoldergui"));
00150 $folder_gui->createObject();
00151 $this->tpl->show();
00152 break;
00153
00154 case "saveObject":
00155 $folder_gui->setReturnLocation("save", $this->ctrl->getLinkTarget($this, "listMedia"));
00156 $parent = ($_GET["obj_id"] == "")
00157 ? $tree->getRootId()
00158 : $_GET["obj_id"];
00159 $folder_gui->setFolderTree($tree);
00160 $folder_gui->saveObject($parent);
00161 break;
00162
00163 case "editObject":
00164 $this->prepareOutput();
00165 $folder_gui =& new ilObjFolderGUI("", $_GET["obj_id"], false, false);
00166 $folder_gui->setFormAction("update", $this->ctrl->getFormActionByClass("ilobjfoldergui"));
00167 $folder_gui->editObject();
00168 $this->tpl->show();
00169 break;
00170
00171 case "updateObject":
00172 $folder_gui =& new ilObjFolderGUI("", $_GET["obj_id"], false, false);
00173 $folder_gui->setReturnLocation("update", $this->ctrl->getLinkTarget($this, "listMedia"));
00174 $folder_gui->updateObject();
00175 break;
00176
00177 case "cancelObject":
00178 sendInfo($this->lng->txt("action_aborted"), true);
00179 $this->ctrl->redirect($this, "listMedia");
00180 break;
00181 }
00182 break;
00183
00184 case "ileditclipboardgui":
00185 $this->prepareOutput();
00186 $this->ctrl->setReturn($this, "listMedia");
00187 $clip_gui = new ilEditClipboardGUI();
00188 $clip_gui->setMultipleSelections(true);
00189
00190 $ret =& $this->ctrl->forwardCommand($clip_gui);
00191 $this->tpl->show();
00192 break;
00193
00194 default:
00195 $cmd = $this->ctrl->getCmd("frameset");
00196 $this->$cmd();
00197 break;
00198 }
00199 }
00200
00205 function saveObject()
00206 {
00207 global $rbacadmin;
00208
00209
00210 $newObj = parent::saveObject();
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221 sendInfo($this->lng->txt("object_added"),true);
00222
00223 ilUtil::redirect($this->getReturnLocation("save","adm_object.php?".$this->link_params));
00224 }
00225
00231 function editObject()
00232 {
00233 global $rbacsystem, $tree, $tpl;
00234
00235 if (!$rbacsystem->checkAccess("visible,write",$this->object->getRefId()))
00236 {
00237 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00238 }
00239
00240
00241 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00242
00243 if (!defined("ILIAS_MODULE"))
00244 {
00245 $this->tpl->setCurrentBlock("btn_cell");
00246 $this->tpl->setVariable("BTN_LINK","content/mep_edit.php?ref_id=".$this->object->getRefID());
00247 $this->tpl->setVariable("BTN_TARGET"," target=\"bottom\" ");
00248 $this->tpl->setVariable("BTN_TXT",$this->lng->txt("edit"));
00249 $this->tpl->parseCurrentBlock();
00250 }
00251
00252 parent::editObject();
00253 }
00254
00258 function edit()
00259 {
00260 $this->prepareOutput();
00261 $this->setFormAction("update", "mep_edit.php?cmd=post&ref_id=".$_GET["ref_id"].
00262 "&obj_id=".$_GET["obj_id"]);
00263 $this->editObject();
00264 $this->tpl->show();
00265 }
00266
00270 function cancel()
00271 {
00272 $this->setReturnLocation("cancel","mep_edit.php?cmd=listMedia&ref_id=".$_GET["ref_id"].
00273 "&obj_id=".$_GET["obj_id"]);
00274 $this->cancelObject();
00275 }
00276
00280 function update()
00281 {
00282 $this->setReturnLocation("update", "mep_edit.php?cmd=listMedia&ref_id=".$_GET["ref_id"].
00283 "&obj_id=".$_GET["obj_id"]);
00284 $this->updateObject();
00285 }
00286
00290 function perm()
00291 {
00292 $this->prepareOutput();
00293 $this->setFormAction("permSave", "mep_edit.php?cmd=permSave&ref_id=".$_GET["ref_id"].
00294 "&obj_id=".$_GET["obj_id"]);
00295 $this->setFormAction("addRole", "mep_edit.php?ref_id=".$_GET["ref_id"].
00296 "&obj_id=".$_GET["obj_id"]."&cmd=addRole");
00297 $this->permObject();
00298 $this->tpl->show();
00299 }
00300
00304 function permSave()
00305 {
00306 $this->setReturnLocation("permSave",
00307 "mep_edit.php?ref_id=".$_GET["ref_id"]."&obj_id=".$_GET["obj_id"]."&cmd=perm");
00308 $this->permSaveObject();
00309 }
00310
00314 function addRole()
00315 {
00316 $this->setReturnLocation("addRole",
00317 "mep_edit.php?ref_id=".$_GET["ref_id"]."&obj_id=".$_GET["obj_id"]."&cmd=perm");
00318 $this->addRoleObject();
00319 }
00320
00324 function owner()
00325 {
00326 $this->prepareOutput();
00327 $this->ownerObject();
00328 $this->tpl->show();
00329 }
00330
00334 function listMedia()
00335 {
00336 global $tree;
00337
00338 if (!$this->output_prepared)
00339 {
00340 $this->prepareOutput();
00341 }
00342
00343
00344 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00345
00346
00347 $this->tpl->setCurrentBlock("btn_cell");
00348 $this->tpl->setVariable("BTN_LINK",
00349 $this->ctrl->getLinkTargetByClass("ilobjfoldergui", "create"));
00350 $this->tpl->setVariable("BTN_TXT",$this->lng->txt("cont_create_folder"));
00351 $this->tpl->parseCurrentBlock();
00352
00353
00354 $this->tpl->setCurrentBlock("btn_cell");
00355 $this->tpl->setVariable("BTN_LINK",
00356 $this->ctrl->getLinkTargetByClass("ilobjmediaobjectgui", "create"));
00357 $this->tpl->setVariable("BTN_TXT",$this->lng->txt("cont_create_mob"));
00358 $this->tpl->parseCurrentBlock();
00359
00360 $obj_id = ($_GET["obj_id"] == "")
00361 ? $obj_id = $this->object->tree->getRootId()
00362 : $_GET["obj_id"];
00363
00364
00365 require_once("classes/class.ilTableGUI.php");
00366 $tbl = new ilTableGUI();
00367
00368
00369 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
00370
00371
00372 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.mep_list_row.html", true);
00373
00374 $num = 0;
00375
00376 $this->tpl->setVariable("FORMACTION", "mep_edit.php?ref_id=".$_GET["ref_id"].
00377 "&obj_id=".$_GET["obj_id"]."&cmd=post");
00378
00379 $tbl->setTitle($this->lng->txt("cont_content"));
00380
00381 $tbl->setHeaderNames(array("", "", $this->lng->txt("title")));
00382
00383 $cols = array("", "", "title");
00384 $header_params = array("ref_id" => $_GET["ref_id"],
00385 "obj_id" => $_GET["obj_id"], "cmd" => "listMedia");
00386 $tbl->setHeaderVars($cols, $header_params);
00387 $tbl->setColumnWidth(array("1%", "1%", "98%"));
00388
00389
00390 $tbl->setOrderColumn($_GET["sort_by"]);
00391 $tbl->setOrderDirection($_GET["sort_order"]);
00392 $tbl->setLimit($_GET["limit"]);
00393 $tbl->setOffset($_GET["offset"]);
00394 $tbl->setMaxCount($this->maxcount);
00395
00396 $this->tpl->setVariable("COLUMN_COUNTS", 3);
00397
00398
00399 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
00400 $this->tpl->setCurrentBlock("tbl_action_btn");
00401 $this->tpl->setVariable("BTN_NAME", "confirmRemove");
00402 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("remove"));
00403 $this->tpl->parseCurrentBlock();
00404
00405
00406 $this->tpl->setCurrentBlock("tbl_action_btn");
00407 $this->tpl->setVariable("BTN_NAME", "copyToClipboard");
00408 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("cont_copy_to_clipboard"));
00409 $this->tpl->parseCurrentBlock();
00410
00411
00412 $this->tpl->setCurrentBlock("tbl_action_btn");
00413 $this->tpl->setVariable("BTN_NAME", "pasteFromClipboard");
00414 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("cont_paste_from_clipboard"));
00415 $this->tpl->parseCurrentBlock();
00416
00417
00418 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00419
00420
00421
00422
00423 $fobjs = $this->object->getChilds($_GET["obj_id"], "fold");
00424 $f2objs = array();
00425 foreach ($fobjs as $obj)
00426 {
00427 $f2objs[$obj["title"].":".$obj["id"]] = $obj;
00428 }
00429 ksort($f2objs);
00430
00431
00432 $mobjs = $this->object->getChilds($_GET["obj_id"], "mob");
00433 $m2objs = array();
00434 foreach ($mobjs as $obj)
00435 {
00436 $m2objs[$obj["title"].":".$obj["id"]] = $obj;
00437 }
00438 ksort($m2objs);
00439
00440
00441 $objs = array_merge($f2objs, $m2objs);
00442
00443
00444
00445 $tbl->setMaxCount(count($objs));
00446 $objs = array_slice($objs, $_GET["offset"], $_GET["limit"]);
00447
00448 $tbl->render();
00449 if(count($objs) > 0)
00450 {
00451 $i=0;
00452 foreach($objs as $obj)
00453 {
00454 $this->tpl->setCurrentBlock("link");
00455 $this->tpl->setVariable("TXT_TITLE", $obj["title"]);
00456 switch($obj["type"])
00457 {
00458 case "fold":
00459 $this->ctrl->setParameter($this, "obj_id", $obj["obj_id"]);
00460 $this->tpl->setVariable("LINK_VIEW",
00461 $this->ctrl->getLinkTarget($this, "listMedia"));
00462 $this->tpl->parseCurrentBlock();
00463 $this->tpl->setCurrentBlock("edit");
00464 $this->tpl->setVariable("TXT_EDIT", $this->lng->txt("edit"));
00465 $this->ctrl->setParameterByClass("ilobjfoldergui", "obj_id", $obj["obj_id"]);
00466 $this->tpl->setVariable("EDIT_LINK",
00467 $this->ctrl->getLinkTargetByClass("ilobjfoldergui", "edit"));
00468 $this->tpl->parseCurrentBlock();
00469 $this->tpl->setCurrentBlock("tbl_content");
00470 $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_".$obj["type"].".gif"));
00471 break;
00472
00473 case "mob":
00474 $this->ctrl->setParameterByClass("ilobjmediaobjectgui", "obj_id", $obj["obj_id"]);
00475 $this->tpl->setVariable("LINK_VIEW",
00476 $this->ctrl->getLinkTargetByClass("ilobjmediaobjectgui", "edit"));
00477 $this->tpl->setCurrentBlock("show");
00478 $this->tpl->setVariable("TXT_SHOW", $this->lng->txt("view"));
00479 $this->ctrl->setParameter($this, "mob_id", $obj["obj_id"]);
00480 $this->tpl->setVariable("SHOW_LINK", $this->ctrl->getLinktarget($this, "showMedia"));
00481 $this->tpl->parseCurrentBlock();
00482 $this->tpl->setCurrentBlock("link");
00483
00484 $this->tpl->setCurrentBlock("tbl_content");
00485
00486
00487 $mob =& new ilObjMediaObject($obj["obj_id"]);
00488 $med =& $mob->getMediaItem("Standard");
00489 $target = $med->getThumbnailTarget();
00490 if ($target != "")
00491 {
00492 $this->tpl->setVariable("IMG_OBJ", $target);
00493 }
00494 else
00495 {
00496 $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_".$obj["type"].".gif"));
00497 }
00498
00499
00500 include_once("content/classes/Media/class.ilObjMediaObjectGUI.php");
00501 $this->tpl->setVariable("MEDIA_INFO",
00502 ilObjMediaObjectGUI::_getMediaInfoHTML($mob));
00503
00504 break;
00505 }
00506
00507
00508 $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
00509 $this->tpl->setVariable("CHECKBOX_ID", $obj["obj_id"]);
00510 $this->tpl->setVariable("CSS_ROW", $css_row);
00511
00512 $this->tpl->parseCurrentBlock();
00513 }
00514 $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
00515 }
00516 else
00517 {
00518 $this->tpl->setCurrentBlock("notfound");
00519 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
00520 $this->tpl->setVariable("NUM_COLS", 3);
00521 $this->tpl->parseCurrentBlock();
00522 }
00523
00524 $this->tpl->parseCurrentBlock();
00525 $this->tpl->show();
00526 }
00527
00528 function getTemplate()
00529 {
00530 $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00531 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00532 }
00533
00539 function frameset()
00540 {
00541 $this->tpl = new ilTemplate("tpl.mep_edit_frameset.html", false, false, "content");
00542 $this->tpl->setVariable("REF_ID",$this->ref_id);
00543 $this->tpl->show();
00544 }
00545
00549 function explorer()
00550 {
00551 $this->tpl = new ilTemplate("tpl.main.html", true, true);
00552
00553 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
00554
00555 $this->tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
00556
00557 require_once ("content/classes/class.ilMediaPoolExplorer.php");
00558 $exp = new ilMediaPoolExplorer($this->ctrl->getLinkTarget($this, "listMedia"), $this->object);
00559 $exp->setTargetGet("obj_id");
00560
00561 $exp->setExpandTarget($this->ctrl->getLinkTarget($this, "explorer"));
00562
00563 $exp->addFilter("root");
00564 $exp->addFilter("fold");
00565 $exp->setFiltered(true);
00566 $exp->setFilterMode(IL_FM_POSITIVE);
00567
00568
00569 if ($_GET["mepexpand"] == "")
00570 {
00571 $mep_tree =& $this->object->getTree();
00572 $expanded = $mep_tree->readRootId();
00573 }
00574 else
00575 {
00576 $expanded = $_GET["mepexpand"];
00577 }
00578
00579 $exp->setExpand($expanded);
00580
00581
00582 $exp->setOutput(0);
00583 $output = $exp->getOutput();
00584
00585 $this->tpl->setCurrentBlock("content");
00586 $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_mep_structure"));
00587 $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
00588 $this->tpl->setVariable("EXPLORER",$output);
00589 $this->tpl->setVariable("ACTION", "mep_edit.php?cmd=explorer&ref_id=".$this->ref_id."&mepexpand=".$_GET["mepexpand"]);
00590 $this->tpl->parseCurrentBlock();
00591 $this->tpl->show(false);
00592
00593 }
00594
00598 function showMedia()
00599 {
00600 $this->tpl =& new ilTemplate("tpl.fullscreen.html", true, true, "content");
00601 include_once("classes/class.ilObjStyleSheet.php");
00602 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
00603 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
00604 ilObjStyleSheet::getContentStylePath(0));
00605
00606
00607 $med_links = ilMediaItem::_getMapAreasIntLinks($_GET["mob_id"]);
00608
00609
00610
00611
00612 $link_xlm = "";
00613
00614 require_once("content/classes/Media/class.ilObjMediaObject.php");
00615 $media_obj =& new ilObjMediaObject($_GET["mob_id"]);
00616
00617 $xml = "<dummy>";
00618
00619
00620 $xml.= $media_obj->getXML(IL_MODE_ALIAS);
00621 $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
00622 $xml.= $link_xml;
00623 $xml.="</dummy>";
00624
00625 $xsl = file_get_contents("./content/page.xsl");
00626 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
00627 $xh = xslt_create();
00628
00629 $wb_path = ilUtil::getWebspaceDir("output");
00630
00631 $mode = ($_GET["cmd"] != "showMedia")
00632 ? "fullscreen"
00633 : "media";
00634 $enlarge_path = ilUtil::getImagePath("enlarge.gif", false, "output");
00635 $fullscreen_link =
00636 $this->ctrl->getLinkTarget($this, "showFullscreen");
00637 $params = array ('mode' => $mode, 'enlarge_path' => $enlarge_path,
00638 'link_params' => "ref_id=".$_GET["ref_id"],'fullscreen_link' => $fullscreen_link,
00639 'ref_id' => $_GET["ref_id"], 'pg_frame' => $pg_frame, 'webspace_path' => $wb_path);
00640 $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
00641 echo xslt_error($xh);
00642 xslt_free($xh);
00643
00644
00645 $this->tpl->setVariable("MEDIA_CONTENT", $output);
00646
00647 $this->tpl->parseCurrentBlock();
00648 $this->tpl->show();
00649
00650 }
00651
00655 function showFullscreen()
00656 {
00657 $this->showMedia();
00658 }
00659
00663 function confirmRemove()
00664 {
00665 if(!isset($_POST["id"]))
00666 {
00667 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00668 }
00669
00670 $this->prepareOutput();
00671
00672
00673 $_SESSION["ilMepRemove"] = $_POST["id"];
00674
00675 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.confirm_deletion.html", true);
00676
00677 sendInfo($this->lng->txt("info_delete_sure"));
00678
00679 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00680
00681
00682 $this->tpl->setCurrentBlock("table_header");
00683 $this->tpl->setVariable("TEXT",$this->lng->txt("objects"));
00684 $this->tpl->parseCurrentBlock();
00685
00686
00687 $counter = 0;
00688 foreach($_POST["id"] as $obj_id)
00689 {
00690 $type = ilObject::_lookupType($obj_id);
00691 $title = ilObject::_lookupTitle($obj_id);
00692 $this->tpl->setCurrentBlock("table_row");
00693 $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor(++$counter,"tblrow1","tblrow2"));
00694 $this->tpl->setVariable("TEXT_CONTENT", $title);
00695 $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_".$type.".gif"));
00696 $this->tpl->parseCurrentBlock();
00697 }
00698
00699
00700 $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
00701 $buttons = array( "cancelRemove" => $this->lng->txt("cancel"),
00702 "remove" => $this->lng->txt("confirm"));
00703 foreach ($buttons as $name => $value)
00704 {
00705 $this->tpl->setCurrentBlock("operation_btn");
00706 $this->tpl->setVariable("BTN_NAME",$name);
00707 $this->tpl->setVariable("BTN_VALUE",$value);
00708 $this->tpl->parseCurrentBlock();
00709 }
00710 $this->tpl->show();
00711 }
00712
00716 function pasteFromClipboard()
00717 {
00718 global $ilCtrl;
00719
00720 $ilCtrl->setParameterByClass("ileditclipboardgui", "returnCommand",
00721 rawurlencode($ilCtrl->getLinkTarget($this,
00722 "insertFromClipboard")));
00723
00724 $ilCtrl->redirectByClass("ilEditClipboardGUI", "getObject");
00725 }
00726
00727
00731 function insertFromClipboard()
00732 {
00733 include_once("content/classes/class.ilEditClipboardGUI.php");
00734 $ids = ilEditClipboardGUI::_getSelectedIDs();
00735 $not_inserted = array();
00736 if (is_array($ids))
00737 {
00738 foreach ($ids as $id)
00739 {
00740 if (!$this->object->insertInTree($id, $_GET["obj_id"]))
00741 {
00742 $not_inserted[] = ilObject::_lookupTitle($id)." [".
00743 $id."]";
00744 }
00745 }
00746 }
00747 if (count($not_inserted) > 0)
00748 {
00749 sendInfo($this->lng->txt("mep_not_insert_already_exist")."<br>".
00750 implode($not_inserted,"<br>"), true);
00751 }
00752 $this->ctrl->redirect($this, "listMedia");
00753 }
00754
00755
00759 function cancelRemove()
00760 {
00761 session_unregister("ilMepRemove");
00762 $this->ctrl->redirect($this, "listMedia");
00763 }
00764
00768 function remove()
00769 {
00770 foreach($_SESSION["ilMepRemove"] as $obj_id)
00771 {
00772 $this->object->deleteChild($obj_id);
00773 }
00774
00775 sendInfo($this->lng->txt("cont_obj_removed"),true);
00776 session_unregister("ilMepRemove");
00777 $this->ctrl->redirect($this, "listMedia");
00778 }
00779
00780
00784 function copyToClipboard()
00785 {
00786 global $ilUser;
00787
00788 if(!isset($_POST["id"]))
00789 {
00790 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00791 }
00792
00793 foreach ($_POST["id"] as $obj_id)
00794 {
00795 $type = ilObject::_lookupType($obj_id);
00796 if ($type == "fold")
00797 {
00798 $this->ilias->raiseError($this->lng->txt("cont_cant_copy_folders"), $this->ilias->error_obj->MESSAGE);
00799 }
00800 }
00801
00802 foreach ($_POST["id"] as $obj_id)
00803 {
00804 $ilUser->addObjectToClipboard($obj_id, "mob", "");
00805 }
00806
00807 sendInfo($this->lng->txt("copied_to_clipboard"),true);
00808 $this->ctrl->redirect($this, "listMedia");
00809 }
00810
00814 function setLocator($a_tree = "", $a_id = "", $scriptname="adm_object.php")
00815 {
00816 global $ilias_locator;
00817
00818 if (!defined("ILIAS_MODULE"))
00819 {
00820 parent::setLocator();
00821 return;
00822 }
00823 else
00824 {
00825 $tree =& $this->object->getTree();
00826 $obj_id = ($_GET["obj_id"] == "")
00827 ? $tree->getRootId()
00828 : $_GET["obj_id"];
00829 parent::setLocator($tree, $obj_id, "mep_edit.php?cmd=listMedia&ref_id=".$_GET["ref_id"],
00830 "obj_id", false, $this->object->getTitle());
00831 }
00832 return;
00833
00834 if (!is_object($a_tree))
00835 {
00836 $a_tree =& $this->tree;
00837 }
00838
00839 if (!($a_id))
00840 {
00841 $a_id = $_GET["ref_id"];
00842 }
00843
00844 $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html");
00845
00846 $path = $a_tree->getPathFull($a_id);
00847
00848
00849
00850 if ($a_parent_parent)
00851 {
00852
00853 $subObj =& $this->ilias->obj_factory->getInstanceByRefId($a_ref_id);
00854
00855 $path[] = array(
00856 "id" => $a_ref_id,
00857 "title" => $this->lng->txt($subObj->getTitle())
00858 );
00859 }
00860
00861
00862 $modifier = 1;
00863
00864 if (isset($_GET["obj_id"]))
00865 {
00866 $modifier = 0;
00867 }
00868
00869
00870 $i = 1;
00871
00872 foreach ($path as $key => $row)
00873 {
00874 if ($key < count($path)-$modifier)
00875 {
00876 $this->tpl->touchBlock("locator_separator");
00877 }
00878
00879 $this->tpl->setCurrentBlock("locator_item");
00880 $this->tpl->setVariable("ITEM", $row["title"]);
00881
00882 $this->tpl->setVariable("LINK_ITEM", $scriptname."?ref_id=".$row["child"]);
00883 $this->tpl->parseCurrentBlock();
00884
00885
00886
00887 $ilias_locator->navigate($i++,$row["title"],$scriptname."?ref_id=".$row["child"],"bottom");
00888 }
00889
00890 if (isset($_GET["obj_id"]))
00891 {
00892 $obj_data =& $this->ilias->obj_factory->getInstanceByObjId($_GET["obj_id"]);
00893
00894 $this->tpl->setCurrentBlock("locator_item");
00895 $this->tpl->setVariable("ITEM", $obj_data->getTitle());
00896
00897 $this->tpl->setVariable("LINK_ITEM", $scriptname."?ref_id=".$_GET["ref_id"]."&obj_id=".$_GET["obj_id"]);
00898 $this->tpl->parseCurrentBlock();
00899
00900
00901
00902 $ilias_locator->navigate($i++,$obj_data->getTitle(),$scriptname."?ref_id=".$_GET["ref_id"]."&obj_id=".$_GET["obj_id"],"bottom");
00903 }
00904
00905 $this->tpl->setCurrentBlock("locator");
00906
00907 if (DEBUG)
00908 {
00909 $debug = "DEBUG: <font color=\"red\">".$this->type."::".$this->id."::".$_GET["cmd"]."</font><br/>";
00910 }
00911
00912 $prop_name = $this->objDefinition->getPropertyName($_GET["cmd"],$this->type);
00913
00914 if ($_GET["cmd"] == "confirmDeleteAdm")
00915 {
00916 $prop_name = "delete_object";
00917 }
00918
00919 $this->tpl->setVariable("TXT_LOCATOR",$debug.$this->lng->txt("locator"));
00920 $this->tpl->parseCurrentBlock();
00921 }
00922
00926 function createFolderForm()
00927 {
00928 $this->prepareOutput();
00929
00930 $folder_gui =& new ilObjFolderGUI("", 0, false, false);
00931 $folder_gui->setFormAction("save", "mep_edit.php?cmd=post&cmdClass=ilObjFolderGUI&ref_id=".
00932 $_GET["ref_id"]."&obj_id=".$_GET["obj_id"]);
00933 $folder_gui->createObject();
00934
00935 }
00936
00940 function prepareOutput()
00941 {
00942 if (!defined("ILIAS_MODULE"))
00943 {
00944 parent::prepareOutput();
00945 return;
00946 }
00947
00948 $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00949 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00950
00951 $title = $this->object->getTitle();
00952
00953
00954 sendInfo();
00955
00956 if (!empty($title))
00957 {
00958 $this->tpl->setVariable("HEADER", $title);
00959 }
00960
00961 $this->setTabs();
00962 $this->setLocator();
00963 }
00964
00968 function setTabs()
00969 {
00970
00971 include_once("classes/class.ilTabsGUI.php");
00972 $tabs_gui =& new ilTabsGUI();
00973 $this->getTabs($tabs_gui);
00974 $this->tpl->setVariable("TABS", $tabs_gui->getHTML());
00975
00976 }
00977
00983 function getTabs(&$tabs_gui)
00984 {
00985 $tabs_gui->addTarget("view_content", $this->ctrl->getLinkTarget($this, "listMedia"),
00986 get_class($this), "listMedia");
00987
00988 $tabs_gui->addTarget("edit_properties", $this->ctrl->getLinkTarget($this, "edit"),
00989 get_class($this), "edit");
00990
00991 $tabs_gui->addTarget("permission_settings", $this->ctrl->getLinkTarget($this, "perm"),
00992 get_class($this), "perm");
00993
00994 $tabs_gui->addTarget("show_owner", $this->ctrl->getLinkTarget($this, "owner"),
00995 get_class($this), "owner");
00996
00997 $tabs_gui->addTarget("clipboard", $this->ctrl->getLinkTargetByClass("ilEditClipboardGUI", "view"),
00998 "ileditclipboardgui", "view");
00999
01000 }
01001
01002
01003
01004 }
01005 ?>