Public Member Functions | |
ilPCTableData (&$a_dom) | |
Constructor public. | |
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 | |
Data Fields | |
$dom |
Definition at line 36 of file class.ilPCTableData.php.
ilPCTableData::deleteCol | ( | ) |
delete column of cell
Definition at line 211 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]); } } }
ilPCTableData::deleteRow | ( | ) |
delete row of cell
Definition at line 127 of file class.ilPCTableData.php.
References ilPageContent::getNode().
{ $td =& $this->getNode(); $parent_tr =& $td->parent_node(); $parent_tr->unlink($parent_tr); }
ilPCTableData::deleteRowContent | ( | &$ | a_row_node | ) |
delete content of cells of a row (not the cells itself)
private
Definition at line 95 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++) { $td_childs =& $tds[$i]->child_nodes(); for($j=0; $j<count($td_childs); $j++) { $tds[$i]->remove_child($td_childs[$j]); } } }
ilPCTableData::deleteTDContent | ( | &$ | a_td_node | ) |
delete content of a cell (not the cell itself)
private
Definition at line 114 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]);
}
}
ilPCTableData::ilPCTableData | ( | &$ | a_dom | ) |
Constructor public.
Definition at line 44 of file class.ilPCTableData.php.
References ilPageContent::ilPageContent(), and ilPageContent::setType().
{ parent::ilPageContent(); $this->setType("td"); $this->dom =& $a_dom; }
ilPCTableData::moveColLeft | ( | ) |
move column left
Definition at line 299 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); } } }
ilPCTableData::moveColRight | ( | ) |
move column right
Definition at line 266 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); } } }
ilPCTableData::moveRowDown | ( | ) |
move row down
Definition at line 240 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); }
ilPCTableData::moveRowUp | ( | ) |
move row up
Definition at line 253 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); }
ilPCTableData::newColAfter | ( | ) |
insert new column after cell
Definition at line 138 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); // 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); } } }
ilPCTableData::newColBefore | ( | ) |
insert new column before cell
Definition at line 178 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); // insert clone before $col_nr $new_td =& $tds[$col_nr]->insert_before($new_td, $tds[$col_nr]); $this->deleteTDContent($new_td); } } }
ilPCTableData::newRowAfter | ( | ) |
insert new row after cell
Definition at line 55 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); 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); }
ilPCTableData::newRowBefore | ( | ) |
insert new row after cell
Definition at line 78 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); // remove td content of new row $this->deleteRowContent($new_tr); }
ilPCTableData::$dom |
Definition at line 38 of file class.ilPCTableData.php.