ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilPCInteractiveImageGUI Class Reference

User interface class for interactive images. More...

+ Inheritance diagram for ilPCInteractiveImageGUI:
+ Collaboration diagram for ilPCInteractiveImageGUI:

Public Member Functions

 __construct (ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id, string $a_pc_id="")
 
 executeCommand ()
 
 getTabs (bool $a_create=false, bool $a_change_obj_ref=false)
 Add tabs to ilTabsGUI object. More...
 
 insert (string $a_post_cmd="edpost", string $a_submit_cmd="create_mob", bool $a_input_error=false)
 Insert new media object form. More...
 
 edit ()
 
 editBaseImage ()
 
 initForm (string $a_mode="edit")
 
 create ()
 
 update ()
 Update (base image) More...
 
 centerAlign ()
 Align media object to center. More...
 
 leftAlign ()
 align media object to left More...
 
 rightAlign ()
 align media object to right More...
 
 leftFloatAlign ()
 align media object to left, floating text More...
 
 rightFloatAlign ()
 align media object to right, floating text More...
 
 listOverlayImages ()
 
 addOverlayImages (ilPropertyFormGUI $a_form=null)
 
 initAddOverlaysForm ()
 
 uploadOverlayImages ()
 
 confirmDeleteOverlays ()
 
 deleteOverlays ()
 
 addPopup ()
 
 savePopups ()
 
 confirmPopupDeletion ()
 
 deletePopups ()
 
 getImportFormAdapter ()
 
 handleUploadResult (FileUpload $upload, UploadResult $result)
 
 editor ()
 
 getOverlayUploadFormAdapter (array $path=null)
 
 handleOverlayUpload (FileUpload $upload, UploadResult $result)
 
 getPopupFormAdapter ()
 
 getBackgroundPropertiesFormAdapter (array $path=null)
 
 handleBackgroundUpload (FileUpload $upload, UploadResult $result)
 
- Public Member Functions inherited from ilPageContentGUI
 __construct (ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id="", string $a_pc_id="0")
 
 setContentObject (ilPageContent $a_val)
 
 getContentObject ()
 
 setPage (ilPageObject $a_val)
 
 getPage ()
 
 setPageConfig (ilPageConfig $a_val)
 
 getPageConfig ()
 
 setStyleId (int $a_styleid)
 
 getStyleId ()
 
 getStyle ()
 
 getCharacteristicsOfCurrentStyle (array $a_type)
 Get characteristics of current style and call setCharacteristics, if style is given. More...
 
 setCharacteristics (array $a_chars)
 
 getCharacteristics ()
 
 getHierId ()
 
 setHierId (string $a_hier_id)
 set hierarchical id in dom object More...
 
 delete ()
 
 displayValidationError ()
 
 cancelCreate ()
 cancel creating page content More...
 
 cancelUpdate ()
 cancel update More...
 
 cancel ()
 Cancel. More...
 
 deactivate ()
 gui function set enabled if is not enabled and vice versa More...
 
 cut ()
 Cut single element. More...
 
 copy ()
 Copy single element. More...
 
 getTemplateOptions (string $a_type="")
 Get table templates. More...
 

Protected Member Functions

 forwardFormToUploadHandler ()
 
 initInteractiveImageEditor ()
 
- Protected Member Functions inherited from ilPageContentGUI
 redirectToParent (string $hier_id="")
 
 getParentReturn (string $hier_id="")
 
 updateAndReturn ()
 
 setCurrentTextLang (string $lang_key)
 
 getCurrentTextLang ()
 
 setEditorToolContext ()
 
 initEditor ()
 
 getEditorScriptTag (string $form_pc_id="", string $form_cname="")
 

Protected Attributes

ILIAS COPage PC InteractiveImage IIMManager $iim_manager
 
ILIAS COPage PC InteractiveImage GUIService $iim_gui
 
ilTabsGUI $tabs
 
ilToolbarGUI $toolbar
 
- Protected Attributes inherited from ilPageContentGUI
ILIAS COPage Editor GUIService $editor_gui
 
ILIAS COPage InternalGUIService $gui
 
EditSessionRepository $edit_repo
 
string $pc_id = ""
 
array $chars
 
ilObjStyleSheet $style = null
 
ilLogger $log
 
int $styleid = 0
 
EditGUIRequest $request
 
string $sub_command = ""
 
int $requested_ref_id = 0
 
ILIAS GlobalScreen ScreenContext ContextServices $tool_context
 
Style Content CharacteristicManager $char_manager
 

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 
- Data Fields inherited from ilPageContentGUI
ilPageContent $content_obj
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilPageObject $pg_obj
 
string $hier_id = ""
 
DOMDocument $dom
 
 $updated
 
string $target_script = ""
 
string $return_location = ""
 
ilPageConfig $page_config = null
 
- Static Public Attributes inherited from ilPageContentGUI
static string $style_selector_reset = "margin-top:2px; margin-bottom:2px; text-indent:0px; position:static; float:none; width: auto;"
 
- Static Protected Attributes inherited from ilPageContentGUI
static array $common_bb_buttons
 

Detailed Description

User interface class for interactive images.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de ilPCInteractiveImageGUI: ilPCIIMTriggerEditorGUI, ilRepoStandardUploadHandlerGUI

Definition at line 31 of file class.ilPCInteractiveImageGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPCInteractiveImageGUI::__construct ( ilPageObject  $a_pg_obj,
?ilPageContent  $a_content_obj,
string  $a_hier_id,
string  $a_pc_id = "" 
)

Definition at line 38 of file class.ilPCInteractiveImageGUI.php.

References $DIC, ILIAS\MetaData\Repository\Validation\Data\__construct(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\tabs(), and ILIAS\Repository\toolbar().

43  {
44  global $DIC;
45 
46  $this->tpl = $DIC["tpl"];
47  $this->lng = $DIC->language();
48  $this->tabs = $DIC->tabs();
49  $this->ctrl = $DIC->ctrl();
50  $this->toolbar = $DIC->toolbar();
51  parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
52  $this->iim_gui = $DIC->copage()->internal()->gui()->pc()->interactiveImage();
53  $this->iim_manager = $DIC->copage()->internal()->domain()->pc()->interactiveImage();
54  }
global $DIC
Definition: feed.php:28
__construct(VocabulariesInterface $vocabularies)
+ Here is the call graph for this function:

Member Function Documentation

◆ addOverlayImages()

ilPCInteractiveImageGUI::addOverlayImages ( ilPropertyFormGUI  $a_form = null)

Definition at line 441 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$tpl, initAddOverlaysForm(), and ilGlobalTemplateInterface\setContent().

Referenced by uploadOverlayImages().

441  : void
442  {
443  $tpl = $this->tpl;
444 
445  if ($a_form) {
446  $form = $a_form;
447  } else {
448  $form = $this->initAddOverlaysForm();
449  }
450 
451  $tpl->setContent($form->getHTML());
452  }
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addPopup()

ilPCInteractiveImageGUI::addPopup ( )

Definition at line 589 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, and ilLanguage\txt().

589  : void
590  {
591  $ilCtrl = $this->ctrl;
592  $lng = $this->lng;
593 
594  $this->content_obj->addContentPopup();
595  $this->pg_obj->update();
596  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
597  $ilCtrl->redirect($this, "listContentPopups");
598  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
+ Here is the call graph for this function:

◆ centerAlign()

ilPCInteractiveImageGUI::centerAlign ( )

Align media object to center.

Definition at line 335 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\getHierId(), ilMediaAliasItem\setHorizontalAlign(), and ilPageContentGUI\updateAndReturn().

335  : void
336  {
337  $std_alias_item = new ilMediaAliasItem(
338  $this->content_obj->getDomDoc(),
339  $this->getHierId(),
340  "Standard",
341  $this->content_obj->getPCId(),
342  "InteractiveImage"
343  );
344  $std_alias_item->setHorizontalAlign("Center");
345  $this->updateAndReturn();
346  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setHorizontalAlign(string $a_halign)
+ Here is the call graph for this function:

◆ confirmDeleteOverlays()

ilPCInteractiveImageGUI::confirmDeleteOverlays ( )

Definition at line 511 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$ctrl, Vendor\Package\$d, ilPageContentGUI\$lng, $tabs, ilPageContentGUI\$tpl, ilGlobalTemplateInterface\setContent(), ilTabsGUI\setTabActive(), and ilLanguage\txt().

511  : void
512  {
513  $ilCtrl = $this->ctrl;
514  $tpl = $this->tpl;
515  $lng = $this->lng;
516  $ilTabs = $this->tabs;
517 
518  $ilTabs->setTabActive("list_overlays");
519 
520  $files = $this->request->getStringArray("file");
521  if (count($files) == 0) {
522  $this->tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
523  $ilCtrl->redirect($this, "listOverlayImages");
524  } else {
525  $cgui = new ilConfirmationGUI();
526  $cgui->setFormAction($ilCtrl->getFormAction($this));
527  $cgui->setHeaderText($lng->txt("cont_really_delete_overlays"));
528  $cgui->setCancel($lng->txt("cancel"), "listOverlayImages");
529  $cgui->setConfirm($lng->txt("delete"), "deleteOverlays");
530 
531  foreach ($files as $i => $d) {
532  $cgui->addItem("file[]", $i, $i);
533  }
534 
535  $tpl->setContent($cgui->getHTML());
536  }
537  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setTabActive(string $a_id)
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
+ Here is the call graph for this function:

◆ confirmPopupDeletion()

ilPCInteractiveImageGUI::confirmPopupDeletion ( )

Definition at line 614 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$ctrl, Vendor\Package\$d, ilPageContentGUI\$lng, $tabs, ilPageContentGUI\$tpl, ilGlobalTemplateInterface\setContent(), ilTabsGUI\setTabActive(), and ilLanguage\txt().

614  : void
615  {
616  $ilCtrl = $this->ctrl;
617  $tpl = $this->tpl;
618  $lng = $this->lng;
619  $ilTabs = $this->tabs;
620 
621  $ilTabs->setTabActive("content_popups");
622 
623  $tids = $this->request->getStringArray("tid");
624  $titles = $this->request->getStringArray("title");
625 
626  if (count($tids) == 0) {
627  $this->tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
628  $ilCtrl->redirect($this, "listContentPopups");
629  } else {
630  $cgui = new ilConfirmationGUI();
631  $cgui->setFormAction($ilCtrl->getFormAction($this));
632  $cgui->setHeaderText($lng->txt("cont_really_delete_popups"));
633  $cgui->setCancel($lng->txt("cancel"), "listContentPopups");
634  $cgui->setConfirm($lng->txt("delete"), "deletePopups");
635 
636  foreach ($tids as $i => $d) {
637  $cgui->addItem("tid[]", $i, $titles[$i]);
638  }
639 
640  $tpl->setContent($cgui->getHTML());
641  }
642  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setTabActive(string $a_id)
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
+ Here is the call graph for this function:

◆ create()

ilPCInteractiveImageGUI::create ( )

Definition at line 212 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$ctrl, Vendor\Package\$e, ilPageContentGUI\$lng, $location, ilPageContentGUI\$tpl, ilObjMediaObject\_getDirectory(), ILIAS\Repository\ctrl(), ilPageContentGUI\displayValidationError(), ilObjMediaObject\getMimeType(), ilPageContentGUI\getPage(), initForm(), insert(), ILIAS\Repository\lng(), ilFileUtils\moveUploadedFile(), ilFileUtils\renameExecutables(), ilGlobalTemplateInterface\setContent(), ilPageContentGUI\setHierId(), and ilLanguage\txt().

212  : void
213  {
214  $ilCtrl = $this->ctrl;
215  $lng = $this->lng;
216  $tpl = $this->tpl;
217 
218  $form = $this->initForm("create");
219  if (!$form->checkInput()) {
220  $this->displayValidationError();
221  $form->setValuesByPost();
222  $tpl->setContent($form->getHTML());
223  return;
224  }
225 
226  $this->content_obj = new ilPCInteractiveImage($this->getPage());
227  $this->content_obj->createMediaObject();
228  $media_obj = $this->content_obj->getMediaObject();
229  $media_obj->setTitle($_FILES['image_file']['name']);
230  $media_obj->create();
231  $mob_dir = ilObjMediaObject::_getDirectory($media_obj->getId());
232  // $media_obj->setStandardType("File");
233  $media_obj->createDirectory();
234  $media_item = new ilMediaItem();
235  $media_obj->addMediaItem($media_item);
236  $media_item->setPurpose("Standard");
237 
238  $file = $mob_dir . "/" . $_FILES['image_file']['name'];
239  try {
241  $_FILES['image_file']['tmp_name'],
242  $_FILES['image_file']['name'],
243  $file
244  );
245  } catch (ilException $e) {
246  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("file_is_infected"), true);
247  return;
248  }
249  // get mime type
250  $format = ilObjMediaObject::getMimeType($file);
251  $location = $_FILES['image_file']['name'];
252 
253  // set real meta and object data
254  $media_item->setFormat($format);
255  $media_item->setLocation($location);
256  $media_item->setLocationType("LocalFile");
257 
259  $media_obj->update();
260 
261  $this->content_obj->createAlias($this->pg_obj, $this->hier_id, $this->pc_id);
262  $this->updated = $this->pg_obj->update();
263  if ($this->updated === true) {
264  $this->pg_obj->stripHierIDs();
265  $this->pg_obj->addHierIDs();
266  $ilCtrl->setParameter($this, "hier_id", $this->content_obj->readHierId());
267  $ilCtrl->setParameter($this, "pc_id", $this->content_obj->readPCId());
268  $this->content_obj->setHierId($this->content_obj->readHierId());
269  $this->setHierId($this->content_obj->readHierId());
270  $this->content_obj->setPcId($this->content_obj->readPCId());
271  $this->tpl->setOnScreenMessage('success', $lng->txt("cont_saved_interactive_image"), true);
272  $this->ctrl->redirectByClass("ilpcinteractiveimagegui", "edit");
273 
274  //$this->ctrl->returnToParent($this, "jump".$this->hier_id);
275  } else {
276  $this->insert();
277  }
278  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: buildRTE.php:22
setHierId(string $a_hier_id)
set hierarchical id in dom object
static renameExecutables(string $a_dir)
insert(string $a_post_cmd="edpost", string $a_submit_cmd="create_mob", bool $a_input_error=false)
Insert new media object form.
static _getDirectory(int $a_mob_id)
Get absolute directory.
static getMimeType(string $a_file, bool $a_external=false)
get mime type for file
setContent(string $a_html)
Sets content for standard template.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilGlobalTemplateInterface $tpl
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ deleteOverlays()

ilPCInteractiveImageGUI::deleteOverlays ( )

Definition at line 539 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$content_obj, ilPageContentGUI\$ctrl, Vendor\Package\$f, ilPageContentGUI\$lng, $tabs, $toolbar, ilPageContentGUI\$tpl, ilGlobalTemplateInterface\setContent(), ilUtil\stripSlashes(), and ilLanguage\txt().

539  : void
540  {
541  $ilCtrl = $this->ctrl;
542  $lng = $this->lng;
543 
544  $files = $this->request->getStringArray("file");
545  if (count($files) > 0) {
546  foreach ($files as $f) {
547  $f = str_replace("..", "", ilUtil::stripSlashes($f));
548  $this->content_obj->getMediaObject()
549  ->removeAdditionalFile("overlays/" . $f);
550  }
551 
552  $this->tpl->setOnScreenMessage('success', $lng->txt("cont_overlays_have_been_deleted"), true);
553  }
554  $ilCtrl->redirect($this, "listOverlayImages");
555  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
+ Here is the call graph for this function:

◆ deletePopups()

ilPCInteractiveImageGUI::deletePopups ( )

Definition at line 644 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$ctrl, $id, ilPageContentGUI\$lng, and ilLanguage\txt().

644  : void
645  {
646  $lng = $this->lng;
647  $ilCtrl = $this->ctrl;
648 
649  $tids = $this->request->getStringArray("tid");
650 
651  if (count($tids) > 0) {
652  foreach ($tids as $id) {
653  $id = explode(":", $id);
654  $this->content_obj->deletePopup($id[0], $id[1]);
655  }
656  $this->pg_obj->update();
657  $this->tpl->setOnScreenMessage('success', $lng->txt("cont_popups_have_been_deleted"), true);
658  }
659  $ilCtrl->redirect($this, "listContentPopups");
660  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ edit()

ilPCInteractiveImageGUI::edit ( )

Definition at line 145 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$ctrl, and ilCtrl\redirect().

145  : void
146  {
147  $ilCtrl = $this->ctrl;
148  $ilCtrl->redirect($this, "editor");
149  }
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
+ Here is the call graph for this function:

◆ editBaseImage()

ilPCInteractiveImageGUI::editBaseImage ( )

Definition at line 151 of file class.ilPCInteractiveImageGUI.php.

References $tabs, ilPageContentGUI\$tpl, ilTabsGUI\activateTab(), initForm(), and ilGlobalTemplateInterface\setContent().

151  : void
152  {
153  $tpl = $this->tpl;
154  $ilTabs = $this->tabs;
155  $ilTabs->activateTab("edit_base_image");
156  $form = $this->initForm();
157  $tpl->setContent($form->getHTML());
158  }
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
activateTab(string $a_id)
+ Here is the call graph for this function:

◆ editor()

ilPCInteractiveImageGUI::editor ( )

Definition at line 689 of file class.ilPCInteractiveImageGUI.php.

References $tabs, ilTabsGUI\activateTab(), ilObjStyleSheet\getBaseContentStylePath(), and initInteractiveImageEditor().

689  : void
690  {
691  $ilTabs = $this->tabs;
692  $ilTabs->activateTab("editor");
693  $this->tpl->addCss(ilObjStyleSheet::getBaseContentStylePath());
694  $this->tpl->setContent($this->iim_gui->editorInit()->getInitHtml());
696  }
activateTab(string $a_id)
+ Here is the call graph for this function:

◆ executeCommand()

ilPCInteractiveImageGUI::executeCommand ( )

Definition at line 56 of file class.ilPCInteractiveImageGUI.php.

References $tabs, ilPageContentGUI\$tpl, ILIAS\Repository\ctrl(), forwardFormToUploadHandler(), ilUtil\getImagePath(), getTabs(), and ilGlobalTemplateInterface\setTitleIcon().

56  : void
57  {
58  $tpl = $this->tpl;
59  $ilTabs = $this->tabs;
60 
61  // get next class that processes or forwards current command
62  $next_class = $this->ctrl->getNextClass($this);
63 
64  // get current command
65  $cmd = $this->ctrl->getCmd();
66 
67  if (is_object($this->content_obj)) {
68  $tpl->setTitleIcon(ilUtil::getImagePath("standard/icon_mob.svg"));
69  $this->getTabs();
70  }
71 
72  switch ($next_class) {
73  case strtolower(ilRepoStandardUploadHandlerGUI::class):
75  break;
76 
77  default:
78  $this->$cmd();
79  break;
80  }
81  }
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
getTabs(bool $a_create=false, bool $a_change_obj_ref=false)
Add tabs to ilTabsGUI object.
setTitleIcon(string $a_icon_path, string $a_icon_desc="")
set title icon
ilGlobalTemplateInterface $tpl
+ Here is the call graph for this function:

◆ forwardFormToUploadHandler()

ilPCInteractiveImageGUI::forwardFormToUploadHandler ( )
protected

Definition at line 83 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$gui, ILIAS\Repository\ctrl(), getBackgroundPropertiesFormAdapter(), getImportFormAdapter(), and getOverlayUploadFormAdapter().

Referenced by executeCommand().

83  : void
84  {
85  switch($this->request->getString("mode")) {
86  case "overlayUpload":
87  $form = $this->getOverlayUploadFormAdapter();
88  $gui = $form->getRepoStandardUploadHandlerGUI("overlay_file");
89  break;
90 
91  case "backgroundUpdate":
92  $form = $this->getBackgroundPropertiesFormAdapter();
93  $gui = $form->getRepoStandardUploadHandlerGUI("input_file");
94  break;
95 
96  default:
97  $form = $this->getImportFormAdapter();
98  $gui = $form->getRepoStandardUploadHandlerGUI("input_file");
99  break;
100  }
101  $this->ctrl->forwardCommand($gui);
102  }
getBackgroundPropertiesFormAdapter(array $path=null)
ILIAS COPage InternalGUIService $gui
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getBackgroundPropertiesFormAdapter()

ilPCInteractiveImageGUI::getBackgroundPropertiesFormAdapter ( array  $path = null)

Definition at line 748 of file class.ilPCInteractiveImageGUI.php.

References Vendor\Package\$f, $path, and ILIAS\Repository\lng().

Referenced by forwardFormToUploadHandler().

749  {
750  if (is_null($path)) {
751  $path = [self::class];
752  }
753 
754  $f = $this->gui->form($path, "#")
755  ->async()
756  ->file(
757  "input_file",
758  $this->lng->txt("file"),
759  \Closure::fromCallable([$this, 'handleBackgroundUpload']),
760  "mob_id",
761  "",
762  1,
763  ["image/png", "image/jpeg", "image/gif"],
764  $path,
765  "copg"
766  )->text(
767  "caption",
768  $this->lng->txt("cont_caption")
769  );
770  return $f;
771  }
$path
Definition: ltiservices.php:32
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getImportFormAdapter()

ilPCInteractiveImageGUI::getImportFormAdapter ( )

Definition at line 662 of file class.ilPCInteractiveImageGUI.php.

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by forwardFormToUploadHandler(), and ilPCInteractiveImageEditorGUI\getRenderedCreationForm().

663  {
664  $this->ctrl->setParameter($this, "cname", "InteractiveImage");
665  $form = $this->gui->form([self::class], "#")
666  ->async()
667  ->section("f", $this->lng->txt("cont_ed_insert_iim"))
668  ->file(
669  "input_file",
670  $this->lng->txt("file"),
671  \Closure::fromCallable([$this, 'handleUploadResult']),
672  "mob_id",
673  "",
674  1,
675  [],
676  [self::class],
677  "copg"
678  )->required();
679  return $form;
680  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOverlayUploadFormAdapter()

ilPCInteractiveImageGUI::getOverlayUploadFormAdapter ( array  $path = null)

Definition at line 704 of file class.ilPCInteractiveImageGUI.php.

References Vendor\Package\$f, $path, and ILIAS\Repository\lng().

Referenced by forwardFormToUploadHandler().

705  {
706  if (is_null($path)) {
707  $path = [self::class];
708  }
709 
710  $f = $this->gui->form($path, "#")
711  ->async()
712  ->file(
713  "overlay_file",
714  $this->lng->txt("file"),
715  \Closure::fromCallable([$this, 'handleOverlayUpload']),
716  "mob_id",
717  "",
718  1,
719  ["image/png", "image/jpeg", "image/gif"],
720  $path,
721  "copg"
722  );
723  return $f;
724  }
$path
Definition: ltiservices.php:32
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPopupFormAdapter()

ilPCInteractiveImageGUI::getPopupFormAdapter ( )

Definition at line 738 of file class.ilPCInteractiveImageGUI.php.

References Vendor\Package\$f, and ILIAS\Repository\lng().

739  {
740  $f = $this->gui->form(null, "#")
741  ->text(
742  "title",
743  $this->lng->txt("title")
744  );
745  return $f;
746  }
+ Here is the call graph for this function:

◆ getTabs()

ilPCInteractiveImageGUI::getTabs ( bool  $a_create = false,
bool  $a_change_obj_ref = false 
)

Add tabs to ilTabsGUI object.

Definition at line 107 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, $tabs, and ilLanguage\txt().

Referenced by executeCommand().

110  : void {
111  $ilCtrl = $this->ctrl;
112  $ilTabs = $this->tabs;
113  $lng = $this->lng;
114 
115  if (!$a_create) {
116  $ilTabs->setBackTarget(
117  $lng->txt("pg"),
118  (string) $ilCtrl->getParentReturn($this)
119  );
120  }
121  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleBackgroundUpload()

ilPCInteractiveImageGUI::handleBackgroundUpload ( FileUpload  $upload,
UploadResult  $result 
)

Definition at line 774 of file class.ilPCInteractiveImageGUI.php.

778  $this->log->debug(">>>");
779  $this->log->debug("Start upload");
780  $this->log->debug($this->content_obj->getMediaObject()->getId());
781  return $this->iim_manager->handleUploadResult(
782  $upload,
783  $result,
784  $this->content_obj->getMediaObject()
785  );
786  }

◆ handleOverlayUpload()

ilPCInteractiveImageGUI::handleOverlayUpload ( FileUpload  $upload,
UploadResult  $result 
)

Definition at line 727 of file class.ilPCInteractiveImageGUI.php.

731  return $this->iim_manager->handleOverlayUpload(
732  $this->content_obj->getMediaObject(),
733  $upload,
734  $result
735  );
736  }

◆ handleUploadResult()

ilPCInteractiveImageGUI::handleUploadResult ( FileUpload  $upload,
UploadResult  $result 
)

Definition at line 682 of file class.ilPCInteractiveImageGUI.php.

686  return $this->iim_manager->handleUploadResult($upload, $result);
687  }

◆ initAddOverlaysForm()

ilPCInteractiveImageGUI::initAddOverlaysForm ( )

Definition at line 454 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, $tabs, ilFileInputGUI\setSuffixes(), ilTabsGUI\setTabActive(), and ilLanguage\txt().

Referenced by addOverlayImages(), and uploadOverlayImages().

455  {
456  $lng = $this->lng;
457  $ilCtrl = $this->ctrl;
458  $ilTabs = $this->tabs;
459 
460  $ilTabs->setTabActive("list_overlays");
461 
462  $form = new ilPropertyFormGUI();
463  $form->setTitle($lng->txt("cont_add_images"));
464  $form->setFormAction($ilCtrl->getFormAction($this));
465 
466  // file input
467  $fi = new ilFileWizardInputGUI($lng->txt("file"), "ovfile");
468  $fi->setSuffixes(array("gif", "jpeg", "jpg", "png"));
469  $fi->setFilenames(array(0 => ''));
470  $fi->setRequired(true);
471  $form->addItem($fi);
472 
473  $form->addCommandButton("uploadOverlayImages", $lng->txt("upload"));
474  $form->addCommandButton("listOverlayImages", $lng->txt("cancel"));
475 
476  return $form;
477  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This class represents a file wizard property in a property form.
setSuffixes(array $a_suffixes)
setTabActive(string $a_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initForm()

ilPCInteractiveImageGUI::initForm ( string  $a_mode = "edit")

Definition at line 161 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, ilPageContentGUI\getHierId(), ILIAS\Repository\lng(), ilImageFileInputGUI\setAllowDeletion(), and ilLanguage\txt().

Referenced by create(), editBaseImage(), insert(), and update().

162  {
163  $lng = $this->lng;
164  $ilCtrl = $this->ctrl;
165  $ti = null;
166 
167  $form = new ilPropertyFormGUI();
168 
169  // image file
170  $fi = new ilImageFileInputGUI($lng->txt("cont_file"), "image_file");
171  $fi->setAllowDeletion(false);
172  if ($a_mode == "edit") {
173  $fi->setImage($this->content_obj->getBaseThumbnailTarget());
174  } else {
175  $fi->setRequired(true);
176  }
177  $form->addItem($fi);
178 
179  if ($a_mode == "edit") {
180  // caption
181  $ti = new ilTextInputGUI($this->lng->txt("cont_caption"), "caption");
182  $ti->setMaxLength(200);
183  $ti->setSize(50);
184  $form->addItem($ti);
185  }
186 
187  // save and cancel commands
188  if ($a_mode == "create") {
189  $form->setTitle($lng->txt("cont_ed_insert_iim"));
190  $form->addCommandButton("create_iim", $lng->txt("save"));
191  $form->addCommandButton("cancelCreate", $lng->txt("cancel"));
192  } else {
193  // get caption
194  $std_alias_item = new ilMediaAliasItem(
195  $this->content_obj->getDomDoc(),
196  $this->getHierId(),
197  "Standard",
198  $this->content_obj->getPCId(),
199  "InteractiveImage"
200  );
201  $ti->setValue($std_alias_item->getCaption());
202 
203  $form->setTitle($lng->txt("cont_edit_base_image"));
204  $form->addCommandButton("update", $lng->txt("save"));
205  }
206 
207  $form->setFormAction($ilCtrl->getFormAction($this));
208 
209  return $form;
210  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents an image file property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initInteractiveImageEditor()

ilPCInteractiveImageGUI::initInteractiveImageEditor ( )
protected

Definition at line 698 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\setEditorToolContext().

Referenced by editor().

698  : void
699  {
700  $this->setEditorToolContext();
701  $this->iim_gui->editorInit()->initUI($this->tpl);
702  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insert()

ilPCInteractiveImageGUI::insert ( string  $a_post_cmd = "edpost",
string  $a_submit_cmd = "create_mob",
bool  $a_input_error = false 
)

Insert new media object form.

Definition at line 126 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), initForm(), ilGlobalTemplateInterface\setContent(), and ilLanguage\txt().

Referenced by create().

130  : void {
131  $tpl = $this->tpl;
132  $ilCtrl = $this->ctrl;
133  $lng = $this->lng;
134 
135  $this->tpl->setOnScreenMessage('info', $lng->txt("cont_iim_create_info"));
136 
137  $form = $this->initForm("create");
138  $form->setFormAction($ilCtrl->getFormAction($this));
139 
140  $this->displayValidationError();
141 
142  $tpl->setContent($form->getHTML());
143  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ leftAlign()

ilPCInteractiveImageGUI::leftAlign ( )

align media object to left

Definition at line 351 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\getHierId(), ilMediaAliasItem\setHorizontalAlign(), and ilPageContentGUI\updateAndReturn().

351  : void
352  {
353  $std_alias_item = new ilMediaAliasItem(
354  $this->dom,
355  $this->getHierId(),
356  "Standard",
357  $this->content_obj->getPCId(),
358  "InteractiveImage"
359  );
360  $std_alias_item->setHorizontalAlign("Left");
361  $this->updateAndReturn();
362  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setHorizontalAlign(string $a_halign)
+ Here is the call graph for this function:

◆ leftFloatAlign()

ilPCInteractiveImageGUI::leftFloatAlign ( )

align media object to left, floating text

Definition at line 383 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\getHierId(), ilMediaAliasItem\setHorizontalAlign(), and ilPageContentGUI\updateAndReturn().

383  : void
384  {
385  $std_alias_item = new ilMediaAliasItem(
386  $this->content_obj->getDomDoc(),
387  $this->getHierId(),
388  "Standard",
389  $this->content_obj->getPCId(),
390  "InteractiveImage"
391  );
392  $std_alias_item->setHorizontalAlign("LeftFloat");
393  $this->updateAndReturn();
394  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setHorizontalAlign(string $a_halign)
+ Here is the call graph for this function:

◆ listOverlayImages()

ilPCInteractiveImageGUI::listOverlayImages ( )

Definition at line 416 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, $tabs, $toolbar, ilPageContentGUI\$tpl, ilGlobalTemplateInterface\setContent(), and ilLanguage\txt().

416  : void
417  {
418  $tpl = $this->tpl;
419  $ilToolbar = $this->toolbar;
420  $ilCtrl = $this->ctrl;
421  $ilTabs = $this->tabs;
422  $lng = $this->lng;
423 
424  $this->tpl->setOnScreenMessage('info', $lng->txt("cont_iim_overlay_info"));
425 
426  $ilTabs->setTabActive("list_overlays");
427 
428  $ilToolbar->addButton(
429  $lng->txt("cont_add_images"),
430  $ilCtrl->getLinkTarget($this, "addOverlayImages")
431  );
432 
433  $tab = new ilPCIIMOverlaysTableGUI(
434  $this,
435  "listOverlayImages",
436  $this->content_obj->getMediaObject()
437  );
438  $tpl->setContent($tab->getHTML());
439  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ rightAlign()

ilPCInteractiveImageGUI::rightAlign ( )

align media object to right

Definition at line 367 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\getHierId(), ilMediaAliasItem\setHorizontalAlign(), and ilPageContentGUI\updateAndReturn().

367  : void
368  {
369  $std_alias_item = new ilMediaAliasItem(
370  $this->content_obj->getDomDoc(),
371  $this->getHierId(),
372  "Standard",
373  $this->content_obj->getPCId(),
374  "InteractiveImage"
375  );
376  $std_alias_item->setHorizontalAlign("Right");
377  $this->updateAndReturn();
378  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setHorizontalAlign(string $a_halign)
+ Here is the call graph for this function:

◆ rightFloatAlign()

ilPCInteractiveImageGUI::rightFloatAlign ( )

align media object to right, floating text

Definition at line 399 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\getHierId(), ilMediaAliasItem\setHorizontalAlign(), and ilPageContentGUI\updateAndReturn().

399  : void
400  {
401  $std_alias_item = new ilMediaAliasItem(
402  $this->content_obj->getDomDoc(),
403  $this->getHierId(),
404  "Standard",
405  $this->content_obj->getPCId(),
406  "InteractiveImage"
407  );
408  $std_alias_item->setHorizontalAlign("RightFloat");
409  $this->updateAndReturn();
410  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setHorizontalAlign(string $a_halign)
+ Here is the call graph for this function:

◆ savePopups()

ilPCInteractiveImageGUI::savePopups ( )

Definition at line 600 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, and ilLanguage\txt().

600  : void
601  {
602  $ilCtrl = $this->ctrl;
603  $lng = $this->lng;
604 
605  $titles = $this->request->getStringArray("title");
606  if (count($titles) > 0) {
607  $this->content_obj->savePopups($titles);
608  $this->pg_obj->update();
609  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
610  }
611  $ilCtrl->redirect($this, "listContentPopups");
612  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
+ Here is the call graph for this function:

◆ update()

ilPCInteractiveImageGUI::update ( )

Update (base image)

Definition at line 283 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, $location, ilObjMediaObject\_getDirectory(), ilPageContentGUI\getHierId(), ilObjMediaObject\getMimeType(), initForm(), ilFileUtils\moveUploadedFile(), ilMediaAliasItem\setCaption(), and ilLanguage\txt().

283  : void
284  {
285  $ilCtrl = $this->ctrl;
286  $lng = $this->lng;
287 
288  $form = $this->initForm("edit");
289  if ($form->checkInput()) {
290  $mob = $this->content_obj->getMediaObject();
291  $mob_dir = ilObjMediaObject::_getDirectory($mob->getId());
292  $std_item = $mob->getMediaItem("Standard");
293  $location = $_FILES['image_file']['name'];
294 
295  if ($location != "" && is_file($_FILES['image_file']['tmp_name'])) {
296  $file = $mob_dir . "/" . $_FILES['image_file']['name'];
298  $_FILES['image_file']['tmp_name'],
299  $_FILES['image_file']['name'],
300  $file
301  );
302 
303  // get mime type
304  $format = ilObjMediaObject::getMimeType($file);
305  $location = $_FILES['image_file']['name'];
306  $std_item->setFormat($format);
307  $std_item->setLocation($location);
308  $std_item->setLocationType("LocalFile");
309  $mob->setDescription($format);
310  $mob->update();
311  }
312 
313  // set caption
314  $std_alias_item = new ilMediaAliasItem(
315  $this->content_obj->getDomDoc(),
316  $this->getHierId(),
317  "Standard",
318  $this->content_obj->getPCId(),
319  "InteractiveImage"
320  );
321  $std_alias_item->setCaption(
322  $form->getInput("caption")
323  );
324  $this->edit_repo->setPageError($this->pg_obj->update());
325  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
326  }
327 
328  $ilCtrl->redirectByClass("ilpcinteractiveimagegui", "editBaseImage");
329  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setCaption(string $a_caption)
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: buildRTE.php:22
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getDirectory(int $a_mob_id)
Get absolute directory.
static getMimeType(string $a_file, bool $a_external=false)
get mime type for file
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
+ Here is the call graph for this function:

◆ uploadOverlayImages()

ilPCInteractiveImageGUI::uploadOverlayImages ( )

Definition at line 479 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, addOverlayImages(), initAddOverlaysForm(), and ilLanguage\txt().

479  : void
480  {
481  $lng = $this->lng;
482  $ilCtrl = $this->ctrl;
483 
484  $form = $this->initAddOverlaysForm();
485  if ($form->checkInput()) {
486  if (is_array($_FILES["ovfile"]["name"])) {
487  foreach ($_FILES["ovfile"]["name"] as $k => $v) {
488  $name = $_FILES["ovfile"]["name"][$k];
489  $tmp_name = $_FILES["ovfile"]["tmp_name"][$k];
490 
491  $this->content_obj->getMediaObject()->uploadAdditionalFile(
492  $name,
493  $tmp_name,
494  "overlays"
495  );
496  $piname = pathinfo($name);
497  $this->content_obj->getMediaObject()->makeThumbnail(
498  "overlays/" . $name,
499  basename($name, "." . $piname['extension']) . ".png"
500  );
501  }
502  }
503  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"));
504  $ilCtrl->redirect($this, "listOverlayImages");
505  } else {
506  $form->setValuesByPost();
507  $this->addOverlayImages($form);
508  }
509  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
addOverlayImages(ilPropertyFormGUI $a_form=null)
+ Here is the call graph for this function:

Field Documentation

◆ $iim_gui

ILIAS COPage PC InteractiveImage GUIService ilPCInteractiveImageGUI::$iim_gui
protected

Definition at line 34 of file class.ilPCInteractiveImageGUI.php.

◆ $iim_manager

ILIAS COPage PC InteractiveImage IIMManager ilPCInteractiveImageGUI::$iim_manager
protected

Definition at line 33 of file class.ilPCInteractiveImageGUI.php.

◆ $tabs

◆ $toolbar

ilToolbarGUI ilPCInteractiveImageGUI::$toolbar
protected

Definition at line 36 of file class.ilPCInteractiveImageGUI.php.

Referenced by deleteOverlays(), and listOverlayImages().


The documentation for this class was generated from the following file: