5 require_once(
"./Services/COPage/classes/class.ilPageContentGUI.php");
6 require_once(
"./Services/COPage/classes/class.ilPCInteractiveImage.php");
7 include_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());
224 if ($a_mode ==
"edit") {
226 $ti =
new ilTextInputGUI($this->lng->txt(
"cont_caption"),
"caption");
227 $ti->setMaxLength(200);
233 if ($a_mode ==
"create") {
234 $form->setTitle(
$lng->txt(
"cont_ed_insert_iim"));
235 $form->addCommandButton(
"create_iim",
$lng->txt(
"save"));
236 $form->addCommandButton(
"cancelCreate",
$lng->txt(
"cancel"));
243 $this->content_obj->getPcId(),
246 $ti->setValue($std_alias_item->getCaption());
248 $form->setTitle(
$lng->txt(
"cont_edit_base_image"));
249 $form->addCommandButton(
"update",
$lng->txt(
"save"));
252 $form->setFormAction(
$ilCtrl->getFormAction($this));
266 $this->content_obj->createMediaObject();
267 $media_obj = $this->content_obj->getMediaObject();
268 $media_obj->setTitle($_FILES[
'image_file'][
'name']);
269 $media_obj->create();
272 $media_obj->createDirectory();
274 $media_obj->addMediaItem($media_item);
275 $media_item->setPurpose(
"Standard");
277 $file = $mob_dir .
"/" . $_FILES[
'image_file'][
'name'];
279 $_FILES[
'image_file'][
'tmp_name'],
280 $_FILES[
'image_file'][
'name'],
286 $location = $_FILES[
'image_file'][
'name'];
289 $media_item->setFormat(
$format);
291 $media_item->setLocationType(
"LocalFile");
294 $media_obj->update();
296 $this->content_obj->createAlias($this->pg_obj, $this->hier_id, $this->pc_id);
297 $this->updated = $this->pg_obj->update();
298 if ($this->updated ===
true) {
299 $this->pg_obj->stripHierIDs();
300 $this->pg_obj->addHierIDs();
301 $ilCtrl->setParameter($this,
"hier_id", $this->content_obj->readHierId());
302 $ilCtrl->setParameter($this,
"pc_id", $this->content_obj->readPCId());
303 $this->content_obj->setHierId($this->content_obj->readHierId());
304 $this->
setHierId($this->content_obj->readHierId());
305 $this->content_obj->setPCId($this->content_obj->readPCId());
306 ilUtil::sendSuccess(
$lng->txt(
"cont_saved_interactive_image"),
true);
307 $this->ctrl->redirectByClass(
"ilpcinteractiveimagegui",
"edit");
323 $mob = $this->content_obj->getMediaObject();
325 $std_item = $mob->getMediaItem(
"Standard");
326 $location = $_FILES[
'image_file'][
'name'];
328 if (
$location !=
"" && is_file($_FILES[
'image_file'][
'tmp_name'])) {
329 $file = $mob_dir .
"/" . $_FILES[
'image_file'][
'name'];
331 $_FILES[
'image_file'][
'tmp_name'],
332 $_FILES[
'image_file'][
'name'],
338 $location = $_FILES[
'image_file'][
'name'];
341 $std_item->setLocationType(
"LocalFile");
351 $this->content_obj->getPcId(),
355 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
356 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
358 $ilCtrl->redirectByClass(
"ilpcinteractiveimagegui",
"editBaseImage");
371 $this->content_obj->getPcId(),
375 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
376 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
388 $this->content_obj->getPcId(),
392 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
393 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
405 $this->content_obj->getPcId(),
409 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
410 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
422 $this->content_obj->getPcId(),
426 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
427 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
439 $this->content_obj->getPcId(),
443 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
444 $this->ctrl->returnToParent($this,
"jump" . $this->hier_id);
467 $ilTabs->setTabActive(
"list_overlays");
469 $ilToolbar->addButton(
470 $lng->txt(
"cont_add_images"),
471 $ilCtrl->getLinkTarget($this,
"addOverlayImages")
474 include_once(
"./Services/COPage/classes/class.ilPCIIMOverlaysTableGUI.php");
478 $this->content_obj->getMediaObject()
496 $tpl->setContent($form->getHTML());
511 $ilTabs->setTabActive(
"list_overlays");
513 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
515 $form->setTitle(
$lng->txt(
"cont_add_images"));
516 $form->setFormAction(
$ilCtrl->getFormAction($this));
519 include_once(
"./Services/Form/classes/class.ilFileWizardInputGUI.php");
521 $fi->
setSuffixes(array(
"gif",
"jpeg",
"jpg",
"png"));
522 $fi->setFilenames(array(0 =>
''));
523 $fi->setRequired(
true);
526 $form->addCommandButton(
"uploadOverlayImages",
$lng->txt(
"upload"));
527 $form->addCommandButton(
"listOverlayImages",
$lng->txt(
"cancel"));
545 if ($form->checkInput()) {
546 if (is_array($_FILES[
"ovfile"][
"name"])) {
547 foreach ($_FILES[
"ovfile"][
"name"] as $k => $v) {
548 $name = $_FILES[
"ovfile"][
"name"][$k];
549 $mime = $_FILES[
"ovfile"][
"type"][$k];
550 $tmp_name = $_FILES[
"ovfile"][
"tmp_name"][$k];
551 $size = $_FILES[
"ovfile"][
"size"][$k];
553 $this->content_obj->getMediaObject()->uploadAdditionalFile(
558 $piname = pathinfo(
$name);
559 $this->content_obj->getMediaObject()->makeThumbnail(
561 basename(
$name,
"." . $piname[
'extension']) .
".png" 565 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"));
566 $ilCtrl->redirect($this,
"listOverlayImages");
568 $form->setValuesByPost();
583 $ilTabs->setTabActive(
"list_overlays");
585 if (!is_array(
$_POST[
"file"]) || count(
$_POST[
"file"]) == 0) {
587 $ilCtrl->redirect($this,
"listOverlayImages");
589 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
591 $cgui->setFormAction(
$ilCtrl->getFormAction($this));
592 $cgui->setHeaderText(
$lng->txt(
"cont_really_delete_overlays"));
593 $cgui->setCancel(
$lng->txt(
"cancel"),
"listOverlayImages");
594 $cgui->setConfirm(
$lng->txt(
"delete"),
"deleteOverlays");
597 $cgui->addItem(
"file[]",
$i,
$i);
600 $tpl->setContent($cgui->getHTML());
612 if (is_array(
$_POST[
"file"]) && count(
$_POST[
"file"]) != 0) {
615 $this->content_obj->getMediaObject()
616 ->removeAdditionalFile(
"overlays/" . $f);
619 ilUtil::sendSuccess(
$lng->txt(
"cont_overlays_have_been_deleted"),
true);
621 $ilCtrl->redirect($this,
"listOverlayImages");
642 $ilTabs->setTabActive(
"content_popups");
644 $ilToolbar->addButton(
645 $lng->txt(
"cont_add_popup"),
646 $ilCtrl->getLinkTarget($this,
"addPopup")
649 include_once(
"./Services/COPage/classes/class.ilPCIIMPopupTableGUI.php");
669 $this->content_obj->addContentPopup();
670 $this->pg_obj->update();
671 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
672 $ilCtrl->redirect($this,
"listContentPopups");
683 if (is_array(
$_POST[
"title"])) {
685 $this->content_obj->savePopUps($titles);
686 $this->pg_obj->update();
687 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
689 $ilCtrl->redirect($this,
"listContentPopups");
702 $ilTabs->setTabActive(
"content_popups");
704 if (!is_array(
$_POST[
"tid"]) || count(
$_POST[
"tid"]) == 0) {
706 $ilCtrl->redirect($this,
"listContentPopups");
708 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
710 $cgui->setFormAction(
$ilCtrl->getFormAction($this));
711 $cgui->setHeaderText(
$lng->txt(
"cont_really_delete_popups"));
712 $cgui->setCancel(
$lng->txt(
"cancel"),
"listContentPopups");
713 $cgui->setConfirm(
$lng->txt(
"delete"),
"deletePopups");
716 $cgui->addItem(
"tid[]",
$i,
$_POST[
"title"][
$i]);
719 $tpl->setContent($cgui->getHTML());
734 if (is_array(
$_POST[
"tid"]) && count(
$_POST[
"tid"]) != 0) {
735 foreach (
$_POST[
"tid"] as $id) {
736 $id = explode(
":", $id);
737 $this->content_obj->deletePopup($id[0], $id[1]);
739 $this->pg_obj->update();
740 ilUtil::sendSuccess(
$lng->txt(
"cont_popups_have_been_deleted"),
true);
742 $ilCtrl->redirect($this,
"listContentPopups");
deletePopups()
Delete popups.
centerAlign()
Align media object to center.
getTabs(&$tab_gui, $a_create=false, $a_change_obj_ref=false)
Add tabs to ilTabsGUI object.
uploadOverlayImages()
Upload overlay images.
getHierId()
get hierarchical id in dom object
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
executeCommand()
execute command
insert($a_post_cmd="edpost", $a_submit_cmd="create_mob", $a_input_error=false)
Insert new media object form.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
confirmDeleteOverlays()
Confirm overlay deletion.
listContentPopups()
List content popups.
displayValidationError()
display validation errors
__construct($a_pg_obj, $a_content_obj, $a_hier_id=0, $a_pc_id="")
rightFloatAlign()
align media object to right, floating text
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
initForm($a_mode="edit")
Init creation/base image form.
initAddOverlaysForm()
Init add overlays form.
listOverlayImages()
List overlay images.
update()
Update (base image)
addOverlayImages($a_form=null)
Add overlay images.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
leftFloatAlign()
align media object to left, floating text
TableGUI class for interactive image overlays.
create()
Create new content element.
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
leftAlign()
align media object to left
__construct(Container $dic, ilPlugin $plugin)
deleteOverlays()
Delete overlays.
rightAlign()
align media object to right
confirmPopupDeletion()
Confirm popup deletion.
editBaseImage($a_form=null)
Edit base image.
User interface class for interactive images.
User interface class for page content map editor.
setHierId($a_hier_id)
get hierarchical id in dom object
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
Confirmation screen class.