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 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 135 $this->tpl->setOnScreenMessage(
'info',
$lng->
txt(
"cont_iim_create_info"));
138 $form->setFormAction($ilCtrl->getFormAction($this));
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));
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(),
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(),
290 $this->content_obj->getPCId(),
303 $this->content_obj->getDomDoc(),
306 $this->content_obj->getPCId(),
319 $this->content_obj->getDomDoc(),
322 $this->content_obj->getPCId(),
335 $this->content_obj->getDomDoc(),
338 $this->content_obj->getPCId(),
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);
377 $this->tpl->setContent($this->iim_gui->editorInit()->getInitHtml());
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()
centerAlign()
Align media object to center.
insert(string $a_post_cmd="edpost", string $a_submit_cmd="", bool $a_input_error=false)
Insert new media object form.
__construct(ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id, string $a_pc_id="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
handleUploadResult(FileUpload $upload, UploadResult $result)
Interface Observer Contains several chained tasks and infos about them.
initInteractiveImageEditor()
getTabs(bool $a_create=false, bool $a_change_obj_ref=false)
Add tabs to ilTabsGUI object.
setContent(string $a_html)
Sets content for standard template.
initForm(string $a_mode="edit")
handleOverlayUpload(FileUpload $upload, UploadResult $result)
Content object of ilPageObject (see ILIAS DTD).
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
getOverlayUploadFormAdapter(?array $path=null)
redirect(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
forwardFormToUploadHandler()
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
handleBackgroundUpload(FileUpload $upload, UploadResult $result)
static getBaseContentStylePath()
ilGlobalTemplateInterface $tpl
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
Class BasicHandlerResult.
rightFloatAlign()
align media object to right, floating text
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
setTitleIcon(string $a_icon_path, string $a_icon_desc="")
set title icon
update()
Update (base image)
activateTab(string $a_id)
leftFloatAlign()
align media object to left, floating text
leftAlign()
align media object to left
__construct(Container $dic, ilPlugin $plugin)
ILIAS COPage PC InteractiveImage GUIService $iim_gui
getBackgroundPropertiesFormAdapter(?array $path=null)
rightAlign()
align media object to right
User interface class for interactive images.
ILIAS COPage InternalGUIService $gui
ILIAS COPage PC InteractiveImage IIMManager $iim_manager