5require_once(
"./Services/COPage/classes/class.ilPageContentGUI.php");
6require_once(
"./Services/COPage/classes/class.ilPCInteractiveImage.php");
7include_once(
"./Services/COPage/classes/class.ilMediaAliasItem.php");
31 public function __construct($a_pg_obj, $a_content_obj, $a_hier_id = 0, $a_pc_id =
"")
35 $this->tpl =
$DIC[
"tpl"];
36 $this->lng =
$DIC->language();
37 $this->tabs =
$DIC->tabs();
38 $this->ctrl =
$DIC->ctrl();
39 $this->toolbar =
$DIC->toolbar();
56 $next_class = $this->ctrl->getNextClass($this);
59 $cmd = $this->ctrl->getCmd();
61 if (is_object($this->content_obj)) {
63 $this->
getTabs($this->tabs_gui);
78 switch ($next_class) {
80 case "ilpciimtriggereditorgui":
81 require_once(
"./Services/COPage/classes/class.ilPCIIMTriggerEditorGUI.php");
82 $ilTabs->setTabActive(
"triggers");
87 $ret = $this->ctrl->forwardCommand($image_map_edit);
107 public function getTabs(&$tab_gui, $a_create =
false, $a_change_obj_ref =
false)
114 $ilTabs->setBackTarget(
116 $ilCtrl->getParentReturn($this)
121 $lng->txt(
"cont_active_areas"),
122 $ilCtrl->getLinkTargetByClass(
"ilpciimtriggereditorgui",
"editMapAreas")
127 $lng->txt(
"cont_overlay_images"),
128 $ilCtrl->getLinkTarget($this,
"listOverlayImages")
133 $lng->txt(
"cont_content_popups"),
134 $ilCtrl->getLinkTarget($this,
"listContentPopups")
139 $lng->txt(
"cont_base_image") .
" & " .
$lng->txt(
"cont_caption"),
140 $ilCtrl->getLinkTarget($this,
"editBaseImage")
148 public function insert($a_post_cmd =
"edpost", $a_submit_cmd =
"create_mob", $a_input_error =
false)
160 if ($a_input_error) {
165 $form->setFormAction($ilCtrl->getFormAction($this));
169 $tpl->setContent($form->getHTML());
180 $ilCtrl->redirectByClass(array(
"ilpcinteractiveimagegui",
"ilpciimtriggereditorgui"),
"editMapAreas");
196 $ilTabs->activateTab(
"edit_base_image");
199 $tpl->setContent($form->getHTML());
213 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
218 $fi->setAllowDeletion(
false);
219 if ($a_mode ==
"edit") {
220 $fi->setImage($this->content_obj->getBaseThumbnailTarget());
222 $fi->setRequired(
true);
226 if ($a_mode ==
"edit") {
228 $ti =
new ilTextInputGUI($this->lng->txt(
"cont_caption"),
"caption");
229 $ti->setMaxLength(200);
235 if ($a_mode ==
"create") {
236 $form->setTitle(
$lng->txt(
"cont_ed_insert_iim"));
237 $form->addCommandButton(
"create_iim",
$lng->txt(
"save"));
238 $form->addCommandButton(
"cancelCreate",
$lng->txt(
"cancel"));
245 $this->content_obj->getPcId(),
248 $ti->setValue($std_alias_item->getCaption());
250 $form->setTitle(
$lng->txt(
"cont_edit_base_image"));
251 $form->addCommandButton(
"update",
$lng->txt(
"save"));
254 $form->setFormAction($ilCtrl->getFormAction($this));
269 if (!$form->checkInput()) {
271 $form->setValuesByPost();
272 $tpl->setContent($form->getHTML());
277 $this->content_obj->createMediaObject();
278 $media_obj = $this->content_obj->getMediaObject();
279 $media_obj->setTitle($_FILES[
'image_file'][
'name']);
280 $media_obj->create();
283 $media_obj->createDirectory();
285 $media_obj->addMediaItem($media_item);
286 $media_item->setPurpose(
"Standard");
288 $file = $mob_dir .
"/" . $_FILES[
'image_file'][
'name'];
291 $_FILES[
'image_file'][
'tmp_name'],
292 $_FILES[
'image_file'][
'name'],
301 $location = $_FILES[
'image_file'][
'name'];
304 $media_item->setFormat(
$format);
306 $media_item->setLocationType(
"LocalFile");
309 $media_obj->update();
311 $this->content_obj->createAlias($this->pg_obj, $this->hier_id, $this->pc_id);
312 $this->updated = $this->pg_obj->update();
313 if ($this->updated ===
true) {
314 $this->pg_obj->stripHierIDs();
315 $this->pg_obj->addHierIDs();
316 $ilCtrl->setParameter($this,
"hier_id", $this->content_obj->readHierId());
317 $ilCtrl->setParameter($this,
"pc_id", $this->content_obj->readPCId());
318 $this->content_obj->setHierId($this->content_obj->readHierId());
319 $this->
setHierId($this->content_obj->readHierId());
320 $this->content_obj->setPCId($this->content_obj->readPCId());
321 ilUtil::sendSuccess(
$lng->txt(
"cont_saved_interactive_image"),
true);
322 $this->ctrl->redirectByClass(
"ilpcinteractiveimagegui",
"edit");
338 $mob = $this->content_obj->getMediaObject();
340 $std_item = $mob->getMediaItem(
"Standard");
341 $location = $_FILES[
'image_file'][
'name'];
343 if (
$location !=
"" && is_file($_FILES[
'image_file'][
'tmp_name'])) {
344 $file = $mob_dir .
"/" . $_FILES[
'image_file'][
'name'];
346 $_FILES[
'image_file'][
'tmp_name'],
347 $_FILES[
'image_file'][
'name'],
353 $location = $_FILES[
'image_file'][
'name'];
356 $std_item->setLocationType(
"LocalFile");
366 $this->content_obj->getPcId(),
370 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
371 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
373 $ilCtrl->redirectByClass(
"ilpcinteractiveimagegui",
"editBaseImage");
386 $this->content_obj->getPcId(),
389 $std_alias_item->setHorizontalAlign(
"Center");
390 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
391 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
403 $this->content_obj->getPcId(),
406 $std_alias_item->setHorizontalAlign(
"Left");
407 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
408 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
420 $this->content_obj->getPcId(),
423 $std_alias_item->setHorizontalAlign(
"Right");
424 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
425 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
437 $this->content_obj->getPcId(),
440 $std_alias_item->setHorizontalAlign(
"LeftFloat");
441 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
442 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
454 $this->content_obj->getPcId(),
457 $std_alias_item->setHorizontalAlign(
"RightFloat");
458 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
459 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
482 $ilTabs->setTabActive(
"list_overlays");
484 $ilToolbar->addButton(
485 $lng->txt(
"cont_add_images"),
486 $ilCtrl->getLinkTarget($this,
"addOverlayImages")
489 include_once(
"./Services/COPage/classes/class.ilPCIIMOverlaysTableGUI.php");
493 $this->content_obj->getMediaObject()
495 $tpl->setContent($tab->getHTML());
511 $tpl->setContent($form->getHTML());
526 $ilTabs->setTabActive(
"list_overlays");
528 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
530 $form->setTitle(
$lng->txt(
"cont_add_images"));
531 $form->setFormAction($ilCtrl->getFormAction($this));
534 include_once(
"./Services/Form/classes/class.ilFileWizardInputGUI.php");
536 $fi->setSuffixes(array(
"gif",
"jpeg",
"jpg",
"png"));
537 $fi->setFilenames(array(0 =>
''));
538 $fi->setRequired(
true);
541 $form->addCommandButton(
"uploadOverlayImages",
$lng->txt(
"upload"));
542 $form->addCommandButton(
"listOverlayImages",
$lng->txt(
"cancel"));
560 if ($form->checkInput()) {
561 if (is_array($_FILES[
"ovfile"][
"name"])) {
562 foreach ($_FILES[
"ovfile"][
"name"] as $k => $v) {
563 $name = $_FILES[
"ovfile"][
"name"][$k];
564 $mime = $_FILES[
"ovfile"][
"type"][$k];
565 $tmp_name = $_FILES[
"ovfile"][
"tmp_name"][$k];
566 $size = $_FILES[
"ovfile"][
"size"][$k];
568 $this->content_obj->getMediaObject()->uploadAdditionalFile(
573 $piname = pathinfo(
$name);
574 $this->content_obj->getMediaObject()->makeThumbnail(
576 basename(
$name,
"." . $piname[
'extension']) .
".png"
580 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"));
581 $ilCtrl->redirect($this,
"listOverlayImages");
583 $form->setValuesByPost();
598 $ilTabs->setTabActive(
"list_overlays");
600 if (!is_array(
$_POST[
"file"]) || count(
$_POST[
"file"]) == 0) {
602 $ilCtrl->redirect($this,
"listOverlayImages");
604 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
606 $cgui->setFormAction($ilCtrl->getFormAction($this));
607 $cgui->setHeaderText(
$lng->txt(
"cont_really_delete_overlays"));
608 $cgui->setCancel(
$lng->txt(
"cancel"),
"listOverlayImages");
609 $cgui->setConfirm(
$lng->txt(
"delete"),
"deleteOverlays");
612 $cgui->addItem(
"file[]",
$i,
$i);
615 $tpl->setContent($cgui->getHTML());
627 if (is_array(
$_POST[
"file"]) && count(
$_POST[
"file"]) != 0) {
630 $this->content_obj->getMediaObject()
631 ->removeAdditionalFile(
"overlays/" .
$f);
634 ilUtil::sendSuccess(
$lng->txt(
"cont_overlays_have_been_deleted"),
true);
636 $ilCtrl->redirect($this,
"listOverlayImages");
657 $ilTabs->setTabActive(
"content_popups");
659 $ilToolbar->addButton(
660 $lng->txt(
"cont_add_popup"),
661 $ilCtrl->getLinkTarget($this,
"addPopup")
664 include_once(
"./Services/COPage/classes/class.ilPCIIMPopupTableGUI.php");
670 $tpl->setContent($tab->getHTML());
684 $this->content_obj->addContentPopup();
685 $this->pg_obj->update();
686 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
687 $ilCtrl->redirect($this,
"listContentPopups");
698 if (is_array(
$_POST[
"title"])) {
700 $this->content_obj->savePopUps($titles);
701 $this->pg_obj->update();
702 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
704 $ilCtrl->redirect($this,
"listContentPopups");
717 $ilTabs->setTabActive(
"content_popups");
719 if (!is_array(
$_POST[
"tid"]) || count(
$_POST[
"tid"]) == 0) {
721 $ilCtrl->redirect($this,
"listContentPopups");
723 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
725 $cgui->setFormAction($ilCtrl->getFormAction($this));
726 $cgui->setHeaderText(
$lng->txt(
"cont_really_delete_popups"));
727 $cgui->setCancel(
$lng->txt(
"cancel"),
"listContentPopups");
728 $cgui->setConfirm(
$lng->txt(
"delete"),
"deletePopups");
731 $cgui->addItem(
"tid[]",
$i,
$_POST[
"title"][
$i]);
734 $tpl->setContent($cgui->getHTML());
749 if (is_array(
$_POST[
"tid"]) && count(
$_POST[
"tid"]) != 0) {
750 foreach (
$_POST[
"tid"] as $id) {
751 $id = explode(
":", $id);
752 $this->content_obj->deletePopup($id[0], $id[1]);
754 $this->pg_obj->update();
755 ilUtil::sendSuccess(
$lng->txt(
"cont_popups_have_been_deleted"),
true);
757 $ilCtrl->redirect($this,
"listContentPopups");
An exception for terminatinating execution or to throw for unit testing.
Confirmation screen class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
TableGUI class for interactive image overlays.
User interface class for page content map editor.
User interface class for interactive images.
confirmPopupDeletion()
Confirm popup deletion.
editBaseImage($a_form=null)
Edit base image.
rightFloatAlign()
align media object to right, floating text
leftAlign()
align media object to left
listContentPopups()
List content popups.
deleteOverlays()
Delete overlays.
__construct($a_pg_obj, $a_content_obj, $a_hier_id=0, $a_pc_id="")
Constructor @access public.
update()
Update (base image)
initAddOverlaysForm()
Init add overlays form.
insert($a_post_cmd="edpost", $a_submit_cmd="create_mob", $a_input_error=false)
Insert new media object form.
leftFloatAlign()
align media object to left, floating text
uploadOverlayImages()
Upload overlay images.
listOverlayImages()
List overlay images.
create()
Create new content element.
initForm($a_mode="edit")
Init creation/base image form.
getTabs(&$tab_gui, $a_create=false, $a_change_obj_ref=false)
Add tabs to ilTabsGUI object.
executeCommand()
execute command
centerAlign()
Align media object to center.
confirmDeleteOverlays()
Confirm overlay deletion.
deletePopups()
Delete popups.
addOverlayImages($a_form=null)
Add overlay images.
rightAlign()
align media object to right
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
getHierId()
get hierarchical id in dom object
displayValidationError()
display validation errors
setHierId($a_hier_id)
get hierarchical id in dom object
This class represents a text property in a property form.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc