ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPCGrid Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 init ()
 Init page content component. More...
 
 setNode (php4DOMElement $a_node)
 Set content node. More...
 
 create (ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id="")
 
 applyTemplate (int $post_layout_template, int $number_of_cells, int $s, int $m, int $l, int $xl)
 
 savePositions (array $a_pos)
 Save positions of grid cells. More...
 
 saveWidths (array $a_width_s, array $a_width_m, array $a_width_l, array $a_width_xl)
 Save widths of cells. More...
 
 deleteGridCell (string $a_hier_id, string $a_pc_id)
 Delete grid cell. More...
 
 addGridCell (int $a_s, int $a_m, int $a_l, int $a_xl)
 Add grid cell. More...
 
 addCell ()
 Add a cell. More...
 
 getJavascriptFiles (string $a_mode)
 
 getCssFiles (string $a_mode)
 
 getCellData ()
 
- Public Member Functions inherited from ilPageContent
 __construct (ilPageObject $a_pg_obj)
 
 setPage (ilPageObject $a_val)
 
 getPage ()
 
 init ()
 Init object. More...
 
 getType ()
 
 setNode (php4DOMElement $a_node)
 Set xml node of page content. More...
 
 getNode ()
 
 getJavascriptFiles (string $a_mode)
 
 getCssFiles (string $a_mode)
 
 getOnloadCode (string $a_mode)
 
 setHierId (string $a_hier_id)
 
 getHierId ()
 
 lookupHierId ()
 
 readHierId ()
 
 setPcId (string $a_pcid)
 
 getPCId ()
 
 setFileDownloadLink (string $a_download_link)
 
 getFileDownloadLink ()
 
 setProfileBackUrl (string $url)
 
 getProfileBackUrl ()
 
 setFullscreenLink (string $a_fullscreen_link)
 
 getFullscreenLink ()
 
 setSourcecodeDownloadScript (string $script_name)
 
 getSourcecodeDownloadScript ()
 
 readPCId ()
 
 writePCId (string $a_pc_id)
 
 setEnabled (string $value)
 Set Enabled value for page content component. More...
 
 enable ()
 
 disable ()
 
 isEnabled ()
 
 createPageContentNode (bool $a_set_this_node=true)
 Create page content node (always use this method first when adding a new element) More...
 
 modifyPageContentPostXsl (string $a_output, string $a_mode, bool $a_abstract_only=false)
 Modify page content after xsl. More...
 
 getModel ()
 Get model as needed for the front-end editor. 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 (string $ed_id)
 Increases an hierarchical editing id at lowest level (last number) More...
 
static decEdId (string $ed_id)
 Decreases an hierarchical editing id at lowest level (last number) More...
 
static sortHierIds (array $a_array)
 Sort an array of Hier IDS in ascending order. More...
 
static isGreaterHierId (string $a, string $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, bool $a_self_ass=true, bool $a_clone_mobs=false, int $new_parent_id=0, int $obj_copy_id=0)
 Handle copied content. More...
 
static afterPageUpdate (ilPageObject $a_page, DOMDocument $a_domdoc, string $a_xml, bool $a_creation)
 After page has been updated (or created) More...
 
static beforePageDelete (ilPageObject $a_page)
 Before page is being deleted. More...
 
static afterRepositoryCopy (ilPageObject $page, array $mapping, int $source_ref_id)
 After repository (container) copy action. More...
 
static afterPageHistoryEntry (ilPageObject $a_page, DOMDocument $a_old_domdoc, string $a_old_xml, int $a_old_nr)
 After page history entry has been created. More...
 
static deleteHistoryLowerEqualThan (string $parent_type, int $page_id, string $lang, int $delete_lower_than_nr)
 Overwrite in derived classes, if old history entries are being deleted. More...
 

Protected Attributes

php4DOMElement $grid_node
 
- Protected Attributes inherited from ilPageContent
string $pcid
 
string $type = ""
 
ilPageObject $pg_obj
 
string $file_download_link
 
string $fullscreen_link
 
string $sourcecode_download_script
 
ilLogger $log
 
string $profile_back_url = ""
 

Additional Inherited Members

- Data Fields inherited from ilPageContent
string $hier_id = ""
 
php4DOMElement $node = null
 
php4DOMDocument $dom = null
 
string $page_lang = ""
 
- Protected Member Functions inherited from ilPageContent
 setType (string $a_type)
 Set Type. More...
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Grid element

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

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

Member Function Documentation

◆ addCell()

ilPCGrid::addCell ( )

Add a cell.

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

212  : void
213  {
214  $new_item = $this->dom->create_element("GridCell");
215  $new_item->set_attribute("WIDTH_XS", "");
216  $new_item->set_attribute("WIDTH_S", "");
217  $new_item->set_attribute("WIDTH_M", "");
218  $new_item->set_attribute("WIDTH_L", "");
219  $new_item->set_attribute("WIDTH_XL", "");
220  $this->grid_node->append_child($new_item);
221  }

◆ addGridCell()

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

Add grid cell.

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

Referenced by applyTemplate().

198  : void {
199  $new_item = $this->dom->create_element("GridCell");
200  $new_item = $this->grid_node->append_child($new_item);
201  //$new_item->set_attribute("xs", $a_xs);
202  $new_item->set_attribute("WIDTH_XS", "");
203  $new_item->set_attribute("WIDTH_S", $a_s);
204  $new_item->set_attribute("WIDTH_M", $a_m);
205  $new_item->set_attribute("WIDTH_L", $a_l);
206  $new_item->set_attribute("WIDTH_XL", $a_xl);
207  }
+ Here is the caller graph for this function:

◆ applyTemplate()

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

Definition at line 81 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.

88  : void {
89  switch ($post_layout_template) {
91  $this->addGridCell(12, 6, 6, 6);
92  $this->addGridCell(12, 6, 6, 6);
93  break;
94 
96  $this->addGridCell(12, 4, 4, 4);
97  $this->addGridCell(12, 4, 4, 4);
98  $this->addGridCell(12, 4, 4, 4);
99  break;
100 
102  $this->addGridCell(12, 6, 8, 9);
103  $this->addGridCell(12, 6, 4, 3);
104  break;
105 
107  $this->addGridCell(12, 6, 6, 3);
108  $this->addGridCell(12, 6, 6, 3);
109  $this->addGridCell(12, 6, 6, 3);
110  $this->addGridCell(12, 6, 6, 3);
111  break;
112 
113 
115  for ($i = 0; $i < $number_of_cells; $i++) {
116  $this->addGridCell($s, $m, $l, $xl);
117  }
118  break;
119  }
120  }
const TEMPLATE_TWO_BY_TWO
const TEMPLATE_TWO_COLUMN
const TEMPLATE_MAIN_SIDE
const TEMPLATE_THREE_COLUMN
addGridCell(int $a_s, int $a_m, int $a_l, int $a_xl)
Add grid cell.
$i
Definition: metadata.php:41
+ Here is the call graph for this function:

◆ create()

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

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

References ilPageContent\createPageContentNode(), IL_INSERT_AFTER, and ilPageObject\insertContent().

74  : void {
75  $this->node = $this->createPageContentNode();
76  $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
77  $this->grid_node = $this->dom->create_element("Grid");
78  $this->grid_node = $this->node->append_child($this->grid_node);
79  }
insertContent(ilPageContent $a_cont_obj, string $a_pos, int $a_mode=IL_INSERT_AFTER, string $a_pcid="", bool $remove_placeholder=true)
insert a content node before/after a sibling or as first child of a parent
const IL_INSERT_AFTER
createPageContentNode(bool $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 ( string  $a_hier_id,
string  $a_pc_id 
)

Delete grid cell.

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

References $i.

178  : void {
179  $childs = $this->grid_node->child_nodes();
180  for ($i = 0; $i < count($childs); $i++) {
181  if ($childs[$i]->node_name() == "GridCell") {
182  if ($a_pc_id == $childs[$i]->get_attribute("PCID") &&
183  $a_hier_id == $childs[$i]->get_attribute("HierId")) {
184  $childs[$i]->unlink($childs[$i]);
185  }
186  }
187  }
188  }
$i
Definition: metadata.php:41

◆ getCellData()

ilPCGrid::getCellData ( )

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

References ilPageContent\$hier_id, and $i.

242  : array
243  {
244  $cells = array();
245  $cell_nodes = $this->grid_node->child_nodes();
246  $k = 0;
247  for ($i = 0; $i < count($cell_nodes); $i++) {
248  if ($cell_nodes[$i]->node_name() == "GridCell") {
249  $pc_id = $cell_nodes[$i]->get_attribute("PCID");
250  $hier_id = $cell_nodes[$i]->get_attribute("HierId");
251  $cells[] = array("pos" => $k,
252  "xs" => $cell_nodes[$i]->get_attribute("WIDTH_XS"),
253  "s" => $cell_nodes[$i]->get_attribute("WIDTH_S"),
254  "m" => $cell_nodes[$i]->get_attribute("WIDTH_M"),
255  "l" => $cell_nodes[$i]->get_attribute("WIDTH_L"),
256  "xl" => $cell_nodes[$i]->get_attribute("WIDTH_XL"),
257  "pc_id" => $pc_id, "hier_id" => $hier_id);
258  $k++;
259  }
260  }
261 
262  return $cells;
263  }
$i
Definition: metadata.php:41

◆ getCssFiles()

ilPCGrid::getCssFiles ( string  $a_mode)

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

237  : array
238  {
239  return parent::getCssFiles($a_mode);
240  }

◆ getJavascriptFiles()

ilPCGrid::getJavascriptFiles ( string  $a_mode)

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

232  : array
233  {
234  return parent::getJavascriptFiles($a_mode);
235  }

◆ getLangVars()

static ilPCGrid::getLangVars ( )
static

Get lang vars needed for editing.

Returns
array array of lang var keys

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

227  : array
228  {
229  return array("pc_grid", "pc_grid_cell", "ed_delete_cell", "ed_cell_left", "ed_cell_right");
230  }

◆ 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

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

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

52  : array
53  {
54  return array("s" => "s", "m" => "m", "l" => "l", "xl" => "xl");
55  }
+ Here is the caller graph for this function:

◆ getWidths()

static ilPCGrid::getWidths ( )
static

Get widths.

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

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

60  : array
61  {
62  return array(
63  "1" => "1/12", "2" => "2/12", "3" => "3/12",
64  "4" => "4/12", "5" => "5/12", "6" => "6/12",
65  "7" => "7/12", "8" => "8/12", "9" => "9/12",
66  "10" => "10/12", "11" => "11/12", "12" => "12/12"
67  );
68  }
+ Here is the caller graph for this function:

◆ init()

ilPCGrid::init ( )

Init page content component.

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

References ilPageContent\setType().

31  : void
32  {
33  $this->setType("grid");
34  }
setType(string $a_type)
Set Type.
+ Here is the call graph for this function:

◆ savePositions()

ilPCGrid::savePositions ( array  $a_pos)

Save positions of grid cells.

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

References ilPageContent\$hier_id, and $i.

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

◆ saveWidths()

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

Save widths of cells.

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

References ilPageContent\$hier_id, and $i.

155  : void {
156  $cell_nodes = $this->grid_node->child_nodes();
157  for ($i = 0; $i < count($cell_nodes); $i++) {
158  if ($cell_nodes[$i]->node_name() == "GridCell") {
159  $pc_id = $cell_nodes[$i]->get_attribute("PCID");
160  $hier_id = $cell_nodes[$i]->get_attribute("HierId");
161  $k = $hier_id . ":" . $pc_id;
162  $cell_nodes[$i]->set_attribute("WIDTH_XS", "");
163  $cell_nodes[$i]->set_attribute("WIDTH_S", $a_width_s[$k]);
164  $cell_nodes[$i]->set_attribute("WIDTH_M", $a_width_m[$k]);
165  $cell_nodes[$i]->set_attribute("WIDTH_L", $a_width_l[$k]);
166  $cell_nodes[$i]->set_attribute("WIDTH_XL", $a_width_xl[$k]);
167  }
168  }
169  }
$i
Definition: metadata.php:41

◆ setNode()

ilPCGrid::setNode ( php4DOMElement  $a_node)

Set content node.

Parameters
php4DOMElement$a_node

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

References php4DOMNode\first_child().

40  : void
41  {
42  parent::setNode($a_node); // this is the PageContent node
43  $this->grid_node = $a_node->first_child(); // this is the Tabs node
44  }
+ Here is the call graph for this function:

Field Documentation

◆ $grid_node

php4DOMElement ilPCGrid::$grid_node
protected

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


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