• 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 = false)
00056         {
00057                 global $lng, $ilCtrl;
00058 
00059 //echo "<br>ilobjmediapoolgui-constructor-id-$a_id";
00060 
00061                 $this->ctrl =& $ilCtrl;
00062                 $this->ctrl->saveParameter($this, array("ref_id", "obj_id"));
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 //echo "ilobjmediapoolgui-".get_class($this->object)."-";
00074         }
00075 
00079         function &executeCommand()
00080         {
00081                 if ($this->ctrl->getRedirectSource() == "ilinternallinkgui")
00082                 {
00083                         $this->explorer();
00084                         return;
00085                 }
00086 //echo "-".$cmd."-";
00087 
00088                 if (!$this->creation_mode)
00089                 {
00090                         $tree =& $this->object->getTree();
00091                 }
00092                 $next_class = $this->ctrl->getNextClass($this);
00093                 $cmd = $this->ctrl->getCmd();
00094                 
00095                 if ($cmd == "create")
00096                 {
00097                         switch($_POST["new_type"])
00098                         {
00099                                 case "mob":
00100                                         $this->ctrl->redirectByClass("ilobjmediaobjectgui", "create");
00101                                         break;
00102                                         
00103                                 case "fold":
00104                                         $this->ctrl->redirectByClass("ilobjfoldergui", "create");
00105                                         break;
00106                         }
00107                 }
00108 
00109                 switch($next_class)
00110                 {
00111                         case "ilobjmediaobjectgui":
00112 
00113                                 //$cmd.="Object";
00114                                 if ($cmd == "create")
00115                                 {
00116                                         $ret_obj = $_GET["obj_id"];
00117                                         $ilObjMediaObjectGUI =& new ilObjMediaObjectGUI("", 0, false, false);
00118                                 }
00119                                 else
00120                                 {
00121                                         $ret_obj = $tree->getParentId($_GET["obj_id"]);
00122                                         $ilObjMediaObjectGUI =& new ilObjMediaObjectGUI("", $_GET["obj_id"], false, false);
00123                                 }
00124                                 if ($this->ctrl->getCmdClass() == "ilinternallinkgui")
00125                                 {
00126                                         $this->ctrl->setReturn($this, "explorer");
00127                                 }
00128                                 else
00129                                 {
00130                                         $this->ctrl->setParameter($this, "obj_id", $ret_obj);
00131                                         $this->ctrl->setReturn($this, "listMedia");
00132                                         $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
00133                                 }
00134                                 $this->getTemplate();
00135                                 $ilObjMediaObjectGUI->setAdminTabs();
00136                                 $this->setLocator();
00137 
00138 //echo ":".$tree->getParentId($_GET["obj_id"]).":";
00139                                 //$ret =& $ilObjMediaObjectGUI->executeCommand();
00140                                 $ret =& $this->ctrl->forwardCommand($ilObjMediaObjectGUI);
00141 //echo "<br>ilObjMediaPoolGUI:afterexecute:<br>"; exit;
00142                                 switch($cmd)
00143                                 {
00144                                         case "save":
00145                                                 $parent = ($_GET["obj_id"] == "")
00146                                                         ? $tree->getRootId()
00147                                                         : $_GET["obj_id"];
00148                                                 $tree->insertNode($ret->getId(), $parent);
00149                                                 ilUtil::redirect("mep_edit.php?cmd=listMedia&ref_id=".
00150                                                         $_GET["ref_id"]."&obj_id=".$_GET["obj_id"]);
00151                                                 break;
00152 
00153                                         default:
00154                                                 $this->tpl->show();
00155                                                 break;
00156                                 }
00157                                 break;
00158 
00159                         case "ilobjfoldergui":
00160                                 $folder_gui = new ilObjFolderGUI("", 0, false, false);
00161                                 $this->ctrl->setReturn($this, "listMedia");
00162                                 $cmd.="Object";
00163                                 switch($cmd)
00164                                 {
00165                                         case "createObject":
00166                                                 $this->prepareOutput();
00167                                                 $folder_gui =& new ilObjFolderGUI("", 0, false, false);
00168                                                 $folder_gui->setFormAction("save",
00169                                                         $this->ctrl->getFormActionByClass("ilobjfoldergui"));
00170                                                 $folder_gui->createObject();
00171                                                 $this->tpl->show();
00172                                                 break;
00173 
00174                                         case "saveObject":
00175                                                 //$folder_gui->setReturnLocation("save", $this->ctrl->getLinkTarget($this, "listMedia"));
00176                                                 $parent = ($_GET["obj_id"] == "")
00177                                                         ? $tree->getRootId()
00178                                                         : $_GET["obj_id"];
00179                                                 $folder_gui->setFolderTree($tree);
00180                                                 $folder_gui->saveObject($parent);
00181                                                 //$this->ctrl->redirect($this, "listMedia");
00182                                                 break;
00183 
00184                                         case "editObject":
00185                                                 $this->prepareOutput();
00186                                                 $folder_gui =& new ilObjFolderGUI("", $_GET["obj_id"], false, false);
00187                                                 $folder_gui->setFormAction("update", $this->ctrl->getFormActionByClass("ilobjfoldergui"));
00188                                                 $folder_gui->editObject();
00189                                                 $this->tpl->show();
00190                                                 break;
00191 
00192                                         case "updateObject":
00193                                                 $folder_gui =& new ilObjFolderGUI("", $_GET["obj_id"], false, false);
00194                                                 //$folder_gui->setReturnLocation("update", $this->ctrl->getLinkTarget($this, "listMedia"));
00195                                                 $folder_gui->updateObject(true);
00196                                                 $this->ctrl->redirect($this, "listMedia");
00197                                                 break;
00198 
00199                                         case "cancelObject":
00200                                                 sendInfo($this->lng->txt("action_aborted"), true);
00201                                                 $this->ctrl->redirect($this, "listMedia");
00202                                                 break;
00203                                 }
00204                                 break;
00205 
00206                         case "ileditclipboardgui":
00207                                 $this->prepareOutput();
00208                                 $this->ctrl->setReturn($this, "listMedia");
00209                                 $clip_gui = new ilEditClipboardGUI();
00210                                 $clip_gui->setMultipleSelections(true);
00211                                 //$ret =& $clip_gui->executeCommand();
00212                                 $ret =& $this->ctrl->forwardCommand($clip_gui);
00213                                 $this->tpl->show();
00214                                 break;
00215                                 
00216                         case 'ilpermissiongui':
00217                                 $this->prepareOutput();
00218                                 include_once("./classes/class.ilPermissionGUI.php");
00219                                 $perm_gui =& new ilPermissionGUI($this);
00220                                 $ret =& $this->ctrl->forwardCommand($perm_gui);
00221                                 $this->tpl->show();
00222                                 break;
00223 
00224                         default:
00225                                 $this->prepareOutput();
00226                                 $cmd = $this->ctrl->getCmd("frameset");
00227                                 if ($this->creation_mode)
00228                                 {
00229                                         $cmd.= "Object";
00230                                 }
00231                                 $this->$cmd();  
00232                                 break;
00233                 }
00234         }
00235         
00236         function createObject()
00237         {
00238                 parent::createObject();
00239                 $this->tpl->setVariable("TARGET", ' target="'.
00240                                 ilFrameTargetInfo::_getFrame("MainContent").'" ');
00241         }
00242         
00243         // for admin compatiblity
00244         function view()
00245         {
00246                 $this->viewObject();
00247         }
00248 
00253         function saveObject()
00254         {
00255                 global $rbacadmin;
00256 
00257                 // create and insert forum in objecttree
00258                 $newObj = parent::saveObject();
00259 
00260                 // setup rolefolder & default local roles
00261                 //$roles = $newObj->initDefaultRoles();
00262 
00263                 // ...finally assign role to creator of object
00264                 //$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "y");
00265 
00266                 // put here object specific stuff
00267 
00268                 // always send a message
00269                 sendInfo($this->lng->txt("object_added"),true);
00270 
00271                 //ilUtil::redirect($this->getReturnLocation("save","adm_object.php?".$this->link_params));
00272                 ilUtil::redirect("content/mep_edit.php?ref_id=".$newObj->getRefId());
00273 
00274         }
00275 
00281         function editObject()
00282         {
00283                 global $rbacsystem, $tree, $tpl;
00284 
00285                 if (!$rbacsystem->checkAccess("visible,write",$this->object->getRefId()))
00286                 {
00287                         $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00288                 }
00289 
00290                 // edit button
00291                 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00292 
00293                 if (!defined("ILIAS_MODULE"))
00294                 {
00295                         $this->tpl->setCurrentBlock("btn_cell");
00296                         $this->tpl->setVariable("BTN_LINK","content/mep_edit.php?ref_id=".$this->object->getRefID());
00297                         $this->tpl->setVariable("BTN_TARGET"," target=\"bottom\" ");
00298                         $this->tpl->setVariable("BTN_TXT",$this->lng->txt("edit"));
00299                         $this->tpl->parseCurrentBlock();
00300                 }
00301 
00302                 parent::editObject();
00303         }
00304 
00308         function edit()
00309         {
00310                 //$this->prepareOutput();
00311                 $this->setFormAction("update", "mep_edit.php?cmd=post&ref_id=".$_GET["ref_id"].
00312                         "&obj_id=".$_GET["obj_id"]);
00313                 $this->editObject();
00314                 $this->tpl->show();
00315         }
00316 
00320         function cancel()
00321         {
00322                 //$this->setReturnLocation("cancel","mep_edit.php?cmd=listMedia&ref_id=".$_GET["ref_id"].
00323                 //      "&obj_id=".$_GET["obj_id"]);
00324                 //$this->cancelObject();
00325                 $this->ctrl->redirect($this, "listMedia");
00326         }
00327         
00333         function cancelObject($in_rep = false)
00334         {
00335                 sendInfo($this->lng->txt("msg_cancel"),true);
00336                 ilUtil::redirect("repository.php?cmd=frameset&ref_id=".$_GET["ref_id"]);
00337                 //$this->ctrl->redirectByClass("ilrepositorygui", "frameset");
00338         }
00339 
00340 
00344         function update()
00345         {
00346                 $this->setReturnLocation("update", "mep_edit.php?cmd=listMedia&ref_id=".$_GET["ref_id"].
00347                         "&obj_id=".$_GET["obj_id"]);
00348                 $this->updateObject();
00349         }
00350 
00354         /*
00355         function perm()
00356         {
00357                 //$this->prepareOutput();
00358                 $this->setFormAction("permSave", "mep_edit.php?cmd=permSave&ref_id=".$_GET["ref_id"].
00359                         "&obj_id=".$_GET["obj_id"]);
00360                 $this->setFormAction("addRole", "mep_edit.php?ref_id=".$_GET["ref_id"].
00361                         "&obj_id=".$_GET["obj_id"]."&cmd=addRole");
00362                 $this->permObject();
00363                 $this->tpl->show();
00364         }*/
00365 
00369         function info()
00370         {
00371                 //$this->prepareOutput();
00372                 $this->infoObject();
00373                 $this->tpl->show();
00374         }
00375 
00379         function permSave()
00380         {
00381                 $this->setReturnLocation("permSave",
00382                         "mep_edit.php?ref_id=".$_GET["ref_id"]."&obj_id=".$_GET["obj_id"]."&cmd=perm");
00383                 $this->permSaveObject();
00384         }
00385 
00389         function addRole()
00390         {
00391                 $this->setReturnLocation("addRole",
00392                         "mep_edit.php?ref_id=".$_GET["ref_id"]."&obj_id=".$_GET["obj_id"]."&cmd=perm");
00393                 $this->addRoleObject();
00394         }
00395 
00399         /*
00400         function owner()
00401         {
00402                 $this->prepareOutput();
00403                 $this->ownerObject();
00404                 $this->tpl->show();
00405         }*/
00406 
00410         function listMedia()
00411         {
00412                 global $tree;
00413 
00414                 if (!$this->output_prepared)
00415                 {
00416                         //$this->prepareOutput();
00417                 }
00418 
00419                 //add template for view button
00420                 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00421 
00422                 /*
00423                 // create folder form button
00424                 $this->tpl->setCurrentBlock("btn_cell");
00425                 $this->tpl->setVariable("BTN_LINK",
00426                         $this->ctrl->getLinkTargetByClass("ilobjfoldergui", "create"));
00427                 $this->tpl->setVariable("BTN_TXT",$this->lng->txt("cont_create_folder"));
00428                 $this->tpl->parseCurrentBlock();
00429 
00430                 // create mob form button
00431                 $this->tpl->setCurrentBlock("btn_cell");
00432                 $this->tpl->setVariable("BTN_LINK",
00433                         $this->ctrl->getLinkTargetByClass("ilobjmediaobjectgui", "create"));
00434                 $this->tpl->setVariable("BTN_TXT",$this->lng->txt("cont_create_mob"));
00435                 $this->tpl->parseCurrentBlock();*/
00436 
00437                 $obj_id = ($_GET["obj_id"] == "")
00438                         ? $obj_id = $this->object->tree->getRootId()
00439                         : $_GET["obj_id"];
00440 
00441                 // create table
00442                 require_once("classes/class.ilTableGUI.php");
00443                 $tbl = new ilTableGUI();
00444 
00445                 // load files templates
00446                 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
00447 
00448                 // load template for table content data
00449                 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.mep_list_row.html", true);
00450 
00451                 $num = 0;
00452 
00453                 $this->tpl->setVariable("FORMACTION", "mep_edit.php?ref_id=".$_GET["ref_id"].
00454                         "&obj_id=".$_GET["obj_id"]."&cmd=post");
00455 
00456                 $tbl->setHeaderNames(array("", "", $this->lng->txt("title")));
00457 
00458                 $cols = array("", "", "title");
00459                 $header_params = array("ref_id" => $_GET["ref_id"],
00460                         "obj_id" => $_GET["obj_id"], "cmd" => "listMedia");
00461                 $tbl->setHeaderVars($cols, $header_params);
00462                 $tbl->setColumnWidth(array("1%", "1%", "98%"));
00463 
00464                 if ($obj_id != $this->object->tree->getRootId())
00465                 {
00466                         $node = $this->object->tree->getNodeData($obj_id);
00467                         $tbl->setTitle($node["title"]);
00468                 }
00469                 else
00470                 {
00471                         $tbl->setTitle($this->object->getTitle());
00472                 }
00473                 
00474                 // control
00475                 $tbl->setOrderColumn($_GET["sort_by"]);
00476                 $tbl->setOrderDirection($_GET["sort_order"]);
00477                 $tbl->setLimit($_GET["limit"]);
00478                 $tbl->setOffset($_GET["offset"]);
00479                 $tbl->setMaxCount($this->maxcount);             // ???
00480 
00481                 $this->tpl->setVariable("COLUMN_COUNTS", 3);
00482 
00483                 // remove button
00484                 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
00485                 $this->tpl->setCurrentBlock("tbl_action_btn");
00486                 $this->tpl->setVariable("BTN_NAME", "confirmRemove");
00487                 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("remove"));
00488                 $this->tpl->parseCurrentBlock();
00489 
00490                 // copy to clipboard
00491                 $this->tpl->setCurrentBlock("tbl_action_btn");
00492                 $this->tpl->setVariable("BTN_NAME", "copyToClipboard");
00493                 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("cont_copy_to_clipboard"));
00494                 $this->tpl->parseCurrentBlock();
00495                 
00496                 // copy to clipboard
00497                 $this->tpl->setCurrentBlock("tbl_action_btn");
00498                 $this->tpl->setVariable("BTN_NAME", "pasteFromClipboard");
00499                 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("cont_paste_from_clipboard"));
00500                 $this->tpl->parseCurrentBlock();
00501 
00502                 // footer
00503                 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00504                 //$tbl->disable("footer");
00505                 
00506                 // get current folders
00507                 $fobjs = $this->object->getChilds($_GET["obj_id"], "fold");
00508                 $f2objs = array();
00509                 foreach ($fobjs as $obj)
00510                 {
00511                         $f2objs[$obj["title"].":".$obj["id"]] = $obj;
00512                 }
00513                 ksort($f2objs);
00514 
00515                 // get current media objects
00516                 $mobjs = $this->object->getChilds($_GET["obj_id"], "mob");
00517                 $m2objs = array();
00518                 foreach ($mobjs as $obj)
00519                 {
00520                         $m2objs[$obj["title"].":".$obj["id"]] = $obj;
00521                 }
00522                 ksort($m2objs);
00523                 
00524                 // merge everything together
00525                 $objs = array_merge($f2objs, $m2objs);
00526                 //$objs = $this->object->getChilds($_GET["obj_id"]);
00527 
00528                 $tbl->setMaxCount(count($objs));
00529                 $objs = array_slice($objs, $_GET["offset"], $_GET["limit"]);
00530 
00531                 $subobj = array(
00532                         "mob" => $this->lng->txt("mob"),
00533                         "fold" => $this->lng->txt("fold"));
00534                 $opts = ilUtil::formSelect("", "new_type", $subobj, false, true);
00535                 $this->tpl->setCurrentBlock("add_object");
00536                 $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
00537                 $this->tpl->setVariable("BTN_NAME", "create");
00538                 $this->tpl->setVariable("TXT_ADD", $this->lng->txt("add"));
00539                 $this->tpl->parseCurrentBlock();
00540                 $tbl->disable("sort");
00541                 //$tbl->disable("title");
00542                 $tbl->disable("header");
00543                 $tbl->render();
00544                 if(count($objs) > 0)
00545                 {
00546                         $i=0;
00547                         foreach($objs as $obj)
00548                         {
00549                                 $this->tpl->setCurrentBlock("link");
00550                                 $this->tpl->setVariable("TXT_TITLE", $obj["title"]);
00551                                 switch($obj["type"])
00552                                 {
00553                                         case "fold":
00554                                                 $this->ctrl->setParameter($this, "obj_id", $obj["obj_id"]);
00555                                                 $this->tpl->setVariable("LINK_VIEW",
00556                                                         $this->ctrl->getLinkTarget($this, "listMedia"));
00557                                                 $this->tpl->parseCurrentBlock();
00558                                                 $this->tpl->setCurrentBlock("edit");
00559                                                 $this->tpl->setVariable("TXT_EDIT", $this->lng->txt("edit"));
00560                                                 $this->ctrl->setParameterByClass("ilobjfoldergui", "obj_id", $obj["obj_id"]);
00561                                                 $this->tpl->setVariable("EDIT_LINK",
00562                                                         $this->ctrl->getLinkTargetByClass("ilobjfoldergui", "edit"));
00563                                                 $this->tpl->parseCurrentBlock();
00564                                                 $this->tpl->setCurrentBlock("tbl_content");
00565                                                 $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_".$obj["type"].".gif"));
00566                                                 break;
00567 
00568                                         case "mob":
00569                                                 $this->ctrl->setParameterByClass("ilobjmediaobjectgui", "obj_id", $obj["obj_id"]);
00570                                                 $this->tpl->setVariable("LINK_VIEW",
00571                                                         $this->ctrl->getLinkTargetByClass("ilobjmediaobjectgui", "edit"));
00572                                                 $this->tpl->setCurrentBlock("show");
00573                                                 $this->tpl->setVariable("TXT_SHOW", $this->lng->txt("view"));
00574                                                 $this->ctrl->setParameter($this, "mob_id", $obj["obj_id"]);
00575                                                 $this->tpl->setVariable("SHOW_LINK", $this->ctrl->getLinktarget($this, "showMedia"));
00576                                                 $this->tpl->parseCurrentBlock();
00577                                                 $this->tpl->setCurrentBlock("link");
00578                         //$this->tpl->setVariable("OBJ_URL", ilUtil::getHtmlPath(ilObjMediaObject::_getDirectory($obj["obj_id"]) . '/'. $obj["title"]));
00579                                                 $this->tpl->setCurrentBlock("tbl_content");
00580                                                 
00581                                                 // output thumbnail (or mob icon)
00582                                                 $mob =& new ilObjMediaObject($obj["obj_id"]);
00583                                                 $med =& $mob->getMediaItem("Standard");
00584                                                 $target = $med->getThumbnailTarget();
00585                                                 if ($target != "")
00586                                                 {
00587                                                         $this->tpl->setVariable("IMG_OBJ", $target);
00588                                                 }
00589                                                 else
00590                                                 {
00591                                                         $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_".$obj["type"].".gif"));
00592                                                 }
00593                                                 
00594                                                 // output media info
00595                                                 include_once("content/classes/Media/class.ilObjMediaObjectGUI.php");
00596                                                 $this->tpl->setVariable("MEDIA_INFO",
00597                                                         ilObjMediaObjectGUI::_getMediaInfoHTML($mob));
00598 
00599                                                 break;
00600                                 }
00601 
00602 
00603                                 $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
00604                                 $this->tpl->setVariable("CHECKBOX_ID", $obj["obj_id"]);
00605                                 $this->tpl->setVariable("CSS_ROW", $css_row);
00606 
00607                                 $this->tpl->parseCurrentBlock();
00608                         }
00609                         $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
00610                 } //if is_array
00611                 else
00612                 {
00613                         $this->tpl->setCurrentBlock("notfound");
00614                         $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
00615                         $this->tpl->setVariable("NUM_COLS", 3);
00616                         $this->tpl->parseCurrentBlock();
00617                 }
00618 
00619                 $this->tpl->parseCurrentBlock();
00620                 $this->tpl->show();
00621         }
00622 
00623         function getTemplate()
00624         {
00625                 $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00626                 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00627         }
00628 
00629         
00634         function showUpperIcon()
00635         {
00636                 global $tpl;
00637                 
00638                 parent::showUpperIcon();
00639                 
00640                 if ($_GET["obj_id"] != "")
00641                 {
00642                         $par_id = $this->object->tree->getParentId($_GET["obj_id"]);
00643                         if ($par_id != $this->object->tree->getRootId())
00644                         {
00645                                 $this->ctrl->setParameter($this, "obj_id", $par_id);
00646                         }
00647                         else
00648                         {
00649                                 $this->ctrl->setParameter($this, "obj_id", "");
00650                         }
00651                         $tpl->setUpperIcon($this->ctrl->getLinkTarget($this, "listMedia"));
00652                         $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
00653                 }
00654         }
00655         
00661         function frameset()
00662         {
00663                 $this->tpl = new ilTemplate("tpl.mep_edit_frameset.html", false, false, "content");
00664                 $this->tpl->setVariable("REF_ID",$this->ref_id);
00665                 $this->tpl->show();
00666         }
00667 
00671         function explorer()
00672         {
00673                 $this->tpl = new ilTemplate("tpl.main.html", true, true);
00674 
00675                 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
00676 
00677                 $this->tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
00678 
00679                 require_once ("content/classes/class.ilMediaPoolExplorer.php");
00680                 $exp = new ilMediaPoolExplorer($this->ctrl->getLinkTarget($this, "listMedia"), $this->object);
00681                 $exp->setTargetGet("obj_id");
00682                 //$exp->setExpandTarget("mep_edit.php?cmd=explorer&ref_id=".$this->object->getRefId());
00683                 $exp->setExpandTarget($this->ctrl->getLinkTarget($this, "explorer"));
00684 
00685                 $exp->addFilter("root");
00686                 $exp->addFilter("fold");
00687                 $exp->setFiltered(true);
00688                 $exp->setFilterMode(IL_FM_POSITIVE);
00689 
00690 
00691                 if ($_GET["mepexpand"] == "")
00692                 {
00693                         $mep_tree =& $this->object->getTree();
00694                         $expanded = $mep_tree->readRootId();
00695                 }
00696                 else
00697                 {
00698                         $expanded = $_GET["mepexpand"];
00699                 }
00700 
00701                 $exp->setExpand($expanded);
00702 
00703                 // build html-output
00704                 $exp->setOutput(0);
00705                 $output = $exp->getOutput();
00706 
00707                 $this->tpl->setCurrentBlock("content");
00708                 $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_mep_structure"));
00709                 $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
00710                 $this->tpl->setVariable("EXPLORER",$output);
00711                 $this->tpl->setVariable("ACTION", "mep_edit.php?cmd=explorer&ref_id=".$this->ref_id."&mepexpand=".$_GET["mepexpand"]);
00712                 $this->tpl->parseCurrentBlock();
00713                 $this->tpl->show(false);
00714 
00715         }
00716         
00720         function showMedia()
00721         {
00722                 $this->tpl =& new ilTemplate("tpl.fullscreen.html", true, true, "content");
00723                 include_once("classes/class.ilObjStyleSheet.php");
00724                 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
00725                 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
00726                         ilObjStyleSheet::getContentStylePath(0));
00727 
00728                 //$int_links = $page_object->getInternalLinks();
00729                 $med_links = ilMediaItem::_getMapAreasIntLinks($_GET["mob_id"]);
00730                 
00731                 // later
00732                 //$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets());
00733                 
00734                 $link_xlm = "";
00735 
00736                 require_once("content/classes/Media/class.ilObjMediaObject.php");
00737                 $media_obj =& new ilObjMediaObject($_GET["mob_id"]);
00738                 
00739                 $xml = "<dummy>";
00740                 // todo: we get always the first alias now (problem if mob is used multiple
00741                 // times in page)
00742                 $xml.= $media_obj->getXML(IL_MODE_ALIAS);
00743                 $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
00744                 $xml.= $link_xml;
00745                 $xml.="</dummy>";
00746 
00747                 $xsl = file_get_contents("./content/page.xsl");
00748                 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
00749                 $xh = xslt_create();
00750 
00751                 $wb_path = ilUtil::getWebspaceDir("output");
00752 
00753                 $mode = ($_GET["cmd"] != "showMedia")
00754                         ? "fullscreen"
00755                         : "media";
00756                 $enlarge_path = ilUtil::getImagePath("enlarge.gif", false, "output");
00757                 $fullscreen_link =
00758                         $this->ctrl->getLinkTarget($this, "showFullscreen");
00759                 $params = array ('mode' => $mode, 'enlarge_path' => $enlarge_path,
00760                         'link_params' => "ref_id=".$_GET["ref_id"],'fullscreen_link' => $fullscreen_link,
00761                         'ref_id' => $_GET["ref_id"], 'pg_frame' => $pg_frame, 'webspace_path' => $wb_path);
00762                 $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
00763                 echo xslt_error($xh);
00764                 xslt_free($xh);
00765 
00766                 // unmask user html
00767                 $this->tpl->setVariable("MEDIA_CONTENT", $output);
00768 
00769                 $this->tpl->parseCurrentBlock();
00770                 $this->tpl->show();
00771 
00772         }
00773 
00777         function showFullscreen()
00778         {
00779                 $this->showMedia();
00780         }
00781         
00785         function confirmRemove()
00786         {
00787                 if(!isset($_POST["id"]))
00788                 {
00789                         $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00790                 }
00791 
00792                 //$this->prepareOutput();
00793 
00794                 // SAVE POST VALUES
00795                 $_SESSION["ilMepRemove"] = $_POST["id"];
00796 
00797                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.confirm_deletion.html", true);
00798 
00799                 sendInfo($this->lng->txt("info_delete_sure"));
00800 
00801                 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00802 
00803                 // BEGIN TABLE HEADER
00804                 $this->tpl->setCurrentBlock("table_header");
00805                 $this->tpl->setVariable("TEXT",$this->lng->txt("objects"));
00806                 $this->tpl->parseCurrentBlock();
00807 
00808                 // BEGIN TABLE DATA
00809                 $counter = 0;
00810                 foreach($_POST["id"] as $obj_id)
00811                 {
00812                         $type = ilObject::_lookupType($obj_id);
00813                         $title = ilObject::_lookupTitle($obj_id);
00814                         $this->tpl->setCurrentBlock("table_row");
00815                         $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor(++$counter,"tblrow1","tblrow2"));
00816                         $this->tpl->setVariable("TEXT_CONTENT", $title);
00817                         $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_".$type.".gif"));
00818                         $this->tpl->parseCurrentBlock();
00819                 }
00820 
00821                 // cancel/confirm button
00822                 $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
00823                 $buttons = array( "cancelRemove"  => $this->lng->txt("cancel"),
00824                         "remove"  => $this->lng->txt("confirm"));
00825                 foreach ($buttons as $name => $value)
00826                 {
00827                         $this->tpl->setCurrentBlock("operation_btn");
00828                         $this->tpl->setVariable("BTN_NAME",$name);
00829                         $this->tpl->setVariable("BTN_VALUE",$value);
00830                         $this->tpl->parseCurrentBlock();
00831                 }
00832                 $this->tpl->show();
00833         }
00834         
00838         function pasteFromClipboard()
00839         {
00840                 global $ilCtrl;
00841 
00842                 $ilCtrl->setParameterByClass("ileditclipboardgui", "returnCommand",
00843                         rawurlencode($ilCtrl->getLinkTarget($this,
00844                         "insertFromClipboard")));
00845 //echo ":".$ilCtrl->getLinkTarget($this, "insertFromClipboard").":";
00846                 $ilCtrl->redirectByClass("ilEditClipboardGUI", "getObject");
00847         }
00848         
00849         
00853         function insertFromClipboard()
00854         {
00855                 include_once("content/classes/class.ilEditClipboardGUI.php");
00856                 $ids = ilEditClipboardGUI::_getSelectedIDs();
00857                 $not_inserted = array();
00858                 if (is_array($ids))
00859                 {
00860                         foreach ($ids as $id)
00861                         {
00862                                 if (!$this->object->insertInTree($id, $_GET["obj_id"]))
00863                                 {
00864                                         $not_inserted[] = ilObject::_lookupTitle($id)." [".
00865                                                 $id."]";
00866                                 }
00867                         }
00868                 }
00869                 if (count($not_inserted) > 0)
00870                 {
00871                         sendInfo($this->lng->txt("mep_not_insert_already_exist")."<br>".
00872                                 implode($not_inserted,"<br>"), true);
00873                 }
00874                 $this->ctrl->redirect($this, "listMedia");
00875         }
00876 
00877 
00881         function cancelRemove()
00882         {
00883                 session_unregister("ilMepRemove");
00884                 $this->ctrl->redirect($this, "listMedia");
00885         }
00886 
00890         function remove()
00891         {
00892                 foreach($_SESSION["ilMepRemove"] as $obj_id)
00893                 {
00894                         $this->object->deleteChild($obj_id);
00895                 }
00896 
00897                 sendInfo($this->lng->txt("cont_obj_removed"),true);
00898                 session_unregister("ilMepRemove");
00899                 $this->ctrl->redirect($this, "listMedia");
00900         }
00901 
00902 
00906         function copyToClipboard()
00907         {
00908                 global $ilUser;
00909 
00910                 if(!isset($_POST["id"]))
00911                 {
00912                         $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00913                 }
00914 
00915                 foreach ($_POST["id"] as $obj_id)
00916                 {
00917                         $type = ilObject::_lookupType($obj_id);
00918                         if ($type == "fold")
00919                         {
00920                                 $this->ilias->raiseError($this->lng->txt("cont_cant_copy_folders"), $this->ilias->error_obj->MESSAGE);
00921                         }
00922                 }
00923 
00924                 foreach ($_POST["id"] as $obj_id)
00925                 {
00926                         $ilUser->addObjectToClipboard($obj_id, "mob", "");
00927                 }
00928 
00929                 sendInfo($this->lng->txt("copied_to_clipboard"),true);
00930                 $this->ctrl->redirect($this, "listMedia");
00931         }
00932 
00936         function addLocatorItems()
00937         {
00938                 global $ilLocator;
00939                 
00940                 if (!$this->getCreationMode())
00941                 {
00942                         $tree =& $this->object->getTree();
00943                         $obj_id = ($_GET["obj_id"] == "")
00944                                 ? $tree->getRootId()
00945                                 : $_GET["obj_id"];
00946                         $path = $tree->getPathFull($obj_id);
00947                         foreach($path as $node)
00948                         {
00949                                 if ($node["child"] == $tree->getRootId())
00950                                 {
00951                                         $this->ctrl->setParameter($this, "obj_id", "");
00952                                         $link = $this->ctrl->getLinkTarget($this, "listMedia");
00953                                         $title = $this->object->getTitle();
00954                                 }
00955                                 else
00956                                 {
00957                                         $this->ctrl->setParameter($this, "obj_id", $node["child"]);
00958                                         $link = $this->ctrl->getLinkTarget($this, "listMedia");
00959                                         $title = $node["title"];
00960                                 }
00961                                 $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
00962                                 $ilLocator->addItem($title, $link);
00963                         }
00964                 }
00965         }
00966         
00970         function createFolderForm()
00971         {
00972                 //$this->prepareOutput();
00973 
00974                 $folder_gui =& new ilObjFolderGUI("", 0, false, false);
00975                 $folder_gui->setFormAction("save", "mep_edit.php?cmd=post&cmdClass=ilObjFolderGUI&ref_id=".
00976                         $_GET["ref_id"]."&obj_id=".$_GET["obj_id"]);
00977                 $folder_gui->createObject();
00978                 //$this->tpl->show();
00979         }
00980 
00984         function prepareOutput()
00985         {
00986                 //if (!defined("ILIAS_MODULE"))
00987                 //{
00988                         parent::prepareOutput();
00989                         return;
00990                 //}
00991 
00992                 $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00993                 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00994 
00995                 $title = $this->object->getTitle();
00996 
00997                 // catch feedback message
00998                 sendInfo();
00999 
01000                 if (!empty($title))
01001                 {
01002                         $this->tpl->setCurrentBlock("header_image");
01003                         $this->tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_mep_b.gif"));
01004                         $this->tpl->parseCurrentBlock();
01005                         $this->tpl->setCurrentBlock("content");
01006                         $this->tpl->setVariable("HEADER", $title);
01007                 }
01008 
01009                 $this->setTabs();
01010                 $this->setLocator();
01011         }
01012 
01016         function setTabs()
01017         {
01018                 // catch feedback message
01019                 #include_once("classes/class.ilTabsGUI.php");
01020                 #$tabs_gui =& new ilTabsGUI();
01021                 $this->getTabs($this->tabs_gui);
01022                 #$this->tpl->setVariable("TABS", $tabs_gui->getHTML());
01023                 //$this->tpl->setVariable("HEADER", $this->object->getTitle());
01024         }
01025 
01031         function getTabs(&$tabs_gui)
01032         {
01033                 $tabs_gui->addTarget("view_content", $this->ctrl->getLinkTarget($this, "listMedia"),
01034                         "listMedia", "");
01035 
01036                 $tabs_gui->addTarget("edit_properties", $this->ctrl->getLinkTarget($this, "edit"),
01037                         "edit", get_class($this));
01038 
01039                 $tabs_gui->addTarget("perm_settings",
01040                         $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
01041 
01042                 $tabs_gui->addTarget("clipboard", $this->ctrl->getLinkTargetByClass("ilEditClipboardGUI", "view"),
01043                         "view", "ileditclipboardgui");
01044         }
01045 
01046 
01047 
01048 }
01049 ?>

Generated on Fri Dec 13 2013 11:57:57 for ILIAS Release_3_6_x_branch .rev 46809 by  doxygen 1.7.1