ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ILIAS\COPage\PC\Resources\ResourcesCommandActionHandler Class Reference
+ Inheritance diagram for ILIAS\COPage\PC\Resources\ResourcesCommandActionHandler:
+ Collaboration diagram for ILIAS\COPage\PC\Resources\ResourcesCommandActionHandler:

Public Member Functions

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

Protected Member Functions

 insertCommand (array $body)
 

Protected Attributes

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 29 of file ResourcesCommandActionHandler.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\COPage\PC\Resources\ResourcesCommandActionHandler::__construct ( \ilPageObjectGUI  $page_gui)

Definition at line 37 of file ResourcesCommandActionHandler.php.

References $DIC, ILIAS\COPage\PC\Resources\ResourcesCommandActionHandler\$page_gui, ILIAS\Repository\lng(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

38  {
39  global $DIC;
40 
41  $this->ui = $DIC->ui();
42  $this->lng = $DIC->language();
43  $this->page_gui = $page_gui;
44  $this->user = $DIC->user();
45 
46  $this->ui_wrapper = new Server\UIWrapper($this->ui, $this->lng);
47  }
global $DIC
Definition: shib_login.php:26
+ Here is the call graph for this function:

Member Function Documentation

◆ handle()

ILIAS\COPage\PC\Resources\ResourcesCommandActionHandler::handle ( array  $query,
array  $body 
)

Definition at line 49 of file ResourcesCommandActionHandler.php.

References ILIAS\COPage\PC\Resources\ResourcesCommandActionHandler\insertCommand().

49  : Server\Response
50  {
51  switch ($body["action"]) {
52  case "insert":
53  return $this->insertCommand($body);
54 
55  case "update":
56  return $this->updateCommand($body);
57 
58  default:
59  throw new Exception("Unknown action " . $body["action"]);
60  }
61  }
+ Here is the call graph for this function:

◆ insertCommand()

ILIAS\COPage\PC\Resources\ResourcesCommandActionHandler::insertCommand ( array  $body)
protected

Definition at line 63 of file ResourcesCommandActionHandler.php.

References $res.

Referenced by ILIAS\COPage\PC\Resources\ResourcesCommandActionHandler\handle().

63  : Server\Response
64  {
65  $page = $this->page_gui->getPageObject();
66 
67  $hier_id = "pg";
68  $pc_id = "";
69  if (!in_array($body["after_pcid"], ["", "pg"])) {
70  $hier_ids = $page->getHierIdsForPCIds([$body["after_pcid"]]);
71  $hier_id = $hier_ids[$body["after_pcid"]];
72  $pc_id = $body["after_pcid"];
73  }
74 
75  // if ($form->checkInput()) {
76  $res = new \ilPCResources($page);
77  $res->create($page, $hier_id, $pc_id);
78 
79  $res_type = $body["res_type"];
80 
81  $invalid = false;
82  if ($res_type === "_other") {
83  $res->setResourceListType("_other");
84  } elseif ($res_type === "_lobj") {
85  $res->setResourceListType("_lobj");
86  } elseif ($res_type !== "itgr") {
87  if (isset($body["type"])) {
88  $res->setResourceListType(
89  $body["type"]
90  );
91  } else {
92  $invalid = true;
93  }
94  } else {
95  $res->setItemGroupRefId(
96  (int) $body["itgr"]
97  );
98  }
99 
100  if (!$invalid) {
101  $updated = $page->update();
102  } else {
103  $page->buildDom(true); // rebuild dom (remove changes)
104  $updated = true;
105  }
106 
107  return $this->ui_wrapper->sendPage($this->page_gui, $updated);
108  }
$res
Definition: ltiservices.php:66
+ Here is the caller graph for this function:

Field Documentation

◆ $lng

ilLanguage ILIAS\COPage\PC\Resources\ResourcesCommandActionHandler::$lng
protected

Definition at line 32 of file ResourcesCommandActionHandler.php.

◆ $page_gui

ilPageObjectGUI ILIAS\COPage\PC\Resources\ResourcesCommandActionHandler::$page_gui
protected

◆ $ui

ILIAS DI UIServices ILIAS\COPage\PC\Resources\ResourcesCommandActionHandler::$ui
protected

Definition at line 31 of file ResourcesCommandActionHandler.php.

◆ $ui_wrapper

Server UIWrapper ILIAS\COPage\PC\Resources\ResourcesCommandActionHandler::$ui_wrapper
protected

Definition at line 35 of file ResourcesCommandActionHandler.php.

◆ $user

ilObjUser ILIAS\COPage\PC\Resources\ResourcesCommandActionHandler::$user
protected

Definition at line 34 of file ResourcesCommandActionHandler.php.


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