ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 ()
 
 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
 
LOMServices $lom_services
 
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\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: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ 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 ILIAS\UICore\GlobalTemplate\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 328 of file class.ilPCListGUI.php.

References ILIAS\Repository\form().

Referenced by edit().

328  : void
329  {
330  $values = array();
331 
332  $values["start_value"] = $this->content_obj->getStartValue();
333  $values["list_type"] = $this->content_obj->getListType();
334  $values["numbering_type"] = $this->content_obj->getNumberingType();
335  if ($values["list_type"] == "Ordered") {
336  $values["number_style"] = $this->content_obj->getStyleClass();
337  $values["bullet_style"] = "";
338  } else {
339  $values["bullet_style"] = $this->content_obj->getStyleClass();
340  $values["number_style"] = "";
341  }
342  $values["item_style_1"] = $this->content_obj->getItemStyleClass();
343  $values["item_style_2"] = $this->content_obj->getItemStyleClass();
344  $this->form->setValuesByArray($values);
345  }
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, ilSubEnabledFormPropertyGUI\addSubItem(), ilRadioOption\addSubItem(), ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilPageContentGUI\getCharacteristics(), ilPageContentGUI\getCharacteristicsOfCurrentStyle(), ILIAS\Repository\lng(), ilNumberInputGUI\setMaxLength(), ilSelectInputGUI\setOptions(), ilRadioOption\setValue(), ilSelectInputGUI\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
197  $style = new ilSelectInputGUI(
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  $style->setValue("");
211  $style->setOptions($options);
212  $op1->addSubItem($style);
213  }
214 
215  $radg->addOption($op1);
216 
217 
218  $op2 = new ilRadioOption($lng->txt("cont_numbered_list"), "Ordered");
219 
220  // style of numbered list
221  $style = new ilSelectInputGUI(
222  $this->lng->txt("cont_style"),
223  "number_style"
224  );
225  $this->getCharacteristicsOfCurrentStyle(["list_o"]);
226  $options = $this->getCharacteristics();
227  if ($a_mode == "edit" && $this->content_obj->getListType() == "Ordered"
228  && $this->content_obj->getStyleClass() != ""
229  && !in_array($this->content_obj->getStyleClass(), $options)) {
230  $options[$this->content_obj->getStyleClass()] =
231  $this->content_obj->getStyleClass();
232  }
233  if (count($options) > 1) {
234  foreach ($options as $k => $option) {
235  $html = '<ol class="ilc_list_o_' . $k . '"><li class="ilc_list_item_StandardListItem">' .
236  $option . '</li></ol>';
237  if ($k == "NumberedList") {
238  $k = "";
239  }
240  //$style->addOption($k, $option, $html);
241  }
242  $style->setValue("");
243  $style->setOptions($options);
244  $op2->addSubItem($style);
245  }
246 
247  // numeric type
248  $options = array(
249  "Number" => $this->lng->txt("cont_number_std"),
250  "Decimal" => $this->lng->txt("cont_decimal"),
251  "Roman" => $this->lng->txt("cont_roman"),
252  "roman" => $this->lng->txt("cont_roman_s"),
253  "Alphabetic" => $this->lng->txt("cont_alphabetic"),
254  "alphabetic" => $this->lng->txt("cont_alphabetic_s")
255  );
256  $si = new ilSelectInputGUI($this->lng->txt("cont_number_type"), "numbering_type");
257  $si->setOptions($options);
258  $op2->addSubItem($si);
259 
260  // starting value
261  $ni = new ilNumberInputGUI($this->lng->txt("cont_start_value"), "start_value");
262  $ni->setMaxLength(3);
263  $ni->setSize(3);
264  $ni->setInfo($lng->txt("cont_start_value_info"));
265  $op2->addSubItem($ni);
266 
267  $radg->addOption($op2);
268  $radg->setValue("Unordered");
269  $this->form->addItem($radg);
270 
271  // list item type
272  $this->getCharacteristicsOfCurrentStyle(["list_item"]);
273  $options = $this->getCharacteristics();
274  if (count($options) > 1) {
275  $style1 = new ilSelectInputGUI(
276  $this->lng->txt("cont_list_item_style"),
277  "item_style_1"
278  );
279  $style2 = new ilSelectInputGUI(
280  $this->lng->txt("cont_list_item_style"),
281  "item_style_2"
282  );
283  foreach ($options as $k => $option) {
284  $html = '<ul style="list-style-type:none;"><li class="ilc_list_item_' . $option . '">' .
285  $option . '</li></ul>';
286  if ($k == "BulletedList") {
287  $k = "";
288  }
289  //$style1->addOption($k, $option, $html);
290  //$style2->addOption($k, $option, $html);
291  }
292  $style1->setOptions($options);
293  $style2->setOptions($options);
294  $style1->setValue("StandardListItem");
295  $style2->setValue("StandardListItem");
296  $op1->addSubItem($style1);
297  $op2->addSubItem($style2);
298  }
299  $options = $this->getCharacteristicsOfCurrentStyle(["list_item"]);
300 
301 
302  // nr of items
303  $options = array();
304  if ($a_mode == "create") {
305  for ($i = 1; $i <= 10; $i++) {
306  $options[$i] = $i;
307  }
308  $si = new ilSelectInputGUI($this->lng->txt("cont_nr_items"), "nr_items");
309  $si->setOptions($options);
310  $si->setValue(2);
311  $this->form->addItem($si);
312  }
313 
314  // save and cancel commands
315  if ($a_mode == "create") {
316  $this->form->addCommandButton("create", $lng->txt("save"));
317  $this->form->addCommandButton("cancelCreate", $lng->txt("cancel"));
318  $this->form->setTitle($lng->txt("cont_insert_list"));
319  } else {
320  $this->form->addCommandButton("saveProperties", $lng->txt("save"));
321  $this->form->addCommandButton("cancelUpdate", $lng->txt("cancel"));
322  $this->form->setTitle($lng->txt("cont_list_properties"));
323  }
324 
325  $this->form->setFormAction($this->ctrl->getFormAction($this));
326  }
This class represents an option in a radio group.
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...
setMaxLength(int $a_maxlength)
setOptions(array $a_options)
This class represents a property in a property form.
setValue($a_value)
Set Value.
This class represents a number property in a property form.
setValue(string $a_value)
form( $class_path, string $cmd, string $submit_caption="")
+ 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 ILIAS\UICore\GlobalTemplate\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: