ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPCMediaObjectGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 require_once ("./Services/COPage/classes/class.ilPageContentGUI.php");
25 require_once ("./Services/COPage/classes/class.ilMediaAliasItem.php");
26 require_once ("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
27 
40 // Todo: extend ilObjMediaObjectGUI !?
42 {
43  var $header;
44  var $ctrl;
45 
46  function ilPCMediaObjectGUI(&$a_pg_obj, &$a_content_obj, $a_hier_id = 0, $a_pc_id = "")
47  {
48  global $ilCtrl;
49 
50  $this->ctrl =& $ilCtrl;
51 
52 //echo "constructor target:".$_SESSION["il_map_il_target"].":<br>";
53  parent::ilPageContentGUI($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
54  }
55 
56  function setHeader($a_title = "")
57  {
58  $this->header = $a_title;
59  }
60 
61  function getHeader()
62  {
63  return $this->header;
64  }
65 
71  function setEnabledMapAreas($a_enabledmapareas)
72  {
73  $this->enabledmapareas = $a_enabledmapareas;
74  }
75 
81  function getEnabledMapAreas()
82  {
83  return $this->enabledmapareas;
84  }
85 
89  function &executeCommand()
90  {
91  global $tpl, $lng, $ilTabs;
92 
93  // get next class that processes or forwards current command
94  $next_class = $this->ctrl->getNextClass($this);
95 //echo "-".$next_class."-";
96  // get current command
97  $cmd = $this->ctrl->getCmd();
98 
99  if (is_object ($this->content_obj))
100  {
101  $tpl->setTitleIcon(ilUtil::getImagePath("icon_mob_b.gif"));
102  $this->getTabs($this->tabs_gui);
103  $tpl->setVariable("HEADER", $lng->txt("mob").": ".
104  $this->content_obj->getMediaObject()->getTitle());
105 // $this->displayLocator("mob"); // ??? von pageeditorgui
106  $mob_gui =& new ilObjMediaObjectGUI("", $this->content_obj->getMediaObject()->getId(),false, false);
107  $mob_gui->setBackTitle($this->page_back_title);
108  $mob_gui->setEnabledMapAreas($this->getEnabledMapAreas());
109  $mob_gui->getTabs($this->tabs_gui);
110  }
111  else
112  {
113  }
114 
115  switch($next_class)
116  {
117  case "ilobjmediaobjectgui":
118  include_once ("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
119  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_mob_b.gif"));
120  $this->tpl->setTitle($this->lng->txt("mob").": ".
121  $this->content_obj->getMediaObject()->getTitle());
122  $mob_gui =& new ilObjMediaObjectGUI("", $this->content_obj->getMediaObject()->getId(),false, false);
123  $mob_gui->setBackTitle($this->page_back_title);
124  $mob_gui->setEnabledMapAreas($this->getEnabledMapAreas());
125  $ret =& $this->ctrl->forwardCommand($mob_gui);
126  break;
127 
128  // instance image map editing
129  case "ilpcimagemapeditorgui":
130  require_once("./Services/COPage/classes/class.ilPCImageMapEditorGUI.php");
131  $ilTabs->setTabActive("cont_inst_map_areas");
132  $image_map_edit = new ilPCImageMapEditorGUI($this->content_obj,
133  $this->pg_obj);
134  $ret = $this->ctrl->forwardCommand($image_map_edit);
135  $tpl->setContent($ret);
136  break;
137 
138  default:
139  $ret =& $this->$cmd();
140  break;
141  }
142 
143  return $ret;
144  }
145 
149  function insert($a_post_cmd = "edpost", $a_submit_cmd = "create_mob")
150  {
151  global $ilTabs;
152 
153  if ($_GET["subCmd"] == "insertNew")
154  {
155  $_SESSION["cont_media_insert"] = "insertNew";
156  }
157  if ($_GET["subCmd"] == "insertFromPool")
158  {
159  $_SESSION["cont_media_insert"] = "insertFromPool";
160  }
161 
162  if (($_GET["subCmd"] == "") && $_SESSION["cont_media_insert"] != "")
163  {
164  $_GET["subCmd"] = $_SESSION["cont_media_insert"];
165  }
166 
167  switch ($_GET["subCmd"])
168  {
169  case "insertFromPool":
170  $this->insertFromPool($a_post_cmd, $a_submit_cmd);
171  break;
172 
173  case "poolSelection":
174  $this->poolSelection();
175  break;
176 
177  case "selectPool":
178  $this->selectPool();
179  break;
180 
181  case "insertNew":
182  default:
183  $this->getTabs($ilTabs, true);
184  $ilTabs->setSubTabActive("cont_new_mob");
185 
186  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mob_new.html",
187  "./Services/MediaObjects");
188  $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_insert_mob"));
189  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
190 
191  $this->displayValidationError();
192 
193  // select fields for number of columns
194  $this->tpl->setVariable("TXT_STANDARD_VIEW", $this->lng->txt("cont_std_view"));
195  $this->tpl->setVariable("TXT_FILE", $this->lng->txt("cont_file"));
196  $this->tpl->setVariable("TXT_REFERENCE", $this->lng->txt("cont_reference"));
197  $this->tpl->setVariable("TXT_REF_HELPTEXT", $this->lng->txt("cont_ref_helptext"));
198  $this->tpl->setVariable("TXT_WIDTH", $this->lng->txt("cont_width"));
199  $this->tpl->setVariable("TXT_HEIGHT", $this->lng->txt("cont_height"));
200  $this->tpl->setVariable("TXT_ORIGINAL_SIZE", $this->lng->txt("cont_orig_size"));
201  $this->tpl->setVariable("TXT_CAPTION", $this->lng->txt("cont_caption"));
202  $this->tpl->setVariable("TXT_FULLSCREEN_VIEW", $this->lng->txt("cont_fullscreen"));
203  $this->tpl->setVariable("TXT_PARAMETER", $this->lng->txt("cont_parameter"));
204  $this->tpl->setVariable("TXT_RESIZE", $this->lng->txt("cont_resize_image"));
205  $this->tpl->setVariable("TXT_RESIZE_EXPLANATION", $this->lng->txt("cont_resize_explanation"));
206  // $this->tpl->parseCurrentBlock();
207 
208  // operations
209  $this->tpl->setCurrentBlock("commands");
210  $this->tpl->setVariable("BTN_NAME", $a_submit_cmd);
211  $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
212  $this->tpl->setVariable("BTN_CANCEL", "cancelCreate");
213  $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
214  $this->tpl->parseCurrentBlock();
215  break;
216  }
217  }
218 
222  function insertFromPool($a_post_cmd = "edpost", $a_submit_cmd = "create_mob")
223  {
224  global $ilCtrl, $ilAccess, $ilTabs, $tpl, $lng;
225 
226 
227  if ($_SESSION["cont_media_pool"] != "" &&
228  $ilAccess->checkAccess("write", "", $_SESSION["cont_media_pool"])
229  && ilObject::_lookupType(ilObject::_lookupObjId($_SESSION["cont_media_pool"])) == "mep")
230  {
231  $tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
232  $tpl->setCurrentBlock("btn_cell");
233  $ilCtrl->setParameter($this, "subCmd", "poolSelection");
234  $tpl->setVariable("BTN_LINK",
235  $ilCtrl->getLinkTarget($this, "insert"));
236  $ilCtrl->setParameter($this, "subCmd", "");
237  $tpl->setVariable("BTN_TXT", $lng->txt("cont_select_media_pool"));
238  $tpl->parseCurrentBlock();
239 
240  $this->getTabs($ilTabs, true);
241  $ilTabs->setSubTabActive("cont_mob_from_media_pool");
242 
243  include_once("./Modules/MediaPool/classes/class.ilObjMediaPool.php");
244  include_once("./Modules/MediaPool/classes/class.ilMediaPoolTableGUI.php");
245  $pool = new ilObjMediaPool($_SESSION["cont_media_pool"]);
246  $ilCtrl->setParameter($this, "subCmd", "insertFromPool");
247  $mpool_table = new ilMediaPoolTableGUI($this, "insert", $pool, "mep_folder",
249 
250  $tpl->setContent($mpool_table->getHTML());
251  }
252  else
253  {
254  $this->poolSelection();
255  }
256  }
257 
261  function selectPool()
262  {
263  global $ilCtrl;
264 
265  $_SESSION["cont_media_pool"] = $_GET["pool_ref_id"];
266  $ilCtrl->setParameter($this, "subCmd", "insertFromPool");
267  $ilCtrl->redirect($this, "insert");
268  }
269 
273  function poolSelection()
274  {
275  global $ilCtrl, $tree, $tpl, $ilTabs;
276 
277  $this->getTabs($ilTabs, true);
278  $ilTabs->setSubTabActive("cont_mob_from_media_pool");
279 
280  include_once "./Services/COPage/classes/class.ilPoolSelectorGUI.php";
281  $exp = new ilPoolSelectorGUI($this->ctrl->getLinkTarget($this, "insert"));
282  if ($_GET["expand"] == "")
283  {
284  $expanded = $tree->readRootId();
285  }
286  else
287  {
288  $expanded = $_GET["expand"];
289  }
290  $exp->setExpand($expanded);
291 
292  $exp->setTargetGet("sel_id");
293  $this->ctrl->setParameter($this, "target_type", $a_type);
294  $ilCtrl->setParameter($this, "subCmd", "poolSelection");
295  $exp->setParamsGet($this->ctrl->getParameterArray($this, "insert"));
296 
297  // filter
298  $exp->setFiltered(true);
299  $exp->setFilterMode(IL_FM_POSITIVE);
300  $exp->addFilter("root");
301  $exp->addFilter("cat");
302  $exp->addFilter("grp");
303  $exp->addFilter("fold");
304  $exp->addFilter("crs");
305  $exp->addFilter("mep");
306 
307  $sel_types = array('mep');
308 
309  $exp->setOutput(0);
310 
311  $tpl->setContent($exp->getOutput());
312  }
313 
314 
318  function &create($a_create_alias = true)
319  {
320  global $ilCtrl;
321 
322 
323  if ($_GET["subCmd"] == "insertFromPool")
324  {
325  if (is_array($_POST["id"]))
326  {
327  for($i = count($_POST["id"]) - 1; $i>=0; $i--)
328  {
329  include_once("./Services/COPage/classes/class.ilPCMediaObject.php");
330  $this->content_obj = new ilPCMediaObject($this->dom);
331  $this->content_obj->readMediaObject($_POST["id"][$i]);
332  $this->content_obj->createAlias($this->pg_obj, $_GET["hier_id"], $this->pc_id);
333  }
334  $this->updated = $this->pg_obj->update();
335  }
336 
337  $ilCtrl->returnToParent($this);
338  }
339 
340  // determinte title and format
341  if ($_POST["standard_type"] == "File")
342  {
343  $title = $_FILES['standard_file']['name'];
344  }
345  else
346  {
347  $title = $_POST["standard_reference"];
348  }
349 
350  // create dummy object in db (we need an id)
351  include_once("./Services/COPage/classes/class.ilPCMediaObject.php");
352  $this->content_obj = new ilPCMediaObject($this->dom);
353  $this->content_obj->createMediaObject();
354  $media_obj = $this->content_obj->getMediaObject();
355  $media_obj->setTitle($title);
356 
357  $media_obj->setDescription("");
358  $media_obj->create();
359 
360  // determine and create mob directory, move uploaded file to directory
361  $media_obj->createDirectory();
362  $mob_dir = ilObjMediaObject::_getDirectory($media_obj->getId());
363 
364  $media_item =& new ilMediaItem();
365  $media_obj->addMediaItem($media_item);
366  $media_item->setPurpose("Standard");
367 
368  if ($_POST["standard_type"] == "File")
369  {
370  $file = $mob_dir."/".$_FILES['standard_file']['name'];
371  //move_uploaded_file($_FILES['standard_file']['tmp_name'], $file);
372  if (!ilUtil::moveUploadedFile($_FILES['standard_file']['tmp_name'],
373  $_FILES['standard_file']['name'], $file, false))
374  {
375  $media_obj->delete();
376  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
377  return;
378  }
379 
380  // get mime type
382  $location = $_FILES['standard_file']['name'];
383 
384  // resize standard images
385  if ($_POST["standard_size"] != "original" &&
386  $_POST["standard_resize"] == "y" &&
387  is_int(strpos($format, "image")))
388  {
389  $location = ilObjMediaObject::_resizeImage($file, $_POST["standard_width"],
390  $_POST["standard_height"]);
391  }
392 
393  // set real meta and object data
394  $media_item->setFormat($format);
395  $media_item->setLocation($location);
396  $media_item->setLocationType("LocalFile");
397  $media_obj->setTitle($_FILES['standard_file']['name']);
398  }
399  else // standard type: reference
400  {
401  $format = ilObjMediaObject::getMimeType($_POST["standard_reference"]);
402  $media_item->setFormat($format);
403  $media_item->setLocation($_POST["standard_reference"]);
404  $media_item->setLocationType("Reference");
405  $media_obj->setTitle($_POST["standard_reference"]);
406  }
407 
408  $media_obj->setDescription($format);
409 
410  // determine width and height of known image types
411  if ($_POST["standard_size"] == "original")
412  {
413  if (ilUtil::deducibleSize($format))
414  {
415  $size = getimagesize($file);
416  $media_item->setWidth($size[0]);
417  $media_item->setHeight($size[1]);
418  }
419  else
420  {
421  $media_item->setWidth(500);
422  $media_item->setHeight(400);
423  }
424  }
425  else
426  {
427  $media_item->setWidth($_POST["standard_width"]);
428  $media_item->setHeight($_POST["standard_height"]);
429  }
430 
431  if ($_POST["standard_caption"] != "")
432  {
433  $media_item->setCaption(ilUtil::stripSlashes($_POST["standard_caption"]));
434  }
435 
436  if ($_POST["standard_param"] != "")
437  {
438  $media_item->setParameters(ilUtil::stripSlashes(utf8_decode($_POST["standard_param"])));
439  }
440 
441  $media_item->setHAlign("Left");
442 
443  // fullscreen view
444  if ($_POST["fullscreen"] == "y")
445  {
446  $media_item =& new ilMediaItem();
447  $media_obj->addMediaItem($media_item);
448  $media_item->setPurpose("Fullscreen");
449 
450  // file
451  if ($_POST["full_type"] == "File")
452  {
453  if ($_FILES['full_file']['name'] != "")
454  {
455  $file = $mob_dir."/".$_FILES['full_file']['name'];
456  //move_uploaded_file($_FILES['full_file']['tmp_name'], $file);
457  if (!ilUtil::moveUploadedFile($_FILES['full_file']['tmp_name'],
458  $_FILES['full_file']['name'], $file, false))
459  {
460  $media_obj->delete();
461  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
462  return;
463  }
464  }
465 
466  if ($_FILES['full_file']['name'] != "" ||
467  ($_POST["full_size"] != "original" &&
468  $_POST["full_resize"] == "y" &&
469  is_int(strpos($format, "image")))
470  )
471  {
472  // set real meta and object data
474  $location = $_FILES['full_file']['name'];
475 
476  // resize fullscreen images
477  if ($_POST["full_size"] != "original" &&
478  $_POST["full_resize"] == "y" &&
479  is_int(strpos($format, "image")))
480  {
481  $location = ilObjMediaObject::_resizeImage($file, $_POST["full_width"],
482  $_POST["full_height"]);
483  }
484  }
485 
486  $media_item->setFormat($format);
487  $media_item->setLocation($location);
488  $media_item->setLocationType("LocalFile");
489 
490  }
491  else // reference
492  {
493  if ($_POST["full_reference"] != "")
494  {
495  $format = ilObjMediaObject::getMimeType($_POST["full_reference"]);
496  $media_item->setFormat($format);
497  $media_item->setLocation($_POST["full_reference"]);
498  $media_item->setLocationType("Reference");
499  }
500  }
501 
502  // determine width and height of known image types
503  if ($_POST["full_size"] == "original")
504  {
505  if (ilUtil::deducibleSize($format))
506  {
507  $size = getimagesize($file);
508  $media_item->setWidth($size[0]);
509  $media_item->setHeight($size[1]);
510  }
511  else
512  {
513  $media_item->setWidth(500);
514  $media_item->setHeight(400);
515  }
516  }
517  else
518  {
519  $media_item->setWidth($_POST["full_width"]);
520  $media_item->setHeight($_POST["full_height"]);
521  }
522 
523  if ($_POST["full_caption"] != "")
524  {
525  $media_item->setCaption(ilUtil::stripSlashes($_POST["full_caption"]));
526  }
527 
528  if ($_POST["full_param"] != "")
529  {
530  $media_item->setParameters(ilUtil::stripSlashes(utf8_decode($_POST["full_param"])));
531  }
532 
533  }
534  ilUtil::renameExecutables($mob_dir);
535  $media_obj->update();
536 
537  if ($a_create_alias)
538  {
539  // need a pcmediaobject here
540  //$this->node = $this->createPageContentNode();
541 
542  $this->content_obj->createAlias($this->pg_obj, $this->hier_id, $this->pc_id);
543  $this->updated = $this->pg_obj->update();
544  if ($this->updated === true)
545  {
546  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
547  }
548  else
549  {
550  $this->insert();
551  }
552  }
553  else
554  {
555  return $this->content_obj;
556  }
557  }
558 
559 
563  function editAlias()
564  {
565  //add template for view button
566  $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
567 
568  //$item_nr = $this->content_obj->getMediaItemNr("Standard");
569  $std_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard",
570  $this->content_obj->getPcId());
571  $std_item =& $this->content_obj->getMediaObject()->getMediaItem("Standard");
572 
573  // edit media alias template
574  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mob_alias_properties.html", "Services/COPage");
575  $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_edit_mob_alias_prop"));
576  $this->tpl->setVariable("TXT_STANDARD_VIEW", $this->lng->txt("cont_std_view"));
577  $this->tpl->setVariable("TXT_DERIVE", $this->lng->txt("cont_derive_from_obj"));
578  $this->tpl->setVariable("TXT_TYPE", $this->lng->txt("cont_".strtolower($std_item->getLocationType())));
579  $this->tpl->setVariable("TXT_LOCATION", $std_item->getLocation());
580  $this->tpl->setVariable("TXT_FORMAT", $this->lng->txt("cont_format"));
581  $this->tpl->setVariable("VAL_FORMAT", $std_item->getFormat());
582  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
583 
584  $this->displayValidationError();
585 
586  // width
587  $this->tpl->setVariable("TXT_MOB_WIDTH", $this->lng->txt("cont_width"));
588  $this->tpl->setVariable("INPUT_MOB_WIDTH", "mob_width");
589  $this->tpl->setVariable("VAL_MOB_WIDTH", $std_alias_item->getWidth());
590 
591  // height
592  $this->tpl->setVariable("TXT_MOB_HEIGHT", $this->lng->txt("cont_height"));
593  $this->tpl->setVariable("INPUT_MOB_HEIGHT", "mob_height");
594  $this->tpl->setVariable("VAL_MOB_HEIGHT", $std_alias_item->getHeight());
595 
596  // caption
597  $this->tpl->setVariable("TXT_CAPTION", $this->lng->txt("cont_caption"));
598  $this->tpl->setVariable("INPUT_CAPTION", "mob_caption");
599  $this->tpl->setVariable("VAL_CAPTION", $std_alias_item->getCaption());
600 // $this->tpl->parseCurrentBlock();
601 
602  // parameters
603  $this->tpl->setVariable("TXT_PARAMETER", $this->lng->txt("cont_parameter"));
604  $this->tpl->setVariable("INPUT_PARAMETERS", "mob_parameters");
605  $this->tpl->setVariable("VAL_PARAMETERS", $std_alias_item->getParameterString());
606 // $this->tpl->parseCurrentBlock();
607 
608  // object default values
609  $this->tpl->setVariable("VAL_OBJ_ST_SIZE", $std_item->getWidth()." / ".$std_item->getHeight());
610  $this->tpl->setVariable("VAL_OBJ_ST_CAPTION", $std_item->getCaption());
611  $this->tpl->setVariable("VAL_OBJ_ST_PARAMETERS", $std_item->getParameterString());
612  if ($std_alias_item->definesSize())
613  {
614  $this->tpl->setVariable("DERIVE_ST_SIZE_N", "checked=\"1\"");
615  }
616  else
617  {
618  $this->tpl->setVariable("DERIVE_ST_SIZE_Y", "checked=\"1\"");
619  }
620  if ($std_alias_item->definesCaption())
621  {
622  $this->tpl->setVariable("DERIVE_ST_CAPTION_N", "checked=\"1\"");
623  }
624  else
625  {
626  $this->tpl->setVariable("DERIVE_ST_CAPTION_Y", "checked=\"1\"");
627  }
628  if ($std_alias_item->definesParameters())
629  {
630  $this->tpl->setVariable("DERIVE_ST_PARAMETER_N", "checked=\"1\"");
631  }
632  else
633  {
634  $this->tpl->setVariable("DERIVE_ST_PARAMETER_Y", "checked=\"1\"");
635  }
636 
637  // fullscreen view
638  if($this->content_obj->getMediaObject()->hasFullScreenItem())
639  {
640  $this->tpl->setCurrentBlock("fullscreen");
641  $full_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Fullscreen",
642  $this->content_obj->getPcId());
643  $full_item =& $this->content_obj->getMediaObject()->getMediaItem("Fullscreen");
644 
645  $this->tpl->setVariable("TXT_FULLSCREEN_VIEW", $this->lng->txt("cont_fullscreen"));
646  $this->tpl->setVariable("TXT_FULL_TYPE", $this->lng->txt("cont_".strtolower($full_item->getLocationType())));
647  $this->tpl->setVariable("TXT_FULL_LOCATION", $full_item->getLocation());
648 
649  $this->tpl->setVariable("TXT_FULL_FORMAT", $this->lng->txt("cont_format"));
650  $this->tpl->setVariable("VAL_FULL_FORMAT", $full_item->getFormat());
651 
652  // width text
653  $this->tpl->setVariable("TXT_FULL_WIDTH", $this->lng->txt("cont_width"));
654  $this->tpl->setVariable("INPUT_FULL_WIDTH", "full_width");
655 
656  // height text
657  $this->tpl->setVariable("TXT_FULL_HEIGHT", $this->lng->txt("cont_height"));
658  $this->tpl->setVariable("INPUT_FULL_HEIGHT", "full_height");
659 
660  // caption text
661  $this->tpl->setVariable("TXT_FULL_CAPTION", $this->lng->txt("cont_caption"));
662  $this->tpl->setVariable("INPUT_FULL_CAPTION", "full_caption");
663 
664  // parameters text
665  $this->tpl->setVariable("TXT_FULL_PARAMETER", $this->lng->txt("cont_parameter"));
666  $this->tpl->setVariable("INPUT_FULL_PARAMETERS", "full_parameters");
667 
668  // object default values
669  $this->tpl->setVariable("VAL_OBJ_FULL_SIZE", $full_item->getWidth()." / ".$full_item->getHeight());
670  $this->tpl->setVariable("VAL_OBJ_FULL_CAPTION", $full_item->getCaption());
671  $this->tpl->setVariable("VAL_OBJ_FULL_PARAMETERS", $full_item->getParameterString());
672  if ($full_alias_item->definesSize())
673  {
674  $this->tpl->setVariable("DERIVE_FULL_SIZE_N", "checked=\"1\"");
675  }
676  else
677  {
678  $this->tpl->setVariable("DERIVE_FULL_SIZE_Y", "checked=\"1\"");
679  }
680  if ($full_alias_item->definesCaption())
681  {
682  $this->tpl->setVariable("DERIVE_FULL_CAPTION_N", "checked=\"1\"");
683  }
684  else
685  {
686  $this->tpl->setVariable("DERIVE_FULL_CAPTION_Y", "checked=\"1\"");
687  }
688  if ($full_alias_item->definesParameters())
689  {
690  $this->tpl->setVariable("DERIVE_FULL_PARAMETER_N", "checked=\"1\"");
691  }
692  else
693  {
694  $this->tpl->setVariable("DERIVE_FULL_PARAMETER_Y", "checked=\"1\"");
695  }
696 
697  if ($full_alias_item->exists())
698  {
699  $this->tpl->setVariable("FULLSCREEN_CHECKED", "checked=\"1\"");
700 
701  // width
702  $this->tpl->setVariable("VAL_FULL_WIDTH", $full_alias_item->getWidth());
703 
704  // height
705  $this->tpl->setVariable("VAL_FULL_HEIGHT", $full_alias_item->getHeight());
706 
707  // caption
708  $this->tpl->setVariable("VAL_FULL_CAPTION", $full_alias_item->getCaption());
709 
710  // parameters
711  $this->tpl->setVariable("VAL_FULL_PARAMETERS", $full_alias_item->getParameterString());
712  }
713 
714  $this->tpl->parseCurrentBlock();
715  }
716 
717  // operations
718  $this->tpl->setCurrentBlock("commands");
719  $this->tpl->setVariable("BTN_NAME", "saveAliasProperties");
720  $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
721  $this->tpl->parseCurrentBlock();
722 
723  }
724 
725 
730  {
731  $std_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard",
732  $this->content_obj->getPcId());
733  $full_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Fullscreen",
734  $this->content_obj->getPcId());
735 
736  // standard size
737  if($_POST["derive_st_size"] == "y")
738  {
739  $std_item->deriveSize();
740  }
741  else
742  {
743  $std_item->setWidth($_POST["mob_width"]);
744  $std_item->setHeight($_POST["mob_height"]);
745  }
746 
747  // standard caption
748  if($_POST["derive_st_caption"] == "y")
749  {
750  $std_item->deriveCaption();
751  }
752  else
753  {
754  $std_item->setCaption(ilUtil::stripSlashes($_POST["mob_caption"]));
755  }
756 
757  // standard parameters
758  if($_POST["derive_st_parameter"] == "y")
759  {
760  $std_item->deriveParameters();
761  }
762  else
763  {
764  $std_item->setParameters(ilUtil::extractParameterString(ilUtil::stripSlashes(utf8_decode($_POST["mob_parameters"]))));
765  }
766 
767  if($this->content_obj->getMediaObject()->hasFullscreenItem())
768  {
769  if ($_POST["fullscreen"] == "y")
770  {
771  if (!$full_item->exists())
772  {
773  $full_item->insert();
774  }
775 
776  // fullscreen size
777  if($_POST["derive_full_size"] == "y")
778  {
779  $full_item->deriveSize();
780  }
781  else
782  {
783  $full_item->setWidth($_POST["full_width"]);
784  $full_item->setHeight($_POST["full_height"]);
785  }
786 
787  // fullscreen caption
788  if($_POST["derive_full_caption"] == "y")
789  {
790  $full_item->deriveCaption();
791  }
792  else
793  {
794  $full_item->setCaption(ilUtil::stripSlashes($_POST["full_caption"]));
795  }
796 
797  // fullscreen parameters
798  if($_POST["derive_full_parameter"] == "y")
799  {
800  $full_item->deriveParameters();
801  }
802  else
803  {
804  $full_item->setParameters(ilUtil::extractParameterString(ilUtil::stripSlashes(utf8_decode($_POST["full_parameters"]))));
805  }
806  }
807  else
808  {
809  if ($full_item->exists())
810  {
811  $full_item->delete();
812  }
813  }
814  }
815 
816  $this->updated = $this->pg_obj->update();
817  if ($this->updated === true)
818  {
819  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
820  }
821  else
822  {
823  $this->pg_obj->addHierIDs();
824  $this->editAlias();
825  }
826  }
827 
831  function copyToClipboard()
832  {
833  $this->ilias->account->addObjectToClipboard($this->content_obj->getMediaObject()->getId(), $this->content_obj->getMediaObject()->getType()
834  , $this->content_obj->getMediaObject()->getTitle());
835  ilUtil::sendInfo($this->lng->txt("copied_to_clipboard"), true);
836  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
837  }
838 
842  function centerAlign()
843  {
844  $std_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard",
845  $this->content_obj->getPcId());
846  $std_alias_item->setHorizontalAlign("Center");
847  $_SESSION["il_pg_error"] = $this->pg_obj->update();
848  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
849  }
850 
854  function leftAlign()
855  {
856  $std_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard",
857  $this->content_obj->getPcId());
858  $std_alias_item->setHorizontalAlign("Left");
859  $_SESSION["il_pg_error"] = $this->pg_obj->update();
860  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
861  }
862 
866  function rightAlign()
867  {
868  $std_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard",
869  $this->content_obj->getPcId());
870  $std_alias_item->setHorizontalAlign("Right");
871  $_SESSION["il_pg_error"] = $this->pg_obj->update();
872  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
873  }
874 
878  function leftFloatAlign()
879  {
880  $std_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard",
881  $this->content_obj->getPcId());
882  $std_alias_item->setHorizontalAlign("LeftFloat");
883  $_SESSION["il_pg_error"] = $this->pg_obj->update();
884  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
885  }
886 
890  function rightFloatAlign()
891  {
892  $std_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard",
893  $this->content_obj->getPcId());
894  $std_alias_item->setHorizontalAlign("RightFloat");
895  $_SESSION["il_pg_error"] = $this->pg_obj->update();
896  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
897  }
898 
905  function getTabs(&$tab_gui, $a_create = false)
906  {
907  global $ilCtrl, $ilTabs;
908 
909  if (!$a_create)
910  {
911  $ilTabs->addTarget("cont_mob_inst_prop",
912  $ilCtrl->getLinkTarget($this, "editAlias"), "editAlias",
913  get_class($this));
914 
915  if ($this->getEnabledMapAreas())
916  {
917  $ilTabs->addTarget("cont_inst_map_areas",
918  $ilCtrl->getLinkTargetByClass("ilpcimagemapeditorgui", "editMapAreas"), array(),
919  get_class("ilpcimagemapeditorgui"));
920  }
921  }
922  else
923  {
924  $ilCtrl->setParameter($this, "subCmd", "insertNew");
925  $ilTabs->addSubTabTarget("cont_new_mob",
926  $ilCtrl->getLinkTarget($this, "insert"), "insert");
927 
928  $ilCtrl->setParameter($this, "subCmd", "insertFromPool");
929  $ilTabs->addSubTabTarget("cont_mob_from_media_pool",
930  $ilCtrl->getLinkTarget($this, "insert"), "insert");
931  $ilCtrl->setParameter($this, "subCmd", "");
932  }
933  }
934 
935 }
936 ?>