ILIAS  release_8 Revision v8.24
class.GridCommandActionHandler.php
Go to the documentation of this file.
1<?php
2
20
23
28{
29 protected \ILIAS\DI\UIServices $ui;
30 protected \ilLanguage $lng;
31 protected \ilPageObjectGUI $page_gui;
32 protected \ilObjUser $user;
34
36 {
37 global $DIC;
38
39 $this->ui = $DIC->ui();
40 $this->lng = $DIC->language();
41 $this->page_gui = $page_gui;
42 $this->user = $DIC->user();
43
44 $this->ui_wrapper = new Server\UIWrapper($this->ui, $this->lng);
45 }
46
47 public function handle(array $query, array $body): Server\Response
48 {
49 switch ($body["action"]) {
50 case "insert":
51 return $this->insertCommand($body);
52
53 default:
54 throw new Exception("Unknown action " . $body["action"]);
55 }
56 }
57
58 protected function insertCommand(array $body): Server\Response
59 {
60 $page = $this->page_gui->getPageObject();
61
62 $hier_id = "pg";
63 $pc_id = "";
64 if (!in_array($body["after_pcid"], ["", "pg"])) {
65 $hier_ids = $page->getHierIdsForPCIds([$body["after_pcid"]]);
66 $hier_id = $hier_ids[$body["after_pcid"]];
67 $pc_id = $body["after_pcid"];
68 }
69
70 // if ($form->checkInput()) {
71 $post_layout_template = (int) $body["layout_template"];
72 $grid = new \ilPCGrid($page);
73 $grid->create($page, $hier_id, $pc_id);
74 $grid->applyTemplate(
75 $post_layout_template,
76 (int) $body["number_of_cells"],
77 (int) $body["s"],
78 (int) $body["m"],
79 (int) $body["l"],
80 (int) $body["xl"]
81 );
82 $updated = $page->update();
83
84 return $this->ui_wrapper->sendPage($this->page_gui, $updated);
85 }
86}
Page editor json server.
Class ilPageObjectGUI.
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
int $updated
Timestamp for when the object was last updated.
Definition: System.php:158
$query