5 declare(strict_types=1);
89 $this->toolbar = $ilToolbar;
94 $this->sp_user_assignment_db = $sp_user_assignment_db;
97 $this->repository_search_gui = $repository_search_gui;
98 $this->individual_plan_gui = $individual_plan_gui;
100 $this->progress_objects = array();
101 $this->position_based_access = $position_based_access;
102 $this->
object = null;
109 $this->parent_gui = $a_parent_gui;
114 $this->ref_id = $ref_id;
120 $cmd = $this->ctrl->getCmd();
121 $next_class = $this->ctrl->getNextClass($this);
127 # TODO: Check permission of user!! 129 switch ($next_class) {
130 case "ilstudyprogrammerepositorysearchgui":
131 $this->repository_search_gui->setCallback($this,
"addUsers");
132 $this->ctrl->setReturn($this,
"view");
133 $this->ctrl->forwardCommand($this->repository_search_gui);
135 case "ilobjstudyprogrammeindividualplangui":
136 $this->individual_plan_gui->setParentGUI($this);
137 $this->individual_plan_gui->setRefId($this->ref_id);
138 $this->ctrl->forwardCommand($this->individual_plan_gui);
140 case "ilstudyprogrammemailmembersearchgui":
141 $this->tabs->clearTargets();
142 $this->tabs->setBackTarget(
143 $this->lng->txt(
'btn_back'),
147 $mail_search =
$dic[
'ilStudyProgrammeMailMemberSearchGUI'];
149 $mail_search->setBackTarget(
150 $this->ctrl->getLinkTarget($this, $this->getDefaultCommand())
152 $this->ctrl->forwardCommand($mail_search);
154 case "ilstudyprogrammechangeexpiredategui":
155 $this->tabs->clearTargets();
156 $this->tabs->setBackTarget(
157 $this->lng->txt(
'btn_back'),
161 $gui =
$dic[
'ilStudyProgrammeChangeExpireDateGUI'];
162 $gui->setRefId($this->ref_id);
164 $this->ctrl->forwardCommand($gui);
166 case "ilstudyprogrammechangedeadlinegui":
167 $this->tabs->clearTargets();
168 $this->tabs->setBackTarget(
169 $this->lng->txt(
'btn_back'),
173 $gui =
$dic[
'ilStudyProgrammeChangeDeadlineGUI'];
174 $gui->setRefId($this->ref_id);
176 $this->ctrl->forwardCommand($gui);
181 case "markAccredited":
182 case "markAccreditedMulti":
183 case "unmarkAccredited":
184 case "unmarkAccreditedMulti":
186 case "removeUserMulti":
187 case "addUsersWithAcknowledgedCourses":
188 case "markNotRelevantMulti":
189 case "markRelevantMulti":
190 case "updateFromCurrentPlanMulti":
193 case "changeDeadlineMulti":
194 case "changeExpireDateMulti":
195 $cont = $this->$cmd();
196 $this->tpl->setContent($cont);
199 throw new ilException(
"ilObjStudyProgrammeMembersGUI: " .
200 "Command not supported: $cmd");
205 "ilObjStudyProgrammeMembersGUI: Can't forward to next class $next_class" 217 $assignments = $this->
object->getAssignments();
233 $this->sp_user_progress_db,
234 $this->position_based_access
244 protected function view() : string
255 return $table->getHTML();
261 $table->resetOffset();
262 $table->writeFilterToSession();
263 $this->ctrl->redirect($this,
"view");
269 $table->resetOffset();
270 $table->resetFilter();
271 $this->ctrl->redirect($this,
"view");
287 $completed_courses = array();
288 foreach ($users as $user_id) {
289 $completed_crss = $prg->getCompletedCourses((
int) $user_id);
290 if ($completed_crss) {
291 $completed_courses[$user_id] = $completed_crss;
295 if (count($completed_courses) > 0) {
302 $this->ctrl->redirect($this,
"view");
316 "tpl.acknowledge_completed_courses.html",
319 "Modules/StudyProgramme" 321 $tpl->setVariable(
"TITLE", $this->lng->txt(
"prg_acknowledge_completed_courses"));
322 $tpl->setVariable(
"CAPTION_ADD", $this->lng->txt(
"btn_next"));
323 $tpl->setVariable(
"CAPTION_CANCEL", $this->lng->txt(
"cancel"));
324 $tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
325 $tpl->setVariable(
"ADD_CMD",
"addUsersWithAcknowledgedCourses");
326 $tpl->setVariable(
"CANCEL_CMD",
"view");
328 foreach ($completed_courses as $user_id => $completed_courses) {
330 $tpl->setCurrentBlock(
"usr_section");
331 $tpl->setVariable(
"FIRSTNAME", $names[
"firstname"]);
332 $tpl->setVariable(
"LASTNAME", $names[
"lastname"]);
338 $tpl->setVariable(
"TABLE", $table->getHTML());
339 $tpl->parseCurrentBlock();
342 foreach ($users as $usr_id) {
343 $tpl->setCurrentBlock(
"usr_ids_section");
344 $tpl->setVariable(
"USR_ID", $usr_id);
345 $tpl->parseCurrentBlock();
348 $this->tpl->setContent(
$tpl->get());
360 $completed_programmes =
$_POST[
"courses"];
361 if (is_array($completed_programmes)) {
362 foreach ($completed_programmes as $user_id => $prg_ref_ids) {
363 $ass_id = $assignments[$user_id]->getId();
364 foreach ($prg_ref_ids as $ids) {
365 [$prg_ref_id, $crs_id, $crsr_id] = explode(
";", $ids);
367 $progress = $prg->getProgressForAssignment((
int) $ass_id);
368 $progress->setLPCompleted((
int) $crsr_id, $user_id);
373 $this->ctrl->redirect($this,
"view");
383 $to_add = $this->position_based_access->filterUsersAccessibleForOperation(
388 $cnt_not_added = count($users) - count($to_add);
389 if ($cnt_not_added > 0) {
392 $this->lng->txt(
'could_not_add_users_no_permissons'),
413 $assignments = array();
415 foreach ($users as $user_id) {
416 $assignments[$user_id] = $prg->assignUser((
int) $user_id);
419 if (count($users) == 1) {
420 ilUtil::sendSuccess($this->lng->txt(
"prg_added_member"),
true);
422 if (count($users) > 1) {
423 ilUtil::sendSuccess($this->lng->txt(
"prg_added_members"),
true);
436 $prgrs_ids =
$_POST[
'prgs_ids'];
437 if ($prgrs_ids === null) {
439 $this->ctrl->redirect($this,
"view");
446 $prgrs_ids =
$_GET[
'prgrs_ids'];
447 if (is_null($prgrs_ids)) {
450 return explode(
',', $prgrs_ids);
461 $this->ctrl->redirect($this,
"view");
471 foreach ($prgrs_ids as $key => $prgrs_id) {
483 $this->ctrl->redirect($this,
"view");
492 $usr_id = $prgrs->getUserId();
494 $this->object->getAccessControlByOrguPositionsGlobal() &&
499 'No permission to edit progress of user' 502 $prgrs->markAccredited($this->
user->getId());
504 $ass = $this->sp_user_assignment_db->getInstanceById($prgrs->getAssignmentId());
516 $this->ctrl->redirect($this,
"view");
525 $usr_id = $prgrs->getUserId();
527 $this->object->getAccessControlByOrguPositionsGlobal() &&
532 'No permission to edit progress of user' 535 $prgrs->unmarkAccredited();
537 $ass = $this->sp_user_assignment_db->getInstanceById($prgrs->getAssignmentId());
548 foreach ($prgrs_ids as $key => $prgrs_id) {
563 $this->ctrl->redirect($this,
"view");
573 foreach ($prgrs_ids as $key => $prgrs_id) {
575 $usr_id = $prgrs->getUserId();
576 if ($this->object->getAccessControlByOrguPositionsGlobal() &&
591 $prgrs->markRelevant($this->
user->getId());
598 $this->ctrl->redirect($this,
"view");
608 foreach ($prgrs_ids as $key => $prgrs_id) {
610 $usr_id = $prgrs->getUserId();
611 if ($this->object->getAccessControlByOrguPositionsGlobal() &&
618 $prgrs->markNotRelevant($this->
user->getId());
625 $this->ctrl->redirect($this,
"view");
634 $not_updated = array();
636 foreach ($prgrs_ids as $key => $prgrs_id) {
640 $ass = $this->sp_user_assignment_db->getInstanceById($prgrs->getAssignmentId());
641 $prg = $ass->getStudyProgramme();
642 if ($prg->getRefId() != $this->ref_id) {
643 $not_updated[] = $prgrs_id;
650 if (count($not_updated) == count($prgrs_ids)) {
652 } elseif (count($not_updated) > 0) {
658 $this->ctrl->redirect($this,
"view");
663 $this->ctrl->setParameterByClass(
664 'ilStudyProgrammeChangeDeadlineGUI',
669 $link = $this->ctrl->getLinkTargetByClass(
670 'ilStudyProgrammeChangeDeadlineGUI',
671 'showDeadlineConfig',
677 $this->ctrl->clearParameterByClass(
'ilStudyProgrammeChangeDeadlineGUI',
'prgrs_ids');
678 $this->ctrl->redirectToURL($link);
683 $this->ctrl->setParameterByClass(
684 'ilStudyProgrammeChangeExpireDateGUI',
689 $link = $this->ctrl->getLinkTargetByClass(
690 'ilStudyProgrammeChangeExpireDateGUI',
691 'showExpireDateConfig',
697 $this->ctrl->clearParameterByClass(
'ilStudyProgrammeChangeExpireDateGUI',
'prgrs_ids');
698 $this->ctrl->redirectToURL($link);
707 $this->
remove($prgrs_id);
709 $this->ctrl->redirect($this,
"view");
718 $not_removed = array();
719 foreach ($prgrs_ids as $key => $prgrs_id) {
721 $this->
remove((int) $prgrs_id);
723 $not_removed[] = $prgrs_id;
726 if (count($not_removed) == count($prgrs_ids)) {
728 } elseif (count($not_removed) > 0) {
733 $this->ctrl->redirect($this,
"view");
739 protected function remove(
int $prgrs_id) :
void 742 $usr_id = $prgrs->getUserId();
744 $this->object->getAccessControlByOrguPositionsGlobal() &&
749 'No permission to manage membership of user' 752 $ass = $this->sp_user_assignment_db->getInstanceById($prgrs->getAssignmentId());
753 $prg = $ass->getStudyProgramme();
754 if ($prg->getRefId() != $this->ref_id) {
755 throw new ilException(
"Can only remove users from the node they where assigned to.");
765 if (!array_key_exists($prgrs_id, $this->progress_objects)) {
766 $this->progress_objects[$prgrs_id] = $this->sp_user_progress_db->getInstanceById(
770 return $this->progress_objects[$prgrs_id];
778 if (!is_numeric(
$_GET[
"prgrs_id"])) {
779 throw new ilException(
"Expected integer 'prgrs_id'");
781 return (
int)
$_GET[
"prgrs_id"];
789 ilUtil::sendSuccess($this->lng->txt(
"prg_$lng_var"),
true);
806 "auto_complete_name" => $this->lng->txt(
"user"),
807 "submit_name" => $this->lng->txt(
"add"),
820 $this->lng->txt(
'mail_members'),
821 $this->ctrl->getLinkTargetByClass(
822 'ilStudyProgrammeMailMemberSearchGUI',
823 'showSelectableUsers' 834 if ($ref_id === null) {
835 $ref_id = $this->ref_id;
847 $target_name =
"markAccredited";
850 $target_name =
"unmarkAccredited";
853 return $this->individual_plan_gui->getLinkTargetView($ass_id);
855 $target_name =
"removeUser";
861 $this->ctrl->setParameter($this,
"prgrs_id", $prgrs_id);
862 $link = $this->ctrl->getLinkTarget($this, $target_name);
863 $this->ctrl->setParameter($this,
"prgrs_id", null);
869 return array_unique(array_merge(
881 if (!$this->view_members) {
882 $this->view_members =
883 array_unique(array_merge(
884 $this->position_based_access->getUsersInPrgAccessibleForOperation(
897 if (!$this->read_learning_progress) {
898 $this->read_learning_progress =
899 array_unique(array_merge(
900 $this->position_based_access->getUsersInPrgAccessibleForOperation(
913 if (!$this->view_individual_plan) {
914 $this->view_individual_plan =
915 array_unique(array_merge(
916 $this->position_based_access->getUsersInPrgAccessibleForOperation(
929 if (!$this->edit_individual_plan) {
930 $this->edit_individual_plan =
931 $this->position_based_access->getUsersInPrgAccessibleForOperation(
942 if (!$this->manage_members) {
943 $this->manage_members =
944 $this->position_based_access->getUsersInPrgAccessibleForOperation(
954 return $this->access->checkAccessOfUser(
955 $this->
user->getId(),
958 $this->
object->getRefId()
964 return $this->
object->getMembers();
970 || $this->position_based_access->isUserAccessibleForOperationAtPrg($usr_id, $this->
object, $operation);
975 $ass->updateFromProgram();
addUsers(array $users)
Assigns a users to SP.
static _lookupName($a_user_id)
lookup user name
const OP_VIEW_INDIVIDUAL_PLAN
getStudyProgramme(int $ref_id=null)
Get studyprogramm object for ref_id Use this ref_id if argument is null.
viewCompletedCourses(array $completed_courses, array $users)
Shows list of completed courses for each user if he should be assigned.
This class provides processing control methods.
updateDeadlineFromProgram()
markNotRelevantMulti()
Mark SP as not relevant for users.
getStudyProgramme()
Get the program node where this assignment was made.
getProgressObject(int $prgrs_id)
Get progress object for prgrs id.
Storage implementation for ilStudyProgrammeUserProgress.
markAccreditedMulti()
Mark SP for users accredited.
markAccreditedById(int $prgrs_id)
Accredited SP.
setParentGUI(ilObjectGUI $a_parent_gui)
removeUserMulti()
Remove user from SP.
static fillAutoCompleteToolbar($parent_object, ilToolbarGUI $toolbar=null, $a_options=array(), $a_sticky=false)
This is just the same as in the parent class, except for the hardcoded class name.
removeUser()
Remove single user from SP.
addUsersWithAcknowledgedCourses()
Assign users if they have any completed course.
Class ilObjStudyProgrammeIndividualPlanGUI.
markRelevantMulti()
Mark SP as relevant for users.
Class ilObjStudyProgrammeMembersTableGUI.
static getInstanceByRefId($a_ref_id)
initMailToMemberButton(ilToolbarGUI $toolbar, bool $separator=false)
const OP_EDIT_INDIVIDUAL_PLAN
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
const ACTION_SHOW_INDIVIDUAL_PLAN
getAddableUsers(array $users)
const OP_READ_LEARNING_PROGRESS
const ACTION_UNMARK_ACCREDITED
markAccredited()
Mark SP for single user accredited.
getLinkTargetForAction(string $action, int $prgrs_id, int $ass_id)
Get the link target for an action on user progress.
showInfoMessage(string $lng_var)
Shows ilUtil failed message.
_addUsers(array $users)
Add users to SP.
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjId($a_id)
view()
Shows table with all members of the SP.
getPrgrsId()
Get current prgrs_id from URL.
ilObjStudyProgrammeMembersGUI: ilStudyProgrammeRepositorySearchGUI ilObjStudyProgrammeMembersGUI: il...
isOperationAllowedForUser(int $usr_id, string $operation)
getPostPrgsIds()
Get post prgs ids.
updateUserAssignmentFromProgramm(ilStudyProgrammeUserAssignment $ass)
updateFromCurrentPlanMulti()
Update user plan from current SP structure if they has no individual plan.
TableGUI class for acknowledgement of completed courses for new members of a study programme...
Custom repository search gui class for study programme to make it possible to get a handle on users s...
showSuccessMessage(string $lng_var)
Shows ilUtil success message.
loadLanguageModule($a_module)
__construct(\ilGlobalTemplateInterface $tpl, \ilCtrl $ilCtrl, \ilToolbarGUI $ilToolbar, \ilAccess $access, \ilLanguage $lng, \ilObjUser $user, \ilTabsGUI $tabs, ilStudyProgrammeUserProgressDB $sp_user_progress_db, ilStudyProgrammeUserAssignmentDB $sp_user_assignment_db, ilStudyProgrammeRepositorySearchGUI $repository_search_gui, ilObjStudyProgrammeIndividualPlanGUI $individual_plan_gui, ilStudyProgrammePositionBasedAccess $position_based_access)
unmarkAccreditedByProgressId(int $prgrs_id)
Deaccredited SP.
updateValidityFromProgram()
const ACTION_MARK_ACCREDITED
unmarkAccredited()
Unmark SP for single user accredited.
Represents one assignment of a user to a study programme.
unmarkAccreditedMulti()
Unmark SP for users accredited.
Represents the progress of a user at one node of a study programme.