ILIAS  release_7 Revision v7.30-3-g800a261c036
ilRecommendedContentRoleConfigGUI Class Reference

Recommended content configuration for roles. More...

+ Collaboration diagram for ilRecommendedContentRoleConfigGUI:

Public Member Functions

 __construct (int $role_id, int $node_ref_id)
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 listItems ()
 List items. More...
 
 confirmRemoveItems ()
 Remove items confirmation. More...
 
 removeItems ()
 Remove items. More...
 

Protected Member Functions

 checkPushPermission ()
 Check permission to push recommended content. More...
 
 selectItem ()
 Select recommended content. More...
 
 assignItem ()
 Assign item. More...
 

Protected Attributes

 $rbacsystem
 
 $rbacreview
 
 $lng
 
 $role_id
 
 $node_ref_id
 
 $ctrl
 
 $toolbar
 
 $main_tpl
 
 $manager
 
 $requested_item_ref_id
 

Detailed Description

Recommended content configuration for roles.

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

Definition at line 10 of file class.ilRecommendedContentRoleConfigGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilRecommendedContentRoleConfigGUI::__construct ( int  $role_id,
int  $node_ref_id 
)

Constructor.

Definition at line 65 of file class.ilRecommendedContentRoleConfigGUI.php.

66 {
67 global $DIC;
68
69 $this->role_id = $role_id;
70 $this->node_ref_id = $node_ref_id;
71 $this->rbacsystem = $DIC->rbac()->system();
72 $this->rbacreview = $DIC->rbac()->review();
73 $this->lng = $DIC->language();
74 $this->ctrl = $DIC->ctrl();
75 $this->toolbar = $DIC->toolbar();
76 $this->main_tpl = $DIC->ui()->mainTemplate();
77 $this->manager = new ilRecommendedContentManager();
78 $this->requested_item_ref_id = (int) $_GET['item_ref_id'];
79 $this->requested_item_ref_ids = is_array($_POST["item_ref_id"])
80 ? array_map(function ($i) {
81 return (int) $i;
82 }, $_POST["item_ref_id"])
83 : [];
84 }
$_GET["client_id"]
$_POST["username"]
Recommended content manager (business logic)
global $DIC
Definition: goto.php:24
$i
Definition: metadata.php:24

References $_GET, $_POST, $DIC, $i, $node_ref_id, and $role_id.

Member Function Documentation

◆ assignItem()

ilRecommendedContentRoleConfigGUI::assignItem ( )
protected

Assign item.

Definition at line 224 of file class.ilRecommendedContentRoleConfigGUI.php.

225 {
227 $this->checkPushPermission();
228 if ($this->requested_item_ref_id > 0) {
229 $this->manager->addRoleRecommendation($this->role_id, $this->requested_item_ref_id);
230 ilUtil::sendSuccess($this->lng->txt('rep_added_rec_content'), true);
231 }
232 $ctrl->redirect($this, 'listItems');
233 }
checkPushPermission()
Check permission to push recommended content.

References $ctrl, and checkPushPermission().

+ Here is the call graph for this function:

◆ checkPushPermission()

ilRecommendedContentRoleConfigGUI::checkPushPermission ( )
protected

Check permission to push recommended content.

Definition at line 188 of file class.ilRecommendedContentRoleConfigGUI.php.

189 {
192
193 if (!$rbacsystem->checkAccess('write', $this->node_ref_id) ||
194 !$rbacsystem->checkAccess('push_desktop_items', USER_FOLDER_ID)) {
195 ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
196 $ctrl->redirect($this, "listItems");
197 }
198 }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
const USER_FOLDER_ID
Definition: constants.php:31

References $ctrl, $rbacsystem, ilUtil\sendFailure(), and USER_FOLDER_ID.

Referenced by assignItem(), confirmRemoveItems(), removeItems(), and selectItem().

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

◆ confirmRemoveItems()

ilRecommendedContentRoleConfigGUI::confirmRemoveItems ( )

Remove items confirmation.

Definition at line 140 of file class.ilRecommendedContentRoleConfigGUI.php.

141 {
142 $this->checkPushPermission();
143
145
146 if (count($this->requested_item_ref_ids) == 0) {
147 ilUtil::sendFailure($this->lng->txt('select_one'));
148 $this->listItems();
149 return;
150 }
151
152 $confirmation_gui = new ilConfirmationGUI();
153 $confirmation_gui->setFormAction($this->ctrl->getFormAction($this));
154 $confirmation_gui->setHeaderText($this->lng->txt('rep_remove_rec_content'));
155 $confirmation_gui->setCancel($this->lng->txt("cancel"), "listItems");
156 $confirmation_gui->setConfirm($this->lng->txt("remove"), "removeItems");
157
158 foreach ($this->requested_item_ref_ids as $item_ref_id) {
159 $confirmation_gui->addItem(
160 "item_ref_id[]",
161 $item_ref_id,
163 );
164 }
165
166 $main_tpl->setContent($confirmation_gui->getHTML());
167 }
Confirmation screen class.
static _lookupTitle($a_id)
lookup object title
static _lookupObjectId($a_ref_id)
lookup object id

References $main_tpl, ilObject\_lookupObjectId(), ilObject\_lookupTitle(), checkPushPermission(), listItems(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ executeCommand()

ilRecommendedContentRoleConfigGUI::executeCommand ( )

Execute command.

Definition at line 89 of file class.ilRecommendedContentRoleConfigGUI.php.

90 {
92
93 $next_class = $ctrl->getNextClass($this);
94 $cmd = $ctrl->getCmd("listItems");
95
96 switch ($next_class) {
97 default:
98 if (in_array($cmd, ["listItems", "selectItem", "assignItem", "confirmRemoveItems", "removeItems"])) {
99 $this->$cmd();
100 }
101 break;
102 }
103 }

References $ctrl.

◆ listItems()

ilRecommendedContentRoleConfigGUI::listItems ( )

List items.

Definition at line 108 of file class.ilRecommendedContentRoleConfigGUI.php.

109 {
116
117 if (!$rbacreview->isAssignable($this->role_id, $this->node_ref_id) &&
118 $this->node_ref_id != ROLE_FOLDER_ID) {
119 ilUtil::sendInfo($this->lng->txt('rep_no_assign_rec_content_to_role'));
120 } else {
121 if ($rbacsystem->checkAccess('push_desktop_items', USER_FOLDER_ID)) {
122 $toolbar->addButton($lng->txt('add'), $ctrl->getLinkTarget(
123 $this,
124 'selectItem'
125 ));
126 }
128 $this,
129 'listItems',
130 $this->role_id,
131 $this->manager
132 );
133 $main_tpl->setContent($tbl->getHTML());
134 }
135 }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
const ROLE_FOLDER_ID
Definition: constants.php:32

References $ctrl, $lng, $main_tpl, $rbacreview, $rbacsystem, $toolbar, ROLE_FOLDER_ID, ilUtil\sendInfo(), and USER_FOLDER_ID.

Referenced by confirmRemoveItems(), and removeItems().

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

◆ removeItems()

ilRecommendedContentRoleConfigGUI::removeItems ( )

Remove items.

Definition at line 172 of file class.ilRecommendedContentRoleConfigGUI.php.

173 {
174 $this->checkPushPermission();
175
176 if (count($this->requested_item_ref_ids) > 0) {
177 foreach ($this->requested_item_ref_ids as $item_ref_id) {
178 $this->manager->removeRoleRecommendation($this->role_id, $item_ref_id);
179 }
180 ilUtil::sendSuccess($this->lng->txt('rep_rec_content_removed'));
181 }
182 $this->listItems();
183 }

References checkPushPermission(), and listItems().

+ Here is the call graph for this function:

◆ selectItem()

ilRecommendedContentRoleConfigGUI::selectItem ( )
protected

Select recommended content.

Definition at line 203 of file class.ilRecommendedContentRoleConfigGUI.php.

204 {
205 $this->checkPushPermission();
206
209 $this,
210 "selectItem",
211 $this,
212 "assignItem",
213 "item_ref_id"
214 );
215 $exp->setSkipRootNode(true);
216 if (!$exp->handleCommand()) {
217 $main_tpl->setContent($exp->getHTML());
218 }
219 }
Explorer for selecting repository items.

References $main_tpl, and checkPushPermission().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilRecommendedContentRoleConfigGUI::$ctrl
protected

◆ $lng

ilRecommendedContentRoleConfigGUI::$lng
protected

Definition at line 25 of file class.ilRecommendedContentRoleConfigGUI.php.

Referenced by listItems().

◆ $main_tpl

ilRecommendedContentRoleConfigGUI::$main_tpl
protected

◆ $manager

ilRecommendedContentRoleConfigGUI::$manager
protected

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

◆ $node_ref_id

ilRecommendedContentRoleConfigGUI::$node_ref_id
protected

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

Referenced by __construct().

◆ $rbacreview

ilRecommendedContentRoleConfigGUI::$rbacreview
protected

Definition at line 20 of file class.ilRecommendedContentRoleConfigGUI.php.

Referenced by listItems().

◆ $rbacsystem

ilRecommendedContentRoleConfigGUI::$rbacsystem
protected

Definition at line 15 of file class.ilRecommendedContentRoleConfigGUI.php.

Referenced by checkPushPermission(), and listItems().

◆ $requested_item_ref_id

ilRecommendedContentRoleConfigGUI::$requested_item_ref_id
protected

Definition at line 60 of file class.ilRecommendedContentRoleConfigGUI.php.

◆ $role_id

ilRecommendedContentRoleConfigGUI::$role_id
protected

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

Referenced by __construct().

◆ $toolbar

ilRecommendedContentRoleConfigGUI::$toolbar
protected

Definition at line 45 of file class.ilRecommendedContentRoleConfigGUI.php.

Referenced by listItems().


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