ILIAS  trunk Revision v12.0_alpha-1329-g1094ddb0c33
ilPortfolioRoleAssignmentGUI Class Reference

@ilCtrl_Calls ilPortfolioRoleAssignmentGUI: ilPropertyFormGUI More...

+ Collaboration diagram for ilPortfolioRoleAssignmentGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 
 initAssignmentForm ()
 
 saveAssignment ()
 

Protected Member Functions

 listAssignments ()
 
 addAssignment ()
 
 checkWrite (bool $return=false)
 
 confirmAssignmentDeletion ()
 
 deleteAssignments ()
 

Protected Attributes

ilAccessHandler $access
 
int $ref_id
 
StandardGUIRequest $port_request
 
ilCtrl $ctrl
 
ilToolbarGUI $toolbar
 
ilLanguage $lng
 
ilGlobalTemplateInterface $main_tpl
 
PortfolioRoleAssignmentManager $manager
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilPortfolioRoleAssignmentGUI::__construct ( )

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

38 {
39 global $DIC;
40
41 $this->toolbar = $DIC->toolbar();
42 $this->ctrl = $DIC->ctrl();
43 $this->lng = $DIC->language();
44 $this->main_tpl = $DIC->ui()->mainTemplate();
45 $this->manager = new PortfolioRoleAssignmentManager();
46 $this->port_request = $DIC->portfolio()
47 ->internal()
48 ->gui()
49 ->standardRequest();
50 $this->ref_id = $this->port_request->getRefId();
51 $this->access = $DIC->access();
52 }
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

Member Function Documentation

◆ addAssignment()

ilPortfolioRoleAssignmentGUI::addAssignment ( )
protected

Definition at line 99 of file class.ilPortfolioRoleAssignmentGUI.php.

99 : void
100 {
102 $form = $this->initAssignmentForm();
103 $main_tpl->setContent($form->getHTML());
104 }
setContent(string $a_html)
Sets content for standard template.

References $main_tpl, initAssignmentForm(), and ILIAS\UICore\GlobalTemplate\setContent().

+ Here is the call graph for this function:

◆ checkWrite()

ilPortfolioRoleAssignmentGUI::checkWrite ( bool  $return = false)
protected

Definition at line 135 of file class.ilPortfolioRoleAssignmentGUI.php.

135 : bool
136 {
139 $has_perm = $this->access->checkAccess(
140 "write",
141 "",
142 $this->ref_id
143 );
144 if ($return && !$has_perm) {
145 $this->main_tpl->setOnScreenMessage('failure', $lng->txt("no_permission"), true);
146 $ctrl->redirect($this, "");
147
148 }
149
150 return $has_perm;
151 }
redirect(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
@inheritDoc
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...

References $ctrl, $lng, ILIAS\Repository\access(), ilCtrl\redirect(), and ilLanguage\txt().

Referenced by confirmAssignmentDeletion(), deleteAssignments(), listAssignments(), and saveAssignment().

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

◆ confirmAssignmentDeletion()

ilPortfolioRoleAssignmentGUI::confirmAssignmentDeletion ( )
protected

Definition at line 173 of file class.ilPortfolioRoleAssignmentGUI.php.

173 : void
174 {
178 $this->checkWrite(true);
179 $template_ids = $this->port_request->getRoleTemplateIds();
180 if (count($template_ids) === 0) {
181 $this->main_tpl->setOnScreenMessage('info', $lng->txt("no_checkbox"), true);
182 $ctrl->redirect($this, "listAssignments");
183 } else {
184 $cgui = new ilConfirmationGUI();
185 $cgui->setFormAction($ctrl->getFormAction($this));
186 $cgui->setHeaderText($lng->txt("prtf_delete_assignment_sure"));
187 $cgui->setCancel($lng->txt("cancel"), "listAssignments");
188 $cgui->setConfirm($lng->txt("delete"), "deleteAssignments");
189 foreach ($template_ids as $i) {
190 $id_arr = explode("_", $i);
191 $role_title = ilObject::_lookupTitle($id_arr[0]);
192 $template_title = ilObject::_lookupTitle(
193 ilObject::_lookupObjId($id_arr[1])
194 );
195 $cgui->addItem("role_template_ids[]", $i, $role_title .
196 " - " . $template_title);
197 }
198
199 $main_tpl->setContent($cgui->getHTML());
200 }
201 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getFormAction(object $a_gui_obj, ?string $a_fallback_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)

References $ctrl, $lng, $main_tpl, ilObject\_lookupObjId(), ilObject\_lookupTitle(), checkWrite(), ilCtrl\getFormAction(), ilCtrl\redirect(), ILIAS\UICore\GlobalTemplate\setContent(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ deleteAssignments()

ilPortfolioRoleAssignmentGUI::deleteAssignments ( )
protected

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

203 : void
204 {
205 $this->checkWrite(true);
208 $template_ids = $this->port_request->getRoleTemplateIds();
209 foreach ($template_ids as $i) {
210 $id_arr = explode("_", $i);
211 $this->manager->delete((int) $id_arr[1], (int) $id_arr[0]);
212 }
213 $this->main_tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
214 $ctrl->redirect($this, "listAssignments");
215 }

References $ctrl, $lng, checkWrite(), ilCtrl\redirect(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ executeCommand()

ilPortfolioRoleAssignmentGUI::executeCommand ( )

Definition at line 54 of file class.ilPortfolioRoleAssignmentGUI.php.

54 : void
55 {
57
58 $next_class = $ctrl->getNextClass($this);
59 $cmd = $ctrl->getCmd("listAssignments");
60
61 switch ($next_class) {
62 case "ilpropertyformgui":
63 $form = $this->initAssignmentForm();
64 $ctrl->forwardCommand($form);
65 break;
66
67 default:
68 if (in_array($cmd, [
69 "listAssignments",
70 "addAssignment",
71 "saveAssignment",
72 "confirmAssignmentDeletion",
73 "deleteAssignments"
74 ])) {
75 $this->$cmd();
76 }
77 }
78 }
getNextClass($a_gui_class=null)
@inheritDoc
forwardCommand(object $a_gui_object)
@inheritDoc
getCmd(?string $fallback_command=null)
@inheritDoc

References $ctrl, ilCtrl\forwardCommand(), ilCtrl\getCmd(), ilCtrl\getNextClass(), and initAssignmentForm().

+ Here is the call graph for this function:

◆ initAssignmentForm()

ilPortfolioRoleAssignmentGUI::initAssignmentForm ( )

Definition at line 106 of file class.ilPortfolioRoleAssignmentGUI.php.

107 {
110
111 $form = new ilPropertyFormGUI();
112
113 $options = $this->manager->getAvailableRoles();
114 $si_roles = new ilSelectInputGUI($this->lng->txt("prtf_role_title"), 'role_id');
115 $si_roles->setRequired(true);
116 $si_roles->setOptions($options);
117 $form->addItem($si_roles);
118
119 $repo = new ilRepositorySelector2InputGUI($lng->txt("prtf_template_title"), "template_ref_id");
120 $repo->setRequired(true);
121 $repo->getExplorerGUI()->setSelectableTypes(array("prtt"));
122 $repo->getExplorerGUI()->setTypeWhiteList(array("root", "prtt", "cat", "crs", "grp", "fold"));
123 $form->addItem($repo);
124
125 // save and cancel commands
126 $form->addCommandButton("saveAssignment", $lng->txt("save"));
127 $form->addCommandButton("listAssignments", $lng->txt("cancel"));
128
129 $form->setTitle($lng->txt("prtf_add_assignment"));
130 $form->setFormAction($ctrl->getFormAction($this));
131
132 return $form;
133 }
This class represents a property form user interface.
This class represents a selection list property in a property form.

References $ctrl, $lng, ILIAS\UI\Implementation\Component\Input\Field\$options, ilCtrl\getFormAction(), ILIAS\Repository\lng(), and ilLanguage\txt().

Referenced by addAssignment(), executeCommand(), and saveAssignment().

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

◆ listAssignments()

ilPortfolioRoleAssignmentGUI::listAssignments ( )
protected

Definition at line 80 of file class.ilPortfolioRoleAssignmentGUI.php.

80 : void
81 {
83 if ($this->checkWrite()) {
84 $this->toolbar->addButton(
85 $lng->txt("prtf_add_assignment"),
86 $this->ctrl->getLinkTarget($this, "addAssignment")
87 );
88 }
89
91 $this,
92 "listAssignments",
93 $this->manager,
94 $this->checkWrite()
95 );
96 $this->main_tpl->setContent($table->getHTML());
97 }

References $lng, checkWrite(), ILIAS\Repository\toolbar(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ saveAssignment()

ilPortfolioRoleAssignmentGUI::saveAssignment ( )

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

153 : void
154 {
158 $this->checkWrite(true);
159 $form = $this->initAssignmentForm();
160 if ($form->checkInput()) {
161 $this->manager->add(
162 (int) $form->getInput("template_ref_id"),
163 (int) $form->getInput("role_id")
164 );
165 $this->main_tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
166 $ctrl->redirect($this, "");
167 } else {
168 $form->setValuesByPost();
169 $main_tpl->setContent($form->getHTML());
170 }
171 }

References $ctrl, $lng, $main_tpl, checkWrite(), initAssignmentForm(), ilCtrl\redirect(), ILIAS\UICore\GlobalTemplate\setContent(), and ilLanguage\txt().

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilPortfolioRoleAssignmentGUI::$access
protected

Definition at line 28 of file class.ilPortfolioRoleAssignmentGUI.php.

◆ $ctrl

ilCtrl ilPortfolioRoleAssignmentGUI::$ctrl
protected

◆ $lng

◆ $main_tpl

ilGlobalTemplateInterface ilPortfolioRoleAssignmentGUI::$main_tpl
protected

◆ $manager

PortfolioRoleAssignmentManager ilPortfolioRoleAssignmentGUI::$manager
protected

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

◆ $port_request

StandardGUIRequest ilPortfolioRoleAssignmentGUI::$port_request
protected

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

◆ $ref_id

int ilPortfolioRoleAssignmentGUI::$ref_id
protected

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

◆ $toolbar

ilToolbarGUI ilPortfolioRoleAssignmentGUI::$toolbar
protected

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


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