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 =
"create_mob",
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));
219 if (!$form->checkInput()) {
221 $form->setValuesByPost();
227 $this->content_obj->createMediaObject();
228 $media_obj = $this->content_obj->getMediaObject();
229 $media_obj->setTitle($_FILES[
'image_file'][
'name']);
230 $media_obj->create();
233 $media_obj->createDirectory();
235 $media_obj->addMediaItem($media_item);
236 $media_item->setPurpose(
"Standard");
238 $file = $mob_dir .
"/" . $_FILES[
'image_file'][
'name'];
241 $_FILES[
'image_file'][
'tmp_name'],
242 $_FILES[
'image_file'][
'name'],
246 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"file_is_infected"),
true);
251 $location = $_FILES[
'image_file'][
'name'];
254 $media_item->setFormat($format);
256 $media_item->setLocationType(
"LocalFile");
259 $media_obj->update();
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");
289 if ($form->checkInput()) {
290 $mob = $this->content_obj->getMediaObject();
292 $std_item = $mob->getMediaItem(
"Standard");
293 $location = $_FILES[
'image_file'][
'name'];
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'],
305 $location = $_FILES[
'image_file'][
'name'];
306 $std_item->setFormat($format);
308 $std_item->setLocationType(
"LocalFile");
309 $mob->setDescription($format);
315 $this->content_obj->getDomDoc(),
318 $this->content_obj->getPCId(),
322 $form->getInput(
"caption")
324 $this->edit_repo->setPageError($this->pg_obj->update());
325 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
328 $ilCtrl->redirectByClass(
"ilpcinteractiveimagegui",
"editBaseImage");
338 $this->content_obj->getDomDoc(),
341 $this->content_obj->getPCId(),
357 $this->content_obj->getPCId(),
370 $this->content_obj->getDomDoc(),
373 $this->content_obj->getPCId(),
386 $this->content_obj->getDomDoc(),
389 $this->content_obj->getPCId(),
402 $this->content_obj->getDomDoc(),
405 $this->content_obj->getPCId(),
424 $this->tpl->setOnScreenMessage(
'info',
$lng->
txt(
"cont_iim_overlay_info"));
426 $ilTabs->setTabActive(
"list_overlays");
428 $ilToolbar->addButton(
430 $ilCtrl->getLinkTarget($this,
"addOverlayImages")
436 $this->content_obj->getMediaObject()
463 $form->setTitle(
$lng->
txt(
"cont_add_images"));
464 $form->setFormAction($ilCtrl->getFormAction($this));
468 $fi->
setSuffixes(array(
"gif",
"jpeg",
"jpg",
"png"));
469 $fi->setFilenames(array(0 =>
''));
470 $fi->setRequired(
true);
473 $form->addCommandButton(
"uploadOverlayImages",
$lng->
txt(
"upload"));
474 $form->addCommandButton(
"listOverlayImages",
$lng->
txt(
"cancel"));
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];
491 $this->content_obj->getMediaObject()->uploadAdditionalFile(
496 $piname = pathinfo($name);
497 $this->content_obj->getMediaObject()->makeThumbnail(
499 basename($name,
"." . $piname[
'extension']) .
".png" 503 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"));
504 $ilCtrl->redirect($this,
"listOverlayImages");
506 $form->setValuesByPost();
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");
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");
531 foreach ($files as $i =>
$d) {
532 $cgui->addItem(
"file[]", $i, $i);
544 $files = $this->request->getStringArray(
"file");
545 if (count($files) > 0) {
546 foreach ($files as
$f) {
548 $this->content_obj->getMediaObject()
549 ->removeAdditionalFile(
"overlays/" . $f);
552 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"cont_overlays_have_been_deleted"),
true);
554 $ilCtrl->redirect($this,
"listOverlayImages");
562 public function listContentPopups():
void 570 $this->tpl->setOnScreenMessage(
'info',
$lng->
txt(
"cont_iim_content_popups_info"));
572 $ilTabs->setTabActive(
"content_popups");
574 $ilToolbar->addButton(
576 $ilCtrl->getLinkTarget($this,
"addPopup")
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");
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);
611 $ilCtrl->redirect($this,
"listContentPopups");
623 $tids = $this->request->getStringArray(
"tid");
624 $titles = $this->request->getStringArray(
"title");
626 if (count($tids) == 0) {
627 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
"no_checkbox"),
true);
628 $ilCtrl->redirect($this,
"listContentPopups");
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");
636 foreach ($tids as $i =>
$d) {
637 $cgui->addItem(
"tid[]", $i, $titles[$i]);
649 $tids = $this->request->getStringArray(
"tid");
651 if (count($tids) > 0) {
652 foreach ($tids as
$id) {
653 $id = explode(
":", $id);
654 $this->content_obj->deletePopup($id[0], $id[1]);
656 $this->pg_obj->update();
657 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"cont_popups_have_been_deleted"),
true);
659 $ilCtrl->redirect($this,
"listContentPopups");
664 $this->
ctrl->setParameter($this,
"cname",
"InteractiveImage");
665 $form = $this->gui->form([self::class],
"#")
667 ->section(
"f", $this->
lng->txt(
"cont_ed_insert_iim"))
670 $this->
lng->txt(
"file"),
671 \Closure::fromCallable([$this,
'handleUploadResult']),
686 return $this->iim_manager->handleUploadResult($upload, $result);
694 $this->tpl->setContent($this->iim_gui->editorInit()->getInitHtml());
701 $this->iim_gui->editorInit()->initUI($this->tpl);
706 if (is_null(
$path)) {
707 $path = [self::class];
710 $f = $this->gui->form(
$path,
"#")
714 $this->
lng->txt(
"file"),
715 \Closure::fromCallable([$this,
'handleOverlayUpload']),
719 [
"image/png",
"image/jpeg",
"image/gif"],
731 return $this->iim_manager->handleOverlayUpload(
732 $this->content_obj->getMediaObject(),
740 $f = $this->gui->form(null,
"#")
743 $this->
lng->txt(
"title")
750 if (is_null(
$path)) {
751 $path = [self::class];
754 $f = $this->gui->form(
$path,
"#")
758 $this->
lng->txt(
"file"),
759 \Closure::fromCallable([$this,
'handleBackgroundUpload']),
763 [
"image/png",
"image/jpeg",
"image/gif"],
768 $this->
lng->txt(
"cont_caption")
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(
784 $this->content_obj->getMediaObject()
ilPageContent $content_obj
centerAlign()
Align media object to center.
__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...
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
getOverlayUploadFormAdapter(array $path=null)
handleUploadResult(FileUpload $upload, UploadResult $result)
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider .
initInteractiveImageEditor()
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
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.
setHierId(string $a_hier_id)
set hierarchical id in dom object
initForm(string $a_mode="edit")
handleOverlayUpload(FileUpload $upload, UploadResult $result)
setTitleIcon(string $a_icon_path, string $a_icon_desc="")
set title icon
Content object of ilPageObject (see ILIAS DTD).
setTabActive(string $a_id)
getBackgroundPropertiesFormAdapter(array $path=null)
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.
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
setContent(string $a_html)
Sets content for standard template.
forwardFormToUploadHandler()
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
handleBackgroundUpload(FileUpload $upload, UploadResult $result)
static getBaseContentStylePath()
ilGlobalTemplateInterface $tpl
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
addOverlayImages(ilPropertyFormGUI $a_form=null)
update()
Update (base image)
activateTab(string $a_id)
leftFloatAlign()
align media object to left, floating text
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
leftAlign()
align media object to left
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS COPage PC InteractiveImage GUIService $iim_gui
rightAlign()
align media object to right
User interface class for interactive images.
ILIAS COPage InternalGUIService $gui
ILIAS COPage PC InteractiveImage IIMManager $iim_manager