ILIAS  Release_3_10_x_branch Revision 61812
 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
- 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.
 readHierId ()
 Read PC Id.
 setPcId ($a_pcid)
 Set PC Id.
 getPCId ()
 Get PC Id.
 readPCId ()
 Read PC Id.
 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.
- 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 17171 2008-08-19 08:09:35Z akill

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

Member Function Documentation

ilPCTableData::deleteCol ( )

delete column of cell

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

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

{
$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]);
}
}
}

+ Here is the call graph for this function:

ilPCTableData::deleteRow ( )

delete row of cell

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

References ilPageContent\getNode().

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

+ 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 101 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 124 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::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::moveColLeft ( )

move column left

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

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

{
$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);
}
}
}

+ Here is the call graph for this function:

ilPCTableData::moveColRight ( )

move column right

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

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

{
$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);
}
}
}

+ Here is the call graph for this function:

ilPCTableData::moveRowDown ( )

move row down

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

References ilPageContent\getNode().

{
$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);
}

+ Here is the call graph for this function:

ilPCTableData::moveRowUp ( )

move row up

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

References ilPageContent\getNode().

{
$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);
}

+ Here is the call graph for this function:

ilPCTableData::newColAfter ( )

insert new column after cell

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

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

{
$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);
}
}
}

+ Here is the call graph for this function:

ilPCTableData::newColBefore ( )

insert new column before cell

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

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

{
$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);
}
}
}

+ 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(), and ilPageContent\getNode().

{
$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);
}

+ Here is the call graph for this function:

ilPCTableData::newRowBefore ( )

insert new row after cell

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

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

{
$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);
}

+ 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: