ILIAS  release_7 Revision v7.30-3-g800a261c036
ilPCDataTable Class Reference

Class ilPCDataTable. More...

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

Public Member Functions

 init ()
 Init page content component. More...
 
 setNode ($a_node)
 Set xml node of page content. More...
 
 create (&$a_pg_obj, $a_hier_id, $a_pc_id="")
 
 makeEmptyCell ($td_node)
 Make cell empty. More...
 
 setData ($a_data)
 Set data of cells. More...
 
- Public Member Functions inherited from ilPCTable
 init ()
 Init page content component. More...
 
 setNode ($a_node)
 Set xml node of page content. More...
 
 create (&$a_pg_obj, $a_hier_id, $a_pc_id="")
 
addRow ()
 
addCell (&$aRow, $a_data="", $a_lang="")
 
 getCellText ($i, $j)
 Get cell text of row $i and cell $j. More...
 
 getCellNode ($i, $j, $create_if_not_exists=false)
 Get cell paragraph node of row $i and cell $j. More...
 
 addRows ($a_nr_rows, $a_nr_cols)
 add rows to table More...
 
 importSpreadsheet ($a_lang, $a_data)
 import from table More...
 
 getLanguage ()
 get table language More...
 
 setLanguage ($a_lang)
 set table language More...
 
 getWidth ()
 get table width More...
 
 setWidth ($a_width)
 set table width More...
 
 getBorder ()
 get table border width More...
 
 setBorder ($a_border)
 set table border More...
 
 getCellSpacing ()
 get table cell spacing More...
 
 setCellSpacing ($a_spacing)
 set table cell spacing More...
 
 getCellPadding ()
 get table cell padding More...
 
 setCellPadding ($a_padding)
 set table cell padding More...
 
 setHorizontalAlign ($a_halign)
 set horizontal align More...
 
 getHorizontalAlign ()
 get table cell padding More...
 
 setTDWidth ($a_hier_id, $a_width, $a_pc_id="")
 set width of table data cell More...
 
 setTDSpans ($a_colspans, $a_rowspans)
 Set TDSpans. More...
 
 fixHideAndSpans ()
 Fix Hide and Spans. More...
 
 makeEmptyCell ($td_node)
 Make cell empty. More...
 
 checkCellHidden ($colspans, $rowspans, $x, $y)
 Check hidden status. More...
 
 getAllCellClasses ()
 Get all cell classes. More...
 
 getAllCellAlignments ()
 Get all cell alignments. More...
 
 getAllCellSpans ()
 Get all cell spans. More...
 
 getAllCellWidths ()
 Get all cell widhts. More...
 
 setTDClass ($a_hier_id, $a_class, $a_pc_id="")
 set class of table data cell More...
 
 setTDAlignment ($a_hier_id, $a_class, $a_pc_id="")
 set alignment of table data cell More...
 
 getCaption ()
 get caption More...
 
 getCaptionAlign ()
 get caption alignment (Top | Bottom) More...
 
 setCaption ($a_content, $a_align)
 set table caption More...
 
 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. More...
 
 setClass ($a_class)
 Set Style Class of table. More...
 
 getClass ()
 Get characteristic of section. More...
 
 setTemplate ($a_template)
 Set template. More...
 
 getTemplate ()
 Get template. More...
 
 setHeaderRows ($a_nr)
 Set header rows. More...
 
 getHeaderRows ()
 Get header rows. More...
 
 setFooterRows ($a_nr)
 Set footer rows. More...
 
 getFooterRows ()
 Get footer rows. More...
 
 setHeaderCols ($a_nr)
 Set header cols. More...
 
 getHeaderCols ()
 Get header cols. More...
 
 setFooterCols ($a_nr)
 Set footer cols. More...
 
 getFooterCols ()
 Get footer cols. More...
 
 getTableAttribute ($a_attr)
 Get table tag attribute. More...
 
 getModel ()
 @inheritDoc More...
 
- Public Member Functions inherited from ilPageContent
 __construct ($a_pg_obj)
 Constructor. More...
 
 setPage ($a_val)
 Set page. More...
 
 getPage ()
 Get page. More...
 
 init ()
 Init object. More...
 
 getType ()
 Get type of page content. More...
 
 setNode ($a_node)
 Set xml node of page content. More...
 
getNode ()
 Get xml node of page content. More...
 
 getJavascriptFiles ($a_mode)
 Get Javascript files. More...
 
 getCssFiles ($a_mode)
 Get css files. More...
 
 getOnloadCode ($a_mode)
 Get on load code. More...
 
 setHierId ($a_hier_id)
 Set hierarchical ID in xml structure. More...
 
 getHierId ()
 Get hierarchical id. More...
 
 lookupHierId ()
 Get hierarchical id from dom. More...
 
 readHierId ()
 Read PC Id. More...
 
 setPcId ($a_pcid)
 Set PC Id. More...
 
 getPCId ()
 Get PC Id. More...
 
 setFileDownloadLink ($a_download_link)
 Set file download link. More...
 
 getFileDownloadLink ()
 Get file download link. More...
 
 setProfileBackUrl ($url)
 
 getProfileBackUrl ()
 
 setFullscreenLink ($a_fullscreen_link)
 Set fullscreen link. More...
 
 getFullscreenLink ()
 Get fullscreen link. More...
 
 setSourcecodeDownloadScript ($script_name)
 Set sourcecode download script. More...
 
 getSourcecodeDownloadScript ()
 Get sourcecode download script. More...
 
 readPCId ()
 Read PC Id. More...
 
 writePCId ($a_pc_id)
 Write pc id. More...
 
 setEnabled ($value)
 Set Enabled value for page content component. More...
 
 enable ()
 Enable page content. More...
 
 disable ()
 Disable page content. More...
 
 isEnabled ()
 Check whether page content is enabled. More...
 
 createPageContentNode ($a_set_this_node=true)
 Create page content node (always use this method first when adding a new element) More...
 
 modifyPageContentPostXsl ($a_output, $a_mode, $a_abstract_only=false)
 Modify page content after xsl. More...
 
 getModel ()
 Get model. More...
 

Data Fields

 $dom
 
 $tab_node
 
- Data Fields inherited from ilPCTable
 $dom
 
 $tab_node
 
- Data Fields inherited from ilPageContent
 $hier_id
 
 $node
 
 $dom
 
 $page_lang
 

Additional Inherited Members

- Static Public Member Functions inherited from ilPCTable
static getLangVars ()
 Get lang vars needed for editing. More...
 
static handleCopiedContent (DOMDocument $a_domdoc, $a_self_ass=true, $a_clone_mobs=false)
 Handle copied content. More...
 
- Static Public Member Functions inherited from ilPageContent
static incEdId ($ed_id)
 Increases an hierarchical editing id at lowest level (last number) More...
 
static decEdId ($ed_id)
 Decreases an hierarchical editing id at lowest level (last number) More...
 
static haveSameContainer ($ed_id1, $ed_id2)
 Check, if two ids are in same container. More...
 
static sortHierIds ($a_array)
 Sort an array of Hier IDS in ascending order. More...
 
static isGreaterHierId ($a, $b)
 Check whether Hier ID $a is greater than Hier ID $b. More...
 
static getLangVars ()
 Get lang vars needed for editing. More...
 
static handleCopiedContent (DOMDocument $a_domdoc, $a_self_ass=true, $a_clone_mobs=false)
 Handle copied content. More...
 
static afterPageUpdate ($a_page, DOMDocument $a_domdoc, $a_xml, $a_creation)
 After page has been updated (or created) More...
 
static beforePageDelete ($a_page)
 Before page is being deleted. More...
 
static afterPageHistoryEntry ($a_page, DOMDocument $a_old_domdoc, $a_old_xml, $a_old_nr)
 After page history entry has been created. More...
 
- Protected Member Functions inherited from ilPCTable
 setTableAttribute ($a_attr, $a_value)
 Set attribute of table tag. More...
 
- Protected Member Functions inherited from ilPageContent
 setType ($a_type)
 Set Type. More...
 
- Protected Attributes inherited from ilPageContent
 $profile_back_url
 
 $file_download_link
 
 $fullscreen_link
 
 $sourcecode_download_script
 
 $log
 

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

◆ create()

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

Reimplemented from ilPCTable.

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

58 {
59 $this->node = $this->createPageContentNode();
60 $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
61 $this->tab_node = $this->dom->create_element("Table");
62 $this->tab_node = $this->node->append_child($this->tab_node);
63 $this->tab_node->set_attribute("Language", "");
64 $this->tab_node->set_attribute("DataTable", "y");
65 }
const IL_INSERT_AFTER
createPageContentNode($a_set_this_node=true)
Create page content node (always use this method first when adding a new element)

References ilPageContent\createPageContentNode(), and IL_INSERT_AFTER.

+ Here is the call graph for this function:

◆ init()

ilPCDataTable::init ( )

Init page content component.

Reimplemented from ilPCTable.

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

47 {
48 $this->setType("dtab");
49 }
setType($a_type)
Set Type.

References ilPageContent\setType().

+ Here is the call graph for this function:

◆ makeEmptyCell()

ilPCDataTable::makeEmptyCell (   $td_node)

Make cell empty.

Reimplemented from ilPCTable.

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

72 {
73 // delete children of paragraph node
74 $children = $td_node->child_nodes();
75 for ($i = 0; $i < count($children); $i++) {
76 $td_node->remove_child($children[$i]);
77 }
78
79 // create page content and paragraph node here.
80 $pc_node = $this->createPageContentNode(false);
81 $pc_node = $td_node->append_child($pc_node);
82 $par_node = $this->dom->create_element("Paragraph");
83 $par_node = $pc_node->append_child($par_node);
84 $par_node->set_attribute("Characteristic", "TableContent");
85 $par_node->set_attribute(
86 "Language",
87 $this->getLanguage()
88 );
89 }
getLanguage()
get table language
$i
Definition: metadata.php:24

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

+ Here is the call graph for this function:

◆ setData()

ilPCDataTable::setData (   $a_data)

Set data of cells.

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

96 {
97 $ok = true;
98 //var_dump($a_data);
99 if (is_array($a_data)) {
100 foreach ($a_data as $i => $row) {
101 if (is_array($row)) {
102 foreach ($row as $j => $cell) {
103 //echo "<br><br>=".$cell."=";
104 $temp_dom = @domxml_open_mem(
105 '<?xml version="1.0" encoding="UTF-8"?><Paragraph>' . $cell . '</Paragraph>',
107 $error
108 );
109
110 $par_node = $this->getCellNode($i, $j, true);
111 //echo "<br>=".htmlentities($this->dom->dump_node($par_node))."=";
112 //echo "<br>-$i-$j-$cell-";
113 // remove all childs
114 if (empty($error) && is_object($par_node)) {
115 // delete children of paragraph node
116 $children = $par_node->child_nodes();
117 for ($k = 0; $k < count($children); $k++) {
118 $par_node->remove_child($children[$k]);
119 }
120
121 // copy new content children in paragraph node
122 $xpc = xpath_new_context($temp_dom);
123 $path = "//Paragraph";
124 $res = xpath_eval($xpc, $path);
125
126 if (count($res->nodeset) == 1) {
127 $new_par_node = $res->nodeset[0];
128 $new_childs = $new_par_node->child_nodes();
129 for ($l = 0; $l < count($new_childs); $l++) {
130 $cloned_child = $new_childs[$l]->clone_node(true);
131 $par_node->append_child($cloned_child);
132 //echo "<br>=".htmlentities($this->dom->dump_node($cloned_child))."=";
133 }
134 }
135 } else {
136 if (!empty($error)) {
137 return $error;
138 }
139 }
140 }
141 }
142 }
143 }
144 //exit;
145 return true;
146 }
getCellNode($i, $j, $create_if_not_exists=false)
Get cell paragraph node of row $i and cell $j.
xpath_eval($xpath_context, $eval_str, $contextnode=null)
domxml_open_mem($str, $mode=0, &$error=null)
xpath_new_context($dom_document)
const DOMXML_LOAD_PARSING
foreach($_POST as $key=> $value) $res

References $i, $ok, $res, DOMXML_LOAD_PARSING, domxml_open_mem(), ilPCTable\getCellNode(), xpath_eval(), and xpath_new_context().

+ Here is the call graph for this function:

◆ setNode()

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.

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

Field Documentation

◆ $dom

ilPCDataTable::$dom

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

◆ $tab_node

ilPCDataTable::$tab_node

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


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