ILIAS  release_8 Revision v8.23
ilPCPlaceHolderGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilPCPlaceHolderGUI:
+ Collaboration diagram for ilPCPlaceHolderGUI:

Public Member Functions

 __construct (ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id, string $a_pc_id="")
 
 executeCommand ()
 
 edit ()
 
 setStyleId (int $a_styleid)
 
 getStyleId ()
 
 cancel ()
 
- Public Member Functions inherited from ilPageContentGUI
 __construct (ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id="", string $a_pc_id="0")
 
 setContentObject (ilPageContent $a_val)
 
 getContentObject ()
 
 setPage (ilPageObject $a_val)
 
 getPage ()
 
 setPageConfig (ilPageConfig $a_val)
 
 getPageConfig ()
 
 setStyleId (int $a_styleid)
 
 getStyleId ()
 
 getStyle ()
 
 getCharacteristicsOfCurrentStyle (array $a_type)
 Get characteristics of current style and call setCharacteristics, if style is given. More...
 
 setCharacteristics (array $a_chars)
 
 getCharacteristics ()
 
 getHierId ()
 
 setHierId (string $a_hier_id)
 set hierarchical id in dom object More...
 
 delete ()
 
 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 ()
 
 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 (string $a_type="")
 Get table templates. More...
 

Data Fields

const TYPE_TEXT = "Text"
 
const TYPE_QUESTION = "Question"
 
const TYPE_MEDIA = "Media"
 
const TYPE_VERIFICATION = "Verification"
 
- Data Fields inherited from ilPageContentGUI
ilPageContent $content_obj
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilPageObject $pg_obj
 
string $hier_id = ""
 
php4DOMDocument $dom
 
 $updated
 
string $target_script = ""
 
string $return_location = ""
 
ilPageConfig $page_config = null
 

Protected Member Functions

 insert ()
 
 create ()
 
 edit_object ()
 
 saveProperties ()
 save placeholder properties in db and return to page edit screen More...
 
 propertyGUI (string $a_action, string $a_type, string $a_height, string $a_mode)
 Property Form. More...
 
 textCOSelectionGUI ()
 Text Item Selection. More...
 
 insertPCText ()
 Forwards Text Item Selection to GUI classes. More...
 
 getAvailableTypes (string $a_selected_type="")
 
 getTypeCaptions ()
 
- Protected Member Functions inherited from ilPageContentGUI
 redirectToParent (string $hier_id="")
 
 getParentReturn (string $hier_id="")
 
 updateAndReturn ()
 
 setCurrentTextLang (string $lang_key)
 
 getCurrentTextLang ()
 

Protected Attributes

ilPropertyFormGUI $form_gui
 
- Protected Attributes inherited from ilPageContentGUI
EditSessionRepository $edit_repo
 
string $pc_id = ""
 
array $chars
 
ilObjStyleSheet $style = null
 
ilLogger $log
 
int $styleid = 0
 
EditGUIRequest $request
 
string $sub_command = ""
 
int $requested_ref_id = 0
 
Style Content CharacteristicManager $char_manager
 

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 
- Static Public Attributes inherited from ilPageContentGUI
static string $style_selector_reset = "margin-top:2px; margin-bottom:2px; text-indent:0px; position:static; float:none; width: auto;"
 
- Static Protected Attributes inherited from ilPageContentGUI
static array $common_bb_buttons
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning User Interface for Place Holder Management

Author
Hendrik Holtmann holtm.nosp@m.ann@.nosp@m.me.co.nosp@m.m ilPCPlaceHolderGUI: ilPCMediaObjectGUI

Definition at line 25 of file class.ilPCPlaceHolderGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPCPlaceHolderGUI::__construct ( ilPageObject  $a_pg_obj,
?ilPageContent  $a_content_obj,
string  $a_hier_id,
string  $a_pc_id = "" 
)

Definition at line 33 of file class.ilPCPlaceHolderGUI.php.

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

38  {
39  global $DIC;
40 
41  $this->lng = $DIC->language();
42  $this->pg_obj = $a_pg_obj;
43  $this->content_obj = $a_content_obj;
44  $this->hier_id = $a_hier_id;
45  $this->pc_id = $a_pc_id;
46 
47  parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
48  }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ cancel()

ilPCPlaceHolderGUI::cancel ( )

Definition at line 317 of file class.ilPCPlaceHolderGUI.php.

References ILIAS\Repository\ctrl().

317  : void
318  {
319  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
320  }
+ Here is the call graph for this function:

◆ create()

ilPCPlaceHolderGUI::create ( )
protected

Definition at line 74 of file class.ilPCPlaceHolderGUI.php.

References ILIAS\Repository\ctrl(), ilPageContentGUI\getPage(), and insert().

74  : void
75  {
76  $plach_height = $this->request->getString("plach_height");
77  if ($plach_height == "" ||
78  !preg_match("/[0-9]+/", $plach_height)) {
79  $this->insert();
80  return;
81  }
82 
83  $this->content_obj = new ilPCPlaceHolder($this->getPage());
84  $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
85  $this->content_obj->setHeight($plach_height . "px");
86  $this->content_obj->setContentClass(
87  $this->request->getString("plach_type")
88  );
89  $this->updated = $this->pg_obj->update();
90  if ($this->updated === true) {
91  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
92  } else {
93  $this->insert();
94  }
95  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ edit()

ilPCPlaceHolderGUI::edit ( )

Definition at line 97 of file class.ilPCPlaceHolderGUI.php.

References edit_object(), and ilPageContentGUI\getPageConfig().

Referenced by saveProperties().

97  : void
98  {
99  if ($this->getPageConfig()->getEnablePCType("PlaceHolder")) {
100  $this->edit_object();
101  } else {
102  $this->forward_edit();
103  }
104  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ edit_object()

ilPCPlaceHolderGUI::edit_object ( )
protected

Definition at line 116 of file class.ilPCPlaceHolderGUI.php.

References ilPageContentGUI\$content_obj, ILIAS\Repository\ctrl(), propertyGUI(), and textCOSelectionGUI().

Referenced by edit(), and saveProperties().

116  : void
117  {
118  $this->propertyGUI(
119  "saveProperties",
120  $this->content_obj->getContentClass(),
121  $this->content_obj->getHeight(),
122  "save"
123  );
124  }
propertyGUI(string $a_action, string $a_type, string $a_height, string $a_mode)
Property Form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilPCPlaceHolderGUI::executeCommand ( )

Definition at line 50 of file class.ilPCPlaceHolderGUI.php.

References ILIAS\Repository\ctrl().

50  : void
51  {
52  // get next class that processes or forwards current command
53  $next_class = $this->ctrl->getNextClass($this);
54  // get current command
55  $cmd = $this->ctrl->getCmd();
56 
57  switch ($next_class) {
58  case 'ilpcmediaobjectgui': //special handling
59  $media_gui = new ilPCMediaObjectGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id);
60  $ret = $this->ctrl->forwardCommand($media_gui);
61  break;
62 
63  default:
64  $this->$cmd();
65  break;
66  }
67  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ getAvailableTypes()

ilPCPlaceHolderGUI::getAvailableTypes ( string  $a_selected_type = "")
protected

Definition at line 322 of file class.ilPCPlaceHolderGUI.php.

References ILIAS\LTI\ToolProvider\$key, and ilPageContentGUI\getPageConfig().

Referenced by propertyGUI().

324  : array {
325  // custom config?
326  if (method_exists($this->getPageConfig(), "getAvailablePlaceholderTypes")) {
327  $types = $this->getPageConfig()->getAvailablePlaceholderTypes();
328  } else {
329  $types = array(self::TYPE_TEXT, self::TYPE_MEDIA, self::TYPE_QUESTION);
330  }
331 
332  $validator = new ilCertificateActiveValidator();
333  if (true === $validator->validate()) {
334  // we remove type verification if certificates are deactivated and this
335  // is not the currently selected value
336  if (($key = array_search(self::TYPE_VERIFICATION, $types)) !== false &&
337  self::TYPE_VERIFICATION != $a_selected_type) {
338  unset($types[$key]);
339  }
340  }
341  return $types;
342  }
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStyleId()

ilPCPlaceHolderGUI::getStyleId ( )

Definition at line 111 of file class.ilPCPlaceHolderGUI.php.

References ilPageContentGUI\$styleid.

Referenced by insertPCText().

111  : int
112  {
113  return $this->styleid;
114  }
+ Here is the caller graph for this function:

◆ getTypeCaptions()

ilPCPlaceHolderGUI::getTypeCaptions ( )
protected

Definition at line 344 of file class.ilPCPlaceHolderGUI.php.

References ilPageContentGUI\$lng, and ilLanguage\txt().

Referenced by propertyGUI().

344  : array
345  {
346  $lng = $this->lng;
347 
348  return array(
349  self::TYPE_TEXT => $lng->txt("cont_ed_plachtext"),
350  self::TYPE_MEDIA => $lng->txt("cont_ed_plachmedia"),
351  self::TYPE_QUESTION => $lng->txt("cont_ed_plachquestion"),
352  self::TYPE_VERIFICATION => $lng->txt("cont_ed_plachverification")
353  );
354  }
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...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insert()

ilPCPlaceHolderGUI::insert ( )
protected

Definition at line 69 of file class.ilPCPlaceHolderGUI.php.

References propertyGUI().

Referenced by create().

69  : void
70  {
71  $this->propertyGUI("create", self::TYPE_TEXT, "100px", "insert");
72  }
propertyGUI(string $a_action, string $a_type, string $a_height, string $a_mode)
Property Form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertPCText()

ilPCPlaceHolderGUI::insertPCText ( )
protected

Forwards Text Item Selection to GUI classes.

Definition at line 254 of file class.ilPCPlaceHolderGUI.php.

References ILIAS\Repository\ctrl(), ilPageContentGUI\getPage(), ilPageContentGUI\getPageConfig(), and getStyleId().

254  : void
255  {
256  switch ($this->request->getString("pctext_type")) {
257  case 0: //Paragraph / Text
258 
259  $ret_class = strtolower(get_class($this->getPage()) . "gui");
260  $this->ctrl->setParameterByClass($ret_class, "pl_hier_id", $this->hier_id);
261  $this->ctrl->setParameterByClass($ret_class, "pl_pc_id", $this->pc_id);
262  $this->ctrl->redirectByClass(
263  $ret_class,
264  "insertJSAtPlaceholder"
265  );
266 
267  $this->ctrl->setCmdClass("ilpcparagraphgui");
268  $this->ctrl->setCmd("insert");
269  $paragraph_gui = new ilPCParagraphGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id);
270  $paragraph_gui->setStyleId($this->getStyleId());
271  $paragraph_gui->setPageConfig($this->getPageConfig());
272  $this->ctrl->forwardCommand($paragraph_gui);
273  break;
274 
275  case 1: //DataTable
276  $this->ctrl->setCmdClass("ilpcdatatablegui");
277  $this->ctrl->setCmd("insert");
278  $dtable_gui = new ilPCDataTableGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id);
279  $this->ctrl->forwardCommand($dtable_gui);
280  break;
281 
282  case 2: //Advanced Table
283  $this->ctrl->setCmdClass("ilpctablegui");
284  $this->ctrl->setCmd("insert");
285  $atable_gui = new ilPCTableGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id);
286  $this->ctrl->forwardCommand($atable_gui);
287  break;
288 
289  case 3: //Advanced List
290  $this->ctrl->setCmdClass("ilpclistgui");
291  $this->ctrl->setCmd("insert");
292  $list_gui = new ilPCListGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id);
293  $this->ctrl->forwardCommand($list_gui);
294  break;
295 
296  case 4: //File List
297  $this->ctrl->setCmdClass("ilpcfilelistgui");
298  $this->ctrl->setCmd("insert");
299  $file_list_gui = new ilPCFileListGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id);
300  $file_list_gui->setStyleId($this->getStyleId());
301  $this->ctrl->forwardCommand($file_list_gui);
302  break;
303 
304  case 5: //Tabs
305  $this->ctrl->setCmdClass("ilpctabsgui");
306  $this->ctrl->setCmd("insert");
307  $tabs_gui = new ilPCTabsGUI($this->pg_obj, $this->content_obj, $this->hier_id, $this->pc_id);
308  $tabs_gui->setStyleId($this->getStyleId());
309  $this->ctrl->forwardCommand($tabs_gui);
310  break;
311 
312  default:
313  break;
314  }
315  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilPCParagraphGUI User Interface for Paragraph Editing.
+ Here is the call graph for this function:

◆ propertyGUI()

ilPCPlaceHolderGUI::propertyGUI ( string  $a_action,
string  $a_type,
string  $a_height,
string  $a_mode 
)
protected

Property Form.

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

References ilPageContentGUI\$lng, $type, ILIAS\Repository\ctrl(), getAvailableTypes(), getTypeCaptions(), and ilLanguage\txt().

Referenced by edit_object(), and insert().

195  : void {
196  $lng = $this->lng;
197 
198  $this->form_gui = new ilPropertyFormGUI();
199  $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
200  $this->form_gui->setTitle($lng->txt("cont_ed_plachprop"));
201 
202  $ttype_input = new ilRadioGroupInputGUI($lng->txt("type"), "plach_type");
203  $type_captions = $this->getTypeCaptions();
204  foreach ($this->getAvailableTypes($a_type) as $type) {
205  $ttype_input->addOption(new ilRadioOption($type_captions[$type], $type));
206  }
207  $ttype_input->setRequired(true);
208  $this->form_gui->addItem($ttype_input);
209 
210  $theight_input = new ilTextInputGUI($lng->txt("height"), "plach_height");
211  $theight_input->setSize(4);
212  $theight_input->setMaxLength(3);
213  $theight_input->setTitle($lng->txt("height") . " (px)");
214  $theight_input->setRequired(true);
215  $this->form_gui->addItem($theight_input);
216 
217  $theight_input->setValue(preg_replace("/px/", "", $a_height));
218  $ttype_input->setValue($a_type);
219 
220  $this->form_gui->addCommandButton($a_action, $lng->txt($a_mode));
221  $this->form_gui->addCommandButton("cancelCreate", $lng->txt("cancel"));
222  $this->tpl->setContent($this->form_gui->getHTML());
223  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getAvailableTypes(string $a_selected_type="")
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...
$type
This class represents a property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveProperties()

ilPCPlaceHolderGUI::saveProperties ( )
protected

save placeholder properties in db and return to page edit screen

Definition at line 166 of file class.ilPCPlaceHolderGUI.php.

References ILIAS\Repository\ctrl(), edit(), and edit_object().

166  : void
167  {
168  $plach_height = $this->request->getString("plach_height");
169  if ($plach_height == "" ||
170  !preg_match("/[0-9]+/", $plach_height)) {
171  $this->edit_object();
172  return;
173  }
174 
175  $this->content_obj->setContentClass($this->request->getString("plach_type"));
176  $this->content_obj->setHeight($plach_height . "px");
177 
178  $this->updated = $this->pg_obj->update();
179  if ($this->updated === true) {
180  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
181  } else {
182  $this->pg_obj->addHierIDs();
183  $this->edit();
184  }
185  }
+ Here is the call graph for this function:

◆ setStyleId()

ilPCPlaceHolderGUI::setStyleId ( int  $a_styleid)

Definition at line 106 of file class.ilPCPlaceHolderGUI.php.

106  : void
107  {
108  $this->styleid = $a_styleid;
109  }

◆ textCOSelectionGUI()

ilPCPlaceHolderGUI::textCOSelectionGUI ( )
protected

Text Item Selection.

Definition at line 228 of file class.ilPCPlaceHolderGUI.php.

References ilPageContentGUI\$lng, ilRadioGroupInputGUI\addOption(), ILIAS\Repository\ctrl(), and ilLanguage\txt().

Referenced by edit_object().

228  : void
229  {
230  $lng = $this->lng;
231 
232  $this->form_gui = new ilPropertyFormGUI();
233  $this->form_gui->setFormAction($this->ctrl->getFormAction($this));
234  $this->form_gui->setTitle($lng->txt("cont_ed_select_pctext"));
235 
236  // Select Question Type
237  $ttype_input = new ilRadioGroupInputGUI($lng->txt("cont_ed_textitem"), "pctext_type");
238  $ttype_input->addOption(new ilRadioOption($lng->txt("cont_ed_par"), 0));
239  $ttype_input->addOption(new ilRadioOption($lng->txt("cont_ed_dtable"), 1));
240  $ttype_input->addOption(new ilRadioOption($lng->txt("cont_ed_atable"), 2));
241  $ttype_input->addOption(new ilRadioOption($lng->txt("cont_ed_list"), 3));
242  $ttype_input->addOption(new ilRadioOption($lng->txt("cont_ed_flist"), 4));
243  $ttype_input->addOption(new ilRadioOption($lng->txt("cont_tabs"), 5));
244  $this->form_gui->addItem($ttype_input);
245 
246  $this->form_gui->addCommandButton("insertPCText", $lng->txt("insert"));
247  $this->form_gui->addCommandButton("cancelCreate", $lng->txt("cancel"));
248  $this->tpl->setContent($this->form_gui->getHTML());
249  }
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...
addOption(ilRadioOption $a_option)
This class represents a property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $form_gui

ilPropertyFormGUI ilPCPlaceHolderGUI::$form_gui
protected

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

◆ TYPE_MEDIA

const ilPCPlaceHolderGUI::TYPE_MEDIA = "Media"

◆ TYPE_QUESTION

const ilPCPlaceHolderGUI::TYPE_QUESTION = "Question"

Definition at line 28 of file class.ilPCPlaceHolderGUI.php.

◆ TYPE_TEXT

const ilPCPlaceHolderGUI::TYPE_TEXT = "Text"

◆ TYPE_VERIFICATION

const ilPCPlaceHolderGUI::TYPE_VERIFICATION = "Verification"

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