ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilPCList.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once("./Services/COPage/classes/class.ilPageContent.php");
5
17{
19
23 function init()
24 {
25 $this->setType("list");
26 }
27
31 function setNode(&$a_node)
32 {
33 parent::setNode($a_node); // this is the PageContent node
34 $this->list_node = $a_node->first_child(); // this is the Table node
35 }
36
40 function create(&$a_pg_obj, $a_hier_id, $a_pc_id = "")
41 {
42 $this->node = $this->createPageContentNode();
43 $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
44 $this->list_node =& $this->dom->create_element("List");
45 $this->list_node =& $this->node->append_child($this->list_node);
46 }
47
51 function addItems($a_nr)
52 {
53 for ($i=1; $i<=$a_nr; $i++)
54 {
55 $new_item =& $this->dom->create_element("ListItem");
56 $new_item =& $this->list_node->append_child($new_item);
57 }
58 }
59
63/* function setOrderType($a_type = "Unordered")
64 {
65 switch ($a_type)
66 {
67 case "Unordered":
68 $this->list_node->set_attribute("Type", "Unordered");
69 if ($this->list_node->has_attribute("NumberingType"))
70 {
71 $this->list_node->remove_attribute("NumberingType");
72 }
73 break;
74
75 case "Number":
76 case "Roman":
77 case "roman":
78 case "Alphabetic":
79 case "alphabetic":
80 case "Decimal":
81 $this->list_node->set_attribute("Type", "Ordered");
82 $this->list_node->set_attribute("NumberingType", $a_type);
83 break;
84 }
85 }*/
86
90 function getOrderType()
91 {
92 if ($this->list_node->get_attribute("Type") == "Unordered")
93 {
94 return "Unordered";
95 }
96
97 $nt = $this->list_node->get_attribute("NumberingType");
98 switch ($nt)
99 {
100 case "Number":
101 case "Roman":
102 case "roman":
103 case "Alphabetic":
104 case "alphabetic":
105 case "Decimal":
106 return $nt;
107 break;
108
109 default:
110 return "Number";
111 }
112 }
113
117 function getListType()
118 {
119 if ($this->list_node->get_attribute("Type") == "Unordered")
120 {
121 return "Unordered";
122 }
123 return "Ordered";
124 }
125
131 function setListType($a_val)
132 {
133 $this->list_node->set_attribute("Type", $a_val);
134 }
135
140 {
141 $nt = $this->list_node->get_attribute("NumberingType");
142 switch ($nt)
143 {
144 case "Number":
145 case "Roman":
146 case "roman":
147 case "Alphabetic":
148 case "alphabetic":
149 case "Decimal":
150 return $nt;
151 break;
152
153 default:
154 return "Number";
155 }
156 }
157
163 function setNumberingType($a_val)
164 {
165 if ($a_val != "")
166 {
167 $this->list_node->set_attribute("NumberingType", $a_val);
168 }
169 else
170 {
171 if ($this->list_node->has_attribute("NumberingType"))
172 {
173 $this->list_node->remove_attribute("NumberingType");
174 }
175 }
176 }
177
183 function setStartValue($a_val)
184 {
185 if ($a_val != "")
186 {
187 $this->list_node->set_attribute("StartValue", $a_val);
188 }
189 else
190 {
191 if ($this->list_node->has_attribute("StartValue"))
192 {
193 $this->list_node->remove_attribute("StartValue");
194 }
195 }
196 }
197
203 function getStartValue()
204 {
205 return $this->list_node->get_attribute("StartValue");
206 }
207
213 function setStyleClass($a_val)
214 {
215 if (!in_array($a_val, array("", "BulletedList", "NumberedList")))
216 {
217 $this->list_node->set_attribute("Class", $a_val);
218 }
219 else
220 {
221 if ($this->list_node->has_attribute("Class"))
222 {
223 $this->list_node->remove_attribute("Class");
224 }
225 }
226 }
227
233 function getStyleClass()
234 {
235 return $this->list_node->get_attribute("Class");
236 }
237}
238?>
const IL_INSERT_AFTER
Class ilPCList.
setStyleClass($a_val)
Set style class.
getStartValue()
Get start value.
addItems($a_nr)
Add a number of items to list.
getStyleClass()
Get style class.
create(&$a_pg_obj, $a_hier_id, $a_pc_id="")
Create new list.
getListType()
Get list type.
getOrderType()
Set order type.
init()
Init page content component.
setStartValue($a_val)
Set start value.
getNumberingType()
Get numbering type.
setListType($a_val)
Set list type.
setNode(&$a_node)
Set pc node.
setNumberingType($a_val)
Set numbering type.
Class ilPageContent.
createPageContentNode($a_set_this_node=true)
Create page content node (always use this method first when adding a new element)
setType($a_type)
Set Type.