• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

content/classes/class.ilObjMediaPoolGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
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                 if ($cmd == "create")
00091                 {
00092                         switch($_POST["new_type"])
00093                         {
00094                                 case "mob":
00095                                         $this->ctrl->redirectByClass("ilobjmediaobjectgui", "create");
00096                                         break;
00097                                         
00098                                 case "fold":
00099                                         $this->ctrl->redirectByClass("ilobjfoldergui", "create");
00100                                         break;
00101                         }
00102                 }
00103 
00104                 switch($next_class)
00105                 {
00106                         case "ilobjmediaobjectgui":
00107 
00108                                 //$cmd.="Object";
00109                                 if ($cmd == "create")
00110                                 {
00111                                         $ret_obj = $_GET["obj_id"];
00112                                         $ilObjMediaObjectGUI =& new ilObjMediaObjectGUI("", 0, false, false);
00113                                 }
00114                                 else
00115                                 {
00116                                         $ret_obj = $tree->getParentId($_GET["obj_id"]);
00117                                         $ilObjMediaObjectGUI =& new ilObjMediaObjectGUI("", $_GET["obj_id"], false, false);
00118                                 }
00119                                 if ($this->ctrl->getCmdClass() == "ilinternallinkgui")
00120                                 {
00121                                         $this->ctrl->setReturn($this, "explorer");
00122                                 }
00123                                 else
00124                                 {
00125                                         $this->ctrl->setParameter($this, "obj_id", $ret_obj);
00126                                         $this->ctrl->setReturn($this, "listMedia");
00127                                         $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
00128                                 }
00129                                 $this->getTemplate();
00130                                 $ilObjMediaObjectGUI->setAdminTabs();
00131                                 $this->setLocator();
00132 
00133 //echo ":".$tree->getParentId($_GET["obj_id"]).":";
00134                                 //$ret =& $ilObjMediaObjectGUI->executeCommand();
00135                                 $ret =& $this->ctrl->forwardCommand($ilObjMediaObjectGUI);
00136 //echo "<br>ilObjMediaPoolGUI:afterexecute:<br>"; exit;
00137                                 switch($cmd)
00138                                 {
00139                                         case "save":
00140                                                 $parent = ($_GET["obj_id"] == "")
00141                                                         ? $tree->getRootId()
00142                                                         : $_GET["obj_id"];
00143                                                 $tree->insertNode($ret->getId(), $parent);
00144                                                 ilUtil::redirect("mep_edit.php?cmd=listMedia&ref_id=".
00145                                                         $_GET["ref_id"]."&obj_id=".$_GET["obj_id"]);
00146                                                 break;
00147 
00148                                         default:
00149                                                 $this->tpl->show();
00150                                                 break;
00151                                 }
00152                                 break;
00153 
00154                         case "ilobjfoldergui":
00155                                 $folder_gui = new ilObjFolderGUI("", 0, false, false);
00156                                 $cmd.="Object";
00157                                 switch($cmd)
00158                                 {
00159                                         case "createObject":
00160                                                 $this->prepareOutput();
00161                                                 $folder_gui =& new ilObjFolderGUI("", 0, false, false);
00162                                                 $folder_gui->setFormAction("save",
00163                                                         $this->ctrl->getFormActionByClass("ilobjfoldergui"));
00164                                                 $folder_gui->createObject();
00165                                                 $this->tpl->show();
00166                                                 break;
00167 
00168                                         case "saveObject":
00169                                                 $folder_gui->setReturnLocation("save", $this->ctrl->getLinkTarget($this, "listMedia"));
00170                                                 $parent = ($_GET["obj_id"] == "")
00171                                                         ? $tree->getRootId()
00172                                                         : $_GET["obj_id"];
00173                                                 $folder_gui->setFolderTree($tree);
00174                                                 $folder_gui->saveObject($parent);
00175                                                 break;
00176 
00177                                         case "editObject":
00178                                                 $this->prepareOutput();
00179                                                 $folder_gui =& new ilObjFolderGUI("", $_GET["obj_id"], false, false);
00180                                                 $folder_gui->setFormAction("update", $this->ctrl->getFormActionByClass("ilobjfoldergui"));
00181                                                 $folder_gui->editObject();
00182                                                 $this->tpl->show();
00183                                                 break;
00184 
00185                                         case "updateObject":
00186                                                 $folder_gui =& new ilObjFolderGUI("", $_GET["obj_id"], false, false);
00187                                                 $folder_gui->setReturnLocation("update", $this->ctrl->getLinkTarget($this, "listMedia"));
00188                                                 $folder_gui->updateObject();
00189                                                 break;
00190 
00191                                         case "cancelObject":
00192                                                 sendInfo($this->lng->txt("action_aborted"), true);
00193                                                 $this->ctrl->redirect($this, "listMedia");
00194                                                 break;
00195                                 }
00196                                 break;
00197 
00198                         case "ileditclipboardgui":
00199                                 $this->prepareOutput();
00200                                 $this->ctrl->setReturn($this, "listMedia");
00201                                 $clip_gui = new ilEditClipboardGUI();
00202                                 $clip_gui->setMultipleSelections(true);
00203                                 //$ret =& $clip_gui->executeCommand();
00204                                 $ret =& $this->ctrl->forwardCommand($clip_gui);
00205                                 $this->tpl->show();
00206                                 break;
00207 
00208                         default:
00209                                 $cmd = $this->ctrl->getCmd("frameset");
00210                                 $this->$cmd();
00211                                 break;
00212                 }
00213         }
00214 
00219         function saveObject()
00220         {
00221                 global $rbacadmin;
00222 
00223                 // create and insert forum in objecttree
00224                 $newObj = parent::saveObject();
00225 
00226                 // setup rolefolder & default local roles
00227                 //$roles = $newObj->initDefaultRoles();
00228 
00229                 // ...finally assign role to creator of object
00230                 //$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "y");
00231 
00232                 // put here object specific stuff
00233 
00234                 // always send a message
00235                 sendInfo($this->lng->txt("object_added"),true);
00236 
00237                 ilUtil::redirect($this->getReturnLocation("save","adm_object.php?".$this->link_params));
00238         }
00239 
00245         function editObject()
00246         {
00247                 global $rbacsystem, $tree, $tpl;
00248 
00249                 if (!$rbacsystem->checkAccess("visible,write",$this->object->getRefId()))
00250                 {
00251                         $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00252                 }
00253 
00254                 // edit button
00255                 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00256 
00257                 if (!defined("ILIAS_MODULE"))
00258                 {
00259                         $this->tpl->setCurrentBlock("btn_cell");
00260                         $this->tpl->setVariable("BTN_LINK","content/mep_edit.php?ref_id=".$this->object->getRefID());
00261                         $this->tpl->setVariable("BTN_TARGET"," target=\"bottom\" ");
00262                         $this->tpl->setVariable("BTN_TXT",$this->lng->txt("edit"));
00263                         $this->tpl->parseCurrentBlock();
00264                 }
00265 
00266                 parent::editObject();
00267         }
00268 
00272         function edit()
00273         {
00274                 $this->prepareOutput();
00275                 $this->setFormAction("update", "mep_edit.php?cmd=post&ref_id=".$_GET["ref_id"].
00276                         "&obj_id=".$_GET["obj_id"]);
00277                 $this->editObject();
00278                 $this->tpl->show();
00279         }
00280 
00284         function cancel()
00285         {
00286                 $this->setReturnLocation("cancel","mep_edit.php?cmd=listMedia&ref_id=".$_GET["ref_id"].
00287                         "&obj_id=".$_GET["obj_id"]);
00288                 $this->cancelObject();
00289         }
00290 
00294         function update()
00295         {
00296                 $this->setReturnLocation("update", "mep_edit.php?cmd=listMedia&ref_id=".$_GET["ref_id"].
00297                         "&obj_id=".$_GET["obj_id"]);
00298                 $this->updateObject();
00299         }
00300 
00304         function perm()
00305         {
00306                 $this->prepareOutput();
00307                 $this->setFormAction("permSave", "mep_edit.php?cmd=permSave&ref_id=".$_GET["ref_id"].
00308                         "&obj_id=".$_GET["obj_id"]);
00309                 $this->setFormAction("addRole", "mep_edit.php?ref_id=".$_GET["ref_id"].
00310                         "&obj_id=".$_GET["obj_id"]."&cmd=addRole");
00311                 $this->permObject();
00312                 $this->tpl->show();
00313         }
00314 
00318         function info()
00319         {
00320                 $this->prepareOutput();
00321                 $this->infoObject();
00322                 $this->tpl->show();
00323         }
00324 
00328         function permSave()
00329         {
00330                 $this->setReturnLocation("permSave",
00331                         "mep_edit.php?ref_id=".$_GET["ref_id"]."&obj_id=".$_GET["obj_id"]."&cmd=perm");
00332                 $this->permSaveObject();
00333         }
00334 
00338         function addRole()
00339         {
00340                 $this->setReturnLocation("addRole",
00341                         "mep_edit.php?ref_id=".$_GET["ref_id"]."&obj_id=".$_GET["obj_id"]."&cmd=perm");
00342                 $this->addRoleObject();
00343         }
00344 
00348         function owner()
00349         {
00350                 $this->prepareOutput();
00351                 $this->ownerObject();
00352                 $this->tpl->show();
00353         }
00354 
00358         function listMedia()
00359         {
00360                 global $tree;
00361 
00362                 if (!$this->output_prepared)
00363                 {
00364                         $this->prepareOutput();
00365                 }
00366 
00367                 //add template for view button
00368                 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00369 
00370                 /*
00371                 // create folder form button
00372                 $this->tpl->setCurrentBlock("btn_cell");
00373                 $this->tpl->setVariable("BTN_LINK",
00374                         $this->ctrl->getLinkTargetByClass("ilobjfoldergui", "create"));
00375                 $this->tpl->setVariable("BTN_TXT",$this->lng->txt("cont_create_folder"));
00376                 $this->tpl->parseCurrentBlock();
00377 
00378                 // create mob form button
00379                 $this->tpl->setCurrentBlock("btn_cell");
00380                 $this->tpl->setVariable("BTN_LINK",
00381                         $this->ctrl->getLinkTargetByClass("ilobjmediaobjectgui", "create"));
00382                 $this->tpl->setVariable("BTN_TXT",$this->lng->txt("cont_create_mob"));
00383                 $this->tpl->parseCurrentBlock();*/
00384 
00385                 $obj_id = ($_GET["obj_id"] == "")
00386                         ? $obj_id = $this->object->tree->getRootId()
00387                         : $_GET["obj_id"];
00388 
00389                 // create table
00390                 require_once("classes/class.ilTableGUI.php");
00391                 $tbl = new ilTableGUI();
00392 
00393                 // load files templates
00394                 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
00395 
00396                 // load template for table content data
00397                 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.mep_list_row.html", true);
00398 
00399                 $num = 0;
00400 
00401                 $this->tpl->setVariable("FORMACTION", "mep_edit.php?ref_id=".$_GET["ref_id"].
00402                         "&obj_id=".$_GET["obj_id"]."&cmd=post");
00403 
00404                 $tbl->setTitle($this->lng->txt("cont_content"));
00405 
00406                 $tbl->setHeaderNames(array("", "", $this->lng->txt("title")));
00407 
00408                 $cols = array("", "", "title");
00409                 $header_params = array("ref_id" => $_GET["ref_id"],
00410                         "obj_id" => $_GET["obj_id"], "cmd" => "listMedia");
00411                 $tbl->setHeaderVars($cols, $header_params);
00412                 $tbl->setColumnWidth(array("1%", "1%", "98%"));
00413 
00414                 // control
00415                 $tbl->setOrderColumn($_GET["sort_by"]);
00416                 $tbl->setOrderDirection($_GET["sort_order"]);
00417                 $tbl->setLimit($_GET["limit"]);
00418                 $tbl->setOffset($_GET["offset"]);
00419                 $tbl->setMaxCount($this->maxcount);             // ???
00420 
00421                 $this->tpl->setVariable("COLUMN_COUNTS", 3);
00422 
00423                 // remove button
00424                 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
00425                 $this->tpl->setCurrentBlock("tbl_action_btn");
00426                 $this->tpl->setVariable("BTN_NAME", "confirmRemove");
00427                 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("remove"));
00428                 $this->tpl->parseCurrentBlock();
00429 
00430                 // copy to clipboard
00431                 $this->tpl->setCurrentBlock("tbl_action_btn");
00432                 $this->tpl->setVariable("BTN_NAME", "copyToClipboard");
00433                 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("cont_copy_to_clipboard"));
00434                 $this->tpl->parseCurrentBlock();
00435                 
00436                 // copy to clipboard
00437                 $this->tpl->setCurrentBlock("tbl_action_btn");
00438                 $this->tpl->setVariable("BTN_NAME", "pasteFromClipboard");
00439                 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("cont_paste_from_clipboard"));
00440                 $this->tpl->parseCurrentBlock();
00441 
00442                 // footer
00443                 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00444                 //$tbl->disable("footer");
00445                 
00446                                                         
00447                 // get current folders
00448                 $fobjs = $this->object->getChilds($_GET["obj_id"], "fold");
00449                 $f2objs = array();
00450                 foreach ($fobjs as $obj)
00451                 {
00452                         $f2objs[$obj["title"].":".$obj["id"]] = $obj;
00453                 }
00454                 ksort($f2objs);
00455 
00456                 // get current media objects
00457                 $mobjs = $this->object->getChilds($_GET["obj_id"], "mob");
00458                 $m2objs = array();
00459                 foreach ($mobjs as $obj)
00460                 {
00461                         $m2objs[$obj["title"].":".$obj["id"]] = $obj;
00462                 }
00463                 ksort($m2objs);
00464                 
00465                 // merge everything together
00466                 $objs = array_merge($f2objs, $m2objs);
00467                 //$objs = $this->object->getChilds($_GET["obj_id"]);
00468 
00469                 $tbl->setMaxCount(count($objs));
00470                 $objs = array_slice($objs, $_GET["offset"], $_GET["limit"]);
00471 
00472                 $subobj = array(
00473                         "mob" => $this->lng->txt("mob"),
00474                         "fold" => $this->lng->txt("fold"));
00475                 $opts = ilUtil::formSelect("", "new_type", $subobj, false, true);
00476                 $this->tpl->setCurrentBlock("add_object");
00477                 $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
00478                 $this->tpl->setVariable("BTN_NAME", "create");
00479                 $this->tpl->setVariable("TXT_ADD", $this->lng->txt("add"));
00480                 $this->tpl->parseCurrentBlock();
00481                 $tbl->disable("sort");
00482                 //$tbl->disable("title");
00483                 $tbl->disable("header");
00484                 $tbl->render();
00485                 if(count($objs) > 0)
00486                 {
00487                         $i=0;
00488                         foreach($objs as $obj)
00489                         {
00490                                 $this->tpl->setCurrentBlock("link");
00491                                 $this->tpl->setVariable("TXT_TITLE", $obj["title"]);
00492                                 switch($obj["type"])
00493                                 {
00494                                         case "fold":
00495                                                 $this->ctrl->setParameter($this, "obj_id", $obj["obj_id"]);
00496                                                 $this->tpl->setVariable("LINK_VIEW",
00497                                                         $this->ctrl->getLinkTarget($this, "listMedia"));
00498                                                 $this->tpl->parseCurrentBlock();
00499                                                 $this->tpl->setCurrentBlock("edit");
00500                                                 $this->tpl->setVariable("TXT_EDIT", $this->lng->txt("edit"));
00501                                                 $this->ctrl->setParameterByClass("ilobjfoldergui", "obj_id", $obj["obj_id"]);
00502                                                 $this->tpl->setVariable("EDIT_LINK",
00503                                                         $this->ctrl->getLinkTargetByClass("ilobjfoldergui", "edit"));
00504                                                 $this->tpl->parseCurrentBlock();
00505                                                 $this->tpl->setCurrentBlock("tbl_content");
00506                                                 $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_".$obj["type"].".gif"));
00507                                                 break;
00508 
00509                                         case "mob":
00510                                                 $this->ctrl->setParameterByClass("ilobjmediaobjectgui", "obj_id", $obj["obj_id"]);
00511                                                 $this->tpl->setVariable("LINK_VIEW",
00512                                                         $this->ctrl->getLinkTargetByClass("ilobjmediaobjectgui", "edit"));
00513                                                 $this->tpl->setCurrentBlock("show");
00514                                                 $this->tpl->setVariable("TXT_SHOW", $this->lng->txt("view"));
00515                                                 $this->ctrl->setParameter($this, "mob_id", $obj["obj_id"]);
00516                                                 $this->tpl->setVariable("SHOW_LINK", $this->ctrl->getLinktarget($this, "showMedia"));
00517                                                 $this->tpl->parseCurrentBlock();
00518                                                 $this->tpl->setCurrentBlock("link");
00519                         //$this->tpl->setVariable("OBJ_URL", ilUtil::getHtmlPath(ilObjMediaObject::_getDirectory($obj["obj_id"]) . '/'. $obj["title"]));
00520                                                 $this->tpl->setCurrentBlock("tbl_content");
00521                                                 
00522                                                 // output thumbnail (or mob icon)
00523                                                 $mob =& new ilObjMediaObject($obj["obj_id"]);
00524                                                 $med =& $mob->getMediaItem("Standard");
00525                                                 $target = $med->getThumbnailTarget();
00526                                                 if ($target != "")
00527                                                 {
00528                                                         $this->tpl->setVariable("IMG_OBJ", $target);
00529                                                 }
00530                                                 else
00531                                                 {
00532                                                         $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_".$obj["type"].".gif"));
00533                                                 }
00534                                                 
00535                                                 // output media info
00536                                                 include_once("content/classes/Media/class.ilObjMediaObjectGUI.php");
00537                                                 $this->tpl->setVariable("MEDIA_INFO",
00538                                                         ilObjMediaObjectGUI::_getMediaInfoHTML($mob));
00539 
00540                                                 break;
00541                                 }
00542 
00543 
00544                                 $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
00545                                 $this->tpl->setVariable("CHECKBOX_ID", $obj["obj_id"]);
00546                                 $this->tpl->setVariable("CSS_ROW", $css_row);
00547 
00548                                 $this->tpl->parseCurrentBlock();
00549                         }
00550                         $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
00551                 } //if is_array
00552                 else
00553                 {
00554                         $this->tpl->setCurrentBlock("notfound");
00555                         $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
00556                         $this->tpl->setVariable("NUM_COLS", 3);
00557                         $this->tpl->parseCurrentBlock();
00558                 }
00559 
00560                 $this->tpl->parseCurrentBlock();
00561                 $this->tpl->show();
00562         }
00563 
00564         function getTemplate()
00565         {
00566                 $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00567                 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00568         }
00569 
00575         function frameset()
00576         {
00577                 $this->tpl = new ilTemplate("tpl.mep_edit_frameset.html", false, false, "content");
00578                 $this->tpl->setVariable("REF_ID",$this->ref_id);
00579                 $this->tpl->show();
00580         }
00581 
00585         function explorer()
00586         {
00587                 $this->tpl = new ilTemplate("tpl.main.html", true, true);
00588 
00589                 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
00590 
00591                 $this->tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
00592 
00593                 require_once ("content/classes/class.ilMediaPoolExplorer.php");
00594                 $exp = new ilMediaPoolExplorer($this->ctrl->getLinkTarget($this, "listMedia"), $this->object);
00595                 $exp->setTargetGet("obj_id");
00596                 //$exp->setExpandTarget("mep_edit.php?cmd=explorer&ref_id=".$this->object->getRefId());
00597                 $exp->setExpandTarget($this->ctrl->getLinkTarget($this, "explorer"));
00598 
00599                 $exp->addFilter("root");
00600                 $exp->addFilter("fold");
00601                 $exp->setFiltered(true);
00602                 $exp->setFilterMode(IL_FM_POSITIVE);
00603 
00604 
00605                 if ($_GET["mepexpand"] == "")
00606                 {
00607                         $mep_tree =& $this->object->getTree();
00608                         $expanded = $mep_tree->readRootId();
00609                 }
00610                 else
00611                 {
00612                         $expanded = $_GET["mepexpand"];
00613                 }
00614 
00615                 $exp->setExpand($expanded);
00616 
00617                 // build html-output
00618                 $exp->setOutput(0);
00619                 $output = $exp->getOutput();
00620 
00621                 $this->tpl->setCurrentBlock("content");
00622                 $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_mep_structure"));
00623                 $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
00624                 $this->tpl->setVariable("EXPLORER",$output);
00625                 $this->tpl->setVariable("ACTION", "mep_edit.php?cmd=explorer&ref_id=".$this->ref_id."&mepexpand=".$_GET["mepexpand"]);
00626                 $this->tpl->parseCurrentBlock();
00627                 $this->tpl->show(false);
00628 
00629         }
00630         
00634         function showMedia()
00635         {
00636                 $this->tpl =& new ilTemplate("tpl.fullscreen.html", true, true, "content");
00637                 include_once("classes/class.ilObjStyleSheet.php");
00638                 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
00639                 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
00640                         ilObjStyleSheet::getContentStylePath(0));
00641 
00642                 //$int_links = $page_object->getInternalLinks();
00643                 $med_links = ilMediaItem::_getMapAreasIntLinks($_GET["mob_id"]);
00644                 
00645                 // later
00646                 //$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets());
00647                 
00648                 $link_xlm = "";
00649 
00650                 require_once("content/classes/Media/class.ilObjMediaObject.php");
00651                 $media_obj =& new ilObjMediaObject($_GET["mob_id"]);
00652                 
00653                 $xml = "<dummy>";
00654                 // todo: we get always the first alias now (problem if mob is used multiple
00655                 // times in page)
00656                 $xml.= $media_obj->getXML(IL_MODE_ALIAS);
00657                 $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
00658                 $xml.= $link_xml;
00659                 $xml.="</dummy>";
00660 
00661                 $xsl = file_get_contents("./content/page.xsl");
00662                 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
00663                 $xh = xslt_create();
00664 
00665                 $wb_path = ilUtil::getWebspaceDir("output");
00666 
00667                 $mode = ($_GET["cmd"] != "showMedia")
00668                         ? "fullscreen"
00669                         : "media";
00670                 $enlarge_path = ilUtil::getImagePath("enlarge.gif", false, "output");
00671                 $fullscreen_link =
00672                         $this->ctrl->getLinkTarget($this, "showFullscreen");
00673                 $params = array ('mode' => $mode, 'enlarge_path' => $enlarge_path,
00674                         'link_params' => "ref_id=".$_GET["ref_id"],'fullscreen_link' => $fullscreen_link,
00675                         'ref_id' => $_GET["ref_id"], 'pg_frame' => $pg_frame, 'webspace_path' => $wb_path);
00676                 $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
00677                 echo xslt_error($xh);
00678                 xslt_free($xh);
00679 
00680                 // unmask user html
00681                 $this->tpl->setVariable("MEDIA_CONTENT", $output);
00682 
00683                 $this->tpl->parseCurrentBlock();
00684                 $this->tpl->show();
00685 
00686         }
00687 
00691         function showFullscreen()
00692         {
00693                 $this->showMedia();
00694         }
00695         
00699         function confirmRemove()
00700         {
00701                 if(!isset($_POST["id"]))
00702                 {
00703                         $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00704                 }
00705 
00706                 $this->prepareOutput();
00707 
00708                 // SAVE POST VALUES
00709                 $_SESSION["ilMepRemove"] = $_POST["id"];
00710 
00711                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.confirm_deletion.html", true);
00712 
00713                 sendInfo($this->lng->txt("info_delete_sure"));
00714 
00715                 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00716 
00717                 // BEGIN TABLE HEADER
00718                 $this->tpl->setCurrentBlock("table_header");
00719                 $this->tpl->setVariable("TEXT",$this->lng->txt("objects"));
00720                 $this->tpl->parseCurrentBlock();
00721 
00722                 // BEGIN TABLE DATA
00723                 $counter = 0;
00724                 foreach($_POST["id"] as $obj_id)
00725                 {
00726                         $type = ilObject::_lookupType($obj_id);
00727                         $title = ilObject::_lookupTitle($obj_id);
00728                         $this->tpl->setCurrentBlock("table_row");
00729                         $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor(++$counter,"tblrow1","tblrow2"));
00730                         $this->tpl->setVariable("TEXT_CONTENT", $title);
00731                         $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_".$type.".gif"));
00732                         $this->tpl->parseCurrentBlock();
00733                 }
00734 
00735                 // cancel/confirm button
00736                 $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
00737                 $buttons = array( "cancelRemove"  => $this->lng->txt("cancel"),
00738                         "remove"  => $this->lng->txt("confirm"));
00739                 foreach ($buttons as $name => $value)
00740                 {
00741                         $this->tpl->setCurrentBlock("operation_btn");
00742                         $this->tpl->setVariable("BTN_NAME",$name);
00743                         $this->tpl->setVariable("BTN_VALUE",$value);
00744                         $this->tpl->parseCurrentBlock();
00745                 }
00746                 $this->tpl->show();
00747         }
00748         
00752         function pasteFromClipboard()
00753         {
00754                 global $ilCtrl;
00755 
00756                 $ilCtrl->setParameterByClass("ileditclipboardgui", "returnCommand",
00757                         rawurlencode($ilCtrl->getLinkTarget($this,
00758                         "insertFromClipboard")));
00759 //echo ":".$ilCtrl->getLinkTarget($this, "insertFromClipboard").":";
00760                 $ilCtrl->redirectByClass("ilEditClipboardGUI", "getObject");
00761         }
00762         
00763         
00767         function insertFromClipboard()
00768         {
00769                 include_once("content/classes/class.ilEditClipboardGUI.php");
00770                 $ids = ilEditClipboardGUI::_getSelectedIDs();
00771                 $not_inserted = array();
00772                 if (is_array($ids))
00773                 {
00774                         foreach ($ids as $id)
00775                         {
00776                                 if (!$this->object->insertInTree($id, $_GET["obj_id"]))
00777                                 {
00778                                         $not_inserted[] = ilObject::_lookupTitle($id)." [".
00779                                                 $id."]";
00780                                 }
00781                         }
00782                 }
00783                 if (count($not_inserted) > 0)
00784                 {
00785                         sendInfo($this->lng->txt("mep_not_insert_already_exist")."<br>".
00786                                 implode($not_inserted,"<br>"), true);
00787                 }
00788                 $this->ctrl->redirect($this, "listMedia");
00789         }
00790 
00791 
00795         function cancelRemove()
00796         {
00797                 session_unregister("ilMepRemove");
00798                 $this->ctrl->redirect($this, "listMedia");
00799         }
00800 
00804         function remove()
00805         {
00806                 foreach($_SESSION["ilMepRemove"] as $obj_id)
00807                 {
00808                         $this->object->deleteChild($obj_id);
00809                 }
00810 
00811                 sendInfo($this->lng->txt("cont_obj_removed"),true);
00812                 session_unregister("ilMepRemove");
00813                 $this->ctrl->redirect($this, "listMedia");
00814         }
00815 
00816 
00820         function copyToClipboard()
00821         {
00822                 global $ilUser;
00823 
00824                 if(!isset($_POST["id"]))
00825                 {
00826                         $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00827                 }
00828 
00829                 foreach ($_POST["id"] as $obj_id)
00830                 {
00831                         $type = ilObject::_lookupType($obj_id);
00832                         if ($type == "fold")
00833                         {
00834                                 $this->ilias->raiseError($this->lng->txt("cont_cant_copy_folders"), $this->ilias->error_obj->MESSAGE);
00835                         }
00836                 }
00837 
00838                 foreach ($_POST["id"] as $obj_id)
00839                 {
00840                         $ilUser->addObjectToClipboard($obj_id, "mob", "");
00841                 }
00842 
00843                 sendInfo($this->lng->txt("copied_to_clipboard"),true);
00844                 $this->ctrl->redirect($this, "listMedia");
00845         }
00846 
00850         function setLocator($a_tree = "", $a_id = "", $scriptname="adm_object.php")
00851         {
00852                 global $ilias_locator;
00853 
00854                 if (!defined("ILIAS_MODULE"))
00855                 {
00856                         parent::setLocator();
00857                         return;
00858                 }
00859                 else
00860                 {
00861                         $tree =& $this->object->getTree();
00862                         $obj_id = ($_GET["obj_id"] == "")
00863                                 ? $tree->getRootId()
00864                                 : $_GET["obj_id"];
00865                         parent::setLocator($tree, $obj_id, "mep_edit.php?cmd=listMedia&ref_id=".$_GET["ref_id"],
00866                                 "obj_id", false, $this->object->getTitle());
00867                 }
00868                 return;
00869 
00870                 if (!is_object($a_tree))
00871                 {
00872                         $a_tree =& $this->tree;
00873                 }
00874 
00875                 if (!($a_id))
00876                 {
00877                         $a_id = $_GET["ref_id"];
00878                 }
00879 
00880                 $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html");
00881 
00882                 $path = $a_tree->getPathFull($a_id);
00883 
00884         //check if object isn't in tree, this is the case if parent_parent is set
00885                 // TODO: parent_parent no longer exist. need another marker
00886                 if ($a_parent_parent)
00887                 {
00888                         //$subObj = getObject($a_ref_id);
00889                         $subObj =& $this->ilias->obj_factory->getInstanceByRefId($a_ref_id);
00890 
00891                         $path[] = array(
00892                                 "id"     => $a_ref_id,
00893                                 "title"  => $this->lng->txt($subObj->getTitle())
00894                                 );
00895                 }
00896 
00897                 // this is a stupid workaround for a bug in PEAR:IT
00898                 $modifier = 1;
00899 
00900                 if (isset($_GET["obj_id"]))
00901                 {
00902                         $modifier = 0;
00903                 }
00904 
00905                 // ### AA 03.11.10 added new locator GUI class ###
00906                 $i = 1;
00907 
00908                 foreach ($path as $key => $row)
00909                 {
00910                         if ($key < count($path)-$modifier)
00911                         {
00912                                 $this->tpl->touchBlock("locator_separator");
00913                         }
00914 
00915                         $this->tpl->setCurrentBlock("locator_item");
00916                         $this->tpl->setVariable("ITEM", $row["title"]);
00917 
00918                         $this->tpl->setVariable("LINK_ITEM", $scriptname."?ref_id=".$row["child"]);
00919                         $this->tpl->parseCurrentBlock();
00920 
00921                         // ### AA 03.11.10 added new locator GUI class ###
00922                         // navigate locator
00923                         $ilias_locator->navigate($i++,$row["title"],$scriptname."?ref_id=".$row["child"],"bottom");
00924                 }
00925 
00926                 if (isset($_GET["obj_id"]))
00927                 {
00928                         $obj_data =& $this->ilias->obj_factory->getInstanceByObjId($_GET["obj_id"]);
00929 
00930                         $this->tpl->setCurrentBlock("locator_item");
00931                         $this->tpl->setVariable("ITEM", $obj_data->getTitle());
00932 
00933                         $this->tpl->setVariable("LINK_ITEM", $scriptname."?ref_id=".$_GET["ref_id"]."&obj_id=".$_GET["obj_id"]);
00934                         $this->tpl->parseCurrentBlock();
00935 
00936                         // ### AA 03.11.10 added new locator GUI class ###
00937                         // navigate locator
00938                         $ilias_locator->navigate($i++,$obj_data->getTitle(),$scriptname."?ref_id=".$_GET["ref_id"]."&obj_id=".$_GET["obj_id"],"bottom");
00939                 }
00940 
00941                 $this->tpl->setCurrentBlock("locator");
00942 
00943                 if (DEBUG)
00944                 {
00945                         $debug = "DEBUG: <font color=\"red\">".$this->type."::".$this->id."::".$_GET["cmd"]."</font><br/>";
00946                 }
00947 
00948                 $prop_name = $this->objDefinition->getPropertyName($_GET["cmd"],$this->type);
00949 
00950                 if ($_GET["cmd"] == "confirmDeleteAdm")
00951                 {
00952                         $prop_name = "delete_object";
00953                 }
00954 
00955                 $this->tpl->setVariable("TXT_LOCATOR",$debug.$this->lng->txt("locator"));
00956                 $this->tpl->parseCurrentBlock();
00957         }
00958 
00962         function createFolderForm()
00963         {
00964                 $this->prepareOutput();
00965 
00966                 $folder_gui =& new ilObjFolderGUI("", 0, false, false);
00967                 $folder_gui->setFormAction("save", "mep_edit.php?cmd=post&cmdClass=ilObjFolderGUI&ref_id=".
00968                         $_GET["ref_id"]."&obj_id=".$_GET["obj_id"]);
00969                 $folder_gui->createObject();
00970                 //$this->tpl->show();
00971         }
00972 
00976         function prepareOutput()
00977         {
00978                 if (!defined("ILIAS_MODULE"))
00979                 {
00980                         parent::prepareOutput();
00981                         return;
00982                 }
00983 
00984                 $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00985                 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00986 
00987                 $title = $this->object->getTitle();
00988 
00989                 // catch feedback message
00990                 sendInfo();
00991 
00992                 if (!empty($title))
00993                 {
00994                         $this->tpl->setCurrentBlock("header_image");
00995                         $this->tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_mep_b.gif"));
00996                         $this->tpl->parseCurrentBlock();
00997                         $this->tpl->setCurrentBlock("content");
00998                         $this->tpl->setVariable("HEADER", $title);
00999                 }
01000 
01001                 $this->setTabs();
01002                 $this->setLocator();
01003         }
01004 
01008         function setTabs()
01009         {
01010                 // catch feedback message
01011                 include_once("classes/class.ilTabsGUI.php");
01012                 $tabs_gui =& new ilTabsGUI();
01013                 $this->getTabs($tabs_gui);
01014                 $this->tpl->setVariable("TABS", $tabs_gui->getHTML());
01015                 //$this->tpl->setVariable("HEADER", $this->object->getTitle());
01016         }
01017 
01023         function getTabs(&$tabs_gui)
01024         {
01025                 $tabs_gui->addTarget("view_content", $this->ctrl->getLinkTarget($this, "listMedia"),
01026                         "listMedia", get_class($this));
01027 
01028                 $tabs_gui->addTarget("edit_properties", $this->ctrl->getLinkTarget($this, "edit"),
01029                         "edit", get_class($this));
01030 
01031                 $tabs_gui->addTarget("permission_settings", $this->ctrl->getLinkTarget($this, "perm"),
01032                         array("perm", "info"), get_class($this));
01033 
01034                 $tabs_gui->addTarget("clipboard", $this->ctrl->getLinkTargetByClass("ilEditClipboardGUI", "view"),
01035                         "view", "ileditclipboardgui");
01036 
01037         }
01038 
01039 
01040 
01041 }
01042 ?>

Generated on Fri Dec 13 2013 10:18:29 for ILIAS Release_3_5_x_branch .rev 46805 by  doxygen 1.7.1