33 protected \ILIAS\COPage\PC\InteractiveImage\IIMManager
$iim_manager;
34 protected \ILIAS\COPage\PC\InteractiveImage\GUIService
$iim_gui;
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();
52 $this->iim_gui =
$DIC->copage()->internal()->gui()->pc()->interactiveImage();
53 $this->iim_manager =
$DIC->copage()->internal()->domain()->pc()->interactiveImage();
62 $next_class = $this->
ctrl->getNextClass($this);
65 $cmd = $this->
ctrl->getCmd();
67 if (is_object($this->content_obj)) {
72 switch ($next_class) {
73 case strtolower(ilRepoStandardUploadHandlerGUI::class):
85 switch ($this->request->getString(
"mode")) {
88 $gui = $form->getRepoStandardUploadHandlerGUI(
"overlay_file");
91 case "backgroundUpdate":
93 $gui = $form->getRepoStandardUploadHandlerGUI(
"input_file");
98 $gui = $form->getRepoStandardUploadHandlerGUI(
"input_file");
108 bool $a_create =
false,
109 bool $a_change_obj_ref =
false
111 $ilCtrl = $this->
ctrl;
116 $ilTabs->setBackTarget(
118 (
string) $ilCtrl->getParentReturn($this)
127 string $a_post_cmd =
"edpost",
128 string $a_submit_cmd =
"",
129 bool $a_input_error =
false
132 $ilCtrl = $this->ctrl;
135 $this->tpl->setOnScreenMessage(
'info',
$lng->txt(
"cont_iim_create_info"));
137 $form = $this->initForm(
"create");
138 $form->setFormAction($ilCtrl->getFormAction($this));
140 $this->displayValidationError();
142 $tpl->setContent($form->getHTML());
147 $ilCtrl = $this->ctrl;
148 $ilCtrl->redirect($this,
"editor");
154 $ilTabs = $this->tabs;
155 $ilTabs->activateTab(
"edit_base_image");
156 $form = $this->initForm();
157 $tpl->setContent($form->getHTML());
164 $ilCtrl = $this->ctrl;
171 $fi->setAllowDeletion(
false);
172 if ($a_mode ==
"edit") {
173 $fi->setImage($this->content_obj->getBaseThumbnailTarget());
175 $fi->setRequired(
true);
179 if ($a_mode ==
"edit") {
182 $ti->setMaxLength(200);
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"));
195 $this->content_obj->getDomDoc(),
198 $this->content_obj->getPCId(),
201 $ti->setValue($std_alias_item->getCaption());
203 $form->setTitle(
$lng->txt(
"cont_edit_base_image"));
204 $form->addCommandButton(
"update",
$lng->txt(
"save"));
207 $form->setFormAction($ilCtrl->getFormAction($this));
218 $ilCtrl = $this->ctrl;
221 $form = $this->initForm(
"edit");
222 if ($form->checkInput()) {
223 $mob = $this->content_obj->getMediaObject();
225 $std_item = $mob->getMediaItem(
"Standard");
226 $location = $_FILES[
'image_file'][
'name'];
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'],
238 $location = $_FILES[
'image_file'][
'name'];
239 $std_item->setFormat($format);
241 $std_item->setLocationType(
"LocalFile");
242 $mob->setDescription($format);
248 $this->content_obj->getDomDoc(),
251 $this->content_obj->getPCId(),
254 $std_alias_item->setCaption(
255 $form->getInput(
"caption")
257 $this->edit_repo->setPageError($this->pg_obj->update());
258 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
261 $ilCtrl->redirectByClass(
"ilpcinteractiveimagegui",
"editBaseImage");
271 $this->content_obj->getDomDoc(),
274 $this->content_obj->getPCId(),
277 $std_alias_item->setHorizontalAlign(
"Center");
278 $this->updateAndReturn();
290 $this->content_obj->getPCId(),
293 $std_alias_item->setHorizontalAlign(
"Left");
294 $this->updateAndReturn();
303 $this->content_obj->getDomDoc(),
306 $this->content_obj->getPCId(),
309 $std_alias_item->setHorizontalAlign(
"Right");
310 $this->updateAndReturn();
319 $this->content_obj->getDomDoc(),
322 $this->content_obj->getPCId(),
325 $std_alias_item->setHorizontalAlign(
"LeftFloat");
326 $this->updateAndReturn();
335 $this->content_obj->getDomDoc(),
338 $this->content_obj->getPCId(),
341 $std_alias_item->setHorizontalAlign(
"RightFloat");
342 $this->updateAndReturn();
347 $this->
ctrl->setParameter($this,
"cname",
"InteractiveImage");
348 $form = $this->gui->form([self::class],
"#")
350 ->section(
"f", $this->
lng->txt(
"cont_ed_insert_iim"))
353 $this->
lng->txt(
"file"),
354 \Closure::fromCallable([$this,
'handleUploadResult']),
369 return $this->iim_manager->handleUploadResult($upload, $result);
374 $ilTabs = $this->tabs;
375 $ilTabs->activateTab(
"editor");
377 $this->tpl->setContent($this->iim_gui->editorInit()->getInitHtml());
378 $this->initInteractiveImageEditor();
383 $this->setEditorToolContext();
384 $this->iim_gui->editorInit()->initUI($this->tpl);
389 if (is_null(
$path)) {
390 $path = [self::class];
393 $f = $this->gui->form(
$path,
"#")
397 $this->
lng->txt(
"file"),
398 \Closure::fromCallable([$this,
'handleOverlayUpload']),
402 [
"image/png",
"image/jpeg",
"image/gif"],
414 return $this->iim_manager->handleOverlayUpload(
415 $this->content_obj->getMediaObject(),
423 $f = $this->gui->form(
null,
"#")
426 $this->
lng->txt(
"title")
433 if (is_null(
$path)) {
434 $path = [self::class];
437 $f = $this->gui->form(
$path,
"#")
441 $this->
lng->txt(
"file"),
442 \Closure::fromCallable([$this,
'handleBackgroundUpload']),
446 [
"image/png",
"image/jpeg",
"image/gif"],
451 $this->
lng->txt(
"cont_caption")
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(
467 $this->content_obj->getMediaObject()
Class BasicHandlerResult.
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
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 getBaseContentStylePath()
User interface class for interactive images.
getTabs(bool $a_create=false, bool $a_change_obj_ref=false)
Add tabs to ilTabsGUI object.
forwardFormToUploadHandler()
rightFloatAlign()
align media object to right, floating text
insert(string $a_post_cmd="edpost", string $a_submit_cmd="", bool $a_input_error=false)
Insert new media object form.
leftAlign()
align media object to left
ILIAS COPage PC InteractiveImage GUIService $iim_gui
update()
Update (base image)
leftFloatAlign()
align media object to left, floating text
__construct(ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id, string $a_pc_id="")
initInteractiveImageEditor()
ILIAS COPage PC InteractiveImage IIMManager $iim_manager
centerAlign()
Align media object to center.
handleBackgroundUpload(FileUpload $upload, UploadResult $result)
handleUploadResult(FileUpload $upload, UploadResult $result)
getOverlayUploadFormAdapter(?array $path=null)
getBackgroundPropertiesFormAdapter(?array $path=null)
handleOverlayUpload(FileUpload $upload, UploadResult $result)
initForm(string $a_mode="edit")
rightAlign()
align media object to right
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
ILIAS COPage InternalGUIService $gui
ilGlobalTemplateInterface $tpl
Content object of ilPageObject (see ILIAS DTD).
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text property in a property form.
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTitleIcon(string $a_icon_path, string $a_icon_desc="")
set title icon
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.