ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilPCListGUI Class Reference

Class ilPCListGUI. More...

+ Inheritance diagram for ilPCListGUI:
+ Collaboration diagram for ilPCListGUI:

Public Member Functions

 __construct (&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id="")
 Constructor public. More...
 
 executeCommand ()
 execute command More...
 
 insert ()
 insert new list form More...
 
 create ()
 Save list. More...
 
 edit ()
 edit properties form More...
 
 saveProperties ()
 Save properties. More...
 
 initListForm ($a_mode="edit")
 Init list form. More...
 
 getValues ()
 Get current values for list from. 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...
 
 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...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 Get common bb buttons. More...
 
- Data Fields inherited from ilPageContentGUI
 $content_obj
 
 $ilias
 
 $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
 getCharacteristicsOfCurrentStyle ($a_type)
 Get characteristics of current style. More...
 
- Protected Attributes inherited from ilPageContentGUI
 $log
 
- Static Protected Attributes inherited from ilPageContentGUI
static $common_bb_buttons
 

Detailed Description

Class ilPCListGUI.

User Interface for LM List Editing

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

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor public.

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

25  {
26  parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
27  }

Member Function Documentation

◆ create()

ilPCListGUI::create ( )

Save list.

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

References $_POST, $ilCtrl, ilPageContentGUI\$lng, ilPageContentGUI\$tpl, ilPageContentGUI\getPage(), and initListForm().

67  {
68  global $tpl, $lng, $ilCtrl;
69 
70  $this->initListForm("create");
71  if ($this->form->checkInput())
72  {
73  $this->content_obj = new ilPCList($this->getPage());
74  $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
75  $this->content_obj->addItems($_POST["nr_items"]);
76  $this->content_obj->setStartValue($_POST["start_value"]);
77  $this->content_obj->setListType($_POST["list_type"]);
78  if ($_POST["list_type"] == "Unordered")
79  {
80  $this->content_obj->setNumberingType("");
81  $this->content_obj->setStyleClass($_POST["bullet_style"]);
82  }
83  else
84  {
85  $this->content_obj->setNumberingType($_POST["numbering_type"]);
86  $this->content_obj->setStyleClass($_POST["number_style"]);
87  }
88  $this->updated = $this->pg_obj->update();
89  if ($this->updated === true)
90  {
91  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
92  }
93  }
94  $this->form->setValuesByPost();
95  $tpl->setContent($this->form->getHtml());
96  }
global $ilCtrl
Definition: ilias.php:18
Class ilPCList.
$_POST["username"]
initListForm($a_mode="edit")
Init list form.
+ Here is the call graph for this function:

◆ edit()

ilPCListGUI::edit ( )

edit properties form

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

References ilPageContentGUI\displayValidationError(), getValues(), and initListForm().

102  {
103  $this->displayValidationError();
104 
105  $this->initListForm("edit");
106  $this->getValues();
107  $this->tpl->setContent($this->form->getHTML());
108  }
displayValidationError()
display validation errors
getValues()
Get current values for list from.
initListForm($a_mode="edit")
Init list form.
+ Here is the call graph for this function:

◆ executeCommand()

ilPCListGUI::executeCommand ( )

execute command

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

References $cmd, and $ret.

33  {
34  // get next class that processes or forwards current command
35  $next_class = $this->ctrl->getNextClass($this);
36 
37  // get current command
38  $cmd = $this->ctrl->getCmd();
39 
40  switch($next_class)
41  {
42  default:
43  $ret = $this->$cmd();
44  break;
45  }
46 
47  return $ret;
48  }
$cmd
Definition: sahs_server.php:35
$ret
Definition: parser.php:6

◆ getValues()

ilPCListGUI::getValues ( )

Get current values for list from.

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

References ilPageContentGUI\$tpl, and array.

Referenced by edit().

281  {
282  global $tpl;
283 
284  $values = array();
285 
286  $values["start_value"] = $this->content_obj->getStartValue();
287  $values["list_type"] = $this->content_obj->getListType();
288  $values["numbering_type"] = $this->content_obj->getNumberingType();
289  if ($values["list_type"] == "Ordered")
290  {
291  $values["number_style"] = $this->content_obj->getStyleClass();
292  $values["bullet_style"] = "";
293  }
294  else
295  {
296  $values["bullet_style"] = $this->content_obj->getStyleClass();
297  $values["number_style"] = "";
298  }
299  $this->form->setValuesByArray($values);
300  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ initListForm()

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

Init list form.

Parameters
int$a_modeEdit Mode

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

References $html, ilPageContentGUI\$lng, $options, $si, $style, ilSubEnabledFormPropertyGUI\addSubItem(), array, ilPageContentGUI\getCharacteristics(), ilPageContentGUI\getCharacteristicsOfCurrentStyle(), ilNumberInputGUI\setMaxLength(), and ilSelectInputGUI\setOptions().

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

149  {
150  global $lng;
151  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
152  $this->form = new ilPropertyFormGUI();
153 
154  // type
155  $radg = new ilRadioGroupInputGUI($lng->txt("type"), "list_type");
156  $op1 = new ilRadioOption($lng->txt("cont_bullet_list"), "Unordered");
157 
158  // style of bullet list
159  require_once("./Services/Form/classes/class.ilAdvSelectInputGUI.php");
160  $style = new ilAdvSelectInputGUI($this->lng->txt("cont_style"),
161  "bullet_style");
162  $this->getCharacteristicsOfCurrentStyle("list_u");
163  $options = $this->getCharacteristics();
164  if ($a_mode == "edit" && $this->content_obj->getListType() == "Unordered"
165  && $this->content_obj->getStyleClass() != ""
166  && !in_array($this->content_obj->getStyleClass(), $options))
167  {
168  $options[$this->content_obj->getStyleClass()] =
169  $this->content_obj->getStyleClass();
170  }
171  if (count($options) > 1)
172  {
173  foreach($options as $k => $option)
174  {
175  $html = '<ul class="ilc_list_u_'.$k.'"><li class="ilc_list_item_StandardListItem">'.
176  $option.'</li></ul>';
177  if ($k == "BulletedList")
178  {
179  $k = "";
180  }
181  $style->addOption($k, $option, $html);
182  }
183  $style->setValue("");
184  $op1->addSubItem($style);
185  }
186 
187  $radg->addOption($op1);
188 
189 
190  $op2 = new ilRadioOption($lng->txt("cont_numbered_list"), "Ordered");
191 
192  // style of numbered list
193  require_once("./Services/Form/classes/class.ilAdvSelectInputGUI.php");
194  $style = new ilAdvSelectInputGUI($this->lng->txt("cont_style"),
195  "number_style");
196  $this->getCharacteristicsOfCurrentStyle("list_o");
197  $options = $this->getCharacteristics();
198  if ($a_mode == "edit" && $this->content_obj->getListType() == "Ordered"
199  && $this->content_obj->getStyleClass() != ""
200  && !in_array($this->content_obj->getStyleClass(), $options))
201  {
202  $options[$this->content_obj->getStyleClass()] =
203  $this->content_obj->getStyleClass();
204  }
205  if (count($options) > 1)
206  {
207  foreach($options as $k => $option)
208  {
209  $html = '<ol class="ilc_list_o_'.$k.'"><li class="ilc_list_item_StandardListItem">'.
210  $option.'</li></ol>';
211  if ($k == "NumberedList")
212  {
213  $k = "";
214  }
215  $style->addOption($k, $option, $html);
216  }
217  $style->setValue("");
218  $op2->addSubItem($style);
219  }
220 
221  // numeric type
222  $options = array(
223  "Number" => $this->lng->txt("cont_number_std"),
224  "Decimal" => $this->lng->txt("cont_decimal"),
225  "Roman" => $this->lng->txt("cont_roman"),
226  "roman" => $this->lng->txt("cont_roman_s"),
227  "Alphabetic" => $this->lng->txt("cont_alphabetic"),
228  "alphabetic" => $this->lng->txt("cont_alphabetic_s")
229  );
230  $si = new ilSelectInputGUI($this->lng->txt("cont_number_type"), "numbering_type");
231  $si->setOptions($options);
232  $op2->addSubItem($si);
233 
234  // starting value
235  $ni = new ilNumberInputGUI($this->lng->txt("cont_start_value"), "start_value");
236  $ni->setMaxLength(3);
237  $ni->setSize(3);
238  $ni->setInfo($lng->txt("cont_start_value_info"));
239  $op2->addSubItem($ni);
240 
241  $radg->addOption($op2);
242  $radg->setValue("Unordered");
243  $this->form->addItem($radg);
244 
245  // nr of items
246  $options = array();
247  if ($a_mode == "create")
248  {
249  for ($i=1; $i<=10; $i++)
250  {
251  $options[$i] = $i;
252  }
253  $si = new ilSelectInputGUI($this->lng->txt("cont_nr_items"), "nr_items");
254  $si->setOptions($options);
255  $si->setValue(2);
256  $this->form->addItem($si);
257  }
258 
259  // save and cancel commands
260  if ($a_mode == "create")
261  {
262  $this->form->addCommandButton("create_list", $lng->txt("save"));
263  $this->form->addCommandButton("cancelCreate", $lng->txt("cancel"));
264  $this->form->setTitle($lng->txt("cont_insert_list"));
265  }
266  else
267  {
268  $this->form->addCommandButton("saveProperties", $lng->txt("save"));
269  $this->form->addCommandButton("cancelUpdate", $lng->txt("cancel"));
270  $this->form->setTitle($lng->txt("cont_list_properties"));
271  }
272 
273  $this->form->setFormAction($this->ctrl->getFormAction($this));
274  }
This class represents an option in a radio group.
getCharacteristicsOfCurrentStyle($a_type)
Get characteristics of current style.
$style
Definition: example_012.php:70
This class represents a selection list property in a property form.
This class represents a property form user interface.
This class represents a property in a property form.
if(!is_array($argv)) $options
This class represents a number property in a property form.
setOptions($a_options)
Set Options.
getCharacteristics()
Get characteristics.
Create styles array
The data for the language used.
setMaxLength($a_maxlength)
Set Max Length.
This class represents an advanced selection list property in a property form.
$html
Definition: example_001.php:87
+ 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 54 of file class.ilPCListGUI.php.

References ilPageContentGUI\displayValidationError(), and initListForm().

55  {
56  $this->displayValidationError();
57 
58  $this->initListForm("create");
59  $this->tpl->setContent($this->form->getHTML());
60  }
displayValidationError()
display validation errors
initListForm($a_mode="edit")
Init list form.
+ Here is the call graph for this function:

◆ saveProperties()

ilPCListGUI::saveProperties ( )

Save properties.

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

References $_POST, $ilCtrl, ilPageContentGUI\$lng, ilPageContentGUI\$tpl, and initListForm().

114  {
115  global $lng, $ilCtrl, $tpl;
116 
117  $this->initListForm("edit");
118  if ($this->form->checkInput())
119  {
120  $this->content_obj->setStartValue($_POST["start_value"]);
121  $this->content_obj->setListType($_POST["list_type"]);
122  if ($_POST["list_type"] == "Unordered")
123  {
124  $this->content_obj->setNumberingType("");
125  $this->content_obj->setStyleClass($_POST["bullet_style"]);
126  }
127  else
128  {
129  $this->content_obj->setNumberingType($_POST["numbering_type"]);
130  $this->content_obj->setStyleClass($_POST["number_style"]);
131  }
132 
133  $this->updated = $this->pg_obj->update();
134  if ($this->updated === true)
135  {
136  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
137  }
138  }
139  $this->form->setValuesByPost();
140  $tpl->setContent($this->form->getHtml());
141  }
global $ilCtrl
Definition: ilias.php:18
$_POST["username"]
initListForm($a_mode="edit")
Init list form.
+ Here is the call graph for this function:

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