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

Class ilPCDataTable. More...

+ Inheritance diagram for ilPCDataTable:
+ Collaboration diagram for ilPCDataTable:

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="")
 getCellNode ($i, $j)
 Get cell paragraph node of row $i and cell $j.
 makeEmptyCell ($td_node)
 Make cell empty.
 getCellText ($i, $j)
 Get cell text of row $i and cell $j.
 setData ($a_data)
 Set data of cells.
- Public Member Functions inherited from ilPCTable
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.
 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 ilPCTable
 $dom
 $tab_node
- 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 ilPCTable
 setTableAttribute ($a_attr, $a_value)
 Set attribute of table tag.

Detailed Description

Class ilPCDataTable.

Data table content object (see ILIAS DTD). This type of table can only hold one paragraph content item per cell.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Member Function Documentation

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

Reimplemented from ilPCTable.

Definition at line 57 of file class.ilPCDataTable.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", "");
$this->tab_node->set_attribute("DataTable", "y");
}

+ Here is the call graph for this function:

ilPCDataTable::getCellNode (   $i,
  $j 
)

Get cell paragraph node of row $i and cell $j.

Definition at line 70 of file class.ilPCDataTable.php.

References $res, ilPageContent\createPageContentNode(), ilPCTable\getLanguage(), xpath_eval(), and xpath_new_context().

Referenced by getCellText(), and setData().

{
$xpc = xpath_new_context($this->dom);
$path = "//PageContent[@HierId='".$this->getHierId()."']".
"/Table/TableRow[$i+1]/TableData[$j+1]/PageContent[1]/Paragraph[1]";
$res =& xpath_eval($xpc, $path);
if (is_object($res->nodeset[0]))
{
return $res->nodeset[0];
}
else // no node -> delete all childs and create paragraph
{
$xpc2 = xpath_new_context($this->dom);
$path2 = "//PageContent[@HierId='".$this->getHierId()."']".
"/Table/TableRow[".($i+1)."]/TableData[".($j+1)."]";
//$path2 = "//PageContent";
$res2 =& xpath_eval($xpc2, $path2);
$td_node = $res2->nodeset[0];
if (is_object($td_node))
{
// delete children of paragraph node
$children = $td_node->child_nodes();
for($i=0; $i<count($children); $i++)
{
$td_node->remove_child($children[$i]);
}
// create page content and paragraph node here.
$pc_node = $this->createPageContentNode(false);
$pc_node = $td_node->append_child($pc_node);
$par_node = $this->dom->create_element("Paragraph");
$par_node = $pc_node->append_child($par_node);
$par_node->set_attribute("Characteristic", "TableContent");
$par_node->set_attribute("Language",
$this->getLanguage());
return $par_node;
}
}
return "";
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCDataTable::getCellText (   $i,
  $j 
)

Get cell text of row $i and cell $j.

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

References getCellNode().

{
$cell_par = $this->getCellNode($i, $j);
if (is_object($cell_par))
{
$content = "";
$childs = $cell_par->child_nodes();
for($i=0; $i<count($childs); $i++)
{
$content.= $this->dom->dump_node($childs[$i]);
}
return $content;
}
else
{
return "";
}
}

+ Here is the call graph for this function:

ilPCDataTable::init ( )

Init page content component.

Reimplemented from ilPCTable.

Definition at line 46 of file class.ilPCDataTable.php.

References ilPageContent\setType().

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

+ Here is the call graph for this function:

ilPCDataTable::makeEmptyCell (   $td_node)

Make cell empty.

Reimplemented from ilPCTable.

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

References ilPageContent\createPageContentNode(), and ilPCTable\getLanguage().

{
// delete children of paragraph node
$children = $td_node->child_nodes();
for($i=0; $i<count($children); $i++)
{
$td_node->remove_child($children[$i]);
}
// create page content and paragraph node here.
$pc_node = $this->createPageContentNode(false);
$pc_node = $td_node->append_child($pc_node);
$par_node = $this->dom->create_element("Paragraph");
$par_node = $pc_node->append_child($par_node);
$par_node->set_attribute("Characteristic", "TableContent");
$par_node->set_attribute("Language",
$this->getLanguage());
}

+ Here is the call graph for this function:

ilPCDataTable::setData (   $a_data)

Set data of cells.

Definition at line 165 of file class.ilPCDataTable.php.

References $error, $l, $ok, $res, $row, DOMXML_LOAD_PARSING, domxml_open_mem(), getCellNode(), xpath_eval(), and xpath_new_context().

{
$ok = true;
//var_dump($a_data);
if (is_array($a_data))
{
foreach ($a_data as $i => $row)
{
if (is_array($row))
{
foreach ($row as $j => $cell)
{
$temp_dom = @domxml_open_mem('<?xml version="1.0" encoding="UTF-8"?><Paragraph>'.$cell.'</Paragraph>',
$par_node = $this->getCellNode($i, $j);
//echo "<br>=".htmlentities($this->dom->dump_node($par_node))."=";
//echo "<br>-$i-$j-$cell-";
// remove all childs
if(empty($error) && is_object($par_node))
{
// delete children of paragraph node
$children = $par_node->child_nodes();
for($k=0; $k < count($children); $k++)
{
$par_node->remove_child($children[$k]);
}
// copy new content children in paragraph node
$xpc = xpath_new_context($temp_dom);
$path = "//Paragraph";
$res =& xpath_eval($xpc, $path);
if (count($res->nodeset) == 1)
{
$new_par_node =& $res->nodeset[0];
$new_childs = $new_par_node->child_nodes();
for ($l = 0; $l < count($new_childs); $l++)
{
$cloned_child = $new_childs[$l]->clone_node(true);
$par_node->append_child($cloned_child);
//echo "<br>=".htmlentities($this->dom->dump_node($cloned_child))."=";
}
}
}
else
{
if (!empty($error))
{
return $error;
}
}
}
}
}
}
return true;
}

+ Here is the call graph for this function:

ilPCDataTable::setNode ( $a_node)

Set xml node of page content.

Parameters
object$a_nodenode object

Reimplemented from ilPCTable.

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

{
parent::setNode($a_node); // this is the PageContent node
$this->tab_node =& $a_node->first_child(); // this is the Table node
}

Field Documentation

ilPCDataTable::$dom

Definition at line 40 of file class.ilPCDataTable.php.

ilPCDataTable::$tab_node

Definition at line 41 of file class.ilPCDataTable.php.


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