31 public function init(): void
42 parent::setNode($a_node);
54 return array(
"s" =>
"s",
"m" =>
"m",
"l" =>
"l",
"xl" =>
"xl");
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" 77 $this->grid_node = $this->dom->create_element(
"Grid");
78 $this->grid_node = $this->node->append_child($this->grid_node);
82 int $post_layout_template,
89 switch ($post_layout_template) {
115 for (
$i = 0;
$i < $number_of_cells;
$i++) {
129 $childs = $this->grid_node->child_nodes();
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]);
140 foreach ($a_pos as $k => $v) {
141 if (is_object($nodes[$k])) {
142 $nodes[$k] = $this->grid_node->append_child($nodes[$k]);
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");
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]);
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]);
199 $new_item = $this->dom->create_element(
"GridCell");
200 $new_item = $this->grid_node->append_child($new_item);
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);
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);
229 return array(
"pc_grid",
"pc_grid_cell",
"ed_delete_cell",
"ed_cell_left",
"ed_cell_right");
234 return parent::getJavascriptFiles($a_mode);
239 return parent::getCssFiles($a_mode);
245 $cell_nodes = $this->grid_node->child_nodes();
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);
static getWidths()
Get widths.
const TEMPLATE_TWO_BY_TWO
setType(string $a_type)
Set Type.
applyTemplate(int $post_layout_template, int $number_of_cells, int $s, int $m, int $l, int $xl)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
savePositions(array $a_pos)
Save positions of grid cells.
const TEMPLATE_TWO_COLUMN
getJavascriptFiles(string $a_mode)
saveWidths(array $a_width_s, array $a_width_m, array $a_width_l, array $a_width_xl)
Save widths of cells.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getCssFiles(string $a_mode)
deleteGridCell(string $a_hier_id, string $a_pc_id)
Delete grid cell.
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
init()
Init page content component.
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
const TEMPLATE_THREE_COLUMN
static getLangVars()
Get lang vars needed for editing.
createPageContentNode(bool $a_set_this_node=true)
Create page content node (always use this method first when adding a new element) ...
php4DOMElement $grid_node
create(ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id="")
addGridCell(int $a_s, int $a_m, int $a_l, int $a_xl)
Add grid cell.
setNode(php4DOMElement $a_node)
Set content node.
static getSizes()
Get sizes.