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