ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilPCTableData Class Reference

Class ilPCTableData. More...

+ Inheritance diagram for ilPCTableData:
+ Collaboration diagram for ilPCTableData:

Public Member Functions

 init ()
 Init page content component. More...
 
 newRowAfter ()
 insert new row after cell More...
 
 newRowBefore ()
 insert new row after cell More...
 
 deleteRowContent (&$a_row_node)
 delete content of cells of a row (not the cells itself) More...
 
 deleteTDContent (&$a_td_node)
 delete content of a cell (not the cell itself) More...
 
 deleteRow ()
 delete row of cell More...
 
 newColAfter ()
 insert new column after cell More...
 
 newColBefore ()
 insert new column before cell More...
 
 deleteCol ()
 delete column of cell More...
 
 moveRowDown ()
 move row down More...
 
 moveRowUp ()
 move row up More...
 
 moveColRight ()
 move column right More...
 
 moveColLeft ()
 move column left More...
 
 initTablePCNode ()
 Table PC Node. More...
 
 fixHideAndSpans ()
 Fix hide attribute and spans. More...
 
- Public Member Functions inherited from ilPageContent
 __construct ($a_pg_obj)
 Constructor. More...
 
 setPage ($a_val)
 Set page. More...
 
 getPage ()
 Get page. More...
 
 init ()
 Init object. More...
 
 getType ()
 Get type of page content. More...
 
 setNode (&$a_node)
 Set xml node of page content. More...
 
getNode ()
 Get xml node of page content. More...
 
 getJavascriptFiles ()
 Get Javascript files. More...
 
 getCssFiles ()
 Get css files. More...
 
 getOnloadCode ()
 Get on load code. More...
 
 setHierId ($a_hier_id)
 Set hierarchical ID in xml structure. More...
 
 getHierId ()
 Get hierarchical id. More...
 
 lookupHierId ()
 Get hierarchical id from dom. More...
 
 readHierId ()
 Read PC Id. More...
 
 setPcId ($a_pcid)
 Set PC Id. More...
 
 getPCId ()
 Get PC Id. More...
 
 readPCId ()
 Read PC Id. More...
 
 writePCId ($a_pc_id)
 Write pc id. More...
 
 isGreaterHierId ($a, $b)
 Check whether Hier ID $a is greater than Hier ID $b. More...
 
 setEnabled ($value)
 Set Enabled value for page content component. More...
 
 enable ()
 Enable page content. More...
 
 disable ()
 Disable page content. More...
 
 isEnabled ()
 Check whether page content is enabled. More...
 
 createPageContentNode ($a_set_this_node=true)
 Create page content node (always use this method first when adding a new element) More...
 
 modifyPageContentPostXsl ($a_output, $a_mode)
 Modify page content after xsl. More...
 

Data Fields

 $dom
 
- Data Fields inherited from ilPageContent
 $hier_id
 
 $node
 
 $dom
 

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContent
static incEdId ($ed_id)
 Increases an hierarchical editing id at lowest level (last number) More...
 
static decEdId ($ed_id)
 Decreases an hierarchical editing id at lowest level (last number) More...
 
static haveSameContainer ($ed_id1, $ed_id2)
 Check, if two ids are in same container. More...
 
static sortHierIds ($a_array)
 Sort an array of Hier IDS in ascending order. More...
 
static getLangVars ()
 Get lang vars needed for editing. More...
 
static handleCopiedContent (DOMDocument $a_domdoc, $a_self_ass=true, $a_clone_mobs=false)
 Handle copied content. More...
 
static afterPageUpdate ($a_page, DOMDocument $a_domdoc, $a_xml, $a_creation)
 After page has been updated (or created) More...
 
static beforePageDelete ($a_page)
 Before page is being deleted. More...
 
static afterPageHistoryEntry ($a_page, DOMDocument $a_old_domdoc, $a_old_xml, $a_old_nr)
 After page history entry has been created. More...
 
- Protected Member Functions inherited from ilPageContent
 setType ($a_type)
 Set Type. More...
 

Detailed Description

Class ilPCTableData.

Table Data content object - a table cell (see ILIAS DTD)

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

Definition at line 36 of file class.ilPCTableData.php.

Member Function Documentation

◆ deleteCol()

ilPCTableData::deleteCol ( )

delete column of cell

Definition at line 242 of file class.ilPCTableData.php.

243 {
244 $this->initTablePCNode();
245 $td =& $this->getNode();
246
247 // determine current column nr
248 $hier_id = $this->getHierId();
249 $parts = explode("_", $hier_id);
250 $col_nr = array_pop($parts);
251 $col_nr--;
252
253 $parent_tr =& $td->parent_node();
254 $parent_table =& $parent_tr->parent_node();
255
256 // iterate all table rows
257 $rows =& $parent_table->child_nodes();
258 for($i=0; $i<count($rows); $i++)
259 {
260 if($rows[$i]->node_name() == "TableRow")
261 {
262 // unlink td at $col_nr
263 $tds =& $rows[$i]->child_nodes();
264 $tds[$col_nr]->unlink($tds[$col_nr]);
265 }
266 }
267 $this->fixHideAndSpans();
268 }
fixHideAndSpans()
Fix hide attribute and spans.
initTablePCNode()
Table PC Node.
getHierId()
Get hierarchical id.
& getNode()
Get xml node of page content.

References ilPageContent\$hier_id, fixHideAndSpans(), ilPageContent\getHierId(), ilPageContent\getNode(), and initTablePCNode().

+ Here is the call graph for this function:

◆ deleteRow()

ilPCTableData::deleteRow ( )

delete row of cell

Definition at line 142 of file class.ilPCTableData.php.

143 {
144 $this->initTablePCNode();
145 $td =& $this->getNode();
146 $parent_tr =& $td->parent_node();
147 $parent_tr->unlink($parent_tr);
148 $this->fixHideAndSpans();
149 }

References fixHideAndSpans(), ilPageContent\getNode(), and initTablePCNode().

+ Here is the call graph for this function:

◆ deleteRowContent()

ilPCTableData::deleteRowContent ( $a_row_node)

delete content of cells of a row (not the cells itself)

@access private

Definition at line 105 of file class.ilPCTableData.php.

106 {
107 // remove td content of row
108 $tds =& $a_row_node->child_nodes();
109 for($i=0; $i<count($tds); $i++)
110 {
111 if ($tds[$i]->has_attribute("PCID"))
112 {
113 $tds[$i]->remove_attribute("PCID");
114 }
115 $td_childs =& $tds[$i]->child_nodes();
116 for($j=0; $j<count($td_childs); $j++)
117 {
118 $tds[$i]->remove_child($td_childs[$j]);
119 }
120 }
121
122 }

Referenced by newRowAfter(), and newRowBefore().

+ Here is the caller graph for this function:

◆ deleteTDContent()

ilPCTableData::deleteTDContent ( $a_td_node)

delete content of a cell (not the cell itself)

@access private

Definition at line 129 of file class.ilPCTableData.php.

130 {
131 $td_childs =& $a_td_node->child_nodes();
132 for($j=0; $j<count($td_childs); $j++)
133 {
134 $a_td_node->remove_child($td_childs[$j]);
135 }
136 }

Referenced by newColAfter(), and newColBefore().

+ Here is the caller graph for this function:

◆ fixHideAndSpans()

ilPCTableData::fixHideAndSpans ( )

Fix hide attribute and spans.

Definition at line 383 of file class.ilPCTableData.php.

384 {
385 include_once("./Services/COPage/classes/class.ilPCTable.php");
386 $table_obj = new ilPCTable($this->getPage());
387 $table_obj->setNode($this->table_pc_node);
388 $table_obj->readHierId();
389 $table_obj->readPCId();
390 $table_obj->fixHideAndSpans();
391 }
Class ilPCTable.

References ilPageContent\getPage().

Referenced by deleteCol(), deleteRow(), moveColLeft(), moveColRight(), moveRowDown(), moveRowUp(), newColAfter(), newColBefore(), newRowAfter(), and newRowBefore().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init()

ilPCTableData::init ( )

Init page content component.

Reimplemented from ilPageContent.

Definition at line 43 of file class.ilPCTableData.php.

44 {
45 $this->setType("td");
46 }
setType($a_type)
Set Type.

References ilPageContent\setType().

+ Here is the call graph for this function:

◆ initTablePCNode()

ilPCTableData::initTablePCNode ( )

Table PC Node.

Definition at line 372 of file class.ilPCTableData.php.

373 {
374 $td = $this->getNode();
375 $tr = $td->parent_node();
376 $table = $tr->parent_node();
377 $this->table_pc_node = $table->parent_node();
378 }

References ilPageContent\getNode().

Referenced by deleteCol(), deleteRow(), moveColLeft(), moveColRight(), moveRowDown(), moveRowUp(), newColAfter(), newColBefore(), newRowAfter(), and newRowBefore().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ moveColLeft()

ilPCTableData::moveColLeft ( )

move column left

Definition at line 338 of file class.ilPCTableData.php.

339 {
340 $this->initTablePCNode();
341 $td =& $this->getNode();
342
343 // determine current column nr
344 $hier_id = $this->getHierId();
345 $parts = explode("_", $hier_id);
346 $col_nr = array_pop($parts);
347 $col_nr--;
348
349 $parent_tr =& $td->parent_node();
350 $parent_table =& $parent_tr->parent_node();
351
352 // iterate all table rows
353 $rows =& $parent_table->child_nodes();
354 for($i=0; $i<count($rows); $i++)
355 {
356 if($rows[$i]->node_name() == "TableRow")
357 {
358 $tds =& $rows[$i]->child_nodes();
359 $td =& $tds[$col_nr];
360 $prev =& $td->previous_sibling();
361 $td_copy = $td->clone_node(true);
362 $td_copy =& $prev->insert_before($td_copy, $prev);
363 $td->unlink($td);
364 }
365 }
366 $this->fixHideAndSpans();
367 }

References ilPageContent\$hier_id, fixHideAndSpans(), ilPageContent\getHierId(), ilPageContent\getNode(), and initTablePCNode().

+ Here is the call graph for this function:

◆ moveColRight()

ilPCTableData::moveColRight ( )

move column right

Definition at line 303 of file class.ilPCTableData.php.

304 {
305 $this->initTablePCNode();
306 $td =& $this->getNode();
307
308 // determine current column nr
309 $hier_id = $this->getHierId();
310 $parts = explode("_", $hier_id);
311 $col_nr = array_pop($parts);
312 $col_nr--;
313
314 $parent_tr =& $td->parent_node();
315 $parent_table =& $parent_tr->parent_node();
316
317 // iterate all table rows
318 $rows =& $parent_table->child_nodes();
319 for($i=0; $i<count($rows); $i++)
320 {
321 if($rows[$i]->node_name() == "TableRow")
322 {
323 $tds =& $rows[$i]->child_nodes();
324 $td =& $tds[$col_nr];
325 //$td =& $this->getNode();
326 $next =& $td->next_sibling();
327 $next_copy = $next->clone_node(true);
328 $next_copy =& $td->insert_before($next_copy, $td);
329 $next->unlink($next);
330 }
331 }
332 $this->fixHideAndSpans();
333 }

References ilPageContent\$hier_id, fixHideAndSpans(), ilPageContent\getHierId(), ilPageContent\getNode(), and initTablePCNode().

+ Here is the call graph for this function:

◆ moveRowDown()

ilPCTableData::moveRowDown ( )

move row down

Definition at line 273 of file class.ilPCTableData.php.

274 {
275 $this->initTablePCNode();
276 $td =& $this->getNode();
277 $tr =& $td->parent_node();
278 $next =& $tr->next_sibling();
279 $next_copy = $next->clone_node(true);
280 $next_copy =& $tr->insert_before($next_copy, $tr);
281 $next->unlink($next);
282 $this->fixHideAndSpans();
283 }

References fixHideAndSpans(), ilPageContent\getNode(), and initTablePCNode().

+ Here is the call graph for this function:

◆ moveRowUp()

ilPCTableData::moveRowUp ( )

move row up

Definition at line 288 of file class.ilPCTableData.php.

289 {
290 $this->initTablePCNode();
291 $td =& $this->getNode();
292 $tr =& $td->parent_node();
293 $prev =& $tr->previous_sibling();
294 $tr_copy = $tr->clone_node(true);
295 $tr_copy =& $prev->insert_before($tr_copy, $prev);
296 $tr->unlink($tr);
297 $this->fixHideAndSpans();
298 }

References fixHideAndSpans(), ilPageContent\getNode(), and initTablePCNode().

+ Here is the call graph for this function:

◆ newColAfter()

ilPCTableData::newColAfter ( )

insert new column after cell

Definition at line 155 of file class.ilPCTableData.php.

156 {
157 $this->initTablePCNode();
158 $td =& $this->getNode();
159
160 // determine current column nr
161 $hier_id = $this->getHierId();
162 $parts = explode("_", $hier_id);
163 $col_nr = array_pop($parts);
164 $col_nr--;
165
166 $parent_tr =& $td->parent_node();
167 $parent_table =& $parent_tr->parent_node();
168
169 // iterate all table rows
170 $rows =& $parent_table->child_nodes();
171 for($i=0; $i<count($rows); $i++)
172 {
173 if($rows[$i]->node_name() == "TableRow")
174 {
175 // clone td at $col_nr
176 $tds =& $rows[$i]->child_nodes();
177 $new_td =& $tds[$col_nr]->clone_node(true);
178
179 if ($new_td->has_attribute("PCID"))
180 {
181 $new_td->remove_attribute("PCID");
182 }
183
184 // insert clone after $col_nr
185 if ($next_td =& $tds[$col_nr]->next_sibling())
186 {
187 $new_td =& $next_td->insert_before($new_td, $next_td);
188 }
189 else
190 {
191 $new_td =& $rows[$i]->append_child($new_td);
192 }
193 $this->deleteTDContent($new_td);
194 }
195 }
196 $this->fixHideAndSpans();
197 }
deleteTDContent(&$a_td_node)
delete content of a cell (not the cell itself)

References ilPageContent\$hier_id, deleteTDContent(), fixHideAndSpans(), ilPageContent\getHierId(), ilPageContent\getNode(), and initTablePCNode().

+ Here is the call graph for this function:

◆ newColBefore()

ilPCTableData::newColBefore ( )

insert new column before cell

Definition at line 202 of file class.ilPCTableData.php.

203 {
204 $this->initTablePCNode();
205 $td =& $this->getNode();
206
207 // determine current column nr
208 $hier_id = $this->getHierId();
209 $parts = explode("_", $hier_id);
210 $col_nr = array_pop($parts);
211 $col_nr--;
212
213 $parent_tr =& $td->parent_node();
214 $parent_table =& $parent_tr->parent_node();
215
216 // iterate all table rows
217 $rows =& $parent_table->child_nodes();
218 for($i=0; $i<count($rows); $i++)
219 {
220 if($rows[$i]->node_name() == "TableRow")
221 {
222 // clone td at $col_nr
223 $tds =& $rows[$i]->child_nodes();
224 $new_td =& $tds[$col_nr]->clone_node(true);
225
226 if ($new_td->has_attribute("PCID"))
227 {
228 $new_td->remove_attribute("PCID");
229 }
230
231 // insert clone before $col_nr
232 $new_td =& $tds[$col_nr]->insert_before($new_td, $tds[$col_nr]);
233 $this->deleteTDContent($new_td);
234 }
235 }
236 $this->fixHideAndSpans();
237 }

References ilPageContent\$hier_id, deleteTDContent(), fixHideAndSpans(), ilPageContent\getHierId(), ilPageContent\getNode(), and initTablePCNode().

+ Here is the call graph for this function:

◆ newRowAfter()

ilPCTableData::newRowAfter ( )

insert new row after cell

Definition at line 51 of file class.ilPCTableData.php.

52 {
53 $this->initTablePCNode();
54 $td =& $this->getNode();
55 $parent_tr =& $td->parent_node();
56 $new_tr = $parent_tr->clone_node(true);
57
58 // remove pc ids
59 if ($new_tr->has_attribute("PCID"))
60 {
61 $new_tr->remove_attribute("PCID");
62 }
63 if ($next_tr =& $parent_tr->next_sibling())
64 {
65 $new_tr =& $next_tr->insert_before($new_tr, $next_tr);
66 }
67 else
68 {
69 $parent_table =& $parent_tr->parent_node();
70 $new_tr =& $parent_table->append_child($new_tr);
71 }
72
73 // remove td content of new row
74 $this->deleteRowContent($new_tr);
75 $this->fixHideAndSpans();
76 }
deleteRowContent(&$a_row_node)
delete content of cells of a row (not the cells itself)

References deleteRowContent(), fixHideAndSpans(), ilPageContent\getNode(), and initTablePCNode().

+ Here is the call graph for this function:

◆ newRowBefore()

ilPCTableData::newRowBefore ( )

insert new row after cell

Definition at line 82 of file class.ilPCTableData.php.

83 {
84 $this->initTablePCNode();
85 $td =& $this->getNode();
86 $parent_tr =& $td->parent_node();
87 $new_tr = $parent_tr->clone_node(true);
88 $new_tr =& $parent_tr->insert_before($new_tr, $parent_tr);
89 if ($new_tr->has_attribute("PCID"))
90 {
91 $new_tr->remove_attribute("PCID");
92 }
93
94 // remove td content of new row
95 $this->deleteRowContent($new_tr);
96 $this->fixHideAndSpans();
97 }

References deleteRowContent(), fixHideAndSpans(), ilPageContent\getNode(), and initTablePCNode().

+ Here is the call graph for this function:

Field Documentation

◆ $dom

ilPCTableData::$dom

Definition at line 38 of file class.ilPCTableData.php.


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