ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
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 ()
 
 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...
 

Protected Attributes

ilPropertyFormGUI $form
 
- 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 ()
 
- 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
 
- 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 ()
 
- 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\GlobalScreen\Provider\__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(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ 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
form( $class_path, string $cmd)
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()

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)
+ 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 279 of file class.ilPCListGUI.php.

References ILIAS\Repository\form().

Referenced by edit().

279  : void
280  {
281  $values = array();
282 
283  $values["start_value"] = $this->content_obj->getStartValue();
284  $values["list_type"] = $this->content_obj->getListType();
285  $values["numbering_type"] = $this->content_obj->getNumberingType();
286  if ($values["list_type"] == "Ordered") {
287  $values["number_style"] = $this->content_obj->getStyleClass();
288  $values["bullet_style"] = "";
289  } else {
290  $values["bullet_style"] = $this->content_obj->getStyleClass();
291  $values["number_style"] = "";
292  }
293  $this->form->setValuesByArray($values);
294  }
form( $class_path, string $cmd)
+ 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 162 of file class.ilPCListGUI.php.

References $i, ilPageContentGUI\$lng, ilPageContentGUI\$style, ilSubEnabledFormPropertyGUI\addSubItem(), ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilPageContentGUI\getCharacteristics(), ilPageContentGUI\getCharacteristicsOfCurrentStyle(), ILIAS\Repository\lng(), ilNumberInputGUI\setMaxLength(), ilRadioOption\setValue(), and ilLanguage\txt().

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

164  : void {
165  $lng = $this->lng;
166  $this->form = new ilPropertyFormGUI();
167 
168  // type
169  $radg = new ilRadioGroupInputGUI($lng->txt("type"), "list_type");
170  $op1 = new ilRadioOption($lng->txt("cont_bullet_list"), "Unordered");
171 
172  // style of bullet list
174  $this->lng->txt("cont_style"),
175  "bullet_style"
176  );
177  $this->getCharacteristicsOfCurrentStyle(["list_u"]);
178  $options = $this->getCharacteristics();
179  if ($a_mode == "edit" && $this->content_obj->getListType() == "Unordered"
180  && $this->content_obj->getStyleClass() != ""
181  && !in_array($this->content_obj->getStyleClass(), $options)) {
182  $options[$this->content_obj->getStyleClass()] =
183  $this->content_obj->getStyleClass();
184  }
185  if (count($options) > 1) {
186  foreach ($options as $k => $option) {
187  $html = '<ul class="ilc_list_u_' . $k . '"><li class="ilc_list_item_StandardListItem">' .
188  $option . '</li></ul>';
189  if ($k == "BulletedList") {
190  $k = "";
191  }
192  $style->addOption($k, $option, $html);
193  }
194  $style->setValue("");
195  $op1->addSubItem($style);
196  }
197 
198  $radg->addOption($op1);
199 
200 
201  $op2 = new ilRadioOption($lng->txt("cont_numbered_list"), "Ordered");
202 
203  // style of numbered list
204  $style = new ilAdvSelectInputGUI(
205  $this->lng->txt("cont_style"),
206  "number_style"
207  );
208  $this->getCharacteristicsOfCurrentStyle(["list_o"]);
209  $options = $this->getCharacteristics();
210  if ($a_mode == "edit" && $this->content_obj->getListType() == "Ordered"
211  && $this->content_obj->getStyleClass() != ""
212  && !in_array($this->content_obj->getStyleClass(), $options)) {
213  $options[$this->content_obj->getStyleClass()] =
214  $this->content_obj->getStyleClass();
215  }
216  if (count($options) > 1) {
217  foreach ($options as $k => $option) {
218  $html = '<ol class="ilc_list_o_' . $k . '"><li class="ilc_list_item_StandardListItem">' .
219  $option . '</li></ol>';
220  if ($k == "NumberedList") {
221  $k = "";
222  }
223  $style->addOption($k, $option, $html);
224  }
225  $style->setValue("");
226  $op2->addSubItem($style);
227  }
228 
229  // numeric type
230  $options = array(
231  "Number" => $this->lng->txt("cont_number_std"),
232  "Decimal" => $this->lng->txt("cont_decimal"),
233  "Roman" => $this->lng->txt("cont_roman"),
234  "roman" => $this->lng->txt("cont_roman_s"),
235  "Alphabetic" => $this->lng->txt("cont_alphabetic"),
236  "alphabetic" => $this->lng->txt("cont_alphabetic_s")
237  );
238  $si = new ilSelectInputGUI($this->lng->txt("cont_number_type"), "numbering_type");
239  $si->setOptions($options);
240  $op2->addSubItem($si);
241 
242  // starting value
243  $ni = new ilNumberInputGUI($this->lng->txt("cont_start_value"), "start_value");
244  $ni->setMaxLength(3);
245  $ni->setSize(3);
246  $ni->setInfo($lng->txt("cont_start_value_info"));
247  $op2->addSubItem($ni);
248 
249  $radg->addOption($op2);
250  $radg->setValue("Unordered");
251  $this->form->addItem($radg);
252 
253  // nr of items
254  $options = array();
255  if ($a_mode == "create") {
256  for ($i = 1; $i <= 10; $i++) {
257  $options[$i] = $i;
258  }
259  $si = new ilSelectInputGUI($this->lng->txt("cont_nr_items"), "nr_items");
260  $si->setOptions($options);
261  $si->setValue(2);
262  $this->form->addItem($si);
263  }
264 
265  // save and cancel commands
266  if ($a_mode == "create") {
267  $this->form->addCommandButton("create_list", $lng->txt("save"));
268  $this->form->addCommandButton("cancelCreate", $lng->txt("cancel"));
269  $this->form->setTitle($lng->txt("cont_insert_list"));
270  } else {
271  $this->form->addCommandButton("saveProperties", $lng->txt("save"));
272  $this->form->addCommandButton("cancelUpdate", $lng->txt("cancel"));
273  $this->form->setTitle($lng->txt("cont_list_properties"));
274  }
275 
276  $this->form->setFormAction($this->ctrl->getFormAction($this));
277  }
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.
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...
setMaxLength(int $a_maxlength)
This class represents a property in a property form.
This class represents a number property in a property form.
setValue(string $a_value)
form( $class_path, string $cmd)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$i
Definition: metadata.php:41
+ 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)
+ 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  } else {
145  $this->content_obj->setNumberingType(
146  $this->form->getInput("numbering_type")
147  );
148  $this->content_obj->setStyleClass(
149  $this->form->getInput("number_style")
150  );
151  }
152 
153  $this->updated = $this->pg_obj->update();
154  if ($this->updated === true) {
155  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
156  }
157  }
158  $this->form->setValuesByPost();
159  $tpl->setContent($this->form->getHTML());
160  }
initListForm(string $a_mode="edit")
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
form( $class_path, string $cmd)
+ 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: