5 declare(strict_types=1);
7 require_once
'Modules/IndividualAssessment/classes/class.ilIndividualAssessmentMembersTableGUI.php';
8 require_once
'Modules/IndividualAssessment/classes/LearningProgress/class.ilIndividualAssessmentLPInterface.php';
10 use \ILIAS\UI\Component\ViewControl;
53 $this->ctrl = $DIC[
'ilCtrl'];
54 $this->parent_gui = $a_parent_gui;
55 $this->
object = $a_parent_gui->object;
56 $this->ref_id = $a_ref_id;
57 $this->tpl = $DIC[
'tpl'];
58 $this->lng = $DIC[
'lng'];
59 $this->toolbar = $DIC[
'ilToolbar'];
60 $this->
user = $DIC[
"ilUser"];
61 $this->iass_access = $this->
object->accessHandler();
62 $this->factory = $DIC->ui()->factory();
63 $this->renderer = $DIC->ui()->renderer();
69 !$this->iass_access->mayEditMembers()
70 && !$this->iass_access->mayGradeUser()
71 && !$this->iass_access->mayViewUser()
72 && !$this->iass_access->mayAmendGradeUser()
74 $this->parent_gui->handleAccessViolation();
77 $cmd = $this->ctrl->getCmd();
78 $next_class = $this->ctrl->getNextClass();
79 $this->ctrl->saveParameterByClass(
"ilIndividualAssessmentMembersGUI", self::F_STATUS);
80 switch ($next_class) {
81 case "ilrepositorysearchgui":
82 require_once
'Services/Search/classes/class.ilRepositorySearchGUI.php';
84 $rep_search->setCallback($this,
"addUsersFromSearch");
85 $rep_search->addUserAccessFilterCallable(
86 function ($a_user_ids) {
90 $this->ctrl->forwardCommand($rep_search);
92 case "ilindividualassessmentmembergui":
93 require_once
'Modules/IndividualAssessment/classes/class.ilIndividualAssessmentMemberGUI.php';
95 $this->ctrl->forwardCommand($member);
108 if (!
$_GET[
'failure']) {
109 ilUtil::sendSuccess($this->
txt(
'iass_add_user_success'));
118 if ($this->iass_access->mayEditMembers()) {
119 require_once
'./Services/Search/classes/class.ilRepositorySearchGUI.php';
121 $search_params = [
'crs',
'grp'];
122 $container_id = $this->
object->getParentContainerIdByType($this->ref_id, $search_params);
123 if ($container_id !== 0) {
128 'auto_complete_name' => $this->
txt(
'user'),
129 'submit_name' => $this->
txt(
'add'),
130 'add_search' =>
true,
131 'add_from_container' => $container_id
139 'auto_complete_name' => $this->
txt(
'user'),
140 'submit_name' => $this->
txt(
'add'),
151 $this->object->accessHandler(),
154 (int) $this->
user->getId()
162 $this->object->loadMembersAsSingleObjects($filter, $sort)
165 $table->setData($entries);
170 if (count($entries) == 0) {
173 $this->tpl->setContent(
$output);
178 $user_ids = array_map(
function ($e) {
181 $viewable_or_gradeable_entries = $this->iass_access->filterViewableOrGradeableUsers($user_ids);
183 return array_filter($entries,
function ($e) use ($viewable_or_gradeable_entries) {
184 return in_array($e->id(), $viewable_or_gradeable_entries);
193 if ($user_ids && is_array($user_ids) && !empty($user_ids)) {
198 $this->ctrl->redirectByClass(array(get_class($this->parent_gui),get_class($this)),
'view');
208 if (!$this->iass_access->mayEditMembers()) {
209 $this->parent_gui->handleAccessViolation();
212 $members = $iass->loadMembers();
214 if (count($user_ids) === 0) {
217 foreach ($user_ids as $user_id) {
219 if (!$members->userAllreadyMember(
$user)) {
220 $members = $members->withAdditionalUser(
$user);
225 $members->updateStorageAndRBAC($iass->membersStorage(), $iass->accessHandler());
227 $this->ctrl->setParameter($this,
'failure',
$failure);
228 $this->ctrl->redirectByClass(array(get_class($this->parent_gui),get_class($this)),
'addedUsers');
236 if (!$this->iass_access->mayEditMembers()) {
237 $this->parent_gui->handleAccessViolation();
239 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
242 $confirm->setHeaderText($this->
txt(
'iass_remove_user_qst'));
243 $confirm->setFormAction($this->ctrl->getFormAction($this));
244 $confirm->setConfirm($this->
txt(
'remove'),
'removeUser');
245 $confirm->setCancel($this->
txt(
'cancel'),
'view');
246 $this->tpl->setContent($confirm->getHTML());
254 if (!$this->iass_access->mayEditMembers()) {
255 $this->parent_gui->handleAccessViolation();
257 $usr_id =
$_POST[
'usr_id'];
260 ->withoutPresentUser(
new ilObjUser($usr_id))
261 ->updateStorageAndRBAC($iass->membersStorage(), $iass->accessHandler());
263 ilUtil::sendSuccess($this->
txt(
"iass_user_removed"),
true);
264 $this->ctrl->redirectByClass(array(get_class($this->parent_gui),get_class($this)),
'view');
274 $vc_factory = $this->factory->viewControl();
290 return $vc_factory->mode(
294 ->withActive($active);
299 $target = $link = $this->ctrl->getLinkTargetByClass(
"ilIndividualAssessmentMembersGUI",
"view");
300 return $vc_factory->sortation(
303 ->withTargetURL(
$target, self::F_SORT)
304 ->withLabel($this->
txt(
"iass_sort"));
338 return $this->
txt(
"iass_filter_not_started");
341 return $this->
txt(
"iass_filter_not_finalized");
344 return $this->
txt(
"iass_filter_finalized");
347 return $this->
txt(
"iass_filter_failed");
350 return $this->
txt(
"iass_filter_all");
359 $this->ctrl->setParameterByClass(
"ilIndividualAssessmentMembersGUI", self::F_STATUS, $value);
360 $link = $this->ctrl->getLinkTargetByClass(
"ilIndividualAssessmentMembersGUI",
"view");
361 $this->ctrl->setParameterByClass(
"ilIndividualAssessmentMembersGUI", self::F_STATUS, null);
372 if (isset($get[self::F_STATUS])
373 && $get[self::F_STATUS] !=
"" 375 $get[self::F_STATUS],
384 return $get[self::F_STATUS];
393 self::S_NAME_ASC => $this->
txt(
"iass_sort_name_asc"),
394 self::S_NAME_DESC => $this->
txt(
"iass_sort_name_desc"),
395 self::S_EXAMINER_ASC => $this->
txt(
"iass_sort_examiner_login_asc"),
396 self::S_EXAMINER_DESC => $this->
txt(
"iass_sort_examiner_login_desc"),
397 self::S_CHANGETIME_ASC => $this->
txt(
"iass_sort_changetime_asc"),
398 self::S_CHANGETIME_DESC => $this->
txt(
"iass_sort_changetime_desc")
408 if (isset($get[self::F_SORT])
409 && $get[self::F_SORT] !=
"" 415 self::S_EXAMINER_ASC,
416 self::S_EXAMINER_DESC,
417 self::S_CHANGETIME_ASC,
418 self::S_CHANGETIME_DESC
422 return $get[self::F_SORT];
430 return $this->lng->txt($code);
getLinkForStatusFilter($value)
addUsers(array $user_ids)
Add users to corresponding iass-object.
static _lookupFullname($a_user_id)
Lookup Full Name.
__construct(ilObjIndividualAssessmentGUI $a_parent_gui, int $a_ref_id)
getActiveLabelForModeByFilter($filter)
For the purpose of streamlining the grading and learning-process status definition outside of tests...
removeUser()
Remove users from corresponding iass-object.
getSortationControl(ViewControl\Factory $vc_factory)
addUsersFromSearch(array $user_ids)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
getModeControl(array $get, ViewControl\Factory $vc_factory)
const LP_ASSESSMENT_NOT_COMPLETED
This is how the factory for UI elements looks.
For the purpose of streamlining the grading and learning-process status definition outside of tests...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
getViewControls(array $get)
filterViewableOrGradeableEntries(array $entries)
This describes a Sortation Control.
This describes a Mode Control.
static fillAutoCompleteToolbar($parent_object, ilToolbarGUI $toolbar=null, $a_options=array(), $a_sticky=false)
fill toolbar with
if(empty($password)) $table
removeUserConfirmation()
Display confirmation form for user might be removed.
For the purpose of streamlining the grading and learning-process status definition outside of tests...
getFilterValue(array $get)
Confirmation screen class.
static updateLPStatusByIds($iass_id, array $usr_ids)