ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\COPage\Page\PageCommandActionHandler Class Reference
+ Inheritance diagram for ILIAS\COPage\Page\PageCommandActionHandler:
+ Collaboration diagram for ILIAS\COPage\Page\PageCommandActionHandler:

Public Member Functions

 __construct (\ilPageObjectGUI $page_gui)
 
 handle (array $query, array $body)
 

Protected Member Functions

 cutCommand (array $body)
 
 pasteCommand (array $body)
 
 copyCommand (array $body)
 
 format (array $body)
 
 delete (array $body)
 
 dragDropCommand (array $body)
 
 sendPage ($updated)
 Send whole page as response. More...
 
 getIdForPCId (string $pcid)
 Get id for pcid. More...
 
 getHierIdForPCId (string $pcid)
 Get hier id for pcid. More...
 
 updateCommand (array $body)
 
 activate (array $body)
 
 listEdit ($body)
 Activate command. More...
 

Protected Attributes

 $updated
 
ilPCParagraph $content_obj
 
ILIAS DI UIServices $ui
 
ilLanguage $lng
 
ilPageObjectGUI $page_gui
 
ilObjUser $user
 
Server UIWrapper $ui_wrapper
 

Detailed Description

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

Definition at line 27 of file class.PageCommandActionHandler.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\COPage\Page\PageCommandActionHandler::__construct ( \ilPageObjectGUI  $page_gui)

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

41 {
42 global $DIC;
43
44 $this->ui = $DIC->ui();
45 $this->lng = $DIC->language();
46 $this->page_gui = $page_gui;
47 $this->user = $DIC->user();
48
49 $this->ui_wrapper = new Server\UIWrapper($this->ui, $this->lng);
50 }
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\COPage\Page\PageCommandActionHandler\$page_gui, ILIAS\Repository\lng(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ activate()

ILIAS\COPage\Page\PageCommandActionHandler::activate ( array  $body)
protected

Definition at line 255 of file class.PageCommandActionHandler.php.

255 : Server\Response
256 {
257 $pcids = $body["data"]["pcids"];
258 $page = $this->page_gui->getPageObject();
259
260 $hids = array_map(
261 function ($pcid) {
262 return $this->getIdForPCId($pcid);
263 },
264 $pcids
265 );
266
267 $updated = $page->switchEnableMultiple(
268 $hids,
269 true,
270 $this->page_gui->getPageConfig()->getEnableSelfAssessment()
271 );
272
273
274 return $this->sendPage($updated);
275 }

References ILIAS\COPage\Page\PageCommandActionHandler\$updated, ILIAS\COPage\Page\PageCommandActionHandler\getIdForPCId(), and ILIAS\COPage\Page\PageCommandActionHandler\sendPage().

Referenced by ILIAS\COPage\Page\PageCommandActionHandler\handle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyCommand()

ILIAS\COPage\Page\PageCommandActionHandler::copyCommand ( array  $body)
protected

Definition at line 117 of file class.PageCommandActionHandler.php.

117 : Server\Response
118 {
119 $pcids = $body["data"]["pcids"];
120 $page = $this->page_gui->getPageObject();
121
122 $hids = array_map(
123 function ($pcid) {
124 return $this->getIdForPCId($pcid);
125 },
126 $pcids
127 );
128
129 $page->copyContents($hids);
130
131 return $this->sendPage(true);
132 }

References ILIAS\COPage\Page\PageCommandActionHandler\getIdForPCId(), and ILIAS\COPage\Page\PageCommandActionHandler\sendPage().

Referenced by ILIAS\COPage\Page\PageCommandActionHandler\handle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cutCommand()

ILIAS\COPage\Page\PageCommandActionHandler::cutCommand ( array  $body)
protected

Definition at line 88 of file class.PageCommandActionHandler.php.

88 : Server\Response
89 {
90 $pcids = $body["data"]["pcids"];
91 $page = $this->page_gui->getPageObject();
92
93 $hids = array_map(
94 function ($pcid) {
95 return $this->getIdForPCId($pcid);
96 },
97 $pcids
98 );
99
100 $updated = $page->cutContents($hids);
101
102 return $this->sendPage($updated);
103 }

References ILIAS\COPage\Page\PageCommandActionHandler\$updated, ILIAS\COPage\Page\PageCommandActionHandler\getIdForPCId(), and ILIAS\COPage\Page\PageCommandActionHandler\sendPage().

Referenced by ILIAS\COPage\Page\PageCommandActionHandler\handle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ILIAS\COPage\Page\PageCommandActionHandler::delete ( array  $body)
protected

Definition at line 153 of file class.PageCommandActionHandler.php.

153 : Server\Response
154 {
155 $pcids = $body["data"]["pcids"];
156 $page = $this->page_gui->getPageObject();
157
158 $hids = array_map(
159 function ($pcid) {
160 return $this->getIdForPCId($pcid);
161 },
162 $pcids
163 );
164
165 $updated = $page->deleteContents(
166 $hids,
167 true,
168 $this->page_gui->getPageConfig()->getEnableSelfAssessment()
169 );
170 if ($updated === true) {
171 $this->page_gui->afterDeleteContents();
172 }
173
174 return $this->sendPage($updated);
175 }

References ILIAS\COPage\Page\PageCommandActionHandler\$updated, ILIAS\COPage\Page\PageCommandActionHandler\getIdForPCId(), and ILIAS\COPage\Page\PageCommandActionHandler\sendPage().

+ Here is the call graph for this function:

◆ dragDropCommand()

ILIAS\COPage\Page\PageCommandActionHandler::dragDropCommand ( array  $body)
protected

Definition at line 177 of file class.PageCommandActionHandler.php.

177 : Server\Response
178 {
179 $target = $body["data"]["target"];
180 $source = $body["data"]["source"];
181
182 $page = $this->page_gui->getPageObject();
183
184 $source = explode(":", $source);
185 $target = explode(":", $target);
186
187 $updated = $page->moveContentAfter($source[0], $target[0], $source[1], $target[1]);
188
189 return $this->sendPage($updated);
190 }

References ILIAS\COPage\Page\PageCommandActionHandler\$updated, and ILIAS\COPage\Page\PageCommandActionHandler\sendPage().

Referenced by ILIAS\COPage\Page\PageCommandActionHandler\handle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ format()

ILIAS\COPage\Page\PageCommandActionHandler::format ( array  $body)
protected

Definition at line 134 of file class.PageCommandActionHandler.php.

134 : Server\Response
135 {
136 $pcids = $body["data"]["pcids"];
137 $par = $body["data"]["paragraph_format"];
138 $sec = $body["data"]["section_format"];
139 $med = $body["data"]["media_format"];
140 $page = $this->page_gui->getPageObject();
141
142 $hids = array_map(
143 function ($pcid) {
144 return $this->getIdForPCId($pcid);
145 },
146 $pcids
147 );
148
149 $updated = $page->assignCharacteristic($hids, $par, $sec, $med);
150 return $this->sendPage($updated);
151 }

References ILIAS\COPage\Page\PageCommandActionHandler\$updated, ILIAS\COPage\Page\PageCommandActionHandler\getIdForPCId(), and ILIAS\COPage\Page\PageCommandActionHandler\sendPage().

Referenced by ILIAS\COPage\Page\PageCommandActionHandler\handle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHierIdForPCId()

ILIAS\COPage\Page\PageCommandActionHandler::getHierIdForPCId ( string  $pcid)
protected

Get hier id for pcid.

Definition at line 218 of file class.PageCommandActionHandler.php.

218 : string
219 {
220 $page = $this->page_gui->getPageObject();
221 $id = "pg";
222 if (!in_array($pcid, ["", "pg"])) {
223 $hier_ids = $page->getHierIdsForPCIds([$pcid]);
224 $id = $hier_ids[$pcid];
225 }
226 return $id;
227 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id.

◆ getIdForPCId()

ILIAS\COPage\Page\PageCommandActionHandler::getIdForPCId ( string  $pcid)
protected

Get id for pcid.

Definition at line 204 of file class.PageCommandActionHandler.php.

204 : string
205 {
206 $page = $this->page_gui->getPageObject();
207 $id = "pg:";
208 if (!in_array($pcid, ["", "pg"])) {
209 $hier_ids = $page->getHierIdsForPCIds([$pcid]);
210 $id = $hier_ids[$pcid] . ":" . $pcid;
211 }
212 return $id;
213 }

References $id.

Referenced by ILIAS\COPage\Page\PageCommandActionHandler\activate(), ILIAS\COPage\Page\PageCommandActionHandler\copyCommand(), ILIAS\COPage\Page\PageCommandActionHandler\cutCommand(), ILIAS\COPage\Page\PageCommandActionHandler\delete(), ILIAS\COPage\Page\PageCommandActionHandler\format(), and ILIAS\COPage\Page\PageCommandActionHandler\pasteCommand().

+ Here is the caller graph for this function:

◆ handle()

ILIAS\COPage\Page\PageCommandActionHandler::handle ( array  $query,
array  $body 
)
Exceptions
Exception

Definition at line 55 of file class.PageCommandActionHandler.php.

55 : Server\Response
56 {
57 switch ($body["action"]) {
58 case "cut":
59 return $this->cutCommand($body);
60
61 case "paste":
62 return $this->pasteCommand($body);
63
64 case "copy":
65 return $this->copyCommand($body);
66
67 case "drag.drop":
68 return $this->dragDropCommand($body);
69
70 case "format":
71 return $this->format($body);
72
73 case "delete":
74 return $this->delete($body);
75
76 case "activate":
77 return $this->activate($body);
78
79 case "list.edit":
80 return $this->listEdit($body);
81 break;
82
83 default:
84 throw new Exception("Unknown action " . $body["action"]);
85 }
86 }

References ILIAS\COPage\Page\PageCommandActionHandler\activate(), ILIAS\COPage\Page\PageCommandActionHandler\copyCommand(), ILIAS\COPage\Page\PageCommandActionHandler\cutCommand(), ILIAS\COPage\Page\PageCommandActionHandler\dragDropCommand(), ILIAS\COPage\Page\PageCommandActionHandler\format(), ILIAS\COPage\Page\PageCommandActionHandler\listEdit(), and ILIAS\COPage\Page\PageCommandActionHandler\pasteCommand().

+ Here is the call graph for this function:

◆ listEdit()

ILIAS\COPage\Page\PageCommandActionHandler::listEdit (   $body)
protected

Activate command.

Parameters
$body
Returns
Server\Response

Definition at line 282 of file class.PageCommandActionHandler.php.

282 : Server\Response
283 {
284 $pcid = $body["data"]["pcid"];
285 $list_cmd = $body["data"]["list_cmd"];
286 $page = $this->page_gui->getPageObject();
287
288 $pc = $page->getContentObjectForPcId($pcid);
289
290 $updated = true;
291 switch ($list_cmd) {
292 case "newItemAfter":
293 $pc->newItemAfter();
294 break;
295 case "newItemBefore":
296 $pc->newItemBefore();
297 break;
298 case "deleteItem":
299 $pc->deleteItem();
300 break;
301 case "moveItemUp":
302 $pc->moveItemUp();
303 break;
304 case "moveItemDown":
305 $pc->moveItemDown();
306 break;
307 }
308 $updated = $page->update();
309
310 return $this->sendPage($updated);
311 }

References ILIAS\COPage\Page\PageCommandActionHandler\$updated, and ILIAS\COPage\Page\PageCommandActionHandler\sendPage().

Referenced by ILIAS\COPage\Page\PageCommandActionHandler\handle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pasteCommand()

ILIAS\COPage\Page\PageCommandActionHandler::pasteCommand ( array  $body)
protected

Definition at line 105 of file class.PageCommandActionHandler.php.

105 : Server\Response
106 {
107 $target_pcid = $body["data"]["target_pcid"];
108 $page = $this->page_gui->getPageObject();
109 $updated = $page->pasteContents(
110 $this->getIdForPCId($target_pcid),
111 $page->getPageConfig()->getEnableSelfAssessment()
112 );
113
114 return $this->sendPage($updated);
115 }

References ILIAS\COPage\Page\PageCommandActionHandler\$updated, ILIAS\COPage\Page\PageCommandActionHandler\getIdForPCId(), and ILIAS\COPage\Page\PageCommandActionHandler\sendPage().

Referenced by ILIAS\COPage\Page\PageCommandActionHandler\handle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendPage()

ILIAS\COPage\Page\PageCommandActionHandler::sendPage (   $updated)
protected

◆ updateCommand()

ILIAS\COPage\Page\PageCommandActionHandler::updateCommand ( array  $body)
protected

Definition at line 229 of file class.PageCommandActionHandler.php.

229 : Server\Response
230 {
231 $page = $this->page_gui->getPageObject();
232
233 $hier_ids = $page->getHierIdsForPCIds([$body["data"]["pcid"]]);
234 $pcid = $hier_ids[$body["data"]["pcid"]] . ":" . $body["data"]["pcid"];
235
236 $content = "<div id='" .
237 $pcid . "' class='ilc_text_block_" .
238 $body["data"]["characteristic"] . "'>" . $body["data"]["content"] . "</div>";
239
240 $this->content_obj = new \ilPCParagraph($page);
241
242 $this->updated = $this->content_obj->saveJS(
243 $page,
244 $content,
245 \ilUtil::stripSlashes($body["data"]["characteristic"]),
247 );
248
249
250 $data = new \stdClass();
251 $data->renderedContent = "Test the rendered content";
252 return new Server\Response($data);
253 }
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")

References $data, and ilUtil\stripSlashes().

+ Here is the call graph for this function:

Field Documentation

◆ $content_obj

ilPCParagraph ILIAS\COPage\Page\PageCommandActionHandler::$content_obj
protected

Definition at line 33 of file class.PageCommandActionHandler.php.

◆ $lng

ilLanguage ILIAS\COPage\Page\PageCommandActionHandler::$lng
protected

Definition at line 35 of file class.PageCommandActionHandler.php.

◆ $page_gui

ilPageObjectGUI ILIAS\COPage\Page\PageCommandActionHandler::$page_gui
protected

◆ $ui

ILIAS DI UIServices ILIAS\COPage\Page\PageCommandActionHandler::$ui
protected

Definition at line 34 of file class.PageCommandActionHandler.php.

◆ $ui_wrapper

Server UIWrapper ILIAS\COPage\Page\PageCommandActionHandler::$ui_wrapper
protected

Definition at line 38 of file class.PageCommandActionHandler.php.

◆ $updated

◆ $user

ilObjUser ILIAS\COPage\Page\PageCommandActionHandler::$user
protected

Definition at line 37 of file class.PageCommandActionHandler.php.


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