ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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...
 
 applyTemplate (int $post_layout_template, int $number_of_cells, $s, $m, $l, $xl)
 
 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...
 
 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...
 

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
 $profile_back_url
 
 $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 247 of file class.ilPCGrid.php.

248  {
249  $new_item = $this->dom->create_element("GridCell");
250  $new_item->set_attribute("WIDTH_XS", "");
251  $new_item->set_attribute("WIDTH_S", "");
252  $new_item->set_attribute("WIDTH_M", "");
253  $new_item->set_attribute("WIDTH_L", "");
254  $new_item->set_attribute("WIDTH_XL", "");
255  $this->grid_node->append_child($new_item);
256  }

◆ addGridCell()

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

Add grid cell.

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

Referenced by applyTemplate().

233  {
234  $new_item = $this->dom->create_element("GridCell");
235  $new_item = $this->grid_node->append_child($new_item);
236  //$new_item->set_attribute("xs", $a_xs);
237  $new_item->set_attribute("WIDTH_XS", "");
238  $new_item->set_attribute("WIDTH_S", $a_s);
239  $new_item->set_attribute("WIDTH_M", $a_m);
240  $new_item->set_attribute("WIDTH_L", $a_l);
241  $new_item->set_attribute("WIDTH_XL", $a_xl);
242  }
+ Here is the caller graph for this function:

◆ applyTemplate()

ilPCGrid::applyTemplate ( int  $post_layout_template,
int  $number_of_cells,
  $s,
  $m,
  $l,
  $xl 
)
Parameters
$post_layout_template
$number_of_cells
$s
$m
$l
$xl

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

References $i, addGridCell(), ilPCGridGUI\TEMPLATE_MAIN_SIDE, ilPCGridGUI\TEMPLATE_MANUAL, ilPCGridGUI\TEMPLATE_THREE_COLUMN, ilPCGridGUI\TEMPLATE_TWO_BY_TWO, and ilPCGridGUI\TEMPLATE_TWO_COLUMN.

108  {
109  switch ($post_layout_template) {
111  $this->addGridCell(12, 6, 6, 6);
112  $this->addGridCell(12, 6, 6, 6);
113  break;
114 
116  $this->addGridCell(12, 4, 4, 4);
117  $this->addGridCell(12, 4, 4, 4);
118  $this->addGridCell(12, 4, 4, 4);
119  break;
120 
122  $this->addGridCell(12, 6, 8, 9);
123  $this->addGridCell(12, 6, 4, 3);
124  break;
125 
127  $this->addGridCell(12, 6, 6, 3);
128  $this->addGridCell(12, 6, 6, 3);
129  $this->addGridCell(12, 6, 6, 3);
130  $this->addGridCell(12, 6, 6, 3);
131  break;
132 
133 
135  for ($i = 0; $i < (int) $number_of_cells; $i++) {
136  $this->addGridCell($s, $m, $l, $xl);
137  }
138  break;
139  }
140  }
const TEMPLATE_TWO_BY_TWO
addGridCell($a_s, $a_m, $a_l, $a_xl)
Add grid cell.
const TEMPLATE_TWO_COLUMN
const TEMPLATE_MAIN_SIDE
const TEMPLATE_THREE_COLUMN
$i
Definition: metadata.php:24
+ Here is the call graph for this function:

◆ 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 216 of file class.ilPCGrid.php.

References $i.

217  {
218  $childs = $this->grid_node->child_nodes();
219  for ($i = 0; $i < count($childs); $i++) {
220  if ($childs[$i]->node_name() == "GridCell") {
221  if ($a_pc_id == $childs[$i]->get_attribute("PCID") &&
222  $a_hier_id == $childs[$i]->get_attribute("HierId")) {
223  $childs[$i]->unlink($childs[$i]);
224  }
225  }
226  }
227  }
$i
Definition: metadata.php:24

◆ getCellData()

ilPCGrid::getCellData ( )

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

References ilPageContent\$hier_id, and $i.

284  {
285  $cells = array();
286  $cell_nodes = $this->grid_node->child_nodes();
287  $k = 0;
288  for ($i = 0; $i < count($cell_nodes); $i++) {
289  if ($cell_nodes[$i]->node_name() == "GridCell") {
290  $pc_id = $cell_nodes[$i]->get_attribute("PCID");
291  $hier_id = $cell_nodes[$i]->get_attribute("HierId");
292  $cells[] = array("pos" => $k,
293  "xs" => $cell_nodes[$i]->get_attribute("WIDTH_XS"),
294  "s" => $cell_nodes[$i]->get_attribute("WIDTH_S"),
295  "m" => $cell_nodes[$i]->get_attribute("WIDTH_M"),
296  "l" => $cell_nodes[$i]->get_attribute("WIDTH_L"),
297  "xl" => $cell_nodes[$i]->get_attribute("WIDTH_XL"),
298  "pc_id" => $pc_id, "hier_id" => $hier_id);
299  $k++;
300  }
301  }
302 
303  return $cells;
304  }
$i
Definition: metadata.php:24

◆ getCssFiles()

ilPCGrid::getCssFiles (   $a_mode)

Get Javascript files.

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

279  {
280  return parent::getCssFiles($a_mode);
281  }

◆ getJavascriptFiles()

ilPCGrid::getJavascriptFiles (   $a_mode)

Get Javascript files.

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

271  {
272  return parent::getJavascriptFiles($a_mode);
273  }

◆ getLangVars()

static ilPCGrid::getLangVars ( )
static

Get lang vars needed for editing.

Returns
array array of lang var keys

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

263  {
264  return array("pc_grid", "pc_grid_cell", "ed_delete_cell", "ed_cell_left", "ed_cell_right");
265  }

◆ 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 170 of file class.ilPCGrid.php.

References ilPageContent\$hier_id, and $i.

171  {
172  asort($a_pos);
173 
174  $childs = $this->grid_node->child_nodes();
175  $nodes = array();
176  for ($i = 0; $i < count($childs); $i++) {
177  if ($childs[$i]->node_name() == "GridCell") {
178  $pc_id = $childs[$i]->get_attribute("PCID");
179  $hier_id = $childs[$i]->get_attribute("HierId");
180  $nodes[$hier_id . ":" . $pc_id] = $childs[$i];
181  $childs[$i]->unlink($childs[$i]);
182  }
183  }
184 
185  foreach ($a_pos as $k => $v) {
186  if (is_object($nodes[$k])) {
187  $nodes[$k] = $this->grid_node->append_child($nodes[$k]);
188  }
189  }
190  }
$i
Definition: metadata.php:24

◆ saveWidths()

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

Save widths of cells.

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

References ilPageContent\$hier_id, and $i.

196  {
197  $cell_nodes = $this->grid_node->child_nodes();
198  for ($i = 0; $i < count($cell_nodes); $i++) {
199  if ($cell_nodes[$i]->node_name() == "GridCell") {
200  $pc_id = $cell_nodes[$i]->get_attribute("PCID");
201  $hier_id = $cell_nodes[$i]->get_attribute("HierId");
202  $k = $hier_id . ":" . $pc_id;
203  $cell_nodes[$i]->set_attribute("WIDTH_XS", "");
204  $cell_nodes[$i]->set_attribute("WIDTH_S", $a_width_s[$k]);
205  $cell_nodes[$i]->set_attribute("WIDTH_M", $a_width_m[$k]);
206  $cell_nodes[$i]->set_attribute("WIDTH_L", $a_width_l[$k]);
207  $cell_nodes[$i]->set_attribute("WIDTH_XL", $a_width_xl[$k]);
208  }
209  }
210  }
$i
Definition: metadata.php:24

◆ 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: