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

Services/MediaObjects/classes/class.ilObjMediaObjectGUI.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 require_once ("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
00025 require_once ("./Modules/LearningModule/classes/class.ilInternalLinkGUI.php");
00026 require_once ("classes/class.ilObjectGUI.php");
00027 
00039 class ilObjMediaObjectGUI extends ilObjectGUI
00040 {
00041         var $ctrl;
00042         var $header;
00043         var $target_script;
00044         var $enabledmapareas = true;
00045 
00046         function ilObjMediaObjectGUI($a_data, $a_id = 0, $a_call_by_reference = false, $a_prepare_output = false)
00047         {
00048                 global $lng, $ilCtrl;
00049 
00050                 $this->ctrl =& $ilCtrl;
00051                 parent::ilObjectGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
00052                 $this->lng =& $lng;
00053                 $this->back_title = "";
00054                 $this->type = "mob";
00055         }
00056 
00057         function _forwards()
00058         {
00059                 return array("ilInternalLinkGUI");
00060         }
00061 
00062         function setHeader($a_title = "")
00063         {
00064                 $this->header = $a_title;
00065         }
00066 
00067         function getHeader()
00068         {
00069                 return $this->header;
00070         }
00071 
00077         function setEnabledMapAreas($a_enabledmapareas)
00078         {
00079                 $this->enabledmapareas = $a_enabledmapareas;
00080         }
00081 
00087         function getEnabledMapAreas()
00088         {
00089                 return $this->enabledmapareas;
00090         }
00091 
00092         function assignObject()
00093         {
00094                 if ($this->id != 0)
00095                 {
00096                         $this->object =& new ilObjMediaObject($this->id);
00097                 }
00098         }
00099 
00100         function returnToContextObject()
00101         {
00102                 $this->ctrl->returnToParent($this);
00103         }
00104         
00105 
00106         function &executeCommand()
00107         {
00108                 $next_class = $this->ctrl->getNextClass($this);
00109                 $cmd = $this->ctrl->getCmd();
00110                 
00111                 switch($next_class)
00112                 {
00113                         case 'ilmdeditorgui':
00114 
00115                                 include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
00116 
00117                                 $md_gui =& new ilMDEditorGUI(0, $this->object->getId(), $this->object->getType());
00118                                 $md_gui->addObserver($this->object,'MDUpdateListener','General');
00119 
00120                                 $this->ctrl->forwardCommand($md_gui);
00121                                 break;
00122 
00123                         case "ilinternallinkgui":
00124                                 require_once("./Modules/LearningModule/classes/class.ilInternalLinkGUI.php");
00125                                 $link_gui = new ilInternalLinkGUI("Media_Media", 0);
00126                                 $link_gui->setMode("link");
00127                                 $link_gui->setSetLinkTargetScript(
00128                                         $this->ctrl->getLinkTargetByClass("ilObjMediaObjectGUI",
00129                                         "setInternalLink", "", true));
00130                                 $link_gui->filterLinkType("Media");
00131                                 //$ret =& $link_gui->executeCommand();
00132                                 $ret =& $this->ctrl->forwardCommand($link_gui);
00133                                 break;
00134 
00135                         default:
00136                                 if (isset($_POST["editImagemapForward"]) ||
00137                                         isset($_POST["editImagemapForward_x"]) ||
00138                                         isset($_POST["editImagemapForward_y"]))
00139                                 {
00140                                         $cmd = "editImagemapForward";
00141                                 }
00142                                 $cmd.= "Object";
00143                                 $ret =& $this->$cmd();
00144                                 break;
00145                 }
00146 
00147                 return $ret;
00148         }
00149 
00153         function setBackTitle($a_title)
00154         {
00155                 $this->back_title = $a_title;
00156         }
00157         
00161         function createObject()
00162         {
00163                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mob_new.html", "Services/MediaObjects");
00164                 $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_insert_mob"));
00165                 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00166 
00167                 // select fields for number of columns
00168                 $this->tpl->setVariable("TXT_STANDARD_VIEW", $this->lng->txt("cont_std_view"));
00169                 $this->tpl->setVariable("TXT_FILE", $this->lng->txt("cont_file"));
00170                 $this->tpl->setVariable("TXT_REFERENCE", $this->lng->txt("cont_reference"));
00171                 $this->tpl->setVariable("TXT_REF_HELPTEXT", $this->lng->txt("cont_ref_helptext"));
00172                 $this->tpl->setVariable("TXT_WIDTH", $this->lng->txt("cont_width"));
00173                 $this->tpl->setVariable("TXT_HEIGHT", $this->lng->txt("cont_height"));
00174                 $this->tpl->setVariable("TXT_ORIGINAL_SIZE", $this->lng->txt("cont_orig_size"));
00175                 $this->tpl->setVariable("TXT_CAPTION", $this->lng->txt("cont_caption"));
00176                 $this->tpl->setVariable("TXT_FULLSCREEN_VIEW", $this->lng->txt("cont_fullscreen"));
00177                 $this->tpl->setVariable("TXT_PARAMETER", $this->lng->txt("cont_parameter"));
00178                 $this->tpl->setVariable("TXT_RESIZE", $this->lng->txt("cont_resize_image"));
00179                 $this->tpl->setVariable("TXT_RESIZE_EXPLANATION", $this->lng->txt("cont_resize_explanation"));
00180                 //$this->tpl->parseCurrentBlock();
00181 
00182                 // operations
00183                 $this->tpl->setCurrentBlock("commands");
00184                 $this->tpl->setVariable("BTN_NAME", "save");
00185                 $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
00186                 $this->tpl->setVariable("BTN_CANCEL", "cancel");
00187                 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
00188                 $this->tpl->parseCurrentBlock();
00189         }
00190 
00194         function saveObject()
00195         {
00196                 // determinte title and format
00197                 if ($_POST["standard_type"] == "File")
00198                 {
00199                         $title = $_FILES['standard_file']['name'];
00200                 }
00201                 else
00202                 {
00203                         $title = $_POST["standard_reference"];
00204                 }
00205 
00206                 // create dummy object in db (we need an id)
00207                 $this->object = new ilObjMediaObject();
00208 
00209                 $this->object->setTitle($title);
00210                 $this->object->setDescription("");
00211                 $this->object->create();
00212 
00213                 // determine and create mob directory, move uploaded file to directory
00214                 //$mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$this->object->getId();
00215                 $this->object->createDirectory();
00216                 $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
00217 
00218                 $media_item =& new ilMediaItem();
00219                 $this->object->addMediaItem($media_item);
00220                 $media_item->setPurpose("Standard");
00221 
00222                 if ($_POST["standard_type"] == "File")
00223                 {
00224                         $file = $mob_dir."/".$_FILES['standard_file']['name'];
00225                         //move_uploaded_file($_FILES['standard_file']['tmp_name'], $file);
00226                         ilUtil::moveUploadedFile($_FILES['standard_file']['tmp_name'],
00227                                 $_FILES['standard_file']['name'], $file);
00228 
00229                         // get mime type
00230                         $format = ilObjMediaObject::getMimeType($file);
00231                         $location = $_FILES['standard_file']['name'];
00232 
00233                         // resize standard images
00234                         if ($_POST["standard_size"] != "original" &&
00235                                 $_POST["standard_resize"] == "y" &&
00236                                 is_int(strpos($format, "image")))
00237                         {
00238                                 $location = ilObjMediaObject::_resizeImage($file, $_POST["standard_width"],
00239                                         $_POST["standard_height"]);
00240                         }
00241 
00242                         // set real meta and object data
00243                         $media_item->setFormat($format);
00244                         $media_item->setLocation($location);
00245                         $media_item->setLocationType("LocalFile");
00246 //                      $meta_technical->addFormat($format);
00247 //                      $meta_technical->setSize($_FILES['standard_file']['size']);
00248 //                      $meta_technical->addLocation("LocalFile", $location);
00249                         $this->object->setTitle($_FILES['standard_file']['name']);
00250                 }
00251                 else    // standard type: reference
00252                 {
00253                         $format = ilObjMediaObject::getMimeType($_POST["standard_reference"]);
00254                         $media_item->setFormat($format);
00255                         $media_item->setLocation($_POST["standard_reference"]);
00256                         $media_item->setLocationType("Reference");
00257 //                      $meta_technical->addFormat($format);
00258 //                      $meta_technical->setSize(0);
00259 //                      $meta_technical->addLocation("Reference", $_POST["standard_reference"]);
00260                         $this->object->setTitle($_POST["standard_reference"]);
00261                 }
00262 //              $meta->addTechnicalSection($meta_technical);
00263                 $this->object->setDescription($format);
00264 
00265                 // determine width and height of known image types
00266                 if ($_POST["standard_size"] == "original")
00267                 {
00268                         if (ilUtil::deducibleSize($format))
00269                         {
00270                                 $size = getimagesize($file);
00271                                 $media_item->setWidth($size[0]);
00272                                 $media_item->setHeight($size[1]);
00273                         }
00274                         else
00275                         {
00276                                 $media_item->setWidth(500);
00277                                 $media_item->setHeight(400);
00278                         }
00279                 }
00280                 else
00281                 {
00282                         $media_item->setWidth($_POST["standard_width"]);
00283                         $media_item->setHeight($_POST["standard_height"]);
00284                 }
00285 
00286                 if ($_POST["standard_caption"] != "")
00287                 {
00288                         $media_item->setCaption($_POST["standard_caption"]);
00289                 }
00290 
00291                 if ($_POST["standard_param"] != "")
00292                 {
00293                         $media_item->setParameters(ilUtil::stripSlashes(utf8_decode($_POST["standard_param"])));
00294                 }
00295 
00296                 $media_item->setHAlign("Left");
00297 
00298                 // fullscreen view
00299                 if ($_POST["fullscreen"] == "y")
00300                 {
00301                         $media_item =& new ilMediaItem();
00302                         $this->object->addMediaItem($media_item);
00303                         $media_item->setPurpose("Fullscreen");
00304 
00305                         // file
00306                         if ($_POST["full_type"] == "File")
00307                         {
00308                                 if ($_FILES['full_file']['name'] != "")
00309                                 {
00310                                         $file = $mob_dir."/".$_FILES['full_file']['name'];
00311                                         //move_uploaded_file($_FILES['full_file']['tmp_name'], $file);
00312                                         ilUtil::moveUploadedFile($_FILES['full_file']['tmp_name'],
00313                                                 $_FILES['full_file']['name'], $file);
00314                                 }
00315 
00316                                 if ($_FILES['full_file']['name'] != "" ||
00317                                                 ($_POST["full_size"] != "original" &&
00318                                                 $_POST["full_resize"] == "y" &&
00319                                                 is_int(strpos($format, "image")))
00320                                         )
00321                                 {
00322                                         // set real meta and object data
00323                                         $format = ilObjMediaObject::getMimeType($file);
00324                                         $location = $_FILES['full_file']['name'];
00325 
00326                                         // resize fullscreen images
00327                                         if ($_POST["full_size"] != "original" &&
00328                                                 $_POST["full_resize"] == "y" &&
00329                                                 is_int(strpos($format, "image")))
00330                                         {
00331                                                 $location = ilObjMediaObject::_resizeImage($file, $_POST["full_width"],
00332                                                         $_POST["full_height"]);
00333                                         }
00334                                 }
00335 
00336                                 $media_item->setFormat($format);
00337                                 $media_item->setLocation($location);
00338                                 $media_item->setLocationType("LocalFile");
00339 /*
00340                                 $meta_technical->addFormat($format);
00341                                 $meta_technical->setSize($meta_technical->getSize()
00342                                 + $_FILES['full_file']['size']);
00343                                 $meta_technical->addLocation("LocalFile", $location);
00344 */
00345 
00346                         }
00347                         else    // reference
00348                         {
00349                                 if ($_POST["full_reference"] != "")
00350                                 {
00351                                         $format = ilObjMediaObject::getMimeType($_POST["full_reference"]);
00352                                         $media_item->setFormat($format);
00353                                         $media_item->setLocation($_POST["full_reference"]);
00354                                         $media_item->setLocationType("Reference");
00355 /*
00356                                         $meta_technical->addFormat($format);
00357                                         $meta_technical->addLocation("Reference", $_POST["full_reference"]);
00358 */
00359                                 }
00360                         }
00361 
00362                         // determine width and height of known image types
00363                         if ($_POST["full_size"] == "original")
00364                         {
00365                                 if (ilUtil::deducibleSize($format))
00366                                 {
00367                                         $size = getimagesize($file);
00368                                         $media_item->setWidth($size[0]);
00369                                         $media_item->setHeight($size[1]);
00370                                 }
00371                                 else
00372                                 {
00373                                         $media_item->setWidth(500);
00374                                         $media_item->setHeight(400);
00375                                 }
00376                         }
00377                         else
00378                         {
00379                                 $media_item->setWidth($_POST["full_width"]);
00380                                 $media_item->setHeight($_POST["full_height"]);
00381                         }
00382 
00383                         if ($_POST["full_caption"] != "")
00384                         {
00385                                 $media_item->setCaption($_POST["full_caption"]);
00386                         }
00387 
00388                         if ($_POST["full_param"] != "")
00389                         {
00390                                 $media_item->setParameters(ilUtil::stripSlashes(utf8_decode($_POST["full_param"])));
00391                         }
00392 
00393                 }
00394 //echo "-".$mob_dir."-";
00395                 ilUtil::renameExecutables($mob_dir);
00396                 $this->object->update();
00397 
00398                 return $this->object;
00399 
00400         }
00401         
00402         function cancelObject()
00403         {
00404                 $this->ctrl->returnToParent($this);
00405         }
00406 
00410         function editObject()
00411         {
00412                 //add template for view button
00413                 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00414 
00415                 // standard item
00416                 $std_item =& $this->object->getMediaItem("Standard");
00417 
00418                 // edit media alias template
00419                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mob_properties.html", "Services/MediaObjects");
00420 
00421                 // deduce size button
00422                 if ($std_item->getLocationType() == "LocalFile" &&
00423                         ilUtil::deducibleSize($std_item->getFormat()))
00424                 {
00425                         $this->tpl->setCurrentBlock("get_size");
00426                         $this->tpl->setVariable("CMD_SIZE", "getStandardSize");
00427                         $this->tpl->setVariable("TXT_GET_SIZE", $this->lng->txt("cont_get_orig_size"));
00428                         $this->tpl->parseCurrentBlock();
00429                         //$this->tpl->setCurrentBlock("adm_content");
00430                 }
00431 
00432                 $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_edit_mob_properties"));
00433                 $this->tpl->setVariable("TXT_STANDARD_VIEW", $this->lng->txt("cont_std_view"));
00434 
00435                 $this->tpl->setVariable("TXT_FILE", $this->lng->txt("cont_LocalFile"));
00436                 $this->tpl->setVariable("TXT_REFERENCE", $this->lng->txt("cont_reference"));
00437                 $this->tpl->setVariable("TXT_REF_HELPTEXT", $this->lng->txt("cont_ref_helptext"));
00438                 if ($std_item->getLocationType() == "LocalFile")
00439                 {
00440                         $this->tpl->setVariable("FILE_CHECKED", "checked=\"1\"");
00441                         $this->tpl->setVariable("VAL_FILE", $std_item->getLocation());
00442                 }
00443                 else
00444                 {
00445                         $this->tpl->setVariable("REF_CHECKED", "checked=\"1\"");
00446                         $this->tpl->setVariable("VAL_REFERENCE", $std_item->getLocation());
00447                 }
00448 
00449                 $this->tpl->setVariable("TXT_FORMAT", $this->lng->txt("cont_format"));
00450                 $this->tpl->setVariable("VAL_FORMAT", $std_item->getFormat());
00451                 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00452 
00453                 // width
00454                 $this->tpl->setVariable("TXT_MOB_WIDTH", $this->lng->txt("cont_width"));
00455                 $this->tpl->setVariable("INPUT_MOB_WIDTH", "mob_width");
00456                 $this->tpl->setVariable("VAL_MOB_WIDTH", $std_item->getWidth());
00457 
00458                 // height
00459                 $this->tpl->setVariable("TXT_MOB_HEIGHT", $this->lng->txt("cont_height"));
00460                 $this->tpl->setVariable("INPUT_MOB_HEIGHT", "mob_height");
00461                 $this->tpl->setVariable("VAL_MOB_HEIGHT", $std_item->getHeight());
00462 
00463                 // output original size
00464                 if ($orig_size = $std_item->getOriginalSize())
00465                 {
00466                         $this->tpl->setCurrentBlock("orig_size");
00467                         $this->tpl->setVariable("TXT_ORIGINAL_SIZE", $this->lng->txt("cont_orig_size"));
00468                         $this->tpl->setVariable("VAL_ORIG_WIDTH", $orig_size["width"]);
00469                         $this->tpl->setVariable("VAL_ORIG_HEIGHT", $orig_size["height"]);
00470                         $this->tpl->parseCurrentBlock();
00471                 }
00472 
00473                 // caption
00474                 $this->tpl->setVariable("TXT_CAPTION", $this->lng->txt("cont_caption"));
00475                 $this->tpl->setVariable("INPUT_CAPTION", "mob_caption");
00476                 $this->tpl->setVariable("VAL_CAPTION", $std_item->getCaption());
00477                 //$this->tpl->parseCurrentBlock();
00478 
00479                 // parameters
00480                 $this->tpl->setVariable("TXT_PARAMETER", $this->lng->txt("cont_parameter"));
00481                 $this->tpl->setVariable("INPUT_PARAMETERS", "mob_parameters");
00482                 $this->tpl->setVariable("VAL_PARAMETERS", $std_item->getParameterString());
00483                 //$this->tpl->parseCurrentBlock();
00484 
00485                 // fullscreen view
00486                 if($this->object->hasFullScreenItem())
00487                 {
00488                         $full_item =& $this->object->getMediaItem("Fullscreen");
00489 
00490                         if ($full_item->getLocationType() == "LocalFile" &&
00491                                 ilUtil::deducibleSize($full_item->getFormat()))
00492                         {
00493                                 $this->tpl->setCurrentBlock("get_full_size");
00494                                 $this->tpl->setVariable("CMD_FULL_SIZE", "getFullscreenSize");
00495                                 $this->tpl->setVariable("TXT_GET_FULL_SIZE", $this->lng->txt("cont_get_orig_size"));
00496                                 $this->tpl->parseCurrentBlock();
00497                         }
00498 
00499                         $this->tpl->setCurrentBlock("fullscreen");
00500 
00501                         // edit media alias template
00502                         $this->tpl->setVariable("TXT_FULLSCREEN_VIEW", $this->lng->txt("cont_fullscreen"));
00503 
00504                         $this->tpl->setVariable("TXT_FULL_FILE", $this->lng->txt("cont_LocalFile"));
00505                         $this->tpl->setVariable("TXT_FULL_REFERENCE", $this->lng->txt("cont_reference"));
00506                         $this->tpl->setVariable("TXT_FULL_REF_HELPTEXT", $this->lng->txt("cont_ref_helptext"));
00507                         if ($full_item->getLocationType() == "LocalFile")
00508                         {
00509                                 $this->tpl->setVariable("FULL_FILE_CHECKED", "checked=\"1\"");
00510                                 $this->tpl->setVariable("VAL_FULL_FILE", $full_item->getLocation());
00511                         }
00512                         else
00513                         {
00514                                 $this->tpl->setVariable("FULL_REF_CHECKED", "checked=\"1\"");
00515                                 $this->tpl->setVariable("VAL_FULL_REFERENCE", $full_item->getLocation());
00516                         }
00517 
00518                         //$this->tpl->setVariable("TXT_FULL_TYPE", $this->lng->txt("cont_".$full_item->getLocationType()));
00519                         //$this->tpl->setVariable("TXT_FULL_LOCATION", $full_item->getLocation());
00520                         $this->tpl->setVariable("TXT_FULL_FORMAT", $this->lng->txt("cont_format"));
00521                         $this->tpl->setVariable("VAL_FULL_FORMAT", $full_item->getFormat());
00522 
00523                         // width
00524                         $this->tpl->setVariable("TXT_FULL_WIDTH", $this->lng->txt("cont_width"));
00525                         $this->tpl->setVariable("INPUT_FULL_WIDTH", "full_width");
00526                         $this->tpl->setVariable("VAL_FULL_WIDTH", $full_item->getWidth());
00527 
00528                         // height
00529                         $this->tpl->setVariable("TXT_FULL_HEIGHT", $this->lng->txt("cont_height"));
00530                         $this->tpl->setVariable("INPUT_FULL_HEIGHT", "full_height");
00531                         $this->tpl->setVariable("VAL_FULL_HEIGHT", $full_item->getHeight());
00532 
00533                         // output original size
00534                         if ($orig_size = $full_item->getOriginalSize())
00535                         {
00536                                 $this->tpl->setCurrentBlock("orig_full_size");
00537                                 $this->tpl->setVariable("TXT_ORIGINAL_SIZE", $this->lng->txt("cont_orig_size"));
00538                                 $this->tpl->setVariable("VAL_ORIG_WIDTH", $orig_size["width"]);
00539                                 $this->tpl->setVariable("VAL_ORIG_HEIGHT", $orig_size["height"]);
00540                                 $this->tpl->parseCurrentBlock();
00541                         }
00542 
00543                         // caption
00544                         $this->tpl->setVariable("TXT_FULL_CAPTION", $this->lng->txt("cont_caption"));
00545                         $this->tpl->setVariable("INPUT_FULL_CAPTION", "full_caption");
00546                         $this->tpl->setVariable("VAL_FULL_CAPTION", $full_item->getCaption());
00547 
00548                         // parameters
00549                         $this->tpl->setVariable("TXT_FULL_PARAMETER", $this->lng->txt("cont_parameter"));
00550                         $this->tpl->setVariable("INPUT_FULL_PARAMETERS", "full_parameters");
00551                         $this->tpl->setVariable("VAL_FULL_PARAMETERS", $full_item->getParameterString());
00552 
00553                         $this->tpl->parseCurrentBlock();
00554                 }
00555 
00556                 // operations
00557                 if($this->object->hasFullScreenItem())
00558                 {
00559                         $this->tpl->setCurrentBlock("remove_full");
00560                         $this->tpl->setVariable("CMD_REMOVE_FULL", "removeFullscreen");
00561                         $this->tpl->setVariable("TXT_REMOVE_FULL", $this->lng->txt("cont_remove_fullscreen"));
00562                         $this->tpl->parseCurrentBlock();
00563                 }
00564                 else
00565                 {
00566                         $this->tpl->setCurrentBlock("add_full");
00567                         $this->tpl->setVariable("CMD_ADD_FULL", "addFullscreen");
00568                         $this->tpl->setVariable("TXT_ADD_FULL", $this->lng->txt("cont_add_fullscreen"));
00569                         $this->tpl->parseCurrentBlock();
00570                 }
00571                 $this->tpl->setCurrentBlock("commands");
00572 
00573                 $this->tpl->setVariable("BTN_RESIZE", "resizeImages");
00574                 $this->tpl->setVariable("TXT_RESIZE", $this->lng->txt("cont_resize_image")." [*]");
00575                 $this->tpl->setVariable("BTN_NAME", "saveProperties");
00576                 $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
00577                 $this->tpl->parseCurrentBlock();
00578 
00579                 $this->tpl->setVariable("TXT_RESIZE_EXPLANATION",
00580                         $this->lng->txt("cont_resize_explanation2"));
00581         }
00582 
00583 
00587         function resizeImagesObject()
00588         {
00589                 // directory
00590                 $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
00591 
00592                 // standard item
00593                 $std_item =& $this->object->getMediaItem("Standard");
00594                 if ($std_item->getLocationType() == "LocalFile" &&
00595                         is_int(strpos($std_item->getFormat(), "image"))
00596                         )
00597                 {
00598                         $file = $mob_dir."/".$std_item->getLocation();
00599                         $location = ilObjMediaObject::_resizeImage($file, $std_item->getWidth(),
00600                                 $std_item->getHeight());
00601                         $std_item->setLocation($location);
00602                         $std_item->update();
00603                 }
00604 
00605                 // fullscreen item
00606                 if($this->object->hasFullScreenItem())
00607                 {
00608                         $full_item =& $this->object->getMediaItem("Fullscreen");
00609                         if ($full_item->getLocationType() == "LocalFile" &&
00610                                 is_int(strpos($full_item->getFormat(), "image"))
00611                                 )
00612                         {
00613                                 $file = $mob_dir."/".$full_item->getLocation();
00614                                 $location = ilObjMediaObject::_resizeImage($file, $full_item->getWidth(),
00615                                         $full_item->getHeight());
00616                                 $full_item->setLocation($location);
00617                                 $full_item->update();
00618                         }
00619                 }
00620 
00621                 $this->ctrl->redirect($this, "edit");
00622         }
00623 
00624 
00628         function getStandardSizeObject()
00629         {
00630                 $std_item =& $this->object->getMediaItem("Standard");
00631                 $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
00632 
00633                 if ($std_item->getLocationType() == "LocalFile")
00634                 {
00635                         $file = $mob_dir."/".$std_item->getLocation();
00636                         $size = getimagesize($file);
00637                         $std_item->setWidth($size[0]);
00638                         $std_item->setHeight($size[1]);
00639                         $this->object->update();
00640                 }
00641                 $this->ctrl->redirect($this, "edit");
00642         }
00643 
00644 
00648         function getFullscreenSizeObject()
00649         {
00650                 $full_item =& $this->object->getMediaItem("Fullscreen");
00651                 $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
00652 
00653                 if ($full_item->getLocationType() == "LocalFile")
00654                 {
00655                         $file = $mob_dir."/".$full_item->getLocation();
00656                         $size = getimagesize($file);
00657                         $full_item->setWidth($size[0]);
00658                         $full_item->setHeight($size[1]);
00659                         $this->object->update();
00660                 }
00661                 $this->ctrl->redirect($this, "edit");
00662         }
00663 
00667         function savePropertiesObject()
00668         {
00669                 $std_item =& $this->object->getMediaItem("Standard");
00670                 if ($_POST["standard_type"] == "Reference")
00671                 {
00672                         $std_item->setLocationType("Reference");
00673                         $std_item->setFormat(ilObjMediaObject::getMimeType($_POST["standard_reference"]));
00674                         $std_item->setLocation($_POST["standard_reference"]);
00675                 }
00676                 if ($_POST["standard_type"] == "LocalFile")
00677                 {
00678                         if ($_FILES['standard_file']['name'] != "")
00679                         {
00680                                 $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
00681                                 $file = $mob_dir."/".$_FILES['standard_file']['name'];
00682                                 //move_uploaded_file($_FILES['standard_file']['tmp_name'], $file);
00683                                 ilUtil::moveUploadedFile($_FILES['standard_file']['tmp_name'],
00684                                         $_FILES['standard_file']['name'], $file);
00685 
00686                                 $format = ilObjMediaObject::getMimeType($file);
00687                                 $std_item->setFormat($format);
00688                                 $std_item->setLocation($_FILES['standard_file']['name']);
00689                         }
00690                         $std_item->setLocationType("LocalFile");
00691                 }
00692                 $std_item->setWidth($_POST["mob_width"]);
00693                 $std_item->setHeight($_POST["mob_height"]);
00694                 $std_item->setCaption($_POST["mob_caption"]);
00695                 $std_item->setParameters(ilUtil::stripSlashes(utf8_decode($_POST["mob_parameters"])));
00696 
00697                 if($this->object->hasFullscreenItem())
00698                 {
00699                         $full_item =& $this->object->getMediaItem("Fullscreen");
00700                         if ($_POST["full_type"] == "Reference")
00701                         {
00702                                 $full_item->setLocationType("Reference");
00703                                 $full_item->setFormat(ilObjMediaObject::getMimeType($_POST["full_reference"]));
00704                                 $full_item->setLocation($_POST["full_reference"]);
00705                         }
00706                         if ($_POST["full_type"] == "LocalFile")
00707                         {
00708                                 if ($_FILES['full_file']['name'] != "")
00709                                 {
00710                                         $mob_dir = ilObjMediaObject::_getDirectory($this->object->getId());
00711                                         $file = $mob_dir."/".$_FILES['full_file']['name'];
00712                                         //move_uploaded_file($_FILES['full_file']['tmp_name'], $file);
00713                                         ilUtil::moveUploadedFile($_FILES['full_file']['tmp_name'],
00714                                                 $_FILES['full_file']['name'], $file);
00715 
00716                                         $format = ilObjMediaObject::getMimeType($file);
00717                                         $full_item->setFormat($format);
00718                                         $full_item->setLocation($_FILES['full_file']['name']);
00719                                 }
00720                                 $full_item->setLocationType("LocalFile");
00721                         }
00722                         $full_item->setWidth($_POST["full_width"]);
00723                         $full_item->setHeight($_POST["full_height"]);
00724                         $full_item->setCaption($_POST["full_caption"]);
00725                         $full_item->setParameters(ilUtil::stripSlashes(utf8_decode($_POST["full_parameters"])));
00726                 }
00727 
00728                 $this->object->update();
00729 
00730                 $this->ctrl->redirect($this, "edit");
00731         }
00732 
00733 
00737         function editFilesObject()
00738         {
00739                 // standard item
00740                 $std_item =& $this->object->getMediaItem("Standard");
00741                 if($this->object->hasFullscreenItem())
00742                 {
00743                         $full_item =& $this->object->getMediaItem("Fullscreen");
00744                 }
00745 
00746                 // create table
00747                 require_once("./Services/Table/classes/class.ilTableGUI.php");
00748                 $tbl = new ilTableGUI();
00749 
00750                 // determine directory
00751                 $cur_subdir = $_GET["cdir"];
00752                 if($_GET["newdir"] == "..")
00753                 {
00754                         $cur_subdir = substr($cur_subdir, 0, strrpos($cur_subdir, "/"));
00755                 }
00756                 else
00757                 {
00758                         if (!empty($_GET["newdir"]))
00759                         {
00760                                 if (!empty($cur_subdir))
00761                                 {
00762                                         $cur_subdir = $cur_subdir."/".$_GET["newdir"];
00763                                 }
00764                                 else
00765                                 {
00766                                         $cur_subdir = $_GET["newdir"];
00767                                 }
00768                         }
00769                 }
00770 
00771                 $cur_subdir = str_replace(".", "", $cur_subdir);
00772                 $mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$this->object->getId();
00773                 $cur_dir = (!empty($cur_subdir))
00774                         ? $mob_dir."/".$cur_subdir
00775                         : $mob_dir;
00776 
00777                 // load files templates
00778                 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.mob_files.html", "Services/MediaObjects");
00779 
00780                 //$this->tpl->setVariable("FORMACTION1", "lm_edit.php?ref_id=".$_GET["ref_id"]."&obj_id=".$_GET["obj_id"].
00781                 //      "&hier_id=".$_GET["hier_id"]."&cdir=".$cur_subdir."&cmd=post");
00782 
00783                 $this->ctrl->setParameter($this, "cdir", urlencode($cur_subdir));
00784                 $this->tpl->setVariable("FORMACTION1", $this->ctrl->getFormAction($this));
00785 //echo "--".$this->getTargetScript().
00786                         //"&hier_id=".$_GET["hier_id"]."&cdir=".$cur_subdir."&cmd=post"."--<br>";
00787                 $this->tpl->setVariable("TXT_NEW_DIRECTORY", $this->lng->txt("cont_new_dir"));
00788                 $this->tpl->setVariable("TXT_NEW_FILE", $this->lng->txt("cont_new_file"));
00789                 $this->tpl->setVariable("CMD_NEW_DIR", "createDirectory");
00790                 $this->tpl->setVariable("CMD_NEW_FILE", "uploadFile");
00791                 $this->tpl->setVariable("BTN_NEW_DIR", $this->lng->txt("create"));
00792                 $this->tpl->setVariable("BTN_NEW_FILE", $this->lng->txt("upload"));
00793 
00794                 //
00795                 $this->tpl->addBlockfile("FILE_TABLE", "files", "tpl.table.html");
00796 
00797                 // load template for table content data
00798                 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.mob_file_row.html", "Services/MediaObjects");
00799 
00800                 $num = 0;
00801 
00802                 $obj_str = ($this->call_by_reference) ? "" : "&obj_id=".$this->obj_id;
00803                 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00804 
00805                 $tbl->setTitle($this->lng->txt("cont_files")." ".$cur_subdir);
00806                 //$tbl->setHelp("tbl_help.php","icon_help.gif",$this->lng->txt("help"));
00807 
00808                 $tbl->setHeaderNames(array("", "", $this->lng->txt("cont_dir_file"),
00809                         $this->lng->txt("cont_size"), $this->lng->txt("cont_purpose")));
00810 
00811                 $cols = array("", "", "dir_file", "size", "purpose");
00812                 $header_params = array("ref_id" => $_GET["ref_id"], "obj_id" => $_GET["obj_id"],
00813                         "cmd" => "editFiles", "hier_id" => $_GET["hier_id"]);
00814                 $tbl->setHeaderVars($cols, $header_params);
00815                 $tbl->setColumnWidth(array("1%", "1%", "33%", "33%", "32%"));
00816 
00817                 // control
00818                 $tbl->setOrderColumn($_GET["sort_by"]);
00819                 $tbl->setOrderDirection($_GET["sort_order"]);
00820                 $tbl->setLimit($_GET["limit"]);
00821                 $tbl->setOffset($_GET["offset"]);
00822                 $tbl->setMaxCount($this->maxcount);             // ???
00823                 //$tbl->setMaxCount(30);                // ???
00824 
00825                 $this->tpl->setVariable("COLUMN_COUNTS", 5);
00826 
00827                 // delete button
00828                 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
00829                 $this->tpl->setCurrentBlock("tbl_action_btn");
00830                 $this->tpl->setVariable("BTN_NAME", "deleteFile");
00831                 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete"));
00832                 $this->tpl->parseCurrentBlock();
00833 
00834                 $this->tpl->setCurrentBlock("tbl_action_btn");
00835                 $this->tpl->setVariable("BTN_NAME", "assignStandard");
00836                 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("cont_assign_std"));
00837                 $this->tpl->parseCurrentBlock();
00838 
00839                 $this->tpl->setCurrentBlock("tbl_action_btn");
00840                 $this->tpl->setVariable("BTN_NAME", "assignFullscreen");
00841                 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("cont_assign_full"));
00842                 $this->tpl->parseCurrentBlock();
00843 
00844                 // footer
00845                 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00846                 //$tbl->disable("footer");
00847 
00848                 $entries = ilUtil::getDir($cur_dir);
00849 
00850                 //$objs = ilUtil::sortArray($objs, $_GET["sort_by"], $_GET["sort_order"]);
00851                 $tbl->setMaxCount(count($entries));
00852                 $entries = array_slice($entries, $_GET["offset"], $_GET["limit"]);
00853 
00854                 $tbl->render();
00855                 if(count($entries) > 0)
00856                 {
00857                         $i=0;
00858                         foreach($entries as $entry)
00859                         {
00860                                 if(($entry["entry"] == ".") || ($entry["entry"] == ".." && empty($cur_subdir)))
00861                                 {
00862                                         continue;
00863                                 }
00864 
00865                                 //$this->tpl->setVariable("ICON", $obj["title"]);
00866                                 if($entry["type"] == "dir")
00867                                 {
00868                                         $this->tpl->setCurrentBlock("FileLink");
00869                                         $this->ctrl->setParameter($this, "cdir", $cur_subdir);
00870                                         $this->ctrl->setParameter($this, "newdir", rawurlencode($entry["entry"]));
00871                                         $this->tpl->setVariable("LINK_FILENAME", $this->ctrl->getLinkTarget($this, "editFiles"));
00872                                         $this->tpl->setVariable("TXT_FILENAME", $entry["entry"]);
00873                                         $this->tpl->parseCurrentBlock();
00874 
00875                                         $this->tpl->setVariable("ICON", "<img src=\"".
00876                                                 ilUtil::getImagePath("icon_cat.gif")."\">");
00877                                 }
00878                                 else
00879                                 {
00880                                         $this->tpl->setCurrentBlock("File");
00881                                         $this->tpl->setVariable("TXT_FILENAME2", $entry["entry"]);
00882                                         $this->tpl->parseCurrentBlock();
00883                                 }
00884 
00885                                 $this->tpl->setCurrentBlock("tbl_content");
00886                                 $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
00887                                 $this->tpl->setVariable("CSS_ROW", $css_row);
00888 
00889                                 $this->tpl->setVariable("TXT_SIZE", $entry["size"]);
00890                                 $this->tpl->setVariable("CHECKBOX_ID", $entry["entry"]);
00891                                 $compare = (!empty($cur_subdir))
00892                                         ? $cur_subdir."/".$entry["entry"]
00893                                         : $entry["entry"];
00894                                 $purpose = array();
00895                                 if ($std_item->getLocation() == $compare)
00896                                 {
00897                                         $purpose[] = $this->lng->txt("cont_std_view");
00898                                 }
00899                                 if($this->object->hasFullscreenItem())
00900                                 {
00901                                         if ($full_item->getLocation() == $compare)
00902                                         {
00903                                                 $purpose[] = $this->lng->txt("cont_fullscreen");
00904                                         }
00905                                 }
00906                                 $this->tpl->setVariable("TXT_PURPOSE", implode($purpose, ", "));
00907 
00908                                 $this->tpl->parseCurrentBlock();
00909                         }
00910                 } //if is_array
00911                 else
00912                 {
00913                         $this->tpl->setCurrentBlock("notfound");
00914                         $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
00915                         $this->tpl->setVariable("NUM_COLS", 4);
00916                         $this->tpl->parseCurrentBlock();
00917                 }
00918 
00919                 $this->tpl->parseCurrentBlock();
00920         }
00921 
00922 
00926         function createDirectoryObject()
00927         {
00928 //echo "cdir:".$_GET["cdir"].":<br>";
00929                 // determine directory
00930                 $cur_subdir = str_replace(".", "", $_GET["cdir"]);
00931                 $mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$this->object->getId();
00932                 $cur_dir = (!empty($cur_subdir))
00933                         ? $mob_dir."/".$cur_subdir
00934                         : $mob_dir;
00935 
00936                 $new_dir = str_replace(".", "", $_POST["new_dir"]);
00937                 $new_dir = str_replace("/", "", $new_dir);
00938 
00939                 if (!empty($new_dir))
00940                 {
00941                         ilUtil::makeDir($cur_dir."/".$new_dir);
00942                 }
00943                 $this->ctrl->saveParameter($this, "cdir");
00944                 $this->ctrl->redirect($this, "editFiles");
00945         }
00946 
00950         function uploadFileObject()
00951         {
00952                 // determine directory
00953                 $cur_subdir = str_replace(".", "", $_GET["cdir"]);
00954                 $mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$this->object->getId();
00955                 $cur_dir = (!empty($cur_subdir))
00956                         ? $mob_dir."/".$cur_subdir
00957                         : $mob_dir;
00958                 if (is_file($_FILES["new_file"]["tmp_name"]))
00959                 {
00960                         //move_uploaded_file($_FILES["new_file"]["tmp_name"],
00961                                 //$cur_dir."/".$_FILES["new_file"]["name"]);
00962                         $file = $cur_dir."/".$_FILES["new_file"]["name"];
00963                         ilUtil::moveUploadedFile($_FILES['new_file']['tmp_name'],
00964                                 $_FILES['new_file']['name'], $file);
00965 
00966                 }
00967                 ilUtil::renameExecutables($mob_dir);
00968                 $this->ctrl->saveParameter($this, "cdir");
00969                 $this->ctrl->redirect($this, "editFiles");
00970         }
00971 
00975         function assignStandardObject()
00976         {
00977                 if (!isset($_POST["file"]))
00978                 {
00979                         $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00980                 }
00981 
00982                 if (count($_POST["file"]) > 1)
00983                 {
00984                         $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
00985                 }
00986 
00987                 // determine directory
00988                 $cur_subdir = str_replace(".", "", $_GET["cdir"]);
00989                 $mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$this->object->getId();
00990                 $cur_dir = (!empty($cur_subdir))
00991                         ? $mob_dir."/".$cur_subdir
00992                         : $mob_dir;
00993                 $file = $cur_dir."/".$_POST["file"][0];
00994                 $location = (!empty($cur_subdir))
00995                         ? $cur_subdir."/".$_POST["file"][0]
00996                         : $_POST["file"][0];
00997 
00998                 if(!is_file($file))
00999                 {
01000                         $this->ilias->raiseError($this->lng->txt("cont_select_file"),$this->ilias->error_obj->MESSAGE);
01001                 }
01002 
01003                 $std_item =& $this->object->getMediaItem("Standard");
01004                 $std_item->setLocationType("LocalFile");
01005                 $std_item->setLocation($location);
01006                 $format = ilObjMediaObject::getMimeType($file);
01007                 $std_item->setFormat($format);
01008                 $this->object->update();
01009                 $this->ctrl->saveParameter($this, "cdir");
01010                 $this->ctrl->redirect($this, "editFiles");
01011 
01012                 $this->ctrl->saveParameter($this, "cdir");
01013                 $this->ctrl->redirect($this, "editFiles");
01014         }
01015 
01016 
01020         function assignFullscreenObject()
01021         {
01022                 if (!isset($_POST["file"]))
01023                 {
01024                         $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
01025                 }
01026 
01027                 if (count($_POST["file"]) > 1)
01028                 {
01029                         $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
01030                 }
01031 
01032                 // determine directory
01033                 $cur_subdir = str_replace(".", "", $_GET["cdir"]);
01034                 $mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$this->object->getId();
01035                 $cur_dir = (!empty($cur_subdir))
01036                         ? $mob_dir."/".$cur_subdir
01037                         : $mob_dir;
01038                 $file = $cur_dir."/".$_POST["file"][0];
01039                 $location = (!empty($cur_subdir))
01040                         ? $cur_subdir."/".$_POST["file"][0]
01041                         : $_POST["file"][0];
01042 
01043                 if(!is_file($file))
01044                 {
01045                         $this->ilias->raiseError($this->lng->txt("cont_select_file"),$this->ilias->error_obj->MESSAGE);
01046                 }
01047 
01048                 if(!$this->object->hasFullScreenItem())
01049                 {       // create new fullscreen item
01050                         $std_item =& $this->object->getMediaItem("Standard");
01051                         $mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$this->object->getId();
01052                         $file = $mob_dir."/".$location;
01053                         $full_item =& new ilMediaItem();
01054                         $full_item->setMobId($std_item->getMobId());
01055                         $full_item->setLocation($location);
01056                         $full_item->setLocationType("LocalFile");
01057                         $full_item->setFormat(ilObjMediaObject::getMimeType($file));
01058                         $full_item->setPurpose("Fullscreen");
01059                         $this->object->addMediaItem($full_item);
01060                 }
01061                 else    // alter existing fullscreen item
01062                 {
01063                         $full_item =& $this->object->getMediaItem("Fullscreen");
01064 
01065                         $full_item->setLocationType("LocalFile");
01066                         $full_item->setLocation($location);
01067                         $format = ilObjMediaObject::getMimeType($file);
01068                         $full_item->setFormat($format);
01069                 }
01070                 $this->object->update();
01071                 $this->ctrl->saveParameter($this, "cdir");
01072                 $this->ctrl->redirect($this, "editFiles");
01073         }
01074 
01075 
01079         function removeFullscreenObject()
01080         {
01081                 $this->object->removeMediaItem("Fullscreen");
01082                 $this->object->update();
01083 
01084                 $this->ctrl->redirect($this, "edit");
01085         }
01086 
01087 
01091         function addFullscreenObject()
01092         {
01093                 if (!$this->object->hasFullScreenItem())
01094                 {
01095                         $std_item =& $this->object->getMediaItem("Standard");
01096                         $full_item =& new ilMediaItem();
01097                         $full_item->setMobId($std_item->getMobId());
01098                         $full_item->setLocation($std_item->getLocation());
01099                         $full_item->setLocationType($std_item->getLocationType());
01100                         $full_item->setFormat($std_item->getFormat());
01101                         $full_item->setWidth($std_item->getWidth());
01102                         $full_item->setHeight($std_item->getHeight());
01103                         $full_item->setCaption($std_item->getCaption());
01104                         $full_item->setPurpose("Fullscreen");
01105                         $this->object->addMediaItem($full_item);
01106 
01107                         $this->object->update();
01108                 }
01109 
01110                 $this->ctrl->redirect($this, "edit");
01111         }
01112 
01113 
01117         function deleteFileObject()
01118         {
01119                 if (!isset($_POST["file"]))
01120                 {
01121                         $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
01122                 }
01123 
01124                 if (count($_POST["file"]) > 1)
01125                 {
01126                         $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
01127                 }
01128 
01129                 if ($_POST["file"][0] == "..")
01130                 {
01131                         $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
01132                 }
01133 
01134                 $cur_subdir = str_replace(".", "", $_GET["cdir"]);
01135                 $mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$this->object->getId();
01136                 $cur_dir = (!empty($cur_subdir))
01137                         ? $mob_dir."/".$cur_subdir
01138                         : $mob_dir;
01139                 $file = $cur_dir."/".$_POST["file"][0];
01140                 $location = (!empty($cur_subdir))
01141                         ? $cur_subdir."/".$_POST["file"][0]
01142                         : $_POST["file"][0];
01143 
01144                 $full_item =& $this->object->getMediaItem("Fullscreen");
01145                 $std_item =& $this->object->getMediaItem("Standard");
01146 
01147                 if ($location == $std_item->getLocation())
01148                 {
01149                         $this->ilias->raiseError($this->lng->txt("cont_cant_del_std"),$this->ilias->error_obj->MESSAGE);
01150                 }
01151 
01152                 if($this->object->hasFullScreenItem())
01153                 {
01154                         if ($location == $full_item->getLocation())
01155                         {
01156                                 $this->ilias->raiseError($this->lng->txt("cont_cant_del_full"),$this->ilias->error_obj->MESSAGE);
01157                         }
01158                 }
01159 
01160                 if (@is_dir($file))
01161                 {
01162                         if (substr($std_item->getLocation(), 0 ,strlen($location)) == $location)
01163                         {
01164                                 $this->ilias->raiseError($this->lng->txt("cont_std_is_in_dir"),$this->ilias->error_obj->MESSAGE);
01165                         }
01166 
01167                         if($this->object->hasFullScreenItem())
01168                         {
01169                                 if (substr($full_item->getLocation(), 0 ,strlen($location)) == $location)
01170                                 {
01171                                         $this->ilias->raiseError($this->lng->txt("cont_full_is_in_dir"),$this->ilias->error_obj->MESSAGE);
01172                                 }
01173                         }
01174                 }
01175 
01176                 if (@is_file($file))
01177                 {
01178                         unlink($file);
01179                 }
01180 
01181                 if (@is_dir($file))
01182                 {
01183                         ilUtil::delDir($file);
01184                 }
01185 
01186                 $this->ctrl->saveParameter($this, "cdir");
01187                 $this->ctrl->redirect($this, "editFiles");
01188         }
01189 
01190 
01194         function showUsagesObject()
01195         {
01196                 // create table
01197                 require_once("./Services/Table/classes/class.ilTableGUI.php");
01198                 $tbl = new ilTableGUI();
01199 
01200                 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
01201 
01202                 // load template for table content data
01203                 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.mob_usage_row.html", "Services/MediaObjects");
01204 
01205                 $num = 0;
01206 
01207                 $tbl->setTitle($this->lng->txt("cont_mob_usages"));
01208                 //$tbl->setHelp("tbl_help.php","icon_help.gif",$this->lng->txt("help"));
01209 
01210                 //$tbl->setHeaderNames(array($this->lng->txt("container")));
01211                 $tbl->disable("header");
01212 
01213                 $cols = array("object");
01214                 $header_params = array("ref_id" => $_GET["ref_id"], "obj_id" => $_GET["obj_id"],
01215                         "cmd" => "showUsages", "hier_id" => $_GET["hier_id"], "cmdClass" => "ilObjMediaObjectGUI");
01216                 $tbl->setHeaderVars($cols, $header_params);
01217                 //$tbl->setColumnWidth(array("1%", "1%", "33%", "33%", "32%"));
01218 
01219                 // control
01220                 $tbl->setOrderColumn($_GET["sort_by"]);
01221                 $tbl->setOrderDirection($_GET["sort_order"]);
01222                 $tbl->setLimit($_GET["limit"]);
01223                 $tbl->setOffset($_GET["offset"]);
01224                 $tbl->setMaxCount($this->maxcount);             // ???
01225                 //$tbl->setMaxCount(30);                // ???
01226 
01227                 //$this->tpl->setVariable("COLUMN_COUNTS", 2);
01228 
01229                 // footer
01230                 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
01231                 //$tbl->disable("footer");
01232 
01233                 //$entries = ilUtil::getDir($cur_dir);
01234                 $usages = $this->object->getUsages();
01235 
01236                 //$objs = ilUtil::sortArray($objs, $_GET["sort_by"], $_GET["sort_order"]);
01237                 $tbl->setMaxCount(count($usages));
01238                 $usages = array_slice($usages, $_GET["offset"], $_GET["limit"]);
01239 
01240                 $tbl->render();
01241                 if(count($usages) > 0)
01242                 {
01243                         $i=0;
01244                         $clip_cnt = 0;
01245                         foreach($usages as $usage)
01246                         {
01247                                 if ($usage["type"] == "clip")
01248                                 {
01249                                         $clip_cnt++;
01250                                         continue;
01251                                 }
01252 
01253                                 $this->tpl->setCurrentBlock("tbl_content");
01254 
01255                                 // set color
01256                                 $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
01257                                 $this->tpl->setVariable("CSS_ROW", $css_row);
01258 
01259                                 if(is_int(strpos($usage["type"], ":")))
01260                                 {
01261                                         $us_arr = explode(":", $usage["type"]);
01262                                         $usage["type"] = $us_arr[1];
01263                                         $cont_type = $us_arr[0];
01264                                 }
01265 
01266                                 switch($usage["type"])
01267                                 {
01268                                         case "pg":
01269 
01270                                                 require_once("./Services/COPage/classes/class.ilPageObject.php");
01271                                                 $page_obj = new ilPageObject($cont_type, $usage["id"]);
01272 
01273                                                 //$this->tpl->setVariable("TXT_OBJECT", $usage["type"].":".$usage["id"]);
01274                                                 switch ($cont_type)
01275                                                 {
01276                                                         case "lm":
01277                                                                 require_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
01278                                                                 require_once("./Modules/LearningModule/classes/class.ilObjLearningModule.php");
01279                                                                 require_once("./Modules/LearningModule/classes/class.ilLMObject.php");
01280                                                                 $lm_obj =& new ilObjLearningModule($page_obj->getParentId(), false);
01281                                                                 $this->tpl->setVariable("TXT_OBJECT", $this->lng->txt("obj_".$cont_type).
01282                                                                         ": ".$lm_obj->getTitle().", ".$this->lng->txt("page").": ".
01283                                                                         ilLMObject::_lookupTitle($page_obj->getId()));
01284                                                                 break;
01285                                                         case "dbk":
01286                                                                 require_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
01287                                                                 require_once("./Modules/LearningModule/classes/class.ilLMObject.php");
01288                                                                 require_once("./Modules/LearningModule/classes/class.ilObjDlBook.php");
01289                                                                 $lm_obj =& new ilObjDlBook($page_obj->getParentId(), false);
01290                                                                 $this->tpl->setVariable("TXT_OBJECT", $this->lng->txt("obj_".$cont_type).
01291                                                                         ": ".$lm_obj->getTitle().", ".$this->lng->txt("page").": ".
01292                                                                         ilLMObject::_lookupTitle($page_obj->getId()));
01293                                                                 break;
01294                                                 }
01295                                                 break;
01296 
01297                                         case "mep":
01298                                                 $this->tpl->setVariable("TXT_OBJECT", $this->lng->txt("obj_mep").
01299                                                         ": ".ilObject::_lookupTitle($usage["id"]));
01300                                                 break;
01301 
01302                                         case "map":
01303                                                 $this->tpl->setVariable("TXT_OBJECT", $this->lng->txt("obj_mob").
01304                                                         " (".$this->lng->txt("cont_link_area")."): ".
01305                                                         ilObject::_lookupTitle($usage["id"]));
01306                                                 break;
01307 
01308                                 }
01309                                 // set usage link / text
01310                                 //$this->tpl->setVariable("TXT_OBJECT", $usage["type"].":".$usage["id"]);
01311                                 $this->tpl->setVariable("TXT_CONTEXT", "-");
01312 
01313                                 $this->tpl->parseCurrentBlock();
01314                         }
01315 
01316                         // usages in clipboards
01317                         if ($clip_cnt > 0)
01318                         {
01319                                 $this->tpl->setCurrentBlock("tbl_content");
01320 
01321                                 // set color
01322                                 $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
01323                                 $this->tpl->setVariable("CSS_ROW", $css_row);
01324                                 $this->tpl->setVariable("TXT_OBJECT", $this->lng->txt("cont_users_have_mob_in_clip1").
01325                                         " ".$clip_cnt." ".$this->lng->txt("cont_users_have_mob_in_clip2"));
01326                                 $this->tpl->setVariable("TXT_CONTEXT", "-");
01327 
01328                                 $this->tpl->parseCurrentBlock();
01329 
01330                         }
01331 
01332 
01333                 } //if is_array
01334                 else
01335                 {
01336                         $this->tpl->setCurrentBlock("notfound");
01337                         $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
01338                         $this->tpl->setVariable("NUM_COLS", 4);
01339                         $this->tpl->parseCurrentBlock();
01340                 }
01341 
01342                 $this->tpl->parseCurrentBlock();
01343         }
01344 
01345 
01349         function editMapAreasObject()
01350         {
01351                 $_SESSION["il_map_edit_target_script"] = $this->ctrl->getLinkTarget($this, "addArea");
01352 
01353                 //$this->initMapParameters();
01354                 $this->handleMapParameters();
01355 
01356                 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.map_edit.html", "Services/MediaObjects");
01357 
01358                 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
01359 
01360                 $this->tpl->setVariable("TXT_IMAGEMAP", $this->lng->txt("cont_imagemap"));
01361 
01362                 // create/update imagemap work copy
01363                 $st_item =& $this->object->getMediaItem("Standard");
01364                 $st_item->makeMapWorkCopy();
01365 
01366                 // output image map
01367                 $xml = "<dummy>";
01368                 $xml.= $this->object->getXML(IL_MODE_ALIAS);
01369                 $xml.= $this->object->getXML(IL_MODE_OUTPUT);
01370                 $xml.="</dummy>";
01371 //echo "xml:".htmlentities($xml).":<br>";
01372                 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
01373                 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
01374                 $xh = xslt_create();
01375                 $wb_path = ilUtil::getWebspaceDir("output");
01376                 $mode = "media";
01377                 $params = array ('map_item' => $st_item->getId(),
01378                         'mode' => $mode,
01379                         'link_params' => "ref_id=".$_GET["ref_id"]."&rand=".rand(1,999999),
01380                         'ref_id' => $_GET["ref_id"],
01381                         'pg_frame' => "",
01382                         'image_map_link' => $this->ctrl->getLinkTarget($this, "showImageMap"),
01383                         'webspace_path' => $wb_path);
01384                 $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
01385 //echo "<br>html:".htmlentities($output).":<br>";
01386                 echo xslt_error($xh);
01387                 xslt_free($xh);
01388                 $this->tpl->setVariable("IMAGE_MAP", $output);
01389 
01390                 $this->tpl->setCurrentBlock("area_table");
01391 
01392                 // output area table header
01393                 $this->tpl->setVariable("TXT_NAME", $this->lng->txt("cont_name"));
01394                 $this->tpl->setVariable("TXT_SHAPE", $this->lng->txt("cont_shape"));
01395                 $this->tpl->setVariable("TXT_COORDS", $this->lng->txt("cont_coords"));
01396                 $this->tpl->setVariable("TXT_LINK", $this->lng->txt("cont_link"));
01397 
01398                 // output command line
01399                 $this->tpl->setCurrentBlock("commands");
01400                 $sel_arr = array("Rect" => $this->lng->txt("cont_Rect"),
01401                         "Circle" => $this->lng->txt("cont_Circle"),
01402                         "Poly" => $this->lng->txt("cont_Poly"));
01403                 $sel_str = ilUtil::formSelect("", "areatype", $sel_arr, false, true);
01404                 $sel_str2 = ilUtil::formSelect("", "areatype2", $sel_arr, false, true);
01405                 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
01406                 $this->tpl->setVariable("BTN_DELETE", "deleteAreas");
01407                 $this->tpl->setVariable("TXT_DELETE", $this->lng->txt("delete"));
01408                 $this->tpl->setVariable("SELECT_TYPE", $sel_str);
01409                 $this->tpl->setVariable("SELECT_TYPE2", $sel_str2);
01410                 $this->tpl->setVariable("BTN_UPDATE", "updateAreas");
01411                 $this->tpl->setVariable("TXT_UPDATE", $this->lng->txt("cont_update_names"));
01412                 $this->tpl->setVariable("BTN_ADD_AREA", "newArea");
01413                 $this->tpl->setVariable("TXT_ADD_AREA", $this->lng->txt("cont_add_area"));
01414                 $this->tpl->setVariable("BTN_SET_LINK", "editLink");
01415                 $this->tpl->setVariable("TXT_SET_LINK", $this->lng->txt("cont_set_link"));
01416                 $this->tpl->setVariable("BTN_SET_SHAPE", "editShape");
01417                 $this->tpl->setVariable("TXT_SET_SHAPE", $this->lng->txt("cont_set_shape"));
01418                 $this->tpl->parseCurrentBlock();
01419 
01420                 // output area data
01421                 $st_item =& $this->object->getMediaItem("Standard");
01422                 $max = ilMapArea::_getMaxNr($st_item->getId());
01423                 for ($i=1; $i<=$max; $i++)
01424                 {
01425                         $this->tpl->setCurrentBlock("area_row");
01426 
01427                         $css_row = ilUtil::switchColor($i, "tblrow1", "tblrow2");
01428                         $this->tpl->setVariable("CSS_ROW", $css_row);
01429 
01430                         $area =& new ilMapArea($st_item->getId(), $i);
01431                         $this->tpl->setVariable("CHECKBOX",
01432                                 ilUtil::formCheckBox("", "area[]", $i));
01433                         $this->tpl->setVariable("VAR_NAME", "name_".$i);
01434                         $this->tpl->setVariable("VAL_NAME", $area->getTitle());
01435                         $this->tpl->setVariable("VAL_SHAPE", $area->getShape());
01436                         $this->tpl->setVariable("VAL_COORDS",
01437                                 implode(explode(",", $area->getCoords()), ", "));
01438                         switch ($area->getLinkType())
01439                         {
01440                                 case "ext":
01441                                         $this->tpl->setVariable("VAL_LINK", $area->getHRef());
01442                                         break;
01443 
01444                                 case "int":
01445                                         $link_str = $this->getMapAreaLinkString($area->getTarget(),
01446                                                 $area->getType(), $area->getTargetFrame());
01447                                         $this->tpl->setVariable("VAL_LINK", $link_str);
01448                                         break;
01449                         }
01450                         $this->tpl->parseCurrentBlock();
01451                 }
01452 
01453                 $this->tpl->parseCurrentBlock();
01454         }
01455         
01459         function showImageMapObject()
01460         {
01461                 $item =& new ilMediaItem($_GET["item_id"]);
01462                 $item->outputMapWorkCopy();
01463         }
01464 
01465 
01466 
01470         function handleMapParameters()
01471         {
01472                 /*if($_POST["areatype"] != "")
01473                 {
01474                         $_SESSION["il_map_edit_area_type"] = $_POST["areatype"];
01475                 }*/
01476 //echo "AT:".$_SESSION["il_map_edit_area_type"].":";
01477                 /*if($_GET["areatype"] != "")
01478                 {
01479                         $_SESSION["il_map_edit_area_type"] = $_GET["areatype"];
01480                 }*/
01481 
01482                 if($_GET["ref_id"] != "")
01483                 {
01484                         $_SESSION["il_map_edit_ref_id"] = $_GET["ref_id"];
01485                 }
01486 
01487                 if($_GET["obj_id"] != "")
01488                 {
01489                         $_SESSION["il_map_edit_obj_id"] = $_GET["obj_id"];
01490                 }
01491 
01492                 if($_GET["hier_id"] != "")
01493                 {
01494                         $_SESSION["il_map_edit_hier_id"] = $_GET["hier_id"];
01495                 }
01496 
01497                 /*
01498                 if($_GET["coords"] != "")
01499                 {
01500 //echo "setcoords:".$_GET["coords"].":";
01501                         $_SESSION["il_map_edit_coords"] = $_GET["coords"];
01502                 }*/
01503         }
01504 
01505 
01509         function _recoverParameters()
01510         {
01511                 $_GET["ref_id"] = $_SESSION["il_map_edit_ref_id"];
01512                 $_GET["obj_id"] = $_SESSION["il_map_edit_obj_id"];
01513                 $_GET["hier_id"] = $_SESSION["il_map_edit_hier_id"];
01514                 //$_GET["areatype"] = $_SESSION["il_map_edit_area_type"];
01515                 //$_GET["coords"] = $_SESSION["il_map_edit_coords"];
01516         }
01517 
01518         function clearParameters()
01519         {
01520                 $_SESSION["il_map_el_href"] = "";
01521         }
01522 
01523 
01527         function initMapParameters()
01528         {
01529                 /*
01530                 //unset($_SESSION["il_map_edit_ref_id"]);
01531                 //unset($_SESSION["il_map_edit_obj_id"]);
01532                 //unset($_SESSION["il_map_edit_hier_id"]);
01533                 unset($_SESSION["il_map_edit_area_type"]);
01534                 unset($_SESSION["il_map_edit_coords"]);
01535                 unset($_SESSION["il_map_el_href"]);
01536                 unset($_SESSION["il_map_il_type"]);
01537                 unset($_SESSION["il_map_il_ltype"]);
01538                 unset($_SESSION["il_map_il_target"]);
01539                 unset($_SESSION["il_map_il_targetframe"]);
01540                 unset($_SESSION["il_map_edit_mode"]);
01541                 unset($_SESSION["il_map_area_nr"]);*/
01542         }
01543 
01544         function newAreaObject()
01545         {
01546                 $_SESSION["il_map_edit_coords"] = "";
01547                 $_SESSION["il_map_edit_mode"] = "";
01548                 $_SESSION["il_map_el_href"] = "";
01549                 $_SESSION["il_map_il_type"] = "";
01550                 $_SESSION["il_map_il_ltype"] = "";
01551                 $_SESSION["il_map_il_target"] = "";
01552                 $_SESSION["il_map_il_targetframe"] = "";
01553                 $_SESSION["il_map_edit_area_type"] = $_POST["areatype"];
01554                 $this->addAreaObject(false);
01555         }
01556 
01560         function addAreaObject($a_handle = true)
01561         {
01562                 // init all SESSION variables if "ADD AREA" button is pressed
01563                 /*
01564                 if ($_POST["areatype"] != "")
01565                 {
01566                         $this->initMapParameters();
01567                 }*/
01568 
01569                 // handle map parameters
01570                 if($a_handle)
01571                 {
01572                         $this->handleMapParameters();
01573                 }
01574 
01575                 $area_type = $_SESSION["il_map_edit_area_type"];
01576                 $coords = $_SESSION["il_map_edit_coords"];
01577                 $cnt_coords = ilMapArea::countCoords($coords);
01578 //echo "areatype:".$_SESSION["il_map_edit_area_type"].":<br>";
01579                 // decide what to do next
01580                 switch ($area_type)
01581                 {
01582                         // Rectangle
01583                         case "Rect" :
01584                                 if ($cnt_coords < 2)
01585                                 {
01586                                         $this->editMapArea(true, false, false);
01587                                 }
01588                                 else if ($cnt_coords == 2)
01589                                 {
01590 //echo "setting2:".$_SESSION["il_map_il_target"].":<br>";
01591                                         $this->editMapArea(false, true, true);
01592                                 }
01593                                 break;
01594 
01595                         // Circle
01596                         case "Circle":
01597 //echo $coords."BHB".$cnt_coords;
01598                                 if ($cnt_coords <= 1)
01599                                 {
01600                                         $this->editMapArea(true, false, false);
01601                                 }
01602                                 else
01603                                 {
01604                                         if ($cnt_coords == 2)
01605                                         {
01606                                                 $c = explode(",",$coords);
01607                                                 $coords = $c[0].",".$c[1].",";  // determine radius
01608                                                 $coords .= round(sqrt(pow(abs($c[3]-$c[1]),2)+pow(abs($c[2]-$c[0]),2)));
01609                                         }
01610                                         $_SESSION["il_map_edit_coords"] = $coords;
01611 
01612                                         $this->editMapArea(false, true, true);
01613                                 }
01614                                 break;
01615 
01616                         // Polygon
01617                         case "Poly":
01618                                 if ($cnt_coords < 1)
01619                                 {
01620                                         $this->editMapArea(true, false, false);
01621                                 }
01622                                 else if ($cnt_coords < 3)
01623                                 {
01624                                         $this->editMapArea(true, true, false);
01625                                 }
01626                                 else
01627                                 {
01628                                         $this->editMapArea(true, true, true);
01629                                 }
01630                                 break;
01631                 }
01632 //echo "setting3:".$_SESSION["il_map_il_target"].":<br>";
01633         }
01634 
01635 
01644         function editMapArea($a_get_next_coordinate = false, $a_output_new_area = false,
01645                 $a_save_form = false, $a_edit_property = "", $a_area_nr = 0)
01646         {
01647 
01648                 $area_type = $_SESSION["il_map_edit_area_type"];
01649 //echo "sessioncoords:".$_SESSION["il_map_edit_coords"].":<br>";
01650                 $coords = $_SESSION["il_map_edit_coords"];
01651                 $cnt_coords = ilMapArea::countCoords($coords);
01652 
01653                 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.map_edit.html", "Services/MediaObjects");
01654 
01655                 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
01656 
01657                 $this->tpl->setVariable("TXT_IMAGEMAP", $this->lng->txt("cont_imagemap"));
01658 
01659                 // output instruction text
01660 
01661                 $this->tpl->setCurrentBlock("instruction");
01662 //echo "at:$area_type:<br>";
01663 //echo "cntcoords:".$cnt_coords.":<br>";
01664 //echo "coords:".$coords.":<br>";
01665                 if ($a_edit_property != "link")
01666                 {
01667                         switch ($area_type)
01668                         {
01669                                 // rectangle
01670                                 case "Rect" :
01671                                         if ($cnt_coords == 0)
01672                                         {
01673                                                 $this->tpl->setVariable("INSTRUCTION", $this->lng->txt("cont_click_tl_corner"));
01674                                         }
01675                                         if ($cnt_coords == 1)
01676                                         {
01677                                                 $this->tpl->setVariable("INSTRUCTION", $this->lng->txt("cont_click_br_corner"));
01678                                         }
01679                                         break;
01680 
01681                                 // circle
01682                                 case "Circle" :
01683                                         if ($cnt_coords == 0)
01684                                         {
01685                                                 $this->tpl->setVariable("INSTRUCTION", $this->lng->txt("cont_click_center"));
01686                                         }
01687                                         if ($cnt_coords == 1)
01688                                         {
01689                                                 $this->tpl->setVariable("INSTRUCTION", $this->lng->txt("cont_click_circle"));
01690                                         }
01691                                         break;
01692 
01693                                 // polygon
01694                                 case "Poly" :
01695                                         if ($cnt_coords == 0)
01696                                         {
01697                                                 $this->tpl->setVariable("INSTRUCTION", $this->lng->txt("cont_click_starting_point"));
01698                                         }
01699                                         else if ($cnt_coords < 3)
01700                                         {
01701                                                 $this->tpl->setVariable("INSTRUCTION", $this->lng->txt("cont_click_next_point"));
01702                                         }
01703                                         else
01704                                         {
01705                                                 $this->tpl->setVariable("INSTRUCTION", $this->lng->txt("cont_click_next_or_save"));
01706                                         }
01707                                         break;
01708                         }
01709                 }
01710                 $this->tpl->parseCurrentBlock();
01711 
01712                 $this->tpl->setCurrentBlock("adm_content");
01713 
01714 
01715                 // map properties input fields (name and link)
01716                 if ($a_save_form)
01717                 {
01718                         if ($a_edit_property != "link" && $a_edit_property != "shape")
01719                         {
01720                                 $this->tpl->setCurrentBlock("edit_name");
01721                                 $this->tpl->setVariable("VAR_NAME2", "area_name");
01722                                 $this->tpl->setVariable("TXT_NAME2", $this->lng->txt("cont_name"));
01723                                 $this->tpl->parseCurrentBlock();
01724                         }
01725 
01726                         if ($a_edit_property != "shape")
01727                         {
01728                                 $this->tpl->setCurrentBlock("edit_link");
01729                                 $this->tpl->setVariable("TXT_LINK_EXT", $this->lng->txt("cont_link_ext"));
01730                                 $this->tpl->setVariable("TXT_LINK_INT", $this->lng->txt("cont_link_int"));
01731                                 if ($_SESSION["il_map_el_href"] != "")
01732                                 {
01733                                         $this->tpl->setVariable("VAL_LINK_EXT", $_SESSION["il_map_el_href"]);
01734                                 }
01735                                 else
01736                                 {
01737                                         $this->tpl->setVariable("VAL_LINK_EXT", "http://");
01738                                 }
01739                                 $this->tpl->setVariable("VAR_LINK_EXT", "area_link_ext");
01740                                 $this->tpl->setVariable("VAR_LINK_TYPE", "area_link_type");
01741                                 if ($_SESSION["il_map_il_ltype"] != "int")
01742                                 {
01743                                         $this->tpl->setVariable("EXT_CHECKED", "checked=\"1\"");
01744                                 }
01745                                 else
01746                                 {
01747                                         $this->tpl->setVariable("INT_CHECKED", "checked=\"1\"");
01748                                 }
01749 
01750                                 // internal link
01751                                 $link_str = "";
01752                                 if($_SESSION["il_map_il_target"] != "")
01753                                 {
01754                                         $link_str = $this->getMapAreaLinkString($_SESSION["il_map_il_target"],
01755                                                 $_SESSION["il_map_il_type"], $_SESSION["il_map_il_targetframe"]);
01756                                         $this->tpl->setVariable("VAL_LINK_INT", $link_str);
01757                                 }
01758 
01759                                 // internal link list
01760                                 $this->ctrl->setParameter($this, "linkmode", "map");
01761                                 $this->tpl->setVariable("LINK_ILINK",
01762                                         $this->ctrl->getLinkTargetByClass("ilInternalLinkGUI", "showLinkHelp",
01763                                         array("ilObjMediaObjectGUI"), true));
01764                                 $this->tpl->setVariable("TXT_ILINK", "[".$this->lng->txt("cont_get_link")."]");
01765 
01766                                 $this->tpl->parseCurrentBlock();
01767                         }
01768 
01769                         $this->tpl->setCurrentBlock("new_area");
01770                         $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
01771                         $this->tpl->setVariable("BTN_SAVE", "saveArea");
01772                         if ($a_edit_property == "")
01773                         {
01774                                 $this->tpl->setVariable("TXT_NEW_AREA", $this->lng->txt("cont_new_area"));
01775                         }
01776                         else
01777                         {
01778                                 $this->tpl->setVariable("TXT_NEW_AREA", $this->lng->txt("cont_edit_area"));
01779                         }
01780                         $this->tpl->parseCurrentBlock();
01781 
01782                         $this->tpl->setCurrentBlock("adm_content");
01783                 }
01784 
01785                 // create/update imagemap work copy
01786                 $st_item =& $this->object->getMediaItem("Standard");
01787 
01788                 if ($a_edit_property == "shape")
01789                 {
01790                         $st_item->makeMapWorkCopy($a_area_nr, true);    // exclude area currently being edited
01791                 }
01792                 else
01793                 {
01794                         $st_item->makeMapWorkCopy($a_area_nr, false);
01795                 }
01796 
01797                 if ($a_output_new_area)
01798                 {
01799                         $st_item->addAreaToMapWorkCopy($area_type, $coords);
01800                 }
01801 
01802                 // output image map
01803                 $xml = "<dummy>";
01804                 $xml.= $this->object->getXML(IL_MODE_ALIAS);
01805                 $xml.= $this->object->getXML(IL_MODE_OUTPUT);
01806                 $xml.="</dummy>";
01807 //echo "xml:".htmlentities($xml).":<br>";
01808                 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
01809                 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
01810                 $xh = xslt_create();
01811                 $wb_path = ilUtil::getWebspaceDir("output");
01812                 $mode = "media";
01813                 if ($a_get_next_coordinate)
01814                 {
01815                         $map_edit_mode = "get_coords";
01816                 }
01817                 else
01818                 {
01819                         $map_edit_mode = "";
01820                 }
01821                 $params = array ('map_edit_mode' => $map_edit_mode,
01822                         'map_item' => $st_item->getId(),
01823                         'mode' => $mode,
01824                         'image_map_link' => $this->ctrl->getLinkTarget($this, "showImageMap"),
01825                         'link_params' => "ref_id=".$_GET["ref_id"]."&rand=".rand(1,999999),
01826                         'ref_id' => $_GET["ref_id"],
01827                         'pg_frame' => "",
01828                         'webspace_path' => $wb_path);
01829                 $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
01830 //echo "<br>html:".htmlentities($output).":<br>";
01831                 echo xslt_error($xh);
01832                 xslt_free($xh);
01833                 $this->tpl->setVariable("IMAGE_MAP", $output);
01834 
01835                 $this->tpl->parseCurrentBlock();
01836         }
01837 
01838 
01842         function editImagemapForwardObject()
01843         {
01844                 ilObjMediaObjectGUI::_recoverParameters();
01845 
01846                 if ($_SESSION["il_map_edit_coords"] != "")
01847                 {
01848                         $_SESSION["il_map_edit_coords"] .= ",";
01849                 }
01850 
01851                 $_SESSION["il_map_edit_coords"] .= $_POST["editImagemapForward_x"].",".
01852                         $_POST["editImagemapForward_y"];
01853 
01854                 // call lm_edit script
01855                 ilUtil::redirect($_SESSION["il_map_edit_target_script"]);
01856         }
01857 
01858 
01864         function setInternalLinkObject()
01865         {
01866                 $_SESSION["il_map_il_type"] = $_GET["linktype"];
01867                 $_SESSION["il_map_il_ltype"] = "int";
01868 
01869                 $_SESSION["il_map_il_target"] = $_GET["linktarget"];
01870 //echo "setting1:".$_SESSION["il_map_il_target"].":<br>";
01871                 $_SESSION["il_map_il_targetframe"] = $_GET["linktargetframe"];
01872                 switch ($_SESSION["il_map_edit_mode"])
01873                 {
01874                         case "edit_link":
01875                                 $this->setLink();
01876                                 break;
01877 
01878                         default:
01879 //echo "addArea";
01880                                 $this->addAreaObject();
01881                                 break;
01882                 }
01883         }
01884 
01894         function getMapAreaLinkString($a_target, $a_type, $a_frame)
01895         {
01896                 $t_arr = explode("_", $a_target);
01897                 if ($a_frame != "")
01898                 {
01899                         $frame_str = " (".$a_frame." Frame)";
01900                 }
01901                 switch($a_type)
01902                 {
01903                         case "StructureObject":
01904                                 require_once("./Modules/LearningModule/classes/class.ilLMObject.php");
01905                                 $title = ilLMObject::_lookupTitle($t_arr[count($t_arr) - 1]);
01906                                 $link_str = $this->lng->txt("chapter").
01907                                         ": ".$title." [".$t_arr[count($t_arr) - 1]."]".$frame_str;
01908                                 break;
01909 
01910                         case "PageObject":
01911                                 require_once("./Modules/LearningModule/classes/class.ilLMObject.php");
01912                                 $title = ilLMObject::_lookupTitle($t_arr[count($t_arr) - 1]);
01913                                 $link_str = $this->lng->txt("page").
01914                                         ": ".$title." [".$t_arr[count($t_arr) - 1]."]".$frame_str;
01915                                 break;
01916 
01917                         case "GlossaryItem":
01918                                 require_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
01919                                 $term =& new ilGlossaryTerm($t_arr[count($t_arr) - 1]);
01920                                 $link_str = $this->lng->txt("term").
01921                                         ": ".$term->getTerm()." [".$t_arr[count($t_arr) - 1]."]".$frame_str;
01922                                 break;
01923 
01924                         case "MediaObject":
01925                                 require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
01926                                 $mob =& new ilObjMediaObject($t_arr[count($t_arr) - 1]);
01927                                 $link_str = $this->lng->txt("mob").
01928                                         ": ".$mob->getTitle()." [".$t_arr[count($t_arr) - 1]."]".$frame_str;
01929                                 break;
01930                                 
01931                         case "RepositoryItem":
01932                                 $title = ilObject::_lookupTitle(
01933                                         ilObject::_lookupObjId($t_arr[count($t_arr) - 1]));
01934                                 $link_str = $this->lng->txt("obj_".$t_arr[count($t_arr) - 2]).
01935                                         ": ".$title." [".$t_arr[count($t_arr) - 1]."]".$frame_str;
01936                                 break;
01937                 }
01938 
01939                 return $link_str;
01940         }
01941 
01945         function updateAreasObject()
01946         {
01947                 $st_item =& $this->object->getMediaItem("Standard");
01948                 $max = ilMapArea::_getMaxNr($st_item->getId());
01949                 for ($i=1; $i<=$max; $i++)
01950                 {
01951                         $area =& new ilMapArea($st_item->getId(), $i);
01952                         $area->setTitle(ilUtil::stripSlashes($_POST["name_".$i]));
01953                         $area->update();
01954                 }
01955 
01956                 ilUtil::sendInfo($this->lng->txt("cont_saved_map_data"), true);
01957                 $this->ctrl->redirect($this, "editMapAreas");
01958         }
01959 
01960 
01964         function deleteAreasObject()
01965         {
01966                 if (!isset($_POST["area"]))
01967                 {
01968                         ilUtil::sendInfo($this->lng->txt("no_checkbox"), true);
01969                         $this->editMapAreasObject();
01970                         return;
01971                 }
01972 
01973                 $st_item =& $this->object->getMediaItem("Standard");
01974                 $max = ilMapArea::_getMaxNr($st_item->getId());
01975 
01976                 if (count($_POST["area"]) > 0)
01977                 {
01978                         $i = 0;
01979 
01980                         foreach ($_POST["area"] as $area_nr)
01981                         {
01982                                 $st_item->deleteMapArea($area_nr - $i);
01983                                 $i++;
01984                         }
01985 
01986                         $this->object->update();
01987                         ilUtil::sendInfo($this->lng->txt("cont_areas_deleted"), true);
01988                 }
01989 
01990                 $this->ctrl->redirect($this, "editMapAreas");
01991         }
01992 
01993 
01997         function saveAreaObject()
01998         {
01999                 switch ($_SESSION["il_map_edit_mode"])
02000                 {
02001                         // save edited link
02002                         case "edit_link":
02003                                 $st_item =& $this->object->getMediaItem("Standard");
02004                                 $max = ilMapArea::_getMaxNr($st_item->getId());
02005                                 $area =& new ilMapArea($st_item->getId(), $_SESSION["il_map_area_nr"]);
02006 
02007                                 if ($_POST["area_link_type"] == IL_INT_LINK)
02008                                 {
02009                                         $area->setLinkType(IL_INT_LINK);
02010                                         $area->setType($_SESSION["il_map_il_type"]);
02011                                         $area->setTarget($_SESSION["il_map_il_target"]);
02012                                         $area->setTargetFrame($_SESSION["il_map_il_targetframe"]);
02013                                 }
02014                                 else
02015                                 {
02016                                         $area->setLinkType(IL_EXT_LINK);
02017                                         $area->setHref($_POST["area_link_ext"]);
02018                                 }
02019                                 $area->update();
02020                                 break;
02021 
02022                         // save edited shape
02023                         case "edit_shape":
02024                                 $st_item =& $this->object->getMediaItem("Standard");
02025                                 $max = ilMapArea::_getMaxNr($st_item->getId());
02026                                 $area =& new ilMapArea($st_item->getId(), $_SESSION["il_map_area_nr"]);
02027 
02028                                 $area->setShape($_SESSION["il_map_edit_area_type"]);
02029                                 $area->setCoords($_SESSION["il_map_edit_coords"]);
02030                                 $area->update();
02031                                 break;
02032 
02033                         // save new area
02034                         default:
02035                                 $area_type = $_SESSION["il_map_edit_area_type"];
02036                                 $coords = $_SESSION["il_map_edit_coords"];
02037 
02038                                 $st_item =& $this->object->getMediaItem("Standard");
02039                                 $max = ilMapArea::_getMaxNr($st_item->getId());
02040 
02041                                 // make new area object
02042                                 $area = new ilMapArea();
02043                                 $area->setItemId($st_item->getId());
02044                                 $area->setShape($area_type);
02045                                 $area->setCoords($coords);
02046                                 $area->setNr($max + 1);
02047                                 $area->setTitle($_POST["area_name"]);
02048                                 switch($_POST["area_link_type"])
02049                                 {
02050                                         case "ext":
02051                                                 $area->setLinkType(IL_EXT_LINK);
02052                                                 $area->setHref($_POST["area_link_ext"]);
02053                                                 break;
02054 
02055                                         case "int":
02056                                                 $area->setLinkType(IL_INT_LINK);
02057                                                 $area->setType($_SESSION["il_map_il_type"]);
02058 //echo "savingTarget:".$_SESSION["il_map_il_target"].":";
02059                                                 $area->setTarget($_SESSION["il_map_il_target"]);
02060                                                 $area->setTargetFrame($_SESSION["il_map_il_targetframe"]);
02061                                                 break;
02062                                 }
02063 
02064                                 // put area into item and update media object
02065                                 $st_item->addMapArea($area);
02066                                 $this->object->update();
02067                                 break;
02068                 }
02069 
02070                 $this->initMapParameters();
02071                 ilUtil::sendInfo($this->lng->txt("cont_saved_map_area"), true);
02072                 $this->ctrl->redirect($this, "editMapAreas");
02073         }
02074 
02075         function editLinkObject()
02076         {
02077                 $_SESSION["il_map_edit_coords"] = "";
02078                 $_SESSION["il_map_edit_mode"] = "";
02079                 $_SESSION["il_map_el_href"] = "";
02080                 $_SESSION["il_map_il_type"] = "";
02081                 $_SESSION["il_map_il_ltype"] = "";
02082                 $_SESSION["il_map_il_target"] = "";
02083                 $_SESSION["il_map_il_targetframe"] = "";
02084                 $_SESSION["il_map_area_nr"] = "";
02085                 $this->setLink(false);
02086         }
02087 
02091         function setLink($a_handle = true)
02092         {
02093                 if($a_handle)
02094                 {
02095                         $this->handleMapParameters();
02096                 }
02097                 if ($_SESSION["il_map_area_nr"] != "")
02098                 {
02099                         $_POST["area"][0] = $_SESSION["il_map_area_nr"];
02100                 }
02101                 if (!isset($_POST["area"]))
02102                 {
02103                         ilUtil::sendInfo($this->lng->txt("no_checkbox"), true);
02104                         $this->editMapAreasObject();
02105                         return;
02106                 }
02107 
02108                 if (count($_POST["area"]) > 1)
02109                 {
02110                         //$this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
02111                         ilUtil::sendInfo($this->lng->txt("cont_select_max_one_item"), true);
02112                         $this->editMapAreasObject();
02113                         return;
02114                 }
02115 
02116                 $st_item =& $this->object->getMediaItem("Standard");
02117                 $area =& $st_item->getMapArea($_POST["area"][0]);
02118                 //$max = ilMapArea::_getMaxNr($st_item->getId());
02119 
02120                 if ($_SESSION["il_map_edit_mode"] != "edit_link")
02121                 {
02122                         $_SESSION["il_map_area_nr"] = $_POST["area"][0];
02123                         $_SESSION["il_map_il_ltype"] = $area->getLinkType();
02124                         $_SESSION["il_map_edit_mode"] = "edit_link";
02125                         $_SESSION["il_map_edit_target_script"] = $this->ctrl->getLinkTarget($this, "setLink");
02126                         if ($_SESSION["il_map_il_ltype"] == IL_INT_LINK)
02127                         {
02128                                 $_SESSION["il_map_il_type"] = $area->getType();
02129                                 $_SESSION["il_map_il_target"] = $area->getTarget();
02130                                 $_SESSION["il_map_il_targetframe"] = $area->getTargetFrame();
02131                         }
02132                         else
02133                         {
02134                                 $_SESSION["il_map_el_href"] = $area->getHref();
02135                         }
02136                 }
02137 
02138                 $this->editMapArea(false, false, true, "link", $_POST["area"][0]);
02139         }
02140 
02141         function editShapeObject()
02142         {
02143                 $_SESSION["il_map_area_nr"] = "";
02144                 $_SESSION["il_map_edit_coords"] = "";
02145                 $_SESSION["il_map_edit_mode"] = "";
02146                 $_SESSION["il_map_el_href"] = "";
02147                 $_SESSION["il_map_il_type"] = "";
02148                 $_SESSION["il_map_il_ltype"] = "";
02149                 $_SESSION["il_map_il_target"] = "";
02150                 $_SESSION["il_map_il_targetframe"] = "";
02151                 $this->setShapeObject(false);
02152         }
02153 
02157         function setShapeObject($a_handle = true)
02158         {
02159                 if($a_handle)
02160                 {
02161                         $this->handleMapParameters();
02162                 }
02163                 if($_POST["areatype2"] != "")
02164                 {
02165                         $_SESSION["il_map_edit_area_type"] = $_POST["areatype2"];
02166                 }
02167                 if ($_SESSION["il_map_area_nr"] != "")
02168                 {
02169                         $_POST["area"][0] = $_SESSION["il_map_area_nr"];
02170                 }
02171                 if (!isset($_POST["area"]))
02172                 {
02173                         ilUtil::sendInfo($this->lng->txt("no_checkbox"), true);
02174                         $this->editMapAreasObject();
02175                         return;
02176                 }
02177 
02178                 if (count($_POST["area"]) > 1)
02179                 {
02180                         //$this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
02181                         ilUtil::sendInfo($this->lng->txt("cont_select_max_one_item"), true);
02182                         $this->editMapAreasObject();
02183                         return;                 
02184                 }
02185 
02186                 $st_item =& $this->object->getMediaItem("Standard");
02187                 $area =& $st_item->getMapArea($_POST["area"][0]);
02188                 //$max = ilMapArea::_getMaxNr($st_item->getId());
02189 
02190                 if ($_SESSION["il_map_edit_mode"] != "edit_shape")
02191                 {
02192                         $_SESSION["il_map_area_nr"] = $_POST["area"][0];
02193                         $_SESSION["il_map_edit_mode"] = "edit_shape";
02194                         $_SESSION["il_map_edit_target_script"] = $this->ctrl->getLinkTarget($this, "setShape");
02195                 }
02196 
02197 
02198                 $area_type = $_SESSION["il_map_edit_area_type"];
02199                 $coords = $_SESSION["il_map_edit_coords"];
02200                 $cnt_coords = ilMapArea::countCoords($coords);
02201 
02202                 // decide what to do next
02203                 switch ($area_type)
02204                 {
02205                         // Rectangle
02206                         case "Rect" :
02207                                 if ($cnt_coords < 2)
02208                                 {
02209                                         $this->editMapArea(true, false, false, "shape", $_POST["area"][0]);
02210                                 }
02211                                 else if ($cnt_coords == 2)
02212                                 {
02213                                         $this->saveAreaObject();
02214                                 }
02215                                 break;
02216 
02217                         // Circle
02218                         case "Circle":
02219 //echo $coords."BHB".$cnt_coords;
02220                                 if ($cnt_coords <= 1)
02221                                 {
02222                                         $this->editMapArea(true, false, false, "shape", $_POST["area"][0]);
02223                                 }
02224                                 else
02225                                 {
02226                                         if ($cnt_coords == 2)
02227                                         {
02228                                                 $c = explode(",",$coords);
02229                                                 $coords = $c[0].",".$c[1].",";  // determine radius
02230                                                 $coords .= round(sqrt(pow(abs($c[3]-$c[1]),2)+pow(abs($c[2]-$c[0]),2)));
02231                                         }
02232                                         $_SESSION["il_map_edit_coords"] = $coords;
02233 
02234                                         $this->saveAreaObject();
02235                                 }
02236                                 break;
02237 
02238                         // Polygon
02239                         case "Poly":
02240                                 if ($cnt_coords < 1)
02241                                 {
02242                                         $this->editMapArea(true, false, false, "shape", $_POST["area"][0]);
02243                                 }
02244                                 else if ($cnt_coords < 3)
02245                                 {
02246                                         $this->editMapArea(true, true, false, "shape", $_POST["area"][0]);
02247                                 }
02248                                 else
02249                                 {
02250                                         $this->editMapArea(true, true, true, "shape", $_POST["area"][0]);
02251                                 }
02252                                 break;
02253                 }
02254 
02255         }
02256 
02260         function _getMediaInfoHTML(&$a_mob)
02261         {
02262                 global $lng;
02263 
02264                 $tpl =& new ilTemplate("tpl.media_info.html", true, true, "Services/MediaObjects");
02265                 $types = array("Standard", "Fullscreen");
02266                 foreach ($types as $type)
02267                 {
02268                         if($type == "Fullscreen" && !$a_mob->hasFullScreenItem())
02269                         {
02270                                 continue;
02271                         }
02272 
02273                         $med =& $a_mob->getMediaItem($type);
02274                         $tpl->setCurrentBlock("media_info");
02275                         if ($type == "Standard")
02276                         {
02277                                 $tpl->setVariable("TXT_PURPOSE", $lng->txt("cont_std_view"));
02278                         }
02279                         else
02280                         {
02281                                 $tpl->setVariable("TXT_PURPOSE", $lng->txt("cont_fullscreen"));
02282                         }
02283                         $tpl->setVariable("TXT_TYPE", $lng->txt("cont_".$med->getLocationType()));
02284                         $tpl->setVariable("VAL_LOCATION", $med->getLocation());
02285                         if ($med->getLocationType() == "LocalFile")
02286                         {
02287                                 $file = ilObjMediaObject::_getDirectory($med->getMobId())."/".$med->getLocation();
02288                                 if (is_file($file))
02289                                 {
02290                                         $size = filesize($file);
02291                                 }
02292                                 else
02293                                 {
02294                                         $size = 0;
02295                                 }
02296                                 $tpl->setVariable("VAL_FILE_SIZE", " ($size ".$lng->txt("bytes").")");
02297                         }
02298                         $tpl->setVariable("TXT_FORMAT", $lng->txt("cont_format"));
02299                         $tpl->setVariable("VAL_FORMAT", $med->getFormat());
02300                         if ($med->getWidth() != "" && $med->getHeight() != "")
02301                         {
02302                                 $tpl->setCurrentBlock("size");
02303                                 $tpl->setVariable("TXT_SIZE", $lng->txt("size"));
02304                                 $tpl->setVariable("VAL_SIZE", $med->getWidth()."x".$med->getHeight());
02305                                 $tpl->parseCurrentBlock();
02306                         }
02307 
02308                         // original size
02309                         if ($orig_size = $med->getOriginalSize())
02310                         {
02311                                 if ($orig_size["width"] != $med->getWidth() ||
02312                                         $orig_size["height"] != $med->getHeight())
02313                                 {
02314                                         $tpl->setCurrentBlock("orig_size");
02315                                         $tpl->setVariable("TXT_ORIG_SIZE", $lng->txt("cont_orig_size"));
02316                                         $tpl->setVariable("ORIG_WIDTH", $orig_size["width"]);
02317                                         $tpl->setVariable("ORIG_HEIGHT", $orig_size["height"]);
02318                                         $tpl->parseCurrentBlock();
02319                                 }
02320                         }
02321                         $tpl->setCurrentBlock("media_info");
02322                         $tpl->parseCurrentBlock();
02323                 }
02324 
02325                 return $tpl->get();
02326         }
02327 
02331         function setAdminTabs()
02332         {
02333                 // catch feedback message
02334                 ilUtil::sendInfo();
02335                 #include_once("classes/class.ilTabsGUI.php");
02336                 #$tabs_gui =& new ilTabsGUI();
02337                 $this->getTabs($this->tabs_gui);
02338 
02339                 //$tabs_gui->setTargetScript($this->ctrl->getLinkTarget($this));
02340                 if (is_object($this->object) && strtolower(get_class($this->object)) == "ilobjmediaobject")
02341                 {
02342                         $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_mob_b.gif"));
02343                         //$this->tpl->setCurrentBlock("header_image");
02344                         //$this->tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_mob_b.gif"));
02345                         //$this->tpl->parseCurrentBlock();
02346                         $this->tpl->setCurrentBlock();
02347                         $title = $this->object->getTitle();
02348                         $this->tpl->setVariable("HEADER", $title);
02349                 }
02350                 else
02351                 {
02352                         //$title = $this->object->getTitle();
02353                         $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_mob_b.gif"));
02354                         //$this->tpl->setCurrentBlock("header_image");
02355                         //$this->tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_mob_b.gif"));
02356                         //$this->tpl->parseCurrentBlock();
02357                         $this->tpl->setVariable("HEADER", $this->lng->txt("cont_create_mob"));
02358                 }
02359 
02360                 // output tabs
02361                 #$this->tpl->setVariable("TABS", $tabs_gui->getHTML());
02362 
02363         }
02364 
02365         function getTabs(&$tabs_gui)
02366         {
02367                 //$tabs_gui->setTargetScript($this->ctrl->getLinkTarget($this));
02368                 if (is_object($this->object) && strtolower(get_class($this->object)) == "ilobjmediaobject"
02369                         && $this->object->getId() > 0)
02370                 {
02371                         // object properties
02372                         $tabs_gui->addTarget("cont_mob_prop",
02373                                 $this->ctrl->getLinkTarget($this, "edit"), "edit",
02374                                 get_class($this));
02375 
02376                         // object files
02377                         $tabs_gui->addTarget("cont_mob_files",
02378                                 $this->ctrl->getLinkTarget($this, "editFiles"), "editFiles",
02379                                 get_class($this));
02380 
02381                         // object usages
02382                         $tabs_gui->addTarget("cont_mob_usages",
02383                                 $this->ctrl->getLinkTarget($this, "showUsages"), "showUsages",
02384                                 get_class($this));
02385 
02386                         // link areas
02387                         $st_item =& $this->object->getMediaItem("Standard");
02388                         if (is_object($st_item) && $this->getEnabledMapAreas())
02389                         {
02390                                 $format = $st_item->getFormat();
02391                                 if (substr($format, 0, 5) == "image")
02392                                 {
02393                                         $tabs_gui->addTarget("cont_map_areas",
02394                                                 $this->ctrl->getLinkTarget($this, "editMapAreas"), "editMapAreas",
02395                                                 get_class($this));
02396                                 }
02397                         }
02398 
02399                         $tabs_gui->addTarget("meta_data",
02400                                 $this->ctrl->getLinkTargetByClass(
02401                                         array("ilobjmediaobjectgui", "ilmdeditorgui"),'listSection'),
02402                                 "", "ilmdeditorgui");
02403 
02404                 }
02405 
02406                 // back to upper context
02407                 if ($this->back_title != "")
02408                 {
02409                         $tabs_gui->setBackTarget($this->back_title,
02410                                 $this->ctrl->getParentReturn($this));
02411                 }
02412         }
02413 
02414 }
02415 ?>

Generated on Fri Dec 13 2013 17:56:58 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1