ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPCInteractiveImageGUI Class Reference

User interface class for interactive images. More...

+ Inheritance diagram for ilPCInteractiveImageGUI:
+ Collaboration diagram for ilPCInteractiveImageGUI:

Public Member Functions

 __construct ($a_pg_obj, $a_content_obj, $a_hier_id=0, $a_pc_id="")
 
 executeCommand ()
 execute command More...
 
 getTabs (&$tab_gui, $a_create=false, $a_change_obj_ref=false)
 Add tabs to ilTabsGUI object. More...
 
 insert ($a_post_cmd="edpost", $a_submit_cmd="create_mob", $a_input_error=false)
 Insert new media object form. More...
 
 edit ()
 Edit. More...
 
 editBaseImage ($a_form=null)
 Edit base image. More...
 
 initForm ($a_mode="edit")
 Init creation/base image form. More...
 
 create ()
 Create new content element. More...
 
 update ()
 Update (base image) More...
 
 centerAlign ()
 Align media object to center. More...
 
 leftAlign ()
 align media object to left More...
 
 rightAlign ()
 align media object to right More...
 
 leftFloatAlign ()
 align media object to left, floating text More...
 
 rightFloatAlign ()
 align media object to right, floating text More...
 
 listOverlayImages ()
 List overlay images. More...
 
 addOverlayImages ($a_form=null)
 Add overlay images. More...
 
 initAddOverlaysForm ()
 Init add overlays form. More...
 
 uploadOverlayImages ()
 Upload overlay images. More...
 
 confirmDeleteOverlays ()
 Confirm overlay deletion. More...
 
 deleteOverlays ()
 Delete overlays. More...
 
 listContentPopups ()
 List content popups. More...
 
 addPopup ()
 Add popup. More...
 
 savePopups ()
 Save popups. More...
 
 confirmPopupDeletion ()
 Confirm popup deletion. More...
 
 deletePopups ()
 Delete popups. More...
 
- Public Member Functions inherited from ilPageContentGUI
 __construct ($a_pg_obj, $a_content_obj, $a_hier_id=0, $a_pc_id="")
 Constructor public. More...
 
 setContentObject ($a_val)
 Set content object. More...
 
 getContentObject ()
 Get content object. More...
 
 setPage ($a_val)
 Set page. More...
 
 getPage ()
 Get page. More...
 
 setPageConfig ($a_val)
 Set Page Config. More...
 
 getPageConfig ()
 Get Page Config. More...
 
 setStyleId ($a_styleid)
 Set Style Id. More...
 
 getStyleId ()
 Get Style Id. More...
 
 getStyle ()
 Get style object. More...
 
 getCharacteristicsOfCurrentStyle ($a_type)
 Get characteristics of current style. More...
 
 setCharacteristics ($a_chars)
 Set Characteristics. More...
 
 getCharacteristics ()
 Get characteristics. More...
 
 getHierId ()
 get hierarchical id in dom object More...
 
 setHierId ($a_hier_id)
 get hierarchical id in dom object More...
 
 getBBMenu ($a_ta_name="par_content")
 Get the bb menu incl. More...
 
 delete ()
 delete content element More...
 
 moveAfter ()
 move content element after another element More...
 
 moveBefore ()
 move content element before another element More...
 
 splitPage ()
 split page to new page at specified position More...
 
 splitPageNext ()
 split page to next page at specified position More...
 
 displayValidationError ()
 display validation errors More...
 
 cancelCreate ()
 cancel creating page content More...
 
 cancelUpdate ()
 cancel update More...
 
 cancel ()
 Cancel. More...
 
 deactivate ()
 gui function set enabled if is not enabled and vice versa More...
 
 cut ()
 Cut single element. More...
 
 copy ()
 Copy single element. More...
 
 getTemplateOptions ($a_type)
 Get table templates. More...
 

Protected Attributes

 $tabs
 
 $toolbar
 
- Protected Attributes inherited from ilPageContentGUI
 $error
 
 $log
 

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 Get common bb buttons. More...
 
- Data Fields inherited from ilPageContentGUI
 $content_obj
 
 $tpl
 
 $lng
 
 $ctrl
 
 $pg_obj
 
 $hier_id
 
 $dom
 
 $updated
 
 $target_script
 
 $return_location
 
 $page_config = null
 
- Static Public Attributes inherited from ilPageContentGUI
static $style_selector_reset = "margin-top:2px; margin-bottom:2px; text-indent:0px; position:static; float:none; width: auto;"
 
- Protected Member Functions inherited from ilPageContentGUI
 redirectToParent ($hier_id="")
 Redirect to parent. More...
 
 getParentReturn ($hier_id="")
 
- Static Protected Attributes inherited from ilPageContentGUI
static $common_bb_buttons
 

Detailed Description

User interface class for interactive images.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

ilPCInteractiveImageGUI: ilPCIIMTriggerEditorGUI

Definition at line 19 of file class.ilPCInteractiveImageGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPCInteractiveImageGUI::__construct (   $a_pg_obj,
  $a_content_obj,
  $a_hier_id = 0,
  $a_pc_id = "" 
)

Definition at line 31 of file class.ilPCInteractiveImageGUI.php.

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

32  {
33  global $DIC;
34 
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();
40  parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
41  }
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ addOverlayImages()

ilPCInteractiveImageGUI::addOverlayImages (   $a_form = null)

Add overlay images.

Definition at line 501 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$tpl, and initAddOverlaysForm().

Referenced by uploadOverlayImages().

502  {
503  $tpl = $this->tpl;
504 
505  if ($a_form) {
506  $form = $a_form;
507  } else {
508  $form = $this->initAddOverlaysForm();
509  }
510 
511  $tpl->setContent($form->getHTML());
512  }
initAddOverlaysForm()
Init add overlays form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addPopup()

ilPCInteractiveImageGUI::addPopup ( )

Add popup.

Parameters

Definition at line 679 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$ctrl, and ilPageContentGUI\$lng.

680  {
681  $ilCtrl = $this->ctrl;
682  $lng = $this->lng;
683 
684  $this->content_obj->addContentPopup();
685  $this->pg_obj->update();
686  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
687  $ilCtrl->redirect($this, "listContentPopups");
688  }

◆ centerAlign()

ilPCInteractiveImageGUI::centerAlign ( )

Align media object to center.

Definition at line 380 of file class.ilPCInteractiveImageGUI.php.

References $_SESSION, ilPageContentGUI\getHierId(), and ilMediaAliasItem\setHorizontalAlign().

381  {
382  $std_alias_item = new ilMediaAliasItem(
383  $this->dom,
384  $this->getHierId(),
385  "Standard",
386  $this->content_obj->getPcId(),
387  "InteractiveImage"
388  );
389  $std_alias_item->setHorizontalAlign("Center");
390  $_SESSION["il_pg_error"] = $this->pg_obj->update();
391  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
392  }
$_SESSION["AccountId"]
getHierId()
get hierarchical id in dom object
Class ilMediaAliasItem.
+ Here is the call graph for this function:

◆ confirmDeleteOverlays()

ilPCInteractiveImageGUI::confirmDeleteOverlays ( )

Confirm overlay deletion.

Definition at line 591 of file class.ilPCInteractiveImageGUI.php.

References $_POST, ilPageContentGUI\$ctrl, $d, $i, ilPageContentGUI\$lng, $tabs, ilPageContentGUI\$tpl, and ilUtil\sendFailure().

592  {
593  $ilCtrl = $this->ctrl;
594  $tpl = $this->tpl;
595  $lng = $this->lng;
596  $ilTabs = $this->tabs;
597 
598  $ilTabs->setTabActive("list_overlays");
599 
600  if (!is_array($_POST["file"]) || count($_POST["file"]) == 0) {
601  ilUtil::sendFailure($lng->txt("no_checkbox"), true);
602  $ilCtrl->redirect($this, "listOverlayImages");
603  } else {
604  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
605  $cgui = new ilConfirmationGUI();
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");
610 
611  foreach ($_POST["file"] as $i => $d) {
612  $cgui->addItem("file[]", $i, $i);
613  }
614 
615  $tpl->setContent($cgui->getHTML());
616  }
617  }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
$i
Definition: metadata.php:24
Confirmation screen class.
+ Here is the call graph for this function:

◆ confirmPopupDeletion()

ilPCInteractiveImageGUI::confirmPopupDeletion ( )

Confirm popup deletion.

Definition at line 710 of file class.ilPCInteractiveImageGUI.php.

References $_POST, ilPageContentGUI\$ctrl, $d, $i, ilPageContentGUI\$lng, $tabs, ilPageContentGUI\$tpl, and ilUtil\sendFailure().

711  {
712  $ilCtrl = $this->ctrl;
713  $tpl = $this->tpl;
714  $lng = $this->lng;
715  $ilTabs = $this->tabs;
716 
717  $ilTabs->setTabActive("content_popups");
718 
719  if (!is_array($_POST["tid"]) || count($_POST["tid"]) == 0) {
720  ilUtil::sendFailure($lng->txt("no_checkbox"), true);
721  $ilCtrl->redirect($this, "listContentPopups");
722  } else {
723  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
724  $cgui = new ilConfirmationGUI();
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");
729 
730  foreach ($_POST["tid"] as $i => $d) {
731  $cgui->addItem("tid[]", $i, $_POST["title"][$i]);
732  }
733 
734  $tpl->setContent($cgui->getHTML());
735  }
736  }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
$i
Definition: metadata.php:24
Confirmation screen class.
+ Here is the call graph for this function:

◆ create()

ilPCInteractiveImageGUI::create ( )

Create new content element.

Definition at line 262 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$ctrl, Vendor\Package\$e, $format, ilPageContentGUI\$lng, $location, ilPageContentGUI\$tpl, ilObjMediaObject\_getDirectory(), ilPageContentGUI\displayValidationError(), ilObjMediaObject\getMimeType(), ilPageContentGUI\getPage(), initForm(), insert(), ilUtil\moveUploadedFile(), ilUtil\renameExecutables(), ilUtil\sendFailure(), and ilPageContentGUI\setHierId().

263  {
264  $ilCtrl = $this->ctrl;
265  $lng = $this->lng;
266  $tpl = $this->tpl;
267 
268  $form = $this->initForm("create");
269  if (!$form->checkInput()) {
270  $this->displayValidationError();
271  $form->setValuesByPost();
272  $tpl->setContent($form->getHTML());
273  return;
274  }
275 
276  $this->content_obj = new ilPCInteractiveImage($this->getPage());
277  $this->content_obj->createMediaObject();
278  $media_obj = $this->content_obj->getMediaObject();
279  $media_obj->setTitle($_FILES['image_file']['name']);
280  $media_obj->create();
281  $mob_dir = ilObjMediaObject::_getDirectory($media_obj->getId());
282  // $media_obj->setStandardType("File");
283  $media_obj->createDirectory();
284  $media_item = new ilMediaItem();
285  $media_obj->addMediaItem($media_item);
286  $media_item->setPurpose("Standard");
287 
288  $file = $mob_dir . "/" . $_FILES['image_file']['name'];
289  try {
291  $_FILES['image_file']['tmp_name'],
292  $_FILES['image_file']['name'],
293  $file
294  );
295  } catch (ilException $e) {
296  ilUtil::sendFailure($this->lng->txt("file_is_infected"), true);
297  return;
298  }
299  // get mime type
301  $location = $_FILES['image_file']['name'];
302 
303  // set real meta and object data
304  $media_item->setFormat($format);
305  $media_item->setLocation($location);
306  $media_item->setLocationType("LocalFile");
307 
308  ilUtil::renameExecutables($mob_dir);
309  $media_obj->update();
310 
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");
323 
324  //$this->ctrl->returnToParent($this, "jump".$this->hier_id);
325  } else {
326  $this->insert();
327  }
328  }
static getMimeType($a_file, $a_external=null)
get mime type for file
$location
Definition: buildRTE.php:44
static _getDirectory($a_mob_id)
Get absolute directory.
insert($a_post_cmd="edpost", $a_submit_cmd="create_mob", $a_input_error=false)
Insert new media object form.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
Class ilMediaItem Media Item, component of a media object (file or reference)
displayValidationError()
display validation errors
$format
Definition: metadata.php:218
initForm($a_mode="edit")
Init creation/base image form.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
setHierId($a_hier_id)
get hierarchical id in dom object
+ Here is the call graph for this function:

◆ deleteOverlays()

ilPCInteractiveImageGUI::deleteOverlays ( )

Delete overlays.

Definition at line 622 of file class.ilPCInteractiveImageGUI.php.

References $_POST, ilPageContentGUI\$ctrl, Vendor\Package\$f, ilPageContentGUI\$lng, and ilUtil\stripSlashes().

623  {
624  $ilCtrl = $this->ctrl;
625  $lng = $this->lng;
626 
627  if (is_array($_POST["file"]) && count($_POST["file"]) != 0) {
628  foreach ($_POST["file"] as $f) {
629  $f = str_replace("..", "", ilUtil::stripSlashes($f));
630  $this->content_obj->getMediaObject()
631  ->removeAdditionalFile("overlays/" . $f);
632  }
633 
634  ilUtil::sendSuccess($lng->txt("cont_overlays_have_been_deleted"), true);
635  }
636  $ilCtrl->redirect($this, "listOverlayImages");
637  }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST["username"]
+ Here is the call graph for this function:

◆ deletePopups()

ilPCInteractiveImageGUI::deletePopups ( )

Delete popups.

Parameters

Definition at line 744 of file class.ilPCInteractiveImageGUI.php.

References $_POST, ilPageContentGUI\$ctrl, and ilPageContentGUI\$lng.

745  {
746  $lng = $this->lng;
747  $ilCtrl = $this->ctrl;
748 
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]);
753  }
754  $this->pg_obj->update();
755  ilUtil::sendSuccess($lng->txt("cont_popups_have_been_deleted"), true);
756  }
757  $ilCtrl->redirect($this, "listContentPopups");
758  }
$_POST["username"]

◆ edit()

ilPCInteractiveImageGUI::edit ( )

Edit.

Definition at line 175 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$ctrl, and ilPageContentGUI\$tpl.

176  {
177  $tpl = $this->tpl;
178  $ilCtrl = $this->ctrl;
179 
180  $ilCtrl->redirectByClass(array("ilpcinteractiveimagegui", "ilpciimtriggereditorgui"), "editMapAreas");
181  //$tpl->setContent("hh");
182  }

◆ editBaseImage()

ilPCInteractiveImageGUI::editBaseImage (   $a_form = null)

Edit base image.

Parameters

Definition at line 190 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$lng, $tabs, ilPageContentGUI\$tpl, and initForm().

191  {
192  $tpl = $this->tpl;
193  $ilTabs = $this->tabs;
194  $lng = $this->lng;
195 
196  $ilTabs->activateTab("edit_base_image");
197 
198  $form = $this->initForm();
199  $tpl->setContent($form->getHTML());
200  }
initForm($a_mode="edit")
Init creation/base image form.
+ Here is the call graph for this function:

◆ executeCommand()

ilPCInteractiveImageGUI::executeCommand ( )

execute command

Definition at line 46 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$lng, $ret, $tabs, ilPageContentGUI\$tpl, ilUtil\getImagePath(), and getTabs().

47  {
48  $tpl = $this->tpl;
49  $lng = $this->lng;
50  $ilTabs = $this->tabs;
51 
52 
53  // $this->getCharacteristicsOfCurrentStyle("media_cont"); // scorm-2004
54 
55  // get next class that processes or forwards current command
56  $next_class = $this->ctrl->getNextClass($this);
57 
58  // get current command
59  $cmd = $this->ctrl->getCmd();
60 
61  if (is_object($this->content_obj)) {
62  $tpl->setTitleIcon(ilUtil::getImagePath("icon_mob.svg"));
63  $this->getTabs($this->tabs_gui);
64 
65  /* $mob = $this->content_obj->getMediaObject();
66  if (is_object($mob))
67  {
68  $tpl->setVariable("HEADER", $lng->txt("mob").": ".
69  $this->content_obj->getMediaObject()->getTitle());
70  $mob_gui = new ilObjMediaObjectGUI("", $this->content_obj->getMediaObject()->getId(),false, false);
71  $mob_gui->setBackTitle($this->page_back_title);
72  $mob_gui->setEnabledMapAreas($this->getEnabledMapAreas());
73  $mob_gui->getTabs($this->tabs_gui);
74  }*/
75  } else {
76  }
77 
78  switch ($next_class) {
79  // trigger editor
80  case "ilpciimtriggereditorgui":
81  require_once("./Services/COPage/classes/class.ilPCIIMTriggerEditorGUI.php");
82  $ilTabs->setTabActive("triggers");
83  $image_map_edit = new ilPCIIMTriggerEditorGUI(
84  $this->content_obj,
85  $this->pg_obj
86  );
87  $ret = $this->ctrl->forwardCommand($image_map_edit);
88  if ($ret != "") {
89  $tpl->setContent($ret);
90  }
91  break;
92 
93  default:
94  $ret = $this->$cmd();
95  break;
96  }
97 
98  return $ret;
99  }
getTabs(&$tab_gui, $a_create=false, $a_change_obj_ref=false)
Add tabs to ilTabsGUI object.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$ret
Definition: parser.php:6
User interface class for page content map editor.
+ Here is the call graph for this function:

◆ getTabs()

ilPCInteractiveImageGUI::getTabs ( $tab_gui,
  $a_create = false,
  $a_change_obj_ref = false 
)

Add tabs to ilTabsGUI object.

Parameters
object$tab_guiilTabsGUI object
boolean$a_createnew creation true/false

Definition at line 107 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, and $tabs.

Referenced by executeCommand().

108  {
109  $ilCtrl = $this->ctrl;
110  $ilTabs = $this->tabs;
111  $lng = $this->lng;
112 
113  if (!$a_create) {
114  $ilTabs->setBackTarget(
115  $lng->txt("pg"),
116  $ilCtrl->getParentReturn($this)
117  );
118 
119  $ilTabs->addTab(
120  "triggers",
121  $lng->txt("cont_active_areas"),
122  $ilCtrl->getLinkTargetByClass("ilpciimtriggereditorgui", "editMapAreas")
123  );
124 
125  $ilTabs->addTab(
126  "list_overlays",
127  $lng->txt("cont_overlay_images"),
128  $ilCtrl->getLinkTarget($this, "listOverlayImages")
129  );
130 
131  $ilTabs->addTab(
132  "content_popups",
133  $lng->txt("cont_content_popups"),
134  $ilCtrl->getLinkTarget($this, "listContentPopups")
135  );
136 
137  $ilTabs->addTab(
138  "edit_base_image",
139  $lng->txt("cont_base_image") . " & " . $lng->txt("cont_caption"),
140  $ilCtrl->getLinkTarget($this, "editBaseImage")
141  );
142  }
143  }
+ Here is the caller graph for this function:

◆ initAddOverlaysForm()

ilPCInteractiveImageGUI::initAddOverlaysForm ( )

Init add overlays form.

Parameters

Definition at line 520 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, $tabs, and ilFileInputGUI\setSuffixes().

Referenced by addOverlayImages(), and uploadOverlayImages().

521  {
522  $lng = $this->lng;
523  $ilCtrl = $this->ctrl;
524  $ilTabs = $this->tabs;
525 
526  $ilTabs->setTabActive("list_overlays");
527 
528  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
529  $form = new ilPropertyFormGUI();
530  $form->setTitle($lng->txt("cont_add_images"));
531  $form->setFormAction($ilCtrl->getFormAction($this));
532 
533  // file input
534  include_once("./Services/Form/classes/class.ilFileWizardInputGUI.php");
535  $fi = new ilFileWizardInputGUI($lng->txt("file"), "ovfile");
536  $fi->setSuffixes(array("gif", "jpeg", "jpg", "png"));
537  $fi->setFilenames(array(0 => ''));
538  $fi->setRequired(true);
539  $form->addItem($fi);
540 
541  $form->addCommandButton("uploadOverlayImages", $lng->txt("upload"));
542  $form->addCommandButton("listOverlayImages", $lng->txt("cancel"));
543 
544  return $form;
545  }
This class represents a property form user interface.
This class represents a file wizard property in a property form.
setSuffixes($a_suffixes)
Set Accepted Suffixes.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initForm()

ilPCInteractiveImageGUI::initForm (   $a_mode = "edit")

Init creation/base image form.

Parameters
int$a_modeEdit Mode

Definition at line 208 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, ilPageContentGUI\getHierId(), and ilImageFileInputGUI\setImage().

Referenced by create(), editBaseImage(), and insert().

209  {
210  $lng = $this->lng;
211  $ilCtrl = $this->ctrl;
212 
213  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
214  $form = new ilPropertyFormGUI();
215 
216  // image file
217  $fi = new ilImageFileInputGUI($lng->txt("cont_file"), "image_file");
218  $fi->setAllowDeletion(false);
219  if ($a_mode == "edit") {
220  $fi->setImage($this->content_obj->getBaseThumbnailTarget());
221  } else {
222  $fi->setRequired(true);
223  }
224  $form->addItem($fi);
225 
226  if ($a_mode == "edit") {
227  // caption
228  $ti = new ilTextInputGUI($this->lng->txt("cont_caption"), "caption");
229  $ti->setMaxLength(200);
230  $ti->setSize(50);
231  $form->addItem($ti);
232  }
233 
234  // save and cancel commands
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"));
239  } else {
240  // get caption
241  $std_alias_item = new ilMediaAliasItem(
242  $this->dom,
243  $this->getHierId(),
244  "Standard",
245  $this->content_obj->getPcId(),
246  "InteractiveImage"
247  );
248  $ti->setValue($std_alias_item->getCaption());
249 
250  $form->setTitle($lng->txt("cont_edit_base_image"));
251  $form->addCommandButton("update", $lng->txt("save"));
252  }
253 
254  $form->setFormAction($ilCtrl->getFormAction($this));
255 
256  return $form;
257  }
This class represents a property form user interface.
getHierId()
get hierarchical id in dom object
Class ilMediaAliasItem.
setImage($a_image)
Set Image.
This class represents an image file property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insert()

ilPCInteractiveImageGUI::insert (   $a_post_cmd = "edpost",
  $a_submit_cmd = "create_mob",
  $a_input_error = false 
)

Insert new media object form.

Definition at line 148 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, $tabs, ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), initForm(), and ilUtil\sendInfo().

Referenced by create().

149  {
150  $ilTabs = $this->tabs;
151  $tpl = $this->tpl;
152  $ilCtrl = $this->ctrl;
153  $lng = $this->lng;
154 
155  ilUtil::sendInfo($lng->txt("cont_iim_create_info"));
156 
157  // $this->getTabs($ilTabs, true);
158  // $ilTabs->setSubTabActive("cont_new_mob");
159 
160  if ($a_input_error) {
161  $form = $this->form;
162  } else {
163  $form = $this->initForm("create");
164  }
165  $form->setFormAction($ilCtrl->getFormAction($this));
166 
167  $this->displayValidationError();
168 
169  $tpl->setContent($form->getHTML());
170  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
displayValidationError()
display validation errors
initForm($a_mode="edit")
Init creation/base image form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ leftAlign()

ilPCInteractiveImageGUI::leftAlign ( )

align media object to left

Definition at line 397 of file class.ilPCInteractiveImageGUI.php.

References $_SESSION, ilPageContentGUI\getHierId(), and ilMediaAliasItem\setHorizontalAlign().

398  {
399  $std_alias_item = new ilMediaAliasItem(
400  $this->dom,
401  $this->getHierId(),
402  "Standard",
403  $this->content_obj->getPcId(),
404  "InteractiveImage"
405  );
406  $std_alias_item->setHorizontalAlign("Left");
407  $_SESSION["il_pg_error"] = $this->pg_obj->update();
408  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
409  }
$_SESSION["AccountId"]
getHierId()
get hierarchical id in dom object
Class ilMediaAliasItem.
+ Here is the call graph for this function:

◆ leftFloatAlign()

ilPCInteractiveImageGUI::leftFloatAlign ( )

align media object to left, floating text

Definition at line 431 of file class.ilPCInteractiveImageGUI.php.

References $_SESSION, ilPageContentGUI\getHierId(), and ilMediaAliasItem\setHorizontalAlign().

432  {
433  $std_alias_item = new ilMediaAliasItem(
434  $this->dom,
435  $this->getHierId(),
436  "Standard",
437  $this->content_obj->getPcId(),
438  "InteractiveImage"
439  );
440  $std_alias_item->setHorizontalAlign("LeftFloat");
441  $_SESSION["il_pg_error"] = $this->pg_obj->update();
442  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
443  }
$_SESSION["AccountId"]
getHierId()
get hierarchical id in dom object
Class ilMediaAliasItem.
+ Here is the call graph for this function:

◆ listContentPopups()

ilPCInteractiveImageGUI::listContentPopups ( )

List content popups.

Definition at line 647 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, $tabs, $toolbar, ilPageContentGUI\$tpl, and ilUtil\sendInfo().

648  {
649  $tpl = $this->tpl;
650  $ilToolbar = $this->toolbar;
651  $ilCtrl = $this->ctrl;
652  $ilTabs = $this->tabs;
653  $lng = $this->lng;
654 
655  ilUtil::sendInfo($lng->txt("cont_iim_content_popups_info"));
656 
657  $ilTabs->setTabActive("content_popups");
658 
659  $ilToolbar->addButton(
660  $lng->txt("cont_add_popup"),
661  $ilCtrl->getLinkTarget($this, "addPopup")
662  );
663 
664  include_once("./Services/COPage/classes/class.ilPCIIMPopupTableGUI.php");
665  $tab = new ilPCIIMPopupTableGUI(
666  $this,
667  "listContentPopups",
668  $this->content_obj
669  );
670  $tpl->setContent($tab->getHTML());
671  }
TableGUI class for content popup.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

◆ listOverlayImages()

ilPCInteractiveImageGUI::listOverlayImages ( )

List overlay images.

Parameters

Definition at line 472 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, $tabs, $toolbar, ilPageContentGUI\$tpl, and ilUtil\sendInfo().

473  {
474  $tpl = $this->tpl;
475  $ilToolbar = $this->toolbar;
476  $ilCtrl = $this->ctrl;
477  $ilTabs = $this->tabs;
478  $lng = $this->lng;
479 
480  ilUtil::sendInfo($lng->txt("cont_iim_overlay_info"));
481 
482  $ilTabs->setTabActive("list_overlays");
483 
484  $ilToolbar->addButton(
485  $lng->txt("cont_add_images"),
486  $ilCtrl->getLinkTarget($this, "addOverlayImages")
487  );
488 
489  include_once("./Services/COPage/classes/class.ilPCIIMOverlaysTableGUI.php");
490  $tab = new ilPCIIMOverlaysTableGUI(
491  $this,
492  "listOverlayImages",
493  $this->content_obj->getMediaObject()
494  );
495  $tpl->setContent($tab->getHTML());
496  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
TableGUI class for interactive image overlays.
+ Here is the call graph for this function:

◆ rightAlign()

ilPCInteractiveImageGUI::rightAlign ( )

align media object to right

Definition at line 414 of file class.ilPCInteractiveImageGUI.php.

References $_SESSION, ilPageContentGUI\getHierId(), and ilMediaAliasItem\setHorizontalAlign().

415  {
416  $std_alias_item = new ilMediaAliasItem(
417  $this->dom,
418  $this->getHierId(),
419  "Standard",
420  $this->content_obj->getPcId(),
421  "InteractiveImage"
422  );
423  $std_alias_item->setHorizontalAlign("Right");
424  $_SESSION["il_pg_error"] = $this->pg_obj->update();
425  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
426  }
$_SESSION["AccountId"]
getHierId()
get hierarchical id in dom object
Class ilMediaAliasItem.
+ Here is the call graph for this function:

◆ rightFloatAlign()

ilPCInteractiveImageGUI::rightFloatAlign ( )

align media object to right, floating text

Definition at line 448 of file class.ilPCInteractiveImageGUI.php.

References $_SESSION, ilPageContentGUI\getHierId(), and ilMediaAliasItem\setHorizontalAlign().

449  {
450  $std_alias_item = new ilMediaAliasItem(
451  $this->dom,
452  $this->getHierId(),
453  "Standard",
454  $this->content_obj->getPcId(),
455  "InteractiveImage"
456  );
457  $std_alias_item->setHorizontalAlign("RightFloat");
458  $_SESSION["il_pg_error"] = $this->pg_obj->update();
459  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
460  }
$_SESSION["AccountId"]
getHierId()
get hierarchical id in dom object
Class ilMediaAliasItem.
+ Here is the call graph for this function:

◆ savePopups()

ilPCInteractiveImageGUI::savePopups ( )

Save popups.

Definition at line 693 of file class.ilPCInteractiveImageGUI.php.

References $_POST, ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, and ilUtil\stripSlashesArray().

694  {
695  $ilCtrl = $this->ctrl;
696  $lng = $this->lng;
697 
698  if (is_array($_POST["title"])) {
699  $titles = ilUtil::stripSlashesArray($_POST["title"]);
700  $this->content_obj->savePopUps($titles);
701  $this->pg_obj->update();
702  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
703  }
704  $ilCtrl->redirect($this, "listContentPopups");
705  }
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
$_POST["username"]
+ Here is the call graph for this function:

◆ update()

ilPCInteractiveImageGUI::update ( )

Update (base image)

Definition at line 333 of file class.ilPCInteractiveImageGUI.php.

References $_POST, $_SESSION, ilPageContentGUI\$ctrl, $format, ilPageContentGUI\$lng, $location, ilObjMediaObject\_getDirectory(), ilPageContentGUI\getHierId(), ilObjMediaObject\getMimeType(), ilUtil\moveUploadedFile(), ilMediaAliasItem\setCaption(), and ilUtil\stripSlashes().

334  {
335  $ilCtrl = $this->ctrl;
336  $lng = $this->lng;
337 
338  $mob = $this->content_obj->getMediaObject();
339  $mob_dir = ilObjMediaObject::_getDirectory($mob->getId());
340  $std_item = $mob->getMediaItem("Standard");
341  $location = $_FILES['image_file']['name'];
342 
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'],
348  $file
349  );
350 
351  // get mime type
353  $location = $_FILES['image_file']['name'];
354  $std_item->setFormat($format);
355  $std_item->setLocation($location);
356  $std_item->setLocationType("LocalFile");
357  $mob->setDescription($format);
358  $mob->update();
359  }
360 
361  // set caption
362  $std_alias_item = new ilMediaAliasItem(
363  $this->dom,
364  $this->getHierId(),
365  "Standard",
366  $this->content_obj->getPcId(),
367  "InteractiveImage"
368  );
369  $std_alias_item->setCaption(ilUtil::stripSlashes($_POST["caption"]));
370  $_SESSION["il_pg_error"] = $this->pg_obj->update();
371  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
372 
373  $ilCtrl->redirectByClass("ilpcinteractiveimagegui", "editBaseImage");
374  }
static getMimeType($a_file, $a_external=null)
get mime type for file
$_SESSION["AccountId"]
setCaption($a_caption)
Set Caption.
$location
Definition: buildRTE.php:44
getHierId()
get hierarchical id in dom object
Class ilMediaAliasItem.
static _getDirectory($a_mob_id)
Get absolute directory.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
$format
Definition: metadata.php:218
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST["username"]
+ Here is the call graph for this function:

◆ uploadOverlayImages()

ilPCInteractiveImageGUI::uploadOverlayImages ( )

Upload overlay images.

Parameters

Definition at line 554 of file class.ilPCInteractiveImageGUI.php.

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, $name, $size, addOverlayImages(), and initAddOverlaysForm().

555  {
556  $lng = $this->lng;
557  $ilCtrl = $this->ctrl;
558 
559  $form = $this->initAddOverlaysForm();
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];
567 
568  $this->content_obj->getMediaObject()->uploadAdditionalFile(
569  $name,
570  $tmp_name,
571  "overlays"
572  );
573  $piname = pathinfo($name);
574  $this->content_obj->getMediaObject()->makeThumbnail(
575  "overlays/" . $name,
576  basename($name, "." . $piname['extension']) . ".png"
577  );
578  }
579  }
580  ilUtil::sendSuccess($lng->txt("msg_obj_modified"));
581  $ilCtrl->redirect($this, "listOverlayImages");
582  } else {
583  $form->setValuesByPost();
584  $this->addOverlayImages($form);
585  }
586  }
$size
Definition: RandomTest.php:84
if($format !==null) $name
Definition: metadata.php:230
initAddOverlaysForm()
Init add overlays form.
addOverlayImages($a_form=null)
Add overlay images.
+ Here is the call graph for this function:

Field Documentation

◆ $tabs

◆ $toolbar

ilPCInteractiveImageGUI::$toolbar
protected

Definition at line 29 of file class.ilPCInteractiveImageGUI.php.

Referenced by listContentPopups(), and listOverlayImages().


The documentation for this class was generated from the following file: