ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilPCTableData Class Reference

Class ilPCTableData. More...

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

Public Member Functions

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

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)
static decEdId ($ed_id)
 Decreases an hierarchical editing id at lowest level (last number)
static haveSameContainer ($ed_id1, $ed_id2)
 Check, if two ids are in same container.
static sortHierIds ($a_array)
 Sort an array of Hier IDS in ascending order.
- Protected Member Functions inherited from ilPageContent
 setType ($a_type)
 Set Type.

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:
class.ilPCTableData.php 19892 2009-05-05 19:39:13Z akill

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

Member Function Documentation

ilPCTableData::deleteCol ( )

delete column of cell

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

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

{
$this->initTablePCNode();
$td =& $this->getNode();
// determine current column nr
$hier_id = $this->getHierId();
$parts = explode("_", $hier_id);
$col_nr = array_pop($parts);
$col_nr--;
$parent_tr =& $td->parent_node();
$parent_table =& $parent_tr->parent_node();
// iterate all table rows
$rows =& $parent_table->child_nodes();
for($i=0; $i<count($rows); $i++)
{
if($rows[$i]->node_name() == "TableRow")
{
// unlink td at $col_nr
$tds =& $rows[$i]->child_nodes();
$tds[$col_nr]->unlink($tds[$col_nr]);
}
}
$this->fixHideAndSpans();
}

+ Here is the call graph for this function:

ilPCTableData::deleteRow ( )

delete row of cell

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

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

{
$this->initTablePCNode();
$td =& $this->getNode();
$parent_tr =& $td->parent_node();
$parent_tr->unlink($parent_tr);
$this->fixHideAndSpans();
}

+ Here is the call graph for this function:

ilPCTableData::deleteRowContent ( $a_row_node)

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

private

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

Referenced by newRowAfter(), and newRowBefore().

{
// remove td content of row
$tds =& $a_row_node->child_nodes();
for($i=0; $i<count($tds); $i++)
{
if ($tds[$i]->has_attribute("PCID"))
{
$tds[$i]->remove_attribute("PCID");
}
$td_childs =& $tds[$i]->child_nodes();
for($j=0; $j<count($td_childs); $j++)
{
$tds[$i]->remove_child($td_childs[$j]);
}
}
}

+ Here is the caller graph for this function:

ilPCTableData::deleteTDContent ( $a_td_node)

delete content of a cell (not the cell itself)

private

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

Referenced by newColAfter(), and newColBefore().

{
$td_childs =& $a_td_node->child_nodes();
for($j=0; $j<count($td_childs); $j++)
{
$a_td_node->remove_child($td_childs[$j]);
}
}

+ Here is the caller graph for this function:

ilPCTableData::fixHideAndSpans ( )

Fix hide attribute and spans.

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

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

{
include_once("./Services/COPage/classes/class.ilPCTable.php");
$table_obj = new ilPCTable($this->dom);
$table_obj->setNode($this->table_pc_node);
$table_obj->readHierId();
$table_obj->readPCId();
$table_obj->fixHideAndSpans();
}

+ Here is the caller graph for this function:

ilPCTableData::init ( )

Init page content component.

Reimplemented from ilPageContent.

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

References ilPageContent\setType().

{
$this->setType("td");
}

+ Here is the call graph for this function:

ilPCTableData::initTablePCNode ( )

Table PC Node.

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

References ilPageContent\getNode().

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

{
$td = $this->getNode();
$tr = $td->parent_node();
$table = $tr->parent_node();
$this->table_pc_node = $table->parent_node();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCTableData::moveColLeft ( )

move column left

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

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

{
$this->initTablePCNode();
$td =& $this->getNode();
// determine current column nr
$hier_id = $this->getHierId();
$parts = explode("_", $hier_id);
$col_nr = array_pop($parts);
$col_nr--;
$parent_tr =& $td->parent_node();
$parent_table =& $parent_tr->parent_node();
// iterate all table rows
$rows =& $parent_table->child_nodes();
for($i=0; $i<count($rows); $i++)
{
if($rows[$i]->node_name() == "TableRow")
{
$tds =& $rows[$i]->child_nodes();
$td =& $tds[$col_nr];
$prev =& $td->previous_sibling();
$td_copy = $td->clone_node(true);
$td_copy =& $prev->insert_before($td_copy, $prev);
$td->unlink($td);
}
}
$this->fixHideAndSpans();
}

+ Here is the call graph for this function:

ilPCTableData::moveColRight ( )

move column right

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

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

{
$this->initTablePCNode();
$td =& $this->getNode();
// determine current column nr
$hier_id = $this->getHierId();
$parts = explode("_", $hier_id);
$col_nr = array_pop($parts);
$col_nr--;
$parent_tr =& $td->parent_node();
$parent_table =& $parent_tr->parent_node();
// iterate all table rows
$rows =& $parent_table->child_nodes();
for($i=0; $i<count($rows); $i++)
{
if($rows[$i]->node_name() == "TableRow")
{
$tds =& $rows[$i]->child_nodes();
$td =& $tds[$col_nr];
//$td =& $this->getNode();
$next =& $td->next_sibling();
$next_copy = $next->clone_node(true);
$next_copy =& $td->insert_before($next_copy, $td);
$next->unlink($next);
}
}
$this->fixHideAndSpans();
}

+ Here is the call graph for this function:

ilPCTableData::moveRowDown ( )

move row down

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

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

{
$this->initTablePCNode();
$td =& $this->getNode();
$tr =& $td->parent_node();
$next =& $tr->next_sibling();
$next_copy = $next->clone_node(true);
$next_copy =& $tr->insert_before($next_copy, $tr);
$next->unlink($next);
$this->fixHideAndSpans();
}

+ Here is the call graph for this function:

ilPCTableData::moveRowUp ( )

move row up

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

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

{
$this->initTablePCNode();
$td =& $this->getNode();
$tr =& $td->parent_node();
$prev =& $tr->previous_sibling();
$tr_copy = $tr->clone_node(true);
$tr_copy =& $prev->insert_before($tr_copy, $prev);
$tr->unlink($tr);
$this->fixHideAndSpans();
}

+ Here is the call graph for this function:

ilPCTableData::newColAfter ( )

insert new column after cell

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

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

{
$this->initTablePCNode();
$td =& $this->getNode();
// determine current column nr
$hier_id = $this->getHierId();
$parts = explode("_", $hier_id);
$col_nr = array_pop($parts);
$col_nr--;
$parent_tr =& $td->parent_node();
$parent_table =& $parent_tr->parent_node();
// iterate all table rows
$rows =& $parent_table->child_nodes();
for($i=0; $i<count($rows); $i++)
{
if($rows[$i]->node_name() == "TableRow")
{
// clone td at $col_nr
$tds =& $rows[$i]->child_nodes();
$new_td =& $tds[$col_nr]->clone_node(true);
if ($new_td->has_attribute("PCID"))
{
$new_td->remove_attribute("PCID");
}
// insert clone after $col_nr
if ($next_td =& $tds[$col_nr]->next_sibling())
{
$new_td =& $next_td->insert_before($new_td, $next_td);
}
else
{
$new_td =& $rows[$i]->append_child($new_td);
}
$this->deleteTDContent($new_td);
}
}
$this->fixHideAndSpans();
}

+ Here is the call graph for this function:

ilPCTableData::newColBefore ( )

insert new column before cell

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

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

{
$this->initTablePCNode();
$td =& $this->getNode();
// determine current column nr
$hier_id = $this->getHierId();
$parts = explode("_", $hier_id);
$col_nr = array_pop($parts);
$col_nr--;
$parent_tr =& $td->parent_node();
$parent_table =& $parent_tr->parent_node();
// iterate all table rows
$rows =& $parent_table->child_nodes();
for($i=0; $i<count($rows); $i++)
{
if($rows[$i]->node_name() == "TableRow")
{
// clone td at $col_nr
$tds =& $rows[$i]->child_nodes();
$new_td =& $tds[$col_nr]->clone_node(true);
if ($new_td->has_attribute("PCID"))
{
$new_td->remove_attribute("PCID");
}
// insert clone before $col_nr
$new_td =& $tds[$col_nr]->insert_before($new_td, $tds[$col_nr]);
$this->deleteTDContent($new_td);
}
}
$this->fixHideAndSpans();
}

+ Here is the call graph for this function:

ilPCTableData::newRowAfter ( )

insert new row after cell

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

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

{
$this->initTablePCNode();
$td =& $this->getNode();
$parent_tr =& $td->parent_node();
$new_tr = $parent_tr->clone_node(true);
// remove pc ids
if ($new_tr->has_attribute("PCID"))
{
$new_tr->remove_attribute("PCID");
}
if ($next_tr =& $parent_tr->next_sibling())
{
$new_tr =& $next_tr->insert_before($new_tr, $next_tr);
}
else
{
$parent_table =& $parent_tr->parent_node();
$new_tr =& $parent_table->append_child($new_tr);
}
// remove td content of new row
$this->deleteRowContent($new_tr);
$this->fixHideAndSpans();
}

+ Here is the call graph for this function:

ilPCTableData::newRowBefore ( )

insert new row after cell

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

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

{
$this->initTablePCNode();
$td =& $this->getNode();
$parent_tr =& $td->parent_node();
$new_tr = $parent_tr->clone_node(true);
$new_tr =& $parent_tr->insert_before($new_tr, $parent_tr);
if ($new_tr->has_attribute("PCID"))
{
$new_tr->remove_attribute("PCID");
}
// remove td content of new row
$this->deleteRowContent($new_tr);
$this->fixHideAndSpans();
}

+ Here is the call graph for this function:

Field Documentation

ilPCTableData::$dom

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


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