ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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="", bool $a_input_error=false)
 Insert new media object form. More...
 
 edit ()
 
 editBaseImage ()
 
 initForm (string $a_mode="edit")
 
 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...
 
 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
 
LOMServices $lom_services
 
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 @ilCtrl_Calls 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 = "" 
)

Reimplemented from ilPageContentGUI.

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

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 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\tabs(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

Member Function Documentation

◆ centerAlign()

ilPCInteractiveImageGUI::centerAlign ( )

Align media object to center.

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

268 : void
269 {
270 $std_alias_item = new ilMediaAliasItem(
271 $this->content_obj->getDomDoc(),
272 $this->getHierId(),
273 "Standard",
274 $this->content_obj->getPCId(),
275 "InteractiveImage"
276 );
277 $std_alias_item->setHorizontalAlign("Center");
278 $this->updateAndReturn();
279 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ edit()

ilPCInteractiveImageGUI::edit ( )

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

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)
@inheritDoc

◆ editBaseImage()

ilPCInteractiveImageGUI::editBaseImage ( )

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

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

◆ editor()

ilPCInteractiveImageGUI::editor ( )

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

372 : void
373 {
374 $ilTabs = $this->tabs;
375 $ilTabs->activateTab("editor");
376 $this->tpl->addCss(ilObjStyleSheet::getBaseContentStylePath());
377 $this->tpl->setContent($this->iim_gui->editorInit()->getInitHtml());
379 }

References ilObjStyleSheet\getBaseContentStylePath().

+ Here is the call graph for this function:

◆ executeCommand()

ilPCInteractiveImageGUI::executeCommand ( )

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

56 : void
57 {
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 }
getTabs(bool $a_create=false, bool $a_change_obj_ref=false)
Add tabs to ilTabsGUI object.
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
setTitleIcon(string $a_icon_path, string $a_icon_desc="")
set title icon

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

+ Here is the call graph for this function:

◆ forwardFormToUploadHandler()

ilPCInteractiveImageGUI::forwardFormToUploadHandler ( )
protected

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

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":
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

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

Referenced by executeCommand().

+ 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 431 of file class.ilPCInteractiveImageGUI.php.

432 {
433 if (is_null($path)) {
434 $path = [self::class];
435 }
436
437 $f = $this->gui->form($path, "#")
438 ->async()
439 ->file(
440 "input_file",
441 $this->lng->txt("file"),
442 \Closure::fromCallable([$this, 'handleBackgroundUpload']),
443 "mob_id",
444 "",
445 1,
446 ["image/png", "image/jpeg", "image/gif"],
447 $path,
448 "copg"
449 )->text(
450 "caption",
451 $this->lng->txt("cont_caption")
452 );
453 return $f;
454 }
$path
Definition: ltiservices.php:30

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

Referenced by forwardFormToUploadHandler().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getImportFormAdapter()

ilPCInteractiveImageGUI::getImportFormAdapter ( )

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

346 {
347 $this->ctrl->setParameter($this, "cname", "InteractiveImage");
348 $form = $this->gui->form([self::class], "#")
349 ->async()
350 ->section("f", $this->lng->txt("cont_ed_insert_iim"))
351 ->file(
352 "input_file",
353 $this->lng->txt("file"),
354 \Closure::fromCallable([$this, 'handleUploadResult']),
355 "mob_id",
356 "",
357 1,
358 [],
359 [self::class],
360 "copg"
361 )->required();
362 return $form;
363 }

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

Referenced by forwardFormToUploadHandler().

+ 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 387 of file class.ilPCInteractiveImageGUI.php.

388 {
389 if (is_null($path)) {
390 $path = [self::class];
391 }
392
393 $f = $this->gui->form($path, "#")
394 ->async()
395 ->file(
396 "overlay_file",
397 $this->lng->txt("file"),
398 \Closure::fromCallable([$this, 'handleOverlayUpload']),
399 "mob_id",
400 "",
401 1,
402 ["image/png", "image/jpeg", "image/gif"],
403 $path,
404 "copg"
405 );
406 return $f;
407 }

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

Referenced by forwardFormToUploadHandler().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPopupFormAdapter()

ilPCInteractiveImageGUI::getPopupFormAdapter ( )

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

422 {
423 $f = $this->gui->form(null, "#")
424 ->text(
425 "title",
426 $this->lng->txt("title")
427 );
428 return $f;
429 }

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

+ 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.

110 : void {
111 $ilCtrl = $this->ctrl;
112 $ilTabs = $this->tabs;
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...

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

Referenced by executeCommand().

+ 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 457 of file class.ilPCInteractiveImageGUI.php.

461 $this->log->debug(">>>");
462 $this->log->debug("Start upload");
463 $this->log->debug($this->content_obj->getMediaObject()->getId());
464 return $this->iim_manager->handleUploadResult(
465 $upload,
466 $result,
467 $this->content_obj->getMediaObject()
468 );
469 }

◆ handleOverlayUpload()

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

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

414 return $this->iim_manager->handleOverlayUpload(
415 $this->content_obj->getMediaObject(),
416 $upload,
417 $result
418 );
419 }

◆ handleUploadResult()

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

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

369 return $this->iim_manager->handleUploadResult($upload, $result);
370 }

◆ initForm()

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

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

162 {
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 }
This class represents an image file property in a property form.
This class represents a property form user interface.
This class represents a text property in a property form.

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

+ Here is the call graph for this function:

◆ initInteractiveImageEditor()

ilPCInteractiveImageGUI::initInteractiveImageEditor ( )
protected

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

381 : void
382 {
383 $this->setEditorToolContext();
384 $this->iim_gui->editorInit()->initUI($this->tpl);
385 }

◆ insert()

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

Insert new media object form.

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

130 : void {
132 $ilCtrl = $this->ctrl;
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 }

◆ leftAlign()

ilPCInteractiveImageGUI::leftAlign ( )

align media object to left

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

284 : void
285 {
286 $std_alias_item = new ilMediaAliasItem(
287 $this->dom,
288 $this->getHierId(),
289 "Standard",
290 $this->content_obj->getPCId(),
291 "InteractiveImage"
292 );
293 $std_alias_item->setHorizontalAlign("Left");
294 $this->updateAndReturn();
295 }

◆ leftFloatAlign()

ilPCInteractiveImageGUI::leftFloatAlign ( )

align media object to left, floating text

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

316 : void
317 {
318 $std_alias_item = new ilMediaAliasItem(
319 $this->content_obj->getDomDoc(),
320 $this->getHierId(),
321 "Standard",
322 $this->content_obj->getPCId(),
323 "InteractiveImage"
324 );
325 $std_alias_item->setHorizontalAlign("LeftFloat");
326 $this->updateAndReturn();
327 }

◆ rightAlign()

ilPCInteractiveImageGUI::rightAlign ( )

align media object to right

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

300 : void
301 {
302 $std_alias_item = new ilMediaAliasItem(
303 $this->content_obj->getDomDoc(),
304 $this->getHierId(),
305 "Standard",
306 $this->content_obj->getPCId(),
307 "InteractiveImage"
308 );
309 $std_alias_item->setHorizontalAlign("Right");
310 $this->updateAndReturn();
311 }

◆ rightFloatAlign()

ilPCInteractiveImageGUI::rightFloatAlign ( )

align media object to right, floating text

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

332 : void
333 {
334 $std_alias_item = new ilMediaAliasItem(
335 $this->content_obj->getDomDoc(),
336 $this->getHierId(),
337 "Standard",
338 $this->content_obj->getPCId(),
339 "InteractiveImage"
340 );
341 $std_alias_item->setHorizontalAlign("RightFloat");
342 $this->updateAndReturn();
343 }

◆ update()

ilPCInteractiveImageGUI::update ( )

Update (base image)

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

216 : void
217 {
218 $ilCtrl = $this->ctrl;
220
221 $form = $this->initForm("edit");
222 if ($form->checkInput()) {
223 $mob = $this->content_obj->getMediaObject();
224 $mob_dir = ilObjMediaObject::_getDirectory($mob->getId());
225 $std_item = $mob->getMediaItem("Standard");
226 $location = $_FILES['image_file']['name'];
227
228 if ($location != "" && is_file($_FILES['image_file']['tmp_name'])) {
229 $file = $mob_dir . "/" . $_FILES['image_file']['name'];
231 $_FILES['image_file']['tmp_name'],
232 $_FILES['image_file']['name'],
233 $file
234 );
235
236 // get mime type
237 $format = ilObjMediaObject::getMimeType($file);
238 $location = $_FILES['image_file']['name'];
239 $std_item->setFormat($format);
240 $std_item->setLocation($location);
241 $std_item->setLocationType("LocalFile");
242 $mob->setDescription($format);
243 $mob->update();
244 }
245
246 // set caption
247 $std_alias_item = new ilMediaAliasItem(
248 $this->content_obj->getDomDoc(),
249 $this->getHierId(),
250 "Standard",
251 $this->content_obj->getPCId(),
252 "InteractiveImage"
253 );
254 $std_alias_item->setCaption(
255 $form->getInput("caption")
256 );
257 $this->edit_repo->setPageError($this->pg_obj->update());
258 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
259 }
260
261 $ilCtrl->redirectByClass("ilpcinteractiveimagegui", "editBaseImage");
262 }
$location
Definition: buildRTE.php:22
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
static getMimeType(string $a_file, bool $a_external=false)
get mime type for file
static _getDirectory(int $a_mob_id)
Get absolute directory.

References $lng, $location, ilObjMediaObject\_getDirectory(), ilObjMediaObject\getMimeType(), and ilFileUtils\moveUploadedFile().

+ 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

ilTabsGUI ilPCInteractiveImageGUI::$tabs
protected

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

Referenced by executeCommand().

◆ $toolbar

ilToolbarGUI ilPCInteractiveImageGUI::$toolbar
protected

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


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