ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilPCTable Class Reference

Class ilPCTable. More...

+ Inheritance diagram for ilPCTable:
+ Collaboration diagram for ilPCTable:

Public Member Functions

 init ()
 Init page content component.
 setNode (&$a_node)
 Set xml node of page content.
 create (&$a_pg_obj, $a_hier_id, $a_pc_id="")
addRow ()
addCell (&$aRow, $a_data="", $a_lang="")
 addRows ($a_nr_rows, $a_nr_cols)
 add rows to table
 importSpreadsheet ($a_lang, $a_data)
 import from table
 getLanguage ()
 get table language
 setLanguage ($a_lang)
 set table language
 getWidth ()
 get table width
 setWidth ($a_width)
 set table width
 getBorder ()
 get table border width
 setBorder ($a_border)
 set table border
 getCellSpacing ()
 get table cell spacing
 setCellSpacing ($a_spacing)
 set table cell spacing
 getCellPadding ()
 get table cell padding
 setCellPadding ($a_padding)
 set table cell padding
 setHorizontalAlign ($a_halign)
 set horizontal align
 getHorizontalAlign ()
 get table cell padding
 setTDWidth ($a_hier_id, $a_width, $a_pc_id="")
 set width of table data cell
 setTDSpans ($a_colspans, $a_rowspans)
 Set TDSpans.
 fixHideAndSpans ()
 Fix Hide and Spans.
 makeEmptyCell ($td_node)
 Make cell empty.
 checkCellHidden ($colspans, $rowspans, $x, $y)
 Check hidden status.
 getAllCellClasses ()
 Get all cell classes.
 getAllCellSpans ()
 Get all cell spans.
 getAllCellWidths ()
 Get all cell widhts.
 setTDClass ($a_hier_id, $a_class, $a_pc_id="")
 set class of table data cell
 getCaption ()
 get caption
 getCaptionAlign ()
 get caption alignment (Top | Bottom)
 setCaption ($a_content, $a_align)
 set table caption
 importTableAttributes (&$node)
 importCellAttributes (&$node, &$par)
 importRow ($lng, &$node)
 importCell ($lng, &$cellNode, &$aRow)
 extractText (&$node)
 importHtml ($lng, $htmlTable)
 setFirstRowStyle ($a_class)
 Set first row td style.
 setClass ($a_class)
 Set Style Class of table.
 getClass ()
 Get characteristic of section.
 setTemplate ($a_template)
 Set template.
 getTemplate ()
 Get template.
 setHeaderRows ($a_nr)
 Set header rows.
 getHeaderRows ()
 Get header rows.
 setFooterRows ($a_nr)
 Set footer rows.
 getFooterRows ()
 Get footer rows.
 setHeaderCols ($a_nr)
 Set header cols.
 getHeaderCols ()
 Get header cols.
 setFooterCols ($a_nr)
 Set footer cols.
 getFooterCols ()
 Get footer cols.
 getTableAttribute ($a_attr)
 Get table tag attribute.
- Public Member Functions inherited from ilPageContent
 __construct ($a_dom)
 Constructor.
 getType ()
 Get type 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.
 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
 $tab_node
- Data Fields inherited from ilPageContent
 $hier_id
 $node
 $dom

Protected Member Functions

 setTableAttribute ($a_attr, $a_value)
 Set attribute of table tag.
- Protected Member Functions inherited from ilPageContent
 setType ($a_type)
 Set Type.

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.

Detailed Description

Class ilPCTable.

Table content object (see ILIAS DTD)

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
Id:
class.ilPCTable.php 19892 2009-05-05 19:39:13Z akill

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

Member Function Documentation

& ilPCTable::addCell ( $aRow,
  $a_data = "",
  $a_lang = "" 
)

Definition at line 71 of file class.ilPCTable.php.

References ilPageContent\createPageContentNode().

Referenced by addRows(), importCell(), and importSpreadsheet().

{
$new_td =& $this->dom->create_element("TableData");
$new_td =& $aRow->append_child($new_td);
// insert data if given
if ($a_data != "")
{
$new_pg =& $this->createPageContentNode(false);
$new_par =& $this->dom->create_element("Paragraph");
$new_par =& $new_pg->append_child($new_par);
$new_par->set_attribute("Language", $a_lang);
$new_par->set_attribute("Characteristic", "TableContent");
$new_par->set_content($a_data);
$new_td->append_child ($new_pg);
}
return $new_td;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilPCTable::addRow ( )

Definition at line 65 of file class.ilPCTable.php.

Referenced by addRows(), importRow(), and importSpreadsheet().

{
$new_tr =& $this->dom->create_element("TableRow");
$new_tr = &$this->tab_node->append_child($new_tr);
return $new_tr;
}

+ Here is the caller graph for this function:

ilPCTable::addRows (   $a_nr_rows,
  $a_nr_cols 
)

add rows to table

Definition at line 94 of file class.ilPCTable.php.

References addCell(), and addRow().

{
for ($i=1; $i<=$a_nr_rows; $i++)
{
$aRow = $this->addRow();
for ($j=1; $j<=$a_nr_cols; $j++)
{
$this->addCell($aRow);
}
}
}

+ Here is the call graph for this function:

ilPCTable::checkCellHidden (   $colspans,
  $rowspans,
  $x,
  $y 
)

Check hidden status.

Definition at line 448 of file class.ilPCTable.php.

References $x, and $y.

Referenced by fixHideAndSpans().

{
for ($i = 0; $i<=$x; $i++)
{
for ($j = 0; $j<=$y; $j++)
{
if ($i != $x || $j != $y)
{
if ((($i + $colspans[$i][$j] > $x) &&
($j + $rowspans[$i][$j] > $y)))
{
return true;
}
}
}
}
return false;
}

+ Here is the caller graph for this function:

ilPCTable::create ( $a_pg_obj,
  $a_hier_id,
  $a_pc_id = "" 
)

Reimplemented in ilPCDataTable.

Definition at line 56 of file class.ilPCTable.php.

References ilPageContent\createPageContentNode(), and IL_INSERT_AFTER.

{
$this->node = $this->createPageContentNode();
$a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
$this->tab_node =& $this->dom->create_element("Table");
$this->tab_node =& $this->node->append_child($this->tab_node);
$this->tab_node->set_attribute("Language", "");
}

+ Here is the call graph for this function:

ilPCTable::extractText ( $node)

Definition at line 737 of file class.ilPCTable.php.

References ilPageContent\$node.

Referenced by importCellAttributes(), and importTableAttributes().

{
$owner_document = $node->owner_document ();
$children = $node->child_nodes();
$total_children = count($children);
for ($i = 0; $i < $total_children; $i++){
$cur_child_node = $children[$i];
$output .= $owner_document->dump_node($cur_child_node);
}
return $output;
}

+ Here is the caller graph for this function:

ilPCTable::fixHideAndSpans ( )

Fix Hide and Spans.

Reduces col and rowspans that are to high. Sets Hide attribute for all cells that are hidden due to other span attributes. Sets hidden cells to empty.

Definition at line 339 of file class.ilPCTable.php.

References $row, $x, $y, checkCellHidden(), and makeEmptyCell().

Referenced by setTDSpans().

{
// first: get max x and y
$max_x = $max_y = 0;
$y = 0;
$rows = $this->tab_node->child_nodes();
foreach($rows as $row)
{
if ($row->node_name() == "TableRow")
{
$x = 0;
$cells = $row->child_nodes();
foreach($cells as $cell)
{
if ($cell->node_name() == "TableData")
{
$max_x = max ($max_x, $x);
$max_y = max ($max_y, $y);
}
$x++;
}
$y++;
}
}
// second: fix hidden/colspans for all cells
$y = 0;
$rows = $this->tab_node->child_nodes();
foreach($rows as $row)
{
if ($row->node_name() == "TableRow")
{
$x = 0;
$cells = $row->child_nodes();
foreach($cells as $cell)
{
if ($cell->node_name() == "TableData")
{
$cspan = max(1, (int) $cell->get_attribute("ColSpan"));
$rspan = max(1, (int) $cell->get_attribute("RowSpan"));
// if col or rowspan is to high: reduce it to the max
if ($cspan > $max_x - $x + 1)
{
$cell->set_attribute("ColSpan", $max_x - $x + 1);
$cspan = $max_x - $x + 1;
}
if ($rspan > $max_y - $y + 1)
{
$cell->set_attribute("RowSpan", $max_y - $y + 1);
$rspan = $max_y - $y + 1;
}
// check hidden status
if ($this->checkCellHidden($colspans, $rowspans, $x, $y))
{
// hidden: set hidden flag, remove col and rowspan
$cell->set_attribute("Hidden", "Y");
$cspan = 1;
$rspan = 1;
if ($cell->has_attribute("ColSpan"))
{
$cell->remove_attribute("ColSpan");
}
if ($cell->has_attribute("RowSpan"))
{
$cell->remove_attribute("RowSpan");
}
$this->makeEmptyCell($cell);
}
else
{
// not hidden: remove hidden flag if existing
if ($cell->has_attribute("Hidden"))
{
$cell->remove_attribute("Hidden");
}
}
$colspans[$x][$y] = $cspan;
$rowspans[$x][$y] = $rspan;
}
$x++;
}
$y++;
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCTable::getAllCellClasses ( )

Get all cell classes.

Returns
array array of cell style classes

Definition at line 472 of file class.ilPCTable.php.

References $row.

{
$classes = array();
$rows = $this->tab_node->child_nodes();
foreach($rows as $row)
{
if ($row->node_name() == "TableRow")
{
$cells = $row->child_nodes();
foreach($cells as $cell)
{
if ($cell->node_name() == "TableData")
{
$classes[$cell->get_attribute("HierId").":".$cell->get_attribute("PCID")]
= $cell->get_attribute("Class");
}
}
}
}
return $classes;
}
ilPCTable::getAllCellSpans ( )

Get all cell spans.

Returns
array array of cell style classes

Definition at line 501 of file class.ilPCTable.php.

References $row, $x, and $y.

{
$spans = array();
$rows = $this->tab_node->child_nodes();
$y = 0;
$max_x = 0;
$max_y = 0;
foreach($rows as $row)
{
if ($row->node_name() == "TableRow")
{
$x = 0;
$cells = $row->child_nodes();
foreach($cells as $cell)
{
if ($cell->node_name() == "TableData")
{
$spans[$cell->get_attribute("HierId").":".$cell->get_attribute("PCID")]
= array("x" => $x, "y" => $y, "colspan" => $cell->get_attribute("ColSpan"),
"rowspan" => $cell->get_attribute("RowSpan"));
$max_x = max($max_x, $x);
$max_y = max($max_y, $y);
}
$x++;
}
$y++;
}
}
foreach ($spans as $k => $v)
{
$spans[$k]["max_x"] = $max_x;
$spans[$k]["max_y"] = $max_y;
}
return $spans;
}
ilPCTable::getAllCellWidths ( )

Get all cell widhts.

Returns
array array of cell style classes

Definition at line 543 of file class.ilPCTable.php.

References $row.

{
$widths = array();
$rows = $this->tab_node->child_nodes();
foreach($rows as $row)
{
if ($row->node_name() == "TableRow")
{
$cells = $row->child_nodes();
foreach($cells as $cell)
{
if ($cell->node_name() == "TableData")
{
$widths[$cell->get_attribute("HierId").":".$cell->get_attribute("PCID")]
= $cell->get_attribute("Width");
}
}
}
}
return $widths;
}
ilPCTable::getBorder ( )

get table border width

Definition at line 185 of file class.ilPCTable.php.

References getTableAttribute().

{
return $this->getTableAttribute("Border");
}

+ Here is the call graph for this function:

ilPCTable::getCaption ( )

get caption

Definition at line 600 of file class.ilPCTable.php.

References ilPageContent\$hier_id, $res, ilPageContent\getHierId(), xpath_eval(), and xpath_new_context().

{
$hier_id = $this->getHierId();
if(!empty($hier_id))
{
$xpc = xpath_new_context($this->dom);
$path = "//PageContent[@HierId = '".$hier_id."']/Table/Caption";
$res =& xpath_eval($xpc, $path);
if (count($res->nodeset) == 1)
{
return $res->nodeset[0]->get_content();
}
}
}

+ Here is the call graph for this function:

ilPCTable::getCaptionAlign ( )

get caption alignment (Top | Bottom)

Definition at line 619 of file class.ilPCTable.php.

References ilPageContent\$hier_id, $res, ilPageContent\getHierId(), xpath_eval(), and xpath_new_context().

{
$hier_id = $this->getHierId();
if(!empty($hier_id))
{
$xpc = xpath_new_context($this->dom);
$path = "//PageContent[@HierId = '".$hier_id."']/Table/Caption";
$res =& xpath_eval($xpc, $path);
if (count($res->nodeset) == 1)
{
return $res->nodeset[0]->get_attribute("Align");
}
}
}

+ Here is the call graph for this function:

ilPCTable::getCellPadding ( )

get table cell padding

Definition at line 221 of file class.ilPCTable.php.

References getTableAttribute().

{
return $this->getTableAttribute("CellPadding");
}

+ Here is the call graph for this function:

ilPCTable::getCellSpacing ( )

get table cell spacing

Definition at line 203 of file class.ilPCTable.php.

References getTableAttribute().

{
return $this->getTableAttribute("CellSpacing");
}

+ Here is the call graph for this function:

ilPCTable::getClass ( )

Get characteristic of section.

Returns
string characteristic

Definition at line 845 of file class.ilPCTable.php.

References getTableAttribute().

{
return $this->getTableAttribute("Class");
}

+ Here is the call graph for this function:

ilPCTable::getFooterCols ( )

Get footer cols.

Returns
string number of footer cols

Definition at line 945 of file class.ilPCTable.php.

References getTableAttribute().

{
return $this->getTableAttribute("FooterCols");
}

+ Here is the call graph for this function:

ilPCTable::getFooterRows ( )

Get footer rows.

Returns
string number of footer rows

Definition at line 905 of file class.ilPCTable.php.

References getTableAttribute().

{
return $this->getTableAttribute("FooterRows");
}

+ Here is the call graph for this function:

ilPCTable::getHeaderCols ( )

Get header cols.

Returns
string number of header cols

Definition at line 925 of file class.ilPCTable.php.

References getTableAttribute().

{
return $this->getTableAttribute("HeaderCols");
}

+ Here is the call graph for this function:

ilPCTable::getHeaderRows ( )

Get header rows.

Returns
string number of header rows

Definition at line 885 of file class.ilPCTable.php.

References getTableAttribute().

{
return $this->getTableAttribute("HeaderRows");
}

+ Here is the call graph for this function:

ilPCTable::getHorizontalAlign ( )

get table cell padding

Definition at line 247 of file class.ilPCTable.php.

References getTableAttribute().

{
return $this->getTableAttribute("HorizontalAlign");
}

+ Here is the call graph for this function:

ilPCTable::getLanguage ( )

get table language

Definition at line 146 of file class.ilPCTable.php.

References getTableAttribute().

Referenced by ilPCDataTable\getCellNode(), and ilPCDataTable\makeEmptyCell().

{
return $this->getTableAttribute("Language");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCTable::getTableAttribute (   $a_attr)

Get table tag attribute.

Returns
string attribute name

Definition at line 976 of file class.ilPCTable.php.

Referenced by getBorder(), getCellPadding(), getCellSpacing(), getClass(), getFooterCols(), getFooterRows(), getHeaderCols(), getHeaderRows(), getHorizontalAlign(), getLanguage(), getTemplate(), and getWidth().

{
if (is_object($this->tab_node))
{
return $this->tab_node->get_attribute($a_attr);
}
}

+ Here is the caller graph for this function:

ilPCTable::getTemplate ( )

Get template.

Returns
string template

Definition at line 865 of file class.ilPCTable.php.

References getTableAttribute().

{
return $this->getTableAttribute("Template");
}

+ Here is the call graph for this function:

ilPCTable::getWidth ( )

get table width

Definition at line 167 of file class.ilPCTable.php.

References getTableAttribute().

{
return $this->getTableAttribute("Width");
}

+ Here is the call graph for this function:

ilPCTable::importCell (   $lng,
$cellNode,
$aRow 
)

Definition at line 725 of file class.ilPCTable.php.

References $lng, addCell(), and importCellAttributes().

Referenced by importRow().

{
/*echo "add Cell";
var_dump($cellNode);*/
$aCell = $this->addCell($aRow);
$par = new ilPCParagraph($this->dom);
$par->createAtNode($aCell);
$par->setText($par->input2xml($this->extractText ($cellNode)));
$par->setCharacteristic("TableContent");
$par->setLanguage($lng);
$this->importCellAttributes($cellNode, $aCell);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCTable::importCellAttributes ( $node,
$par 
)

Definition at line 684 of file class.ilPCTable.php.

References $n, ilPageContent\$node, and extractText().

Referenced by importCell().

{
/*echo "importing table attributes";
var_dump($tableNode);*/
if ($node->has_attributes ())
{
foreach($node->attributes() as $n)
{
switch (strtolower($n->node_name ())) {
case "class":
$par->set_attribute("Class", $this->extractText($n));
break;
case "width":
$par->set_attribute("Width", $this->extractText($n));
break;
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCTable::importHtml (   $lng,
  $htmlTable 
)

Definition at line 748 of file class.ilPCTable.php.

References $_SESSION, $dom, $error, $lng, $n, ilPageContent\$node, $res, DOMXML_LOAD_PARSING, domxml_open_mem(), importRow(), importTableAttributes(), ilUtil\stripSlashes(), xpath_eval(), and xpath_new_context().

{
$dummy = ilUtil::stripSlashes($htmlTable, false);
//echo htmlentities($dummy);
if ($dom)
{
// extract first table object
$path = "//table[1] | //Table[1]";
$res = @xpath_eval($xpc, $path);
if (count($res->nodeset) == 0)
{
$error = "Could not find a table root node";
}
if (empty ($error))
{
for($i = 0; $i < count($res->nodeset); $i++)
{
$node = $res->nodeset[$i];
if ($node->has_child_nodes())
{
foreach($node->child_nodes() as $n)
{
if ($n->node_type() == XML_ELEMENT_NODE &&
strcasecmp($n->node_name (), "tr") == 0)
{
$this->importRow ($lng, $n);
}
}
}
}
}
$dom->free ();
}
if (is_array($error)) {
$errmsg = "";
foreach ($error as $errorline) { # Loop through all errors
$errmsg .= "[" . $errorline['line'] . ", " . $errorline['col'] . "]: ".$errorline['errormessage']." at Node '". $errorline['nodename'] . "'<br />";
}
}else
{
$errmsg = $error;
}
if (empty ($errmsg)) {
return true;
}
$_SESSION["message"] = $errmsg;
return false;
}

+ Here is the call graph for this function:

ilPCTable::importRow (   $lng,
$node 
)

Definition at line 706 of file class.ilPCTable.php.

References $lng, $n, ilPageContent\$node, addRow(), and importCell().

Referenced by importHtml().

{
/*echo "add Row";
var_dump($node);*/
$aRow = $this->addRow();
if ($node->has_child_nodes())
{
foreach($node->child_nodes() as $n)
{
if ($n->node_type() == XML_ELEMENT_NODE &&
strcasecmp($n->node_name (), "td") == 0)
{
$this->importCell ($lng, $n, $aRow);
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCTable::importSpreadsheet (   $a_lang,
  $a_data 
)

import from table

Definition at line 109 of file class.ilPCTable.php.

References $data, $row, addCell(), and addRow().

{
str_replace($a_data, "\r", "\n");
str_replace($a_data, "\n\n", "\n");
$target_rows = array();
$rows = explode("\n", $a_data);
// get maximum of cols in a row and
// put data in target_row arrays
foreach($rows as $row)
{
$cells = explode("\t", $row);
$max_cols = ($max_cols > count($cells))
? $max_cols
: count($cells);
$target_rows[] = $cells;
}
// iterate target row arrays and insert data
foreach($target_rows as $row)
{
$aRow = $this->addRow();
for ($j=0; $j<$max_cols; $j++)
{
// mask html
$data = str_replace("&","&amp;", $row[$j]);
$data = str_replace("<","&lt;", $data);
$data = str_replace(">","&gt;", $data);
$this->addCell($aRow, $data, $a_lang);
}
}
}

+ Here is the call graph for this function:

ilPCTable::importTableAttributes ( $node)

Definition at line 652 of file class.ilPCTable.php.

References $n, ilPageContent\$node, extractText(), setBorder(), setCellPadding(), setCellSpacing(), setHorizontalAlign(), and setWidth().

Referenced by importHtml().

{
/*echo "importing table attributes";
var_dump($tableNode);*/
if ($node->has_attributes ())
{
foreach($node->attributes() as $n)
{
switch (strtolower($n->node_name ())) {
case "border":
$this->setBorder ($this->extractText($n));
break;
case "align":
$this->setHorizontalAlign(ucfirst(strtolower($this->extractText($n))));
break;
case "cellspacing":
$this->setCellSpacing($this->extractText($n));
break;
case "cellpadding":
$this->setCellPadding($this->extractText($n));
break;
case "width":
$this->setWidth($this->extractText($n));
break;
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCTable::init ( )

Init page content component.

Reimplemented from ilPageContent.

Reimplemented in ilPCDataTable.

Definition at line 45 of file class.ilPCTable.php.

References ilPageContent\setType().

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

+ Here is the call graph for this function:

ilPCTable::makeEmptyCell (   $td_node)

Make cell empty.

Reimplemented in ilPCDataTable.

Definition at line 435 of file class.ilPCTable.php.

Referenced by fixHideAndSpans().

{
// delete children of paragraph node
$children = $td_node->child_nodes();
for($i=0; $i<count($children); $i++)
{
$td_node->remove_child($children[$i]);
}
}

+ Here is the caller graph for this function:

ilPCTable::setBorder (   $a_border)

set table border

Parameters
string$a_bordertable border

Definition at line 195 of file class.ilPCTable.php.

References setTableAttribute().

Referenced by importTableAttributes().

{
$this->setTableAttribute("Border", $a_border);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCTable::setCaption (   $a_content,
  $a_align 
)

set table caption

Definition at line 637 of file class.ilPCTable.php.

References ilDOMUtil\deleteAllChildsByName(), and ilDOMUtil\setFirstOptionalElement().

{
if ($a_content != "")
{
ilDOMUtil::setFirstOptionalElement($this->dom, $this->tab_node, "Caption",
array("Summary", "TableRow"), $a_content,
array("Align" => $a_align));
}
else
{
ilDOMUtil::deleteAllChildsByName($this->tab_node, array("Caption"));
}
}

+ Here is the call graph for this function:

ilPCTable::setCellPadding (   $a_padding)

set table cell padding

Parameters
string$a_paddingtable cell padding

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

References setTableAttribute().

Referenced by importTableAttributes().

{
$this->setTableAttribute("CellPadding", $a_padding);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCTable::setCellSpacing (   $a_spacing)

set table cell spacing

Parameters
string$a_spacingtable cell spacing

Definition at line 213 of file class.ilPCTable.php.

References setTableAttribute().

Referenced by importTableAttributes().

{
$this->setTableAttribute("CellSpacing", $a_spacing);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCTable::setClass (   $a_class)

Set Style Class of table.

Parameters
string$a_classclass

Definition at line 835 of file class.ilPCTable.php.

References setTableAttribute().

{
$this->setTableAttribute("Class", $a_class);
}

+ Here is the call graph for this function:

ilPCTable::setFirstRowStyle (   $a_class)

Set first row td style.

Definition at line 810 of file class.ilPCTable.php.

{
$childs = $this->tab_node->child_nodes();
foreach($childs as $child)
{
if ($child->node_name() == "TableRow")
{
$gchilds = $child->child_nodes();
foreach($gchilds as $gchild)
{
if ($gchild->node_name() == "TableData")
{
$gchild->set_attribute("Class", $a_class);
}
}
return;
}
}
}
ilPCTable::setFooterCols (   $a_nr)

Set footer cols.

Parameters
stringnumber of footer cols

Definition at line 935 of file class.ilPCTable.php.

References setTableAttribute().

{
$this->setTableAttribute("FooterCols", $a_nr);
}

+ Here is the call graph for this function:

ilPCTable::setFooterRows (   $a_nr)

Set footer rows.

Parameters
stringnumber of footer rows

Definition at line 895 of file class.ilPCTable.php.

References setTableAttribute().

{
$this->setTableAttribute("FooterRows", $a_nr);
}

+ Here is the call graph for this function:

ilPCTable::setHeaderCols (   $a_nr)

Set header cols.

Parameters
stringnumber of header cols

Definition at line 915 of file class.ilPCTable.php.

References setTableAttribute().

{
$this->setTableAttribute("HeaderCols", $a_nr);
}

+ Here is the call graph for this function:

ilPCTable::setHeaderRows (   $a_nr)

Set header rows.

Parameters
stringnumber of header rows

Definition at line 875 of file class.ilPCTable.php.

References setTableAttribute().

{
$this->setTableAttribute("HeaderRows", $a_nr);
}

+ Here is the call graph for this function:

ilPCTable::setHorizontalAlign (   $a_halign)

set horizontal align

Definition at line 239 of file class.ilPCTable.php.

Referenced by importTableAttributes().

{
$this->tab_node->set_attribute("HorizontalAlign", $a_halign);
}

+ Here is the caller graph for this function:

ilPCTable::setLanguage (   $a_lang)

set table language

Parameters
string$a_langlanguage code

Definition at line 156 of file class.ilPCTable.php.

References setTableAttribute().

{
if($a_lang != "")
{
$this->setTableAttribute("Language", $a_lang);
}
}

+ Here is the call graph for this function:

ilPCTable::setNode ( $a_node)

Set xml node of page content.

Parameters
object$a_nodenode object

Reimplemented from ilPageContent.

Reimplemented in ilPCDataTable.

Definition at line 50 of file class.ilPCTable.php.

{
parent::setNode($a_node); // this is the PageContent node
$this->tab_node =& $a_node->first_child(); // this is the Table node
}
ilPCTable::setTableAttribute (   $a_attr,
  $a_value 
)
protected

Set attribute of table tag.

Parameters
stringattribute name
stringattribute value

Definition at line 956 of file class.ilPCTable.php.

Referenced by setBorder(), setCellPadding(), setCellSpacing(), setClass(), setFooterCols(), setFooterRows(), setHeaderCols(), setHeaderRows(), setLanguage(), setTemplate(), and setWidth().

{
if (!empty($a_value))
{
$this->tab_node->set_attribute($a_attr, $a_value);
}
else
{
if ($this->tab_node->has_attribute($a_attr))
{
$this->tab_node->remove_attribute($a_attr);
}
}
}

+ Here is the caller graph for this function:

ilPCTable::setTDClass (   $a_hier_id,
  $a_class,
  $a_pc_id = "" 
)

set class of table data cell

Definition at line 569 of file class.ilPCTable.php.

References $res, xpath_eval(), and xpath_new_context().

{
$xpc = xpath_new_context($this->dom);
if ($a_pc_id == "")
{
$path = "//TableData[@HierId = '".$a_hier_id."']";
}
else
{
$path = "//TableData[@PCID = '".$a_pc_id."']";
}
$res =& xpath_eval($xpc, $path);
if (count($res->nodeset) == 1)
{
if($a_class != "")
{
$res->nodeset[0]->set_attribute("Class", $a_class);
}
else
{
if ($res->nodeset[0]->has_attribute("Class"))
{
$res->nodeset[0]->remove_attribute("Class");
}
}
}
}

+ Here is the call graph for this function:

ilPCTable::setTDSpans (   $a_colspans,
  $a_rowspans 
)

Set TDSpans.

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

References $row, $x, $y, and fixHideAndSpans().

{
$y = 0;
$rows = $this->tab_node->child_nodes();
foreach($rows as $row)
{
if ($row->node_name() == "TableRow")
{
$x = 0;
$cells = $row->child_nodes();
foreach($cells as $cell)
{
if ($cell->node_name() == "TableData")
{
$ckey = $cell->get_attribute("HierId").":".$cell->get_attribute("PCID");
if((int) $a_colspans[$ckey] > 1)
{
$cell->set_attribute("ColSpan", (int) $a_colspans[$ckey]);
}
else
{
if ($cell->has_attribute("ColSpan"))
{
$cell->remove_attribute("ColSpan");
}
}
if((int) $a_rowspans[$ckey] > 1)
{
$cell->set_attribute("RowSpan", (int) $a_rowspans[$ckey]);
}
else
{
if ($cell->has_attribute("RowSpan"))
{
$cell->remove_attribute("RowSpan");
}
}
}
$x++;
}
$y++;
}
}
$this->fixHideAndSpans();
}

+ Here is the call graph for this function:

ilPCTable::setTDWidth (   $a_hier_id,
  $a_width,
  $a_pc_id = "" 
)

set width of table data cell

Definition at line 255 of file class.ilPCTable.php.

References $res, xpath_eval(), and xpath_new_context().

{
$xpc = xpath_new_context($this->dom);
if ($a_pc_id == "")
{
$path = "//TableData[@HierId = '".$a_hier_id."']";
}
else
{
$path = "//TableData[@PCID = '".$a_pc_id."']";
}
$res =& xpath_eval($xpc, $path);
if (count($res->nodeset) == 1)
{
if($a_width != "")
{
$res->nodeset[0]->set_attribute("Width", $a_width);
}
else
{
if ($res->nodeset[0]->has_attribute("Width"))
{
$res->nodeset[0]->remove_attribute("Width");
}
}
}
}

+ Here is the call graph for this function:

ilPCTable::setTemplate (   $a_template)

Set template.

Parameters
string$a_templatetemplate

Definition at line 855 of file class.ilPCTable.php.

References setTableAttribute().

{
$this->setTableAttribute("Template", $a_template);
}

+ Here is the call graph for this function:

ilPCTable::setWidth (   $a_width)

set table width

Parameters
string$a_widthtable width

Definition at line 177 of file class.ilPCTable.php.

References setTableAttribute().

Referenced by importTableAttributes().

{
$this->setTableAttribute("Width", $a_width);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilPCTable::$dom

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

Referenced by importHtml().

ilPCTable::$tab_node

Definition at line 39 of file class.ilPCTable.php.


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