ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilPCListGUI 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 ilPCListGUI:
+ Collaboration diagram for ilPCListGUI:

Public Member Functions

 __construct (ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id, string $a_pc_id="")
 
 executeCommand ()
 
 insert ()
 insert new list form More...
 
 create ()
 Save list. More...
 
 edit ()
 edit properties form More...
 
 saveProperties ()
 Save properties. More...
 
 initListForm (string $a_mode="edit")
 
 getValues ()
 
- 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 ()
 
 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...
 

Static Public Member Functions

static _getListCharacteristics (int $a_style_id, string $type)
 
- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 

Protected Attributes

ilPropertyFormGUI $form
 
- Protected Attributes inherited from ilPageContentGUI
ILIAS COPage Editor GUIService $editor_gui
 
ILIAS COPage InternalGUIService $gui
 
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
 
ILIAS GlobalScreen ScreenContext ContextServices $tool_context
 
Style Content CharacteristicManager $char_manager
 

Additional Inherited Members

- Data Fields inherited from ilPageContentGUI
ilPageContent $content_obj
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilPageObject $pg_obj
 
string $hier_id = ""
 
DOMDocument $dom
 
 $updated
 
string $target_script = ""
 
string $return_location = ""
 
ilPageConfig $page_config = null
 
- 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;"
 
- Protected Member Functions inherited from ilPageContentGUI
 redirectToParent (string $hier_id="")
 
 getParentReturn (string $hier_id="")
 
 updateAndReturn ()
 
 setCurrentTextLang (string $lang_key)
 
 getCurrentTextLang ()
 
 setEditorToolContext ()
 
 initEditor ()
 
 getEditorScriptTag (string $form_pc_id="", string $form_cname="")
 
- 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 Class ilPCListGUI

User Interface for LM List Editing

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 26 of file class.ilPCListGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 30 of file class.ilPCListGUI.php.

References $DIC, ILIAS\MetaData\Repository\Validation\Data\__construct(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

35  {
36  global $DIC;
37 
38  $this->tpl = $DIC["tpl"];
39  $this->lng = $DIC->language();
40  $this->ctrl = $DIC->ctrl();
41  parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
42  }
global $DIC
Definition: feed.php:28
__construct(VocabulariesInterface $vocabularies)
+ Here is the call graph for this function:

Member Function Documentation

◆ _getListCharacteristics()

static ilPCListGUI::_getListCharacteristics ( int  $a_style_id,
string  $type 
)
static

Definition at line 168 of file class.ilPCListGUI.php.

References ilPageContentGUI\$chars, ilPageContentGUI\$style, ilObject\_lookupType(), and ilObjStyleSheet\getCharacteristics().

Referenced by ilPageObjectGUI\getTinyMenu().

171  : array {
172  $chars = [];
173 
174  if ($a_style_id > 0 &&
175  ilObject::_lookupType($a_style_id) == "sty") {
176  $style = new ilObjStyleSheet($a_style_id);
177  $types = [$type];
178  foreach ($types as $t) {
179  $chars = array_merge($chars, $style->getCharacteristics($t, false, true));
180  }
181  }
182 
183  return $chars;
184  }
getCharacteristics(string $a_type="", bool $a_no_hidden=false, bool $a_include_core=true)
Get characteristics.
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create()

ilPCListGUI::create ( )

Save list.

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

References ilPageContentGUI\$tpl, ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilPageContentGUI\getPage(), initListForm(), and ilGlobalTemplateInterface\setContent().

74  : void
75  {
76  $tpl = $this->tpl;
77 
78  $this->initListForm("create");
79  if ($this->form->checkInput()) {
80  $this->content_obj = new ilPCList($this->getPage());
81  $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
82  $this->content_obj->addItems($this->form->getInput("nr_items"));
83  $this->content_obj->setStartValue(
84  (int) $this->form->getInput("start_value")
85  );
86  $list_type = $this->form->getInput("list_type");
87  $this->content_obj->setListType(
88  $list_type
89  );
90  if ($list_type == "Unordered") {
91  $this->content_obj->setNumberingType("");
92  $this->content_obj->setStyleClass(
93  $this->form->getInput("bullet_style")
94  );
95  } else {
96  $this->content_obj->setNumberingType(
97  $this->form->getInput("numbering_type")
98  );
99  $this->content_obj->setStyleClass(
100  $this->form->getInput("number_style")
101  );
102  }
103  $this->updated = $this->pg_obj->update();
104  if ($this->updated === true) {
105  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
106  }
107  }
108  $this->form->setValuesByPost();
109  $tpl->setContent($this->form->getHTML());
110  }
initListForm(string $a_mode="edit")
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:

◆ edit()

ilPCListGUI::edit ( )

edit properties form

Definition at line 115 of file class.ilPCListGUI.php.

References ilPageContentGUI\displayValidationError(), ILIAS\Repository\form(), getValues(), and initListForm().

115  : void
116  {
117  $this->displayValidationError();
118  $this->initListForm("edit");
119  $this->getValues();
120  $this->tpl->setContent($this->form->getHTML());
121  }
initListForm(string $a_mode="edit")
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:

◆ executeCommand()

ilPCListGUI::executeCommand ( )

Definition at line 44 of file class.ilPCListGUI.php.

References ILIAS\Repository\ctrl().

44  : void
45  {
46  // get next class that processes or forwards current command
47  $next_class = $this->ctrl->getNextClass($this);
48 
49  // get current command
50  $cmd = $this->ctrl->getCmd();
51 
52  switch ($next_class) {
53  default:
54  $this->$cmd();
55  break;
56  }
57  }
+ Here is the call graph for this function:

◆ getValues()

ilPCListGUI::getValues ( )

Definition at line 332 of file class.ilPCListGUI.php.

References ILIAS\Repository\form().

Referenced by edit().

332  : void
333  {
334  $values = array();
335 
336  $values["start_value"] = $this->content_obj->getStartValue();
337  $values["list_type"] = $this->content_obj->getListType();
338  $values["numbering_type"] = $this->content_obj->getNumberingType();
339  if ($values["list_type"] == "Ordered") {
340  $values["number_style"] = $this->content_obj->getStyleClass();
341  $values["bullet_style"] = "";
342  } else {
343  $values["bullet_style"] = $this->content_obj->getStyleClass();
344  $values["number_style"] = "";
345  }
346  $values["item_style_1"] = $this->content_obj->getItemStyleClass();
347  $values["item_style_2"] = $this->content_obj->getItemStyleClass();
348  $this->form->setValuesByArray($values);
349  }
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initListForm()

ilPCListGUI::initListForm ( string  $a_mode = "edit")

Definition at line 186 of file class.ilPCListGUI.php.

References ilPageContentGUI\$lng, ilPageContentGUI\$style, ilAdvSelectInputGUI\addOption(), ilSubEnabledFormPropertyGUI\addSubItem(), ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilPageContentGUI\getCharacteristics(), ilPageContentGUI\getCharacteristicsOfCurrentStyle(), ILIAS\Repository\lng(), ilSelectInputGUI\setOptions(), ilAdvSelectInputGUI\setValue(), ilRadioOption\setValue(), and ilLanguage\txt().

Referenced by create(), edit(), insert(), and saveProperties().

188  : void {
189  $lng = $this->lng;
190  $this->form = new ilPropertyFormGUI();
191 
192  // type
193  $radg = new ilRadioGroupInputGUI($lng->txt("type"), "list_type");
194  $op1 = new ilRadioOption($lng->txt("cont_bullet_list"), "Unordered");
195 
196  // style of bullet list
198  $this->lng->txt("cont_style"),
199  "bullet_style"
200  );
201  $this->getCharacteristicsOfCurrentStyle(["list_u"]);
202  $options = $this->getCharacteristics();
203  if ($a_mode == "edit" && $this->content_obj->getListType() == "Unordered"
204  && $this->content_obj->getStyleClass() != ""
205  && !in_array($this->content_obj->getStyleClass(), $options)) {
206  $options[$this->content_obj->getStyleClass()] =
207  $this->content_obj->getStyleClass();
208  }
209  if (count($options) > 1) {
210  foreach ($options as $k => $option) {
211  $html = '<ul class="ilc_list_u_' . $k . '"><li class="ilc_list_item_StandardListItem">' .
212  $option . '</li></ul>';
213  if ($k == "BulletedList") {
214  $k = "";
215  }
216  $style->addOption($k, $option, $html);
217  }
218  $style->setValue("");
219  $op1->addSubItem($style);
220  }
221 
222  $radg->addOption($op1);
223 
224 
225  $op2 = new ilRadioOption($lng->txt("cont_numbered_list"), "Ordered");
226 
227  // style of numbered list
228  $style = new ilAdvSelectInputGUI(
229  $this->lng->txt("cont_style"),
230  "number_style"
231  );
232  $this->getCharacteristicsOfCurrentStyle(["list_o"]);
233  $options = $this->getCharacteristics();
234  if ($a_mode == "edit" && $this->content_obj->getListType() == "Ordered"
235  && $this->content_obj->getStyleClass() != ""
236  && !in_array($this->content_obj->getStyleClass(), $options)) {
237  $options[$this->content_obj->getStyleClass()] =
238  $this->content_obj->getStyleClass();
239  }
240  if (count($options) > 1) {
241  foreach ($options as $k => $option) {
242  $html = '<ol class="ilc_list_o_' . $k . '"><li class="ilc_list_item_StandardListItem">' .
243  $option . '</li></ol>';
244  if ($k == "NumberedList") {
245  $k = "";
246  }
247  $style->addOption($k, $option, $html);
248  }
249  $style->setValue("");
250  $op2->addSubItem($style);
251  }
252 
253  // numeric type
254  $options = array(
255  "Number" => $this->lng->txt("cont_number_std"),
256  "Decimal" => $this->lng->txt("cont_decimal"),
257  "Roman" => $this->lng->txt("cont_roman"),
258  "roman" => $this->lng->txt("cont_roman_s"),
259  "Alphabetic" => $this->lng->txt("cont_alphabetic"),
260  "alphabetic" => $this->lng->txt("cont_alphabetic_s")
261  );
262  $si = new ilSelectInputGUI($this->lng->txt("cont_number_type"), "numbering_type");
263  $si->setOptions($options);
264  $op2->addSubItem($si);
265 
266  // starting value
267  $ni = new ilNumberInputGUI($this->lng->txt("cont_start_value"), "start_value");
268  $ni->setMaxLength(3);
269  $ni->setSize(3);
270  $ni->setInfo($lng->txt("cont_start_value_info"));
271  $op2->addSubItem($ni);
272 
273  $radg->addOption($op2);
274  $radg->setValue("Unordered");
275  $this->form->addItem($radg);
276 
277  // list item type
278  $this->getCharacteristicsOfCurrentStyle(["list_item"]);
279  $options = $this->getCharacteristics();
280  if (count($options) > 1) {
281  $style1 = new ilAdvSelectInputGUI(
282  $this->lng->txt("cont_list_item_style"),
283  "item_style_1"
284  );
285  $style2 = new ilAdvSelectInputGUI(
286  $this->lng->txt("cont_list_item_style"),
287  "item_style_2"
288  );
289  foreach ($options as $k => $option) {
290  $html = '<ul style="list-style-type:none;"><li class="ilc_list_item_' . $option . '">' .
291  $option . '</li></ul>';
292  if ($k == "BulletedList") {
293  $k = "";
294  }
295  $style1->addOption($k, $option, $html);
296  $style2->addOption($k, $option, $html);
297  }
298  $style1->setValue("StandardListItem");
299  $style2->setValue("StandardListItem");
300  $op1->addSubItem($style1);
301  $op2->addSubItem($style2);
302  }
303  $options = $this->getCharacteristicsOfCurrentStyle(["list_item"]);
304 
305 
306  // nr of items
307  $options = array();
308  if ($a_mode == "create") {
309  for ($i = 1; $i <= 10; $i++) {
310  $options[$i] = $i;
311  }
312  $si = new ilSelectInputGUI($this->lng->txt("cont_nr_items"), "nr_items");
313  $si->setOptions($options);
314  $si->setValue(2);
315  $this->form->addItem($si);
316  }
317 
318  // save and cancel commands
319  if ($a_mode == "create") {
320  $this->form->addCommandButton("create_list", $lng->txt("save"));
321  $this->form->addCommandButton("cancelCreate", $lng->txt("cancel"));
322  $this->form->setTitle($lng->txt("cont_insert_list"));
323  } else {
324  $this->form->addCommandButton("saveProperties", $lng->txt("save"));
325  $this->form->addCommandButton("cancelUpdate", $lng->txt("cancel"));
326  $this->form->setTitle($lng->txt("cont_list_properties"));
327  }
328 
329  $this->form->setFormAction($this->ctrl->getFormAction($this));
330  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getCharacteristicsOfCurrentStyle(array $a_type)
Get characteristics of current style and call setCharacteristics, if style is given.
This class represents a selection list property in a property form.
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...
setOptions(array $a_options)
addOption(string $a_value, string $a_text, string $a_html="")
This class represents a property in a property form.
setValue(string $a_value)
form( $class_path, string $cmd, string $submit_caption="")
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:
+ Here is the caller graph for this function:

◆ insert()

ilPCListGUI::insert ( )

insert new list form

Definition at line 63 of file class.ilPCListGUI.php.

References ilPageContentGUI\displayValidationError(), ILIAS\Repository\form(), and initListForm().

63  : void
64  {
65  $this->displayValidationError();
66  $this->initListForm("create");
67  $this->tpl->setContent($this->form->getHTML());
68  }
initListForm(string $a_mode="edit")
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:

◆ saveProperties()

ilPCListGUI::saveProperties ( )

Save properties.

Definition at line 126 of file class.ilPCListGUI.php.

References ilPageContentGUI\$tpl, ILIAS\Repository\ctrl(), ILIAS\Repository\form(), initListForm(), and ilGlobalTemplateInterface\setContent().

126  : void
127  {
128  $tpl = $this->tpl;
129 
130  $this->initListForm("edit");
131  if ($this->form->checkInput()) {
132  $this->content_obj->setStartValue(
133  $this->form->getInput("start_value")
134  );
135  $list_type = $this->form->getInput("list_type");
136  $this->content_obj->setListType(
137  $list_type
138  );
139  if ($list_type == "Unordered") {
140  $this->content_obj->setNumberingType("");
141  $this->content_obj->setStyleClass(
142  $this->form->getInput("bullet_style")
143  );
144  $this->content_obj->setItemStyleClass(
145  $this->form->getInput("item_style_1")
146  );
147  } else {
148  $this->content_obj->setNumberingType(
149  $this->form->getInput("numbering_type")
150  );
151  $this->content_obj->setStyleClass(
152  $this->form->getInput("number_style")
153  );
154  $this->content_obj->setItemStyleClass(
155  $this->form->getInput("item_style_2")
156  );
157  }
158 
159  $this->updated = $this->pg_obj->update();
160  if ($this->updated === true) {
161  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
162  }
163  }
164  $this->form->setValuesByPost();
165  $tpl->setContent($this->form->getHTML());
166  }
initListForm(string $a_mode="edit")
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:

Field Documentation

◆ $form

ilPropertyFormGUI ilPCListGUI::$form
protected

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


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