ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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 ($a_mode)
 Get Javascript files. More...
 
 getCssFiles ($a_mode)
 Get css files. More...
 
 getOnloadCode ($a_mode)
 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...
 
 setFileDownloadLink ($a_download_link)
 Set file download link. More...
 
 getFileDownloadLink ()
 Get file download link. More...
 
 setProfileBackUrl ($url)
 
 getProfileBackUrl ()
 
 setFullscreenLink ($a_fullscreen_link)
 Set fullscreen link. More...
 
 getFullscreenLink ()
 Get fullscreen link. More...
 
 setSourcecodeDownloadScript ($script_name)
 Set sourcecode download script. More...
 
 getSourcecodeDownloadScript ()
 Get sourcecode download script. More...
 
 readPCId ()
 Read PC Id. More...
 
 writePCId ($a_pc_id)
 Write pc id. 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, $a_abstract_only=false)
 Modify page content after xsl. More...
 
 getModel ()
 Get model. More...
 

Data Fields

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

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 isGreaterHierId ($a, $b)
 Check whether Hier ID $a is greater than Hier ID $b. 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...
 
- Protected Attributes inherited from ilPageContent
 $profile_back_url
 
 $file_download_link
 
 $fullscreen_link
 
 $sourcecode_download_script
 
 $log
 

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 222 of file class.ilPCTableData.php.

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

223  {
224  $this->initTablePCNode();
225  $td = $this->getNode();
226 
227  // determine current column nr
228  $hier_id = $this->getHierId();
229  $parts = explode("_", $hier_id);
230  $col_nr = array_pop($parts);
231  $col_nr--;
232 
233  $parent_tr = $td->parent_node();
234  $parent_table = $parent_tr->parent_node();
235 
236  // iterate all table rows
237  $rows = $parent_table->child_nodes();
238  for ($i = 0; $i < count($rows); $i++) {
239  if ($rows[$i]->node_name() == "TableRow") {
240  // unlink td at $col_nr
241  $tds = $rows[$i]->child_nodes();
242  $tds[$col_nr]->unlink($tds[$col_nr]);
243  }
244  }
245  $this->fixHideAndSpans();
246  }
& getNode()
Get xml node of page content.
fixHideAndSpans()
Fix hide attribute and spans.
getHierId()
Get hierarchical id.
$rows
Definition: xhr_table.php:10
initTablePCNode()
Table PC Node.
$i
Definition: metadata.php:24
+ Here is the call graph for this function:

◆ deleteRow()

ilPCTableData::deleteRow ( )

delete row of cell

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

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

133  {
134  $this->initTablePCNode();
135  $td = $this->getNode();
136  $parent_tr = $td->parent_node();
137  $parent_tr->unlink($parent_tr);
138  $this->fixHideAndSpans();
139  }
& getNode()
Get xml node of page content.
fixHideAndSpans()
Fix hide attribute and spans.
initTablePCNode()
Table PC Node.
+ 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)

private

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

References $i.

Referenced by newRowAfter(), and newRowBefore().

101  {
102  // remove td content of row
103  $tds = $a_row_node->child_nodes();
104  for ($i = 0; $i < count($tds); $i++) {
105  if ($tds[$i]->has_attribute("PCID")) {
106  $tds[$i]->remove_attribute("PCID");
107  }
108  $td_childs = $tds[$i]->child_nodes();
109  for ($j = 0; $j < count($td_childs); $j++) {
110  $tds[$i]->remove_child($td_childs[$j]);
111  }
112  }
113  }
$i
Definition: metadata.php:24
+ Here is the caller graph for this function:

◆ deleteTDContent()

ilPCTableData::deleteTDContent ( $a_td_node)

delete content of a cell (not the cell itself)

private

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

Referenced by newColAfter(), and newColBefore().

121  {
122  $td_childs = $a_td_node->child_nodes();
123  for ($j = 0; $j < count($td_childs); $j++) {
124  $a_td_node->remove_child($td_childs[$j]);
125  }
126  }
+ Here is the caller graph for this function:

◆ fixHideAndSpans()

ilPCTableData::fixHideAndSpans ( )

Fix hide attribute and spans.

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

References ilPageContent\getPage().

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

358  {
359  include_once("./Services/COPage/classes/class.ilPCTable.php");
360  $table_obj = new ilPCTable($this->getPage());
361  $table_obj->setNode($this->table_pc_node);
362  $table_obj->readHierId();
363  $table_obj->readPCId();
364  $table_obj->fixHideAndSpans();
365  }
Class ilPCTable.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init()

ilPCTableData::init ( )

Init page content component.

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

References ilPageContent\setType().

44  {
45  $this->setType("td");
46  }
setType($a_type)
Set Type.
+ Here is the call graph for this function:

◆ initTablePCNode()

ilPCTableData::initTablePCNode ( )

Table PC Node.

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

References ilPageContent\getNode().

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

347  {
348  $td = $this->getNode();
349  $tr = $td->parent_node();
350  $table = $tr->parent_node();
351  $this->table_pc_node = $table->parent_node();
352  }
& getNode()
Get xml node of page content.
+ 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 314 of file class.ilPCTableData.php.

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

315  {
316  $this->initTablePCNode();
317  $td = $this->getNode();
318 
319  // determine current column nr
320  $hier_id = $this->getHierId();
321  $parts = explode("_", $hier_id);
322  $col_nr = array_pop($parts);
323  $col_nr--;
324 
325  $parent_tr = $td->parent_node();
326  $parent_table = $parent_tr->parent_node();
327 
328  // iterate all table rows
329  $rows = $parent_table->child_nodes();
330  for ($i = 0; $i < count($rows); $i++) {
331  if ($rows[$i]->node_name() == "TableRow") {
332  $tds = $rows[$i]->child_nodes();
333  $td = $tds[$col_nr];
334  $prev = $td->previous_sibling();
335  $td_copy = $td->clone_node(true);
336  $td_copy = $prev->insert_before($td_copy, $prev);
337  $td->unlink($td);
338  }
339  }
340  $this->fixHideAndSpans();
341  }
& getNode()
Get xml node of page content.
fixHideAndSpans()
Fix hide attribute and spans.
getHierId()
Get hierarchical id.
$rows
Definition: xhr_table.php:10
initTablePCNode()
Table PC Node.
$i
Definition: metadata.php:24
+ Here is the call graph for this function:

◆ moveColRight()

ilPCTableData::moveColRight ( )

move column right

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

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

282  {
283  $this->initTablePCNode();
284  $td = $this->getNode();
285 
286  // determine current column nr
287  $hier_id = $this->getHierId();
288  $parts = explode("_", $hier_id);
289  $col_nr = array_pop($parts);
290  $col_nr--;
291 
292  $parent_tr = $td->parent_node();
293  $parent_table = $parent_tr->parent_node();
294 
295  // iterate all table rows
296  $rows = $parent_table->child_nodes();
297  for ($i = 0; $i < count($rows); $i++) {
298  if ($rows[$i]->node_name() == "TableRow") {
299  $tds = $rows[$i]->child_nodes();
300  $td = $tds[$col_nr];
301  //$td = $this->getNode();
302  $next = $td->next_sibling();
303  $next_copy = $next->clone_node(true);
304  $next_copy = $td->insert_before($next_copy, $td);
305  $next->unlink($next);
306  }
307  }
308  $this->fixHideAndSpans();
309  }
& getNode()
Get xml node of page content.
fixHideAndSpans()
Fix hide attribute and spans.
getHierId()
Get hierarchical id.
$rows
Definition: xhr_table.php:10
initTablePCNode()
Table PC Node.
$i
Definition: metadata.php:24
+ Here is the call graph for this function:

◆ moveRowDown()

ilPCTableData::moveRowDown ( )

move row down

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

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

252  {
253  $this->initTablePCNode();
254  $td = $this->getNode();
255  $tr = $td->parent_node();
256  $next = $tr->next_sibling();
257  $next_copy = $next->clone_node(true);
258  $next_copy = $tr->insert_before($next_copy, $tr);
259  $next->unlink($next);
260  $this->fixHideAndSpans();
261  }
& getNode()
Get xml node of page content.
fixHideAndSpans()
Fix hide attribute and spans.
initTablePCNode()
Table PC Node.
+ Here is the call graph for this function:

◆ moveRowUp()

ilPCTableData::moveRowUp ( )

move row up

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

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

267  {
268  $this->initTablePCNode();
269  $td = $this->getNode();
270  $tr = $td->parent_node();
271  $prev = $tr->previous_sibling();
272  $tr_copy = $tr->clone_node(true);
273  $tr_copy = $prev->insert_before($tr_copy, $prev);
274  $tr->unlink($tr);
275  $this->fixHideAndSpans();
276  }
& getNode()
Get xml node of page content.
fixHideAndSpans()
Fix hide attribute and spans.
initTablePCNode()
Table PC Node.
+ Here is the call graph for this function:

◆ newColAfter()

ilPCTableData::newColAfter ( )

insert new column after cell

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

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

146  {
147  $this->initTablePCNode();
148  $td = $this->getNode();
149 
150  // determine current column nr
151  $hier_id = $this->getHierId();
152  $parts = explode("_", $hier_id);
153  $col_nr = array_pop($parts);
154  $col_nr--;
155 
156  $parent_tr = $td->parent_node();
157  $parent_table = $parent_tr->parent_node();
158 
159  // iterate all table rows
160  $rows = $parent_table->child_nodes();
161  for ($i = 0; $i < count($rows); $i++) {
162  if ($rows[$i]->node_name() == "TableRow") {
163  // clone td at $col_nr
164  $tds = $rows[$i]->child_nodes();
165  $new_td = $tds[$col_nr]->clone_node(true);
166 
167  if ($new_td->has_attribute("PCID")) {
168  $new_td->remove_attribute("PCID");
169  }
170 
171  // insert clone after $col_nr
172  if ($next_td = $tds[$col_nr]->next_sibling()) {
173  $new_td = $next_td->insert_before($new_td, $next_td);
174  } else {
175  $new_td = $rows[$i]->append_child($new_td);
176  }
177  $this->deleteTDContent($new_td);
178  }
179  }
180  $this->fixHideAndSpans();
181  }
& getNode()
Get xml node of page content.
fixHideAndSpans()
Fix hide attribute and spans.
getHierId()
Get hierarchical id.
$rows
Definition: xhr_table.php:10
initTablePCNode()
Table PC Node.
$i
Definition: metadata.php:24
deleteTDContent(&$a_td_node)
delete content of a cell (not the cell itself)
+ Here is the call graph for this function:

◆ newColBefore()

ilPCTableData::newColBefore ( )

insert new column before cell

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

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

187  {
188  $this->initTablePCNode();
189  $td = $this->getNode();
190 
191  // determine current column nr
192  $hier_id = $this->getHierId();
193  $parts = explode("_", $hier_id);
194  $col_nr = array_pop($parts);
195  $col_nr--;
196  $parent_tr = $td->parent_node();
197  $parent_table = $parent_tr->parent_node();
198 
199  // iterate all table rows
200  $rows = $parent_table->child_nodes();
201  for ($i = 0; $i < count($rows); $i++) {
202  if ($rows[$i]->node_name() == "TableRow") {
203  // clone td at $col_nr
204  $tds = $rows[$i]->child_nodes();
205  $new_td = $tds[$col_nr]->clone_node(true);
206 
207  if ($new_td->has_attribute("PCID")) {
208  $new_td->remove_attribute("PCID");
209  }
210 
211  // insert clone before $col_nr
212  $new_td = $tds[$col_nr]->insert_before($new_td, $tds[$col_nr]);
213  $this->deleteTDContent($new_td);
214  }
215  }
216  $this->fixHideAndSpans();
217  }
& getNode()
Get xml node of page content.
fixHideAndSpans()
Fix hide attribute and spans.
getHierId()
Get hierarchical id.
$rows
Definition: xhr_table.php:10
initTablePCNode()
Table PC Node.
$i
Definition: metadata.php:24
deleteTDContent(&$a_td_node)
delete content of a cell (not the cell itself)
+ 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.

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

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  $new_tr->remove_attribute("PCID");
61  }
62  if ($next_tr = $parent_tr->next_sibling()) {
63  $new_tr = $next_tr->insert_before($new_tr, $next_tr);
64  } else {
65  $parent_table = $parent_tr->parent_node();
66  $new_tr = $parent_table->append_child($new_tr);
67  }
68 
69  // remove td content of new row
70  $this->deleteRowContent($new_tr);
71  $this->fixHideAndSpans();
72  }
& getNode()
Get xml node of page content.
fixHideAndSpans()
Fix hide attribute and spans.
deleteRowContent(&$a_row_node)
delete content of cells of a row (not the cells itself)
initTablePCNode()
Table PC Node.
+ Here is the call graph for this function:

◆ newRowBefore()

ilPCTableData::newRowBefore ( )

insert new row after cell

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

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

79  {
80  $this->initTablePCNode();
81  $td = $this->getNode();
82  $parent_tr = $td->parent_node();
83  $new_tr = $parent_tr->clone_node(true);
84  $new_tr = $parent_tr->insert_before($new_tr, $parent_tr);
85  if ($new_tr->has_attribute("PCID")) {
86  $new_tr->remove_attribute("PCID");
87  }
88 
89  // remove td content of new row
90  $this->deleteRowContent($new_tr);
91  $this->fixHideAndSpans();
92  }
& getNode()
Get xml node of page content.
fixHideAndSpans()
Fix hide attribute and spans.
deleteRowContent(&$a_row_node)
delete content of cells of a row (not the cells itself)
initTablePCNode()
Table PC Node.
+ 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: