ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilPCGrid Class Reference

Grid element. More...

+ Inheritance diagram for ilPCGrid:
+ Collaboration diagram for ilPCGrid:

Public Member Functions

 init ()
 Init page content component. More...
 
 setNode ($a_node)
 Set content node. More...
 
 create ($a_pg_obj, $a_hier_id, $a_pc_id="")
 Create new Grid node. More...
 
 savePositions ($a_pos)
 Set attribute of grid tag. More...
 
 saveWidths ($a_width_s, $a_width_m, $a_width_l, $a_width_xl)
 Save widths of cells. More...
 
 deleteGridCell ($a_hier_id, $a_pc_id)
 Delete grid cell. More...
 
 addGridCell ($a_s, $a_m, $a_l, $a_xl)
 Add grid cell. More...
 
 addCell ()
 Add a cell. More...
 
 getJavascriptFiles ($a_mode)
 Get Javascript files. More...
 
 getCssFiles ($a_mode)
 Get Javascript files. More...
 
 getCellData ()
 
- 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...
 
 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)
 Modify page content after xsl. More...
 

Static Public Member Functions

static getSizes ()
 Get sizes. More...
 
static getWidths ()
 Get widths. More...
 
static getLangVars ()
 Get lang vars needed for editing. 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 Attributes

 $grid_node
 
- Protected Attributes inherited from ilPageContent
 $file_download_link
 
 $fullscreen_link
 
 $sourcecode_download_script
 
 $log
 

Additional Inherited Members

- Data Fields inherited from ilPageContent
 $hier_id
 
 $node
 
 $dom
 
 $page_lang
 
- Protected Member Functions inherited from ilPageContent
 setType ($a_type)
 Set Type. More...
 

Detailed Description

Grid element.

Author
Alex Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 33 of file class.ilPCGrid.php.

Member Function Documentation

◆ addCell()

ilPCGrid::addCell ( )

Add a cell.

Definition at line 198 of file class.ilPCGrid.php.

199  {
200  $new_item = $this->dom->create_element("GridCell");
201  $new_item->set_attribute("WIDTH_XS", "");
202  $new_item->set_attribute("WIDTH_S", "");
203  $new_item->set_attribute("WIDTH_M", "");
204  $new_item->set_attribute("WIDTH_L", "");
205  $new_item->set_attribute("WIDTH_XL", "");
206  $this->grid_node->append_child($new_item);
207  }

◆ addGridCell()

ilPCGrid::addGridCell (   $a_s,
  $a_m,
  $a_l,
  $a_xl 
)

Add grid cell.

Definition at line 183 of file class.ilPCGrid.php.

184  {
185  $new_item = $this->dom->create_element("GridCell");
186  $new_item = $this->grid_node->append_child($new_item);
187  //$new_item->set_attribute("xs", $a_xs);
188  $new_item->set_attribute("WIDTH_XS", "");
189  $new_item->set_attribute("WIDTH_S", $a_s);
190  $new_item->set_attribute("WIDTH_M", $a_m);
191  $new_item->set_attribute("WIDTH_L", $a_l);
192  $new_item->set_attribute("WIDTH_XL", $a_xl);
193  }

◆ create()

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

Create new Grid node.

Definition at line 85 of file class.ilPCGrid.php.

References ilPageContent\createPageContentNode(), and IL_INSERT_AFTER.

86  {
87  $this->node = $this->createPageContentNode();
88  $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
89  $this->grid_node = $this->dom->create_element("Grid");
90  $this->grid_node = $this->node->append_child($this->grid_node);
91  }
const IL_INSERT_AFTER
createPageContentNode($a_set_this_node=true)
Create page content node (always use this method first when adding a new element) ...
+ Here is the call graph for this function:

◆ deleteGridCell()

ilPCGrid::deleteGridCell (   $a_hier_id,
  $a_pc_id 
)

Delete grid cell.

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

References $i.

168  {
169  $childs = $this->grid_node->child_nodes();
170  for ($i = 0; $i < count($childs); $i++) {
171  if ($childs[$i]->node_name() == "GridCell") {
172  if ($a_pc_id == $childs[$i]->get_attribute("PCID") &&
173  $a_hier_id == $childs[$i]->get_attribute("HierId")) {
174  $childs[$i]->unlink($childs[$i]);
175  }
176  }
177  }
178  }
$i
Definition: disco.tpl.php:19

◆ getCellData()

ilPCGrid::getCellData ( )

Definition at line 234 of file class.ilPCGrid.php.

References ilPageContent\$hier_id, and $i.

235  {
236  $cells = array();
237  $cell_nodes = $this->grid_node->child_nodes();
238  $k = 0;
239  for ($i = 0; $i < count($cell_nodes); $i++) {
240  if ($cell_nodes[$i]->node_name() == "GridCell") {
241  $pc_id = $cell_nodes[$i]->get_attribute("PCID");
242  $hier_id = $cell_nodes[$i]->get_attribute("HierId");
243  $cells[] = array("pos" => $k,
244  "xs" => $cell_nodes[$i]->get_attribute("WIDTH_XS"),
245  "s" => $cell_nodes[$i]->get_attribute("WIDTH_S"),
246  "m" => $cell_nodes[$i]->get_attribute("WIDTH_M"),
247  "l" => $cell_nodes[$i]->get_attribute("WIDTH_L"),
248  "xl" => $cell_nodes[$i]->get_attribute("WIDTH_XL"),
249  "pc_id" => $pc_id, "hier_id" => $hier_id);
250  $k++;
251  }
252  }
253 
254  return $cells;
255  }
$i
Definition: disco.tpl.php:19

◆ getCssFiles()

ilPCGrid::getCssFiles (   $a_mode)

Get Javascript files.

Definition at line 229 of file class.ilPCGrid.php.

230  {
231  return parent::getCssFiles($a_mode);
232  }

◆ getJavascriptFiles()

ilPCGrid::getJavascriptFiles (   $a_mode)

Get Javascript files.

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

222  {
223  return parent::getJavascriptFiles($a_mode);
224  }

◆ getLangVars()

static ilPCGrid::getLangVars ( )
static

Get lang vars needed for editing.

Returns
array array of lang var keys

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

214  {
215  return array("pc_grid", "pc_grid_cell", "ed_delete_cell", "ed_cell_left", "ed_cell_right");
216  }

◆ getSizes()

static ilPCGrid::getSizes ( )
static

Get sizes.

Note that these are mapped to (BS3): s > .col-xs, m > .col-sm, l > .col-md, xl > .col-lg

Returns
array

Definition at line 63 of file class.ilPCGrid.php.

Referenced by ilPCGridCellTableGUI\fillRow(), and ilPCGridGUI\initCreationForm().

64  {
65  return array("s" => "s", "m" => "m", "l" => "l", "xl" => "xl");
66  }
+ Here is the caller graph for this function:

◆ getWidths()

static ilPCGrid::getWidths ( )
static

Get widths.

Returns
array

Definition at line 72 of file class.ilPCGrid.php.

Referenced by ilPCGridCellTableGUI\fillRow(), and ilPCGridGUI\initCreationForm().

73  {
74  return array(
75  "1" => "1/12", "2" => "2/12", "3" => "3/12",
76  "4" => "4/12", "5" => "5/12", "6" => "6/12",
77  "7" => "7/12", "8" => "8/12", "9" => "9/12",
78  "10" => "10/12", "11" => "11/12", "12" => "12/12"
79  );
80  }
+ Here is the caller graph for this function:

◆ init()

ilPCGrid::init ( )

Init page content component.

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

References ilPageContent\setType().

41  {
42  $this->setType("grid");
43  }
setType($a_type)
Set Type.
+ Here is the call graph for this function:

◆ savePositions()

ilPCGrid::savePositions (   $a_pos)

Set attribute of grid tag.

Parameters
string$a_attrattribute name
string$a_valueattribute value Save positions of grid cells
array$a_pos

Definition at line 121 of file class.ilPCGrid.php.

References ilPageContent\$hier_id, $i, and $nodes.

122  {
123  asort($a_pos);
124 
125  $childs = $this->grid_node->child_nodes();
126  $nodes = array();
127  for ($i = 0; $i < count($childs); $i++) {
128  if ($childs[$i]->node_name() == "GridCell") {
129  $pc_id = $childs[$i]->get_attribute("PCID");
130  $hier_id = $childs[$i]->get_attribute("HierId");
131  $nodes[$hier_id . ":" . $pc_id] = $childs[$i];
132  $childs[$i]->unlink($childs[$i]);
133  }
134  }
135 
136  foreach ($a_pos as $k => $v) {
137  if (is_object($nodes[$k])) {
138  $nodes[$k] = $this->grid_node->append_child($nodes[$k]);
139  }
140  }
141  }
$i
Definition: disco.tpl.php:19

◆ saveWidths()

ilPCGrid::saveWidths (   $a_width_s,
  $a_width_m,
  $a_width_l,
  $a_width_xl 
)

Save widths of cells.

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

References ilPageContent\$hier_id, and $i.

147  {
148  $cell_nodes = $this->grid_node->child_nodes();
149  for ($i = 0; $i < count($cell_nodes); $i++) {
150  if ($cell_nodes[$i]->node_name() == "GridCell") {
151  $pc_id = $cell_nodes[$i]->get_attribute("PCID");
152  $hier_id = $cell_nodes[$i]->get_attribute("HierId");
153  $k = $hier_id . ":" . $pc_id;
154  $cell_nodes[$i]->set_attribute("WIDTH_XS", "");
155  $cell_nodes[$i]->set_attribute("WIDTH_S", $a_width_s[$k]);
156  $cell_nodes[$i]->set_attribute("WIDTH_M", $a_width_m[$k]);
157  $cell_nodes[$i]->set_attribute("WIDTH_L", $a_width_l[$k]);
158  $cell_nodes[$i]->set_attribute("WIDTH_XL", $a_width_xl[$k]);
159  }
160  }
161  }
$i
Definition: disco.tpl.php:19

◆ setNode()

ilPCGrid::setNode (   $a_node)

Set content node.

Parameters
object$a_node

Definition at line 49 of file class.ilPCGrid.php.

50  {
51  parent::setNode($a_node); // this is the PageContent node
52  $this->grid_node = $a_node->first_child(); // this is the Tabs node
53  }

Field Documentation

◆ $grid_node

ilPCGrid::$grid_node
protected

Definition at line 35 of file class.ilPCGrid.php.


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