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

Public Member Functions

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

Protected Member Functions

 insertCommand (array $body)
 
 updateCommand (array $body)
 

Protected Attributes

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

Detailed Description

Definition at line 24 of file class.PlaceHolderCommandActionHandler.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\COPage\PC\PlaceHolder\PlaceHolderCommandActionHandler::__construct ( \ilPageObjectGUI  $page_gui)

Definition at line 32 of file class.PlaceHolderCommandActionHandler.php.

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

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

Member Function Documentation

◆ handle()

ILIAS\COPage\PC\PlaceHolder\PlaceHolderCommandActionHandler::handle ( array  $query,
array  $body 
)

Definition at line 44 of file class.PlaceHolderCommandActionHandler.php.

References ILIAS\COPage\PC\PlaceHolder\PlaceHolderCommandActionHandler\insertCommand(), and ILIAS\COPage\PC\PlaceHolder\PlaceHolderCommandActionHandler\updateCommand().

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

◆ insertCommand()

ILIAS\COPage\PC\PlaceHolder\PlaceHolderCommandActionHandler::insertCommand ( array  $body)
protected

Definition at line 58 of file class.PlaceHolderCommandActionHandler.php.

Referenced by ILIAS\COPage\PC\PlaceHolder\PlaceHolderCommandActionHandler\handle().

58  : 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  $ph = new \ilPCPlaceHolder($page);
72  $ph->create($page, $hier_id, $pc_id);
73  $ph->setHeight("300px");
74  $ph->setContentClass(
75  $body["plach_type"]
76  );
77  $updated = $page->update();
78 
79  return $this->ui_wrapper->sendPage($this->page_gui, $updated);
80  }
+ Here is the caller graph for this function:

◆ updateCommand()

ILIAS\COPage\PC\PlaceHolder\PlaceHolderCommandActionHandler::updateCommand ( array  $body)
protected

Definition at line 82 of file class.PlaceHolderCommandActionHandler.php.

Referenced by ILIAS\COPage\PC\PlaceHolder\PlaceHolderCommandActionHandler\handle().

82  : Server\Response
83  {
84  $page = $this->page_gui->getPageObject();
85  $page->addHierIDs();
86  $hier_id = $page->getHierIdForPcId($body["pcid"]);
87  $ph = $page->getContentObjectForPcId($body["pcid"]);
88  $ph_gui = new \ilPCPlaceHolderGUI($page, $ph, $hier_id, $body["pcid"]);
89  $ph_gui->setPageConfig($page->getPageConfig());
90 
91  $form = $ph_gui->initCreationForm();
92 
93  // note: we have everyting in _POST here, form works the usual way
94  $updated = true;
95  if ($form->checkInput()) {
96  $ph->setContentClass(
97  $form->getInput("plach_type")
98  );
99  $updated = $page->update();
100  }
101 
102  return $this->ui_wrapper->sendPage($this->page_gui, $updated);
103  }
+ Here is the caller graph for this function:

Field Documentation

◆ $lng

ilLanguage ILIAS\COPage\PC\PlaceHolder\PlaceHolderCommandActionHandler::$lng
protected

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

◆ $page_gui

ilPageObjectGUI ILIAS\COPage\PC\PlaceHolder\PlaceHolderCommandActionHandler::$page_gui
protected

◆ $ui

ILIAS DI UIServices ILIAS\COPage\PC\PlaceHolder\PlaceHolderCommandActionHandler::$ui
protected

Definition at line 26 of file class.PlaceHolderCommandActionHandler.php.

◆ $ui_wrapper

Server UIWrapper ILIAS\COPage\PC\PlaceHolder\PlaceHolderCommandActionHandler::$ui_wrapper
protected

Definition at line 30 of file class.PlaceHolderCommandActionHandler.php.

◆ $user

ilObjUser ILIAS\COPage\PC\PlaceHolder\PlaceHolderCommandActionHandler::$user
protected

Definition at line 29 of file class.PlaceHolderCommandActionHandler.php.


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