24 require_once(
"./Services/COPage/classes/class.ilPageContent.php");
51 parent::setNode($a_node);
52 $this->grid_node = $a_node->first_child();
65 return array(
"s" =>
"s",
"m" =>
"m",
"l" =>
"l",
"xl" =>
"xl");
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" 85 public function create($a_pg_obj, $a_hier_id, $a_pc_id =
"")
89 $this->grid_node = $this->dom->create_element(
"Grid");
90 $this->grid_node = $this->node->append_child($this->grid_node);
125 $childs = $this->grid_node->child_nodes();
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");
132 $childs[
$i]->unlink($childs[
$i]);
136 foreach ($a_pos as $k => $v) {
137 if (is_object(
$nodes[$k])) {
138 $nodes[$k] = $this->grid_node->append_child(
$nodes[$k]);
146 public function saveWidths($a_width_s, $a_width_m, $a_width_l, $a_width_xl)
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");
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]);
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]);
185 $new_item = $this->dom->create_element(
"GridCell");
186 $new_item = $this->grid_node->append_child($new_item);
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);
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);
215 return array(
"pc_grid",
"pc_grid_cell",
"ed_delete_cell",
"ed_cell_left",
"ed_cell_right");
223 return parent::getJavascriptFiles($a_mode);
231 return parent::getCssFiles($a_mode);
237 $cell_nodes = $this->grid_node->child_nodes();
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);
static getWidths()
Get widths.
saveWidths($a_width_s, $a_width_m, $a_width_l, $a_width_xl)
Save widths of cells.
addGridCell($a_s, $a_m, $a_l, $a_xl)
Add grid cell.
setNode($a_node)
Set content node.
savePositions($a_pos)
Set attribute of grid tag.
deleteGridCell($a_hier_id, $a_pc_id)
Delete grid cell.
setType($a_type)
Set Type.
create($a_pg_obj, $a_hier_id, $a_pc_id="")
Create new Grid node.
init()
Init page content component.
static getLangVars()
Get lang vars needed for editing.
createPageContentNode($a_set_this_node=true)
Create page content node (always use this method first when adding a new element) ...
getJavascriptFiles($a_mode)
Get Javascript files.
getCssFiles($a_mode)
Get Javascript files.
static getSizes()
Get sizes.