• 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 require_once("classes/class.ilObjectGUI.php");
00039 require_once("content/classes/class.ilObjMediaPool.php");
00040 require_once("classes/class.ilTableGUI.php");
00041 require_once("classes/class.ilObjFolderGUI.php");
00042 require_once("content/classes/Media/class.ilObjMediaObjectGUI.php");
00043 require_once ("content/classes/class.ilEditClipboardGUI.php");
00044 
00045 class ilObjMediaPoolGUI extends ilObjectGUI
00046 {
00047         var $output_prepared;
00048 
00054         function ilObjMediaPoolGUI($a_data,$a_id = 0,$a_call_by_reference = true, $a_prepare_output = true)
00055         {
00056                 global $lng, $ilCtrl;
00057 
00058                 $this->ctrl =& $ilCtrl;
00059 
00060                 $this->ctrl->saveParameter($this, array("ref_id", "obj_id"));
00061 
00062                 $this->type = "mep";
00063                 $lng->loadLanguageModule("content");
00064                 parent::ilObjectGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
00065 
00066                 $this->output_prepared = $a_prepare_output;
00067 
00068                 if (defined("ILIAS_MODULE"))
00069                 {
00070                         $this->setTabTargetScript("mep_edit.php");
00071                 }
00072         }
00073 
00077         function executeCommand()
00078         {
00079                 if ($this->ctrl->getRedirectSource() == "ilinternallinkgui")
00080                 {
00081                         $this->explorer();
00082                         return;
00083                 }
00084 
00085                 $tree =& $this->object->getTree();
00086                 $next_class = $this->ctrl->getNextClass($this);
00087                 $cmd = $this->ctrl->getCmd();
00088 
00089                 switch($next_class)
00090                 {
00091                         case "ilobjmediaobjectgui":
00092 
00093                                 //$cmd.="Object";
00094                                 if ($cmd == "create")
00095                                 {
00096                                         $ret_obj = $_GET["obj_id"];
00097                                         $ilObjMediaObjectGUI =& new ilObjMediaObjectGUI("", 0, false, false);
00098                                 }
00099                                 else
00100                                 {
00101                                         $ret_obj = $tree->getParentId($_GET["obj_id"]);
00102                                         $ilObjMediaObjectGUI =& new ilObjMediaObjectGUI("", $_GET["obj_id"], false, false);
00103                                 }
00104                                 if ($this->ctrl->getCmdClass() == "ilinternallinkgui")
00105                                 {
00106                                         $this->ctrl->setReturn($this, "explorer");
00107                                 }
00108                                 else
00109                                 {
00110                                         $this->ctrl->setParameter($this, "obj_id", $ret_obj);
00111                                         $this->ctrl->setReturn($this, "listMedia");
00112                                         $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
00113                                 }
00114                                 $this->getTemplate();
00115                                 $ilObjMediaObjectGUI->setAdminTabs();
00116                                 $this->setLocator();
00117 
00118 //echo ":".$tree->getParentId($_GET["obj_id"]).":";
00119                                 //$ret =& $ilObjMediaObjectGUI->executeCommand();
00120                                 $ret =& $this->ctrl->forwardCommand($ilObjMediaObjectGUI);
00121 //echo "<br>ilObjMediaPoolGUI:afterexecute:<br>"; exit;
00122                                 switch($cmd)
00123                                 {
00124                                         case "save":
00125                                                 $parent = ($_GET["obj_id"] == "")
00126                                                         ? $tree->getRootId()
00127                                                         : $_GET["obj_id"];
00128                                                 $tree->insertNode($ret->getId(), $parent);
00129                                                 ilUtil::redirect("mep_edit.php?cmd=listMedia&ref_id=".
00130                                                         $_GET["ref_id"]."&obj_id=".$_GET["obj_id"]);
00131                                                 break;
00132 
00133                                         default:
00134                                                 $this->tpl->show();
00135                                                 break;
00136                                 }
00137                                 break;
00138 
00139                         case "ilobjfoldergui":
00140                                 $folder_gui = new ilObjFolderGUI("", 0, false, false);
00141                                 $cmd.="Object";
00142                                 switch($cmd)
00143                                 {
00144                                         case "createObject":
00145                                                 $this->prepareOutput();
00146                                                 $folder_gui =& new ilObjFolderGUI("", 0, false, false);
00147                                                 $folder_gui->setFormAction("save",
00148                                                         $this->ctrl->getFormActionByClass("ilobjfoldergui"));
00149                                                 $folder_gui->createObject();
00150                                                 $this->tpl->show();
00151                                                 break;
00152 
00153                                         case "saveObject":
00154                                                 $folder_gui->setReturnLocation("save", $this->ctrl->getLinkTarget($this, "listMedia"));
00155                                                 $parent = ($_GET["obj_id"] == "")
00156                                                         ? $tree->getRootId()
00157                                                         : $_GET["obj_id"];
00158                                                 $folder_gui->setFolderTree($tree);
00159                                                 $folder_gui->saveObject($parent);
00160                                                 break;
00161 
00162                                         case "editObject":
00163                                                 $this->prepareOutput();
00164                                                 $folder_gui =& new ilObjFolderGUI("", $_GET["obj_id"], false, false);
00165                                                 $folder_gui->setFormAction("update", $this->ctrl->getFormActionByClass("ilobjfoldergui"));
00166                                                 $folder_gui->editObject();
00167                                                 $this->tpl->show();
00168                                                 break;
00169 
00170                                         case "updateObject":
00171                                                 $folder_gui =& new ilObjFolderGUI("", $_GET["obj_id"], false, false);
00172                                                 $folder_gui->setReturnLocation("update", $this->ctrl->getLinkTarget($this, "listMedia"));
00173                                                 $folder_gui->updateObject();
00174                                                 break;
00175 
00176                                         case "cancelObject":
00177                                                 sendInfo($this->lng->txt("action_aborted"), true);
00178                                                 $this->ctrl->redirect($this, "listMedia");
00179                                                 break;
00180                                 }
00181                                 break;
00182 
00183                         case "ileditclipboardgui":
00184                                 $this->prepareOutput();
00185                                 $this->ctrl->setReturn($this, "listMedia");
00186                                 $clip_gui = new ilEditClipboardGUI();
00187                                 //$ret =& $clip_gui->executeCommand();
00188                                 $ret =& $this->ctrl->forwardCommand($clip_gui);
00189                                 $this->tpl->show();
00190                                 break;
00191 
00192                         default:
00193                                 $cmd = $this->ctrl->getCmd("frameset");
00194                                 $this->$cmd();
00195                                 break;
00196                 }
00197         }
00198 
00203         function saveObject()
00204         {
00205                 global $rbacadmin;
00206 
00207                 // create and insert forum in objecttree
00208                 $newObj = parent::saveObject();
00209 
00210                 // setup rolefolder & default local roles
00211                 //$roles = $newObj->initDefaultRoles();
00212 
00213                 // ...finally assign role to creator of object
00214                 //$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "y");
00215 
00216                 // put here object specific stuff
00217 
00218                 // always send a message
00219                 sendInfo($this->lng->txt("object_added"),true);
00220 
00221                 ilUtil::redirect($this->getReturnLocation("save","adm_object.php?".$this->link_params));
00222         }
00223 
00229         function editObject()
00230         {
00231                 global $rbacsystem, $tree, $tpl;
00232 
00233                 if (!$rbacsystem->checkAccess("visible,write",$this->object->getRefId()))
00234                 {
00235                         $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00236                 }
00237 
00238                 // edit button
00239                 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00240 
00241                 if (!defined("ILIAS_MODULE"))
00242                 {
00243                         $this->tpl->setCurrentBlock("btn_cell");
00244                         $this->tpl->setVariable("BTN_LINK","content/mep_edit.php?ref_id=".$this->object->getRefID());
00245                         $this->tpl->setVariable("BTN_TARGET"," target=\"bottom\" ");
00246                         $this->tpl->setVariable("BTN_TXT",$this->lng->txt("edit"));
00247                         $this->tpl->parseCurrentBlock();
00248                 }
00249 
00250                 parent::editObject();
00251         }
00252 
00256         function edit()
00257         {
00258                 $this->prepareOutput();
00259                 $this->setFormAction("update", "mep_edit.php?cmd=post&ref_id=".$_GET["ref_id"].
00260                         "&obj_id=".$_GET["obj_id"]);
00261                 $this->editObject();
00262                 $this->tpl->show();
00263         }
00264 
00268         function cancel()
00269         {
00270                 $this->setReturnLocation("cancel","mep_edit.php?cmd=listMedia&ref_id=".$_GET["ref_id"].
00271                         "&obj_id=".$_GET["obj_id"]);
00272                 $this->cancelObject();
00273         }
00274 
00278         function update()
00279         {
00280                 $this->setReturnLocation("update", "mep_edit.php?cmd=listMedia&ref_id=".$_GET["ref_id"].
00281                         "&obj_id=".$_GET["obj_id"]);
00282                 $this->updateObject();
00283         }
00284 
00288         function perm()
00289         {
00290                 $this->prepareOutput();
00291                 $this->setFormAction("permSave", "mep_edit.php?cmd=permSave&ref_id=".$_GET["ref_id"].
00292                         "&obj_id=".$_GET["obj_id"]);
00293                 $this->setFormAction("addRole", "mep_edit.php?ref_id=".$_GET["ref_id"].
00294                         "&obj_id=".$_GET["obj_id"]."&cmd=addRole");
00295                 $this->permObject();
00296                 $this->tpl->show();
00297         }
00298 
00302         function permSave()
00303         {
00304                 $this->setReturnLocation("permSave",
00305                         "mep_edit.php?ref_id=".$_GET["ref_id"]."&obj_id=".$_GET["obj_id"]."&cmd=perm");
00306                 $this->permSaveObject();
00307         }
00308 
00312         function addRole()
00313         {
00314                 $this->setReturnLocation("addRole",
00315                         "mep_edit.php?ref_id=".$_GET["ref_id"]."&obj_id=".$_GET["obj_id"]."&cmd=perm");
00316                 $this->addRoleObject();
00317         }
00318 
00322         function owner()
00323         {
00324                 $this->prepareOutput();
00325                 $this->ownerObject();
00326                 $this->tpl->show();
00327         }
00328 
00332         function listMedia()
00333         {
00334                 global $tree;
00335 
00336                 if (!$this->output_prepared)
00337                 {
00338                         $this->prepareOutput();
00339                 }
00340 
00341                 //add template for view button
00342                 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00343 
00344                 // create folder form button
00345                 $this->tpl->setCurrentBlock("btn_cell");
00346                 $this->tpl->setVariable("BTN_LINK",
00347                         $this->ctrl->getLinkTargetByClass("ilobjfoldergui", "create"));
00348                 $this->tpl->setVariable("BTN_TXT",$this->lng->txt("cont_create_folder"));
00349                 $this->tpl->parseCurrentBlock();
00350 
00351                 // create mob form button
00352                 $this->tpl->setCurrentBlock("btn_cell");
00353                 $this->tpl->setVariable("BTN_LINK",
00354                         $this->ctrl->getLinkTargetByClass("ilobjmediaobjectgui", "create"));
00355                 $this->tpl->setVariable("BTN_TXT",$this->lng->txt("cont_create_mob"));
00356                 $this->tpl->parseCurrentBlock();
00357 
00358                 $obj_id = ($_GET["obj_id"] == "")
00359                         ? $obj_id = $this->object->tree->getRootId()
00360                         : $_GET["obj_id"];
00361 
00362                 // create table
00363                 require_once("classes/class.ilTableGUI.php");
00364                 $tbl = new ilTableGUI();
00365 
00366                 // load files templates
00367                 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
00368 
00369                 // load template for table content data
00370                 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.mep_list_row.html", true);
00371 
00372                 $num = 0;
00373 
00374                 $this->tpl->setVariable("FORMACTION", "mep_edit.php?ref_id=".$_GET["ref_id"].
00375                         "&obj_id=".$_GET["obj_id"]."&cmd=post");
00376 
00377                 $tbl->setTitle($this->lng->txt("cont_content"));
00378 
00379                 $tbl->setHeaderNames(array("", $this->lng->txt("type"), $this->lng->txt("title")));
00380 
00381                 $cols = array("", "type", "title");
00382                 $header_params = array("ref_id" => $_GET["ref_id"],
00383                         "obj_id" => $_GET["obj_id"], "cmd" => "listMedia");
00384                 $tbl->setHeaderVars($cols, $header_params);
00385                 $tbl->setColumnWidth(array("1%", "1%", "98%"));
00386 
00387                 // control
00388                 $tbl->setOrderColumn($_GET["sort_by"]);
00389                 $tbl->setOrderDirection($_GET["sort_order"]);
00390                 $tbl->setLimit($_GET["limit"]);
00391                 $tbl->setOffset($_GET["offset"]);
00392                 $tbl->setMaxCount($this->maxcount);             // ???
00393 
00394                 $this->tpl->setVariable("COLUMN_COUNTS", 3);
00395 
00396                 // remove button
00397                 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
00398                 $this->tpl->setCurrentBlock("tbl_action_btn");
00399                 $this->tpl->setVariable("BTN_NAME", "confirmRemove");
00400                 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("remove"));
00401                 $this->tpl->parseCurrentBlock();
00402 
00403                 // copy to clipboard
00404                 $this->tpl->setCurrentBlock("tbl_action_btn");
00405                 $this->tpl->setVariable("BTN_NAME", "copyToClipboard");
00406                 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("cont_copy_to_clipboard"));
00407                 $this->tpl->parseCurrentBlock();
00408 
00409                 // footer
00410                 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00411                 //$tbl->disable("footer");
00412 
00413                 $objs = $this->object->getChilds($_GET["obj_id"]);
00414 
00415                 $tbl->setMaxCount(count($objs));
00416                 $objs = array_slice($objs, $_GET["offset"], $_GET["limit"]);
00417 
00418                 $tbl->render();
00419                 if(count($objs) > 0)
00420                 {
00421                         $i=0;
00422                         foreach($objs as $obj)
00423                         {
00424                                 $this->tpl->setCurrentBlock("link");
00425                                 $this->tpl->setVariable("TXT_TITLE", $obj["title"]);
00426                                 switch($obj["type"])
00427                                 {
00428                                         case "fold":
00429                                                 $this->ctrl->setParameter($this, "obj_id", $obj["obj_id"]);
00430                                                 $this->tpl->setVariable("LINK_VIEW",
00431                                                         $this->ctrl->getLinkTarget($this, "listMedia"));
00432                                                 break;
00433 
00434                                         case "mob":
00435                                                 $this->ctrl->setParameterByClass("ilobjmediaobjectgui", "obj_id", $obj["obj_id"]);
00436                                                 $this->tpl->setVariable("LINK_VIEW",
00437                                                         $this->ctrl->getLinkTargetByClass("ilobjmediaobjectgui", "edit"));
00438                                                 $this->tpl->setCurrentBlock("show");
00439                                                 $this->tpl->setVariable("TXT_SHOW", $this->lng->txt("view"));
00440                                                 $this->ctrl->setParameter($this, "mob_id", $obj["obj_id"]);
00441                                                 $this->tpl->setVariable("SHOW_LINK", $this->ctrl->getLinktarget($this, "showMedia"));
00442                                                 $this->tpl->parseCurrentBlock();
00443                                                 $this->tpl->setCurrentBlock("link");
00444                         //$this->tpl->setVariable("OBJ_URL", ilUtil::getHtmlPath(ilObjMediaObject::_getDirectory($obj["obj_id"]) . '/'. $obj["title"]));
00445                                                 break;
00446                                 }
00447                                 $this->tpl->parseCurrentBlock();
00448 
00449                                 // edit folder Link
00450                                 if ($obj["type"] == "fold")
00451                                 {
00452                                         $this->tpl->setCurrentBlock("link");
00453                                         $this->tpl->setVariable("TXT_TITLE", "[".$this->lng->txt("edit")."]");
00454                                         $this->ctrl->setParameterByClass("ilobjfoldergui", "obj_id", $obj["obj_id"]);
00455                                         $this->tpl->setVariable("LINK_VIEW",
00456                                                 $this->ctrl->getLinkTargetByClass("ilobjfoldergui", "edit"));
00457                                         $this->tpl->parseCurrentBlock();
00458                                 }
00459 
00460                                 $this->tpl->setCurrentBlock("tbl_content");
00461                                 $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
00462                                 $this->tpl->setVariable("CHECKBOX_ID", $obj["obj_id"]);
00463                                 $this->tpl->setVariable("CSS_ROW", $css_row);
00464                                 $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_".$obj["type"].".gif"));
00465 
00466                                 $this->tpl->parseCurrentBlock();
00467                         }
00468                         $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
00469                 } //if is_array
00470                 else
00471                 {
00472                         $this->tpl->setCurrentBlock("notfound");
00473                         $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
00474                         $this->tpl->setVariable("NUM_COLS", 3);
00475                         $this->tpl->parseCurrentBlock();
00476                 }
00477 
00478                 $this->tpl->parseCurrentBlock();
00479                 $this->tpl->show();
00480         }
00481 
00482         function getTemplate()
00483         {
00484                 $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00485                 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00486         }
00487 
00493         function frameset()
00494         {
00495                 $this->tpl = new ilTemplate("tpl.mep_edit_frameset.html", false, false, "content");
00496                 $this->tpl->setVariable("REF_ID",$this->ref_id);
00497                 $this->tpl->show();
00498         }
00499 
00503         function explorer()
00504         {
00505                 $this->tpl = new ilTemplate("tpl.main.html", true, true);
00506 
00507                 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
00508 
00509                 $this->tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
00510 
00511                 require_once ("content/classes/class.ilMediaPoolExplorer.php");
00512                 $exp = new ilMediaPoolExplorer($this->ctrl->getLinkTarget($this, "listMedia"), $this->object);
00513                 $exp->setTargetGet("obj_id");
00514                 //$exp->setExpandTarget("mep_edit.php?cmd=explorer&ref_id=".$this->object->getRefId());
00515                 $exp->setExpandTarget($this->ctrl->getLinkTarget($this, "explorer"));
00516 
00517                 $exp->addFilter("root");
00518                 $exp->addFilter("fold");
00519                 $exp->setFiltered(true);
00520                 $exp->setFilterMode(IL_FM_POSITIVE);
00521 
00522 
00523                 if ($_GET["mepexpand"] == "")
00524                 {
00525                         $mep_tree =& $this->object->getTree();
00526                         $expanded = $mep_tree->readRootId();
00527                 }
00528                 else
00529                 {
00530                         $expanded = $_GET["mepexpand"];
00531                 }
00532 
00533                 $exp->setExpand($expanded);
00534 
00535                 // build html-output
00536                 $exp->setOutput(0);
00537                 $output = $exp->getOutput();
00538 
00539                 $this->tpl->setCurrentBlock("content");
00540                 $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_mep_structure"));
00541                 $this->tpl->setVariable("EXPLORER",$output);
00542                 $this->tpl->setVariable("ACTION", "mep_edit.php?cmd=explorer&ref_id=".$this->ref_id."&mepexpand=".$_GET["mepexpand"]);
00543                 $this->tpl->parseCurrentBlock();
00544                 $this->tpl->show(false);
00545 
00546         }
00547         
00551         function showMedia()
00552         {
00553                 //$int_links = $page_object->getInternalLinks();
00554                 $med_links = ilMediaItem::_getMapAreasIntLinks($_GET["mob_id"]);
00555                 
00556                 // later
00557                 //$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets());
00558                 
00559                 $link_xlm = "";
00560 
00561                 require_once("content/classes/Media/class.ilObjMediaObject.php");
00562                 $media_obj =& new ilObjMediaObject($_GET["mob_id"]);
00563                 
00564                 $xml = "<dummy>";
00565                 // todo: we get always the first alias now (problem if mob is used multiple
00566                 // times in page)
00567                 $xml.= $media_obj->getXML(IL_MODE_ALIAS);
00568                 $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
00569                 $xml.= $link_xml;
00570                 $xml.="</dummy>";
00571 
00572                 $xsl = file_get_contents("./content/page.xsl");
00573                 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
00574                 $xh = xslt_create();
00575 
00576                 $wb_path = ilUtil::getWebspaceDir("output");
00577 
00578                 $mode = ($_GET["cmd"] != "showMedia")
00579                         ? "fullscreen"
00580                         : "media";
00581                 $enlarge_path = ilUtil::getImagePath("enlarge.gif", false, "output");
00582                 $fullscreen_link =
00583                         $this->ctrl->getLinkTarget($this, "showFullscreen");
00584                 $params = array ('mode' => $mode, 'enlarge_path' => $enlarge_path,
00585                         'link_params' => "ref_id=".$_GET["ref_id"],'fullscreen_link' => $fullscreen_link,
00586                         'ref_id' => $_GET["ref_id"], 'pg_frame' => $pg_frame, 'webspace_path' => $wb_path);
00587                 $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
00588                 echo xslt_error($xh);
00589                 xslt_free($xh);
00590 
00591                 // unmask user html
00592                 $this->tpl->setVariable("CONTENT", $output);
00593 
00594                 $this->tpl->parseCurrentBlock();
00595                 $this->tpl->show();
00596 
00597         }
00598 
00602         function showFullscreen()
00603         {
00604                 $this->showMedia();
00605         }
00606         
00610         function confirmRemove()
00611         {
00612                 if(!isset($_POST["id"]))
00613                 {
00614                         $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00615                 }
00616 
00617                 $this->prepareOutput();
00618 
00619                 // SAVE POST VALUES
00620                 $_SESSION["ilMepRemove"] = $_POST["id"];
00621 
00622                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.confirm_deletion.html", true);
00623 
00624                 sendInfo($this->lng->txt("info_delete_sure"));
00625 
00626                 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00627 
00628                 // BEGIN TABLE HEADER
00629                 $this->tpl->setCurrentBlock("table_header");
00630                 $this->tpl->setVariable("TEXT",$this->lng->txt("objects"));
00631                 $this->tpl->parseCurrentBlock();
00632 
00633                 // BEGIN TABLE DATA
00634                 $counter = 0;
00635                 foreach($_POST["id"] as $obj_id)
00636                 {
00637                         $type = ilObject::_lookupType($obj_id);
00638                         $title = ilObject::_lookupTitle($obj_id);
00639                         $this->tpl->setCurrentBlock("table_row");
00640                         $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor(++$counter,"tblrow1","tblrow2"));
00641                         $this->tpl->setVariable("TEXT_CONTENT", $title);
00642                         $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_".$type.".gif"));
00643                         $this->tpl->parseCurrentBlock();
00644                 }
00645 
00646                 // cancel/confirm button
00647                 $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
00648                 $buttons = array( "cancelRemove"  => $this->lng->txt("cancel"),
00649                         "remove"  => $this->lng->txt("confirm"));
00650                 foreach ($buttons as $name => $value)
00651                 {
00652                         $this->tpl->setCurrentBlock("operation_btn");
00653                         $this->tpl->setVariable("BTN_NAME",$name);
00654                         $this->tpl->setVariable("BTN_VALUE",$value);
00655                         $this->tpl->parseCurrentBlock();
00656                 }
00657                 $this->tpl->show();
00658         }
00659 
00663         function cancelRemove()
00664         {
00665                 session_unregister("ilMepRemove");
00666                 $this->ctrl->redirect($this, "listMedia");
00667         }
00668 
00672         function remove()
00673         {
00674                 foreach($_SESSION["ilMepRemove"] as $obj_id)
00675                 {
00676                         $this->object->deleteChild($obj_id);
00677                 }
00678 
00679                 sendInfo($this->lng->txt("cont_obj_removed"),true);
00680                 session_unregister("ilMepRemove");
00681                 $this->ctrl->redirect($this, "listMedia");
00682         }
00683 
00684 
00688         function copyToClipboard()
00689         {
00690                 global $ilUser;
00691 
00692                 if(!isset($_POST["id"]))
00693                 {
00694                         $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00695                 }
00696 
00697                 foreach ($_POST["id"] as $obj_id)
00698                 {
00699                         $type = ilObject::_lookupType($obj_id);
00700                         if ($type == "fold")
00701                         {
00702                                 $this->ilias->raiseError($this->lng->txt("cont_cant_copy_folders"), $this->ilias->error_obj->MESSAGE);
00703                         }
00704                 }
00705 
00706                 foreach ($_POST["id"] as $obj_id)
00707                 {
00708                         $ilUser->addObjectToClipboard($obj_id, "mob", "");
00709                 }
00710 
00711                 sendInfo($this->lng->txt("copied_to_clipboard"),true);
00712                 $this->ctrl->redirect($this, "listMedia");
00713         }
00714 
00718         function setLocator($a_tree = "", $a_id = "", $scriptname="adm_object.php")
00719         {
00720                 global $ilias_locator;
00721 
00722                 if (!defined("ILIAS_MODULE"))
00723                 {
00724                         parent::setLocator();
00725                         return;
00726                 }
00727                 else
00728                 {
00729                         $tree =& $this->object->getTree();
00730                         $obj_id = ($_GET["obj_id"] == "")
00731                                 ? $tree->getRootId()
00732                                 : $_GET["obj_id"];
00733                         parent::setLocator($tree, $obj_id, "mep_edit.php?cmd=listMedia&ref_id=".$_GET["ref_id"],
00734                                 "obj_id", false, $this->object->getTitle());
00735                 }
00736                 return;
00737 
00738                 if (!is_object($a_tree))
00739                 {
00740                         $a_tree =& $this->tree;
00741                 }
00742 
00743                 if (!($a_id))
00744                 {
00745                         $a_id = $_GET["ref_id"];
00746                 }
00747 
00748                 $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html");
00749 
00750                 $path = $a_tree->getPathFull($a_id);
00751 
00752         //check if object isn't in tree, this is the case if parent_parent is set
00753                 // TODO: parent_parent no longer exist. need another marker
00754                 if ($a_parent_parent)
00755                 {
00756                         //$subObj = getObject($a_ref_id);
00757                         $subObj =& $this->ilias->obj_factory->getInstanceByRefId($a_ref_id);
00758 
00759                         $path[] = array(
00760                                 "id"     => $a_ref_id,
00761                                 "title"  => $this->lng->txt($subObj->getTitle())
00762                                 );
00763                 }
00764 
00765                 // this is a stupid workaround for a bug in PEAR:IT
00766                 $modifier = 1;
00767 
00768                 if (isset($_GET["obj_id"]))
00769                 {
00770                         $modifier = 0;
00771                 }
00772 
00773                 // ### AA 03.11.10 added new locator GUI class ###
00774                 $i = 1;
00775 
00776                 foreach ($path as $key => $row)
00777                 {
00778                         if ($key < count($path)-$modifier)
00779                         {
00780                                 $this->tpl->touchBlock("locator_separator");
00781                         }
00782 
00783                         $this->tpl->setCurrentBlock("locator_item");
00784                         $this->tpl->setVariable("ITEM", $row["title"]);
00785 
00786                         $this->tpl->setVariable("LINK_ITEM", $scriptname."?ref_id=".$row["child"]);
00787                         $this->tpl->parseCurrentBlock();
00788 
00789                         // ### AA 03.11.10 added new locator GUI class ###
00790                         // navigate locator
00791                         $ilias_locator->navigate($i++,$row["title"],$scriptname."?ref_id=".$row["child"],"bottom");
00792                 }
00793 
00794                 if (isset($_GET["obj_id"]))
00795                 {
00796                         $obj_data =& $this->ilias->obj_factory->getInstanceByObjId($_GET["obj_id"]);
00797 
00798                         $this->tpl->setCurrentBlock("locator_item");
00799                         $this->tpl->setVariable("ITEM", $obj_data->getTitle());
00800 
00801                         $this->tpl->setVariable("LINK_ITEM", $scriptname."?ref_id=".$_GET["ref_id"]."&obj_id=".$_GET["obj_id"]);
00802                         $this->tpl->parseCurrentBlock();
00803 
00804                         // ### AA 03.11.10 added new locator GUI class ###
00805                         // navigate locator
00806                         $ilias_locator->navigate($i++,$obj_data->getTitle(),$scriptname."?ref_id=".$_GET["ref_id"]."&obj_id=".$_GET["obj_id"],"bottom");
00807                 }
00808 
00809                 $this->tpl->setCurrentBlock("locator");
00810 
00811                 if (DEBUG)
00812                 {
00813                         $debug = "DEBUG: <font color=\"red\">".$this->type."::".$this->id."::".$_GET["cmd"]."</font><br/>";
00814                 }
00815 
00816                 $prop_name = $this->objDefinition->getPropertyName($_GET["cmd"],$this->type);
00817 
00818                 if ($_GET["cmd"] == "confirmDeleteAdm")
00819                 {
00820                         $prop_name = "delete_object";
00821                 }
00822 
00823                 $this->tpl->setVariable("TXT_LOCATOR",$debug.$this->lng->txt("locator"));
00824                 $this->tpl->parseCurrentBlock();
00825         }
00826 
00830         function createFolderForm()
00831         {
00832                 $this->prepareOutput();
00833 
00834                 $folder_gui =& new ilObjFolderGUI("", 0, false, false);
00835                 $folder_gui->setFormAction("save", "mep_edit.php?cmd=post&cmdClass=ilObjFolderGUI&ref_id=".
00836                         $_GET["ref_id"]."&obj_id=".$_GET["obj_id"]);
00837                 $folder_gui->createObject();
00838                 //$this->tpl->show();
00839         }
00840 
00844         function prepareOutput()
00845         {
00846                 if (!defined("ILIAS_MODULE"))
00847                 {
00848                         parent::prepareOutput();
00849                         return;
00850                 }
00851 
00852                 $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00853                 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00854 
00855                 $title = $this->object->getTitle();
00856 
00857                 // catch feedback message
00858                 sendInfo();
00859 
00860                 if (!empty($title))
00861                 {
00862                         $this->tpl->setVariable("HEADER", $title);
00863                 }
00864 
00865                 $this->setTabs();
00866                 $this->setLocator();
00867         }
00868 
00872         function setTabs()
00873         {
00874                 // catch feedback message
00875                 include_once("classes/class.ilTabsGUI.php");
00876                 $tabs_gui =& new ilTabsGUI();
00877                 $this->getTabs($tabs_gui);
00878                 $this->tpl->setVariable("TABS", $tabs_gui->getHTML());
00879                 //$this->tpl->setVariable("HEADER", $this->object->getTitle());
00880         }
00881 
00887         function getTabs(&$tabs_gui)
00888         {
00889                 $tabs_gui->addTarget("view_content", $this->ctrl->getLinkTarget($this, "listMedia"),
00890                         get_class($this), "listMedia");
00891 
00892                 $tabs_gui->addTarget("edit_properties", $this->ctrl->getLinkTarget($this, "edit"),
00893                         get_class($this), "edit");
00894 
00895                 $tabs_gui->addTarget("permission_settings", $this->ctrl->getLinkTarget($this, "perm"),
00896                         get_class($this), "perm");
00897 
00898                 $tabs_gui->addTarget("show_owner", $this->ctrl->getLinkTarget($this, "owner"),
00899                         get_class($this), "owner");
00900 
00901                 $tabs_gui->addTarget("clipboard", $this->ctrl->getLinkTargetByClass("ilEditClipboardGUI", "view"),
00902                         "ileditclipboardgui", "view");
00903 
00904         }
00905 
00906 
00907 
00908 }
00909 ?>

Generated on Fri Dec 13 2013 08:00:16 for ILIAS Release_3_3_x_branch .rev 46803 by  doxygen 1.7.1