ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 @access 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 @access 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
 
 $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
 $error
 
 $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 @access public.

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

25 {
26 global $DIC;
27
28 $this->tpl = $DIC["tpl"];
29 $this->lng = $DIC->language();
30 $this->ctrl = $DIC->ctrl();
31 parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
32 }
global $DIC
Definition: saml.php:7

References $DIC.

Member Function Documentation

◆ create()

ilPCListGUI::create ( )

Save list.

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

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

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

+ Here is the call graph for this function:

◆ edit()

ilPCListGUI::edit ( )

edit properties form

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

103 {
104 $this->displayValidationError();
105
106 $this->initListForm("edit");
107 $this->getValues();
108 $this->tpl->setContent($this->form->getHTML());
109 }
getValues()
Get current values for list from.
displayValidationError()
display validation errors

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

+ Here is the call graph for this function:

◆ executeCommand()

ilPCListGUI::executeCommand ( )

execute command

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

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

References $ret.

◆ getValues()

ilPCListGUI::getValues ( )

Get current values for list from.

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

270 {
272
273 $values = array();
274
275 $values["start_value"] = $this->content_obj->getStartValue();
276 $values["list_type"] = $this->content_obj->getListType();
277 $values["numbering_type"] = $this->content_obj->getNumberingType();
278 if ($values["list_type"] == "Ordered") {
279 $values["number_style"] = $this->content_obj->getStyleClass();
280 $values["bullet_style"] = "";
281 } else {
282 $values["bullet_style"] = $this->content_obj->getStyleClass();
283 $values["number_style"] = "";
284 }
285 $this->form->setValuesByArray($values);
286 }

References ilPageContentGUI\$tpl.

Referenced by edit().

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

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

References $html, $i, ilPageContentGUI\$lng, $options, $si, $style, ilPageContentGUI\getCharacteristics(), and ilPageContentGUI\getCharacteristicsOfCurrentStyle().

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

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

59 {
61
62 $this->initListForm("create");
63 $this->tpl->setContent($this->form->getHTML());
64 }

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

+ Here is the call graph for this function:

◆ saveProperties()

ilPCListGUI::saveProperties ( )

Save properties.

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

115 {
119
120 $this->initListForm("edit");
121 if ($this->form->checkInput()) {
122 $this->content_obj->setStartValue($_POST["start_value"]);
123 $this->content_obj->setListType($_POST["list_type"]);
124 if ($_POST["list_type"] == "Unordered") {
125 $this->content_obj->setNumberingType("");
126 $this->content_obj->setStyleClass($_POST["bullet_style"]);
127 } else {
128 $this->content_obj->setNumberingType($_POST["numbering_type"]);
129 $this->content_obj->setStyleClass($_POST["number_style"]);
130 }
131
132 $this->updated = $this->pg_obj->update();
133 if ($this->updated === true) {
134 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
135 }
136 }
137 $this->form->setValuesByPost();
138 $tpl->setContent($this->form->getHtml());
139 }

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

+ Here is the call graph for this function:

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