5 declare(strict_types=1);
116 $this->ctrl = $ilCtrl;
117 $this->toolbar = $ilToolbar;
121 $this->sp_user_assignment_db = $sp_user_assignment_db;
125 $this->confirmation_gui = $confirmation_gui;
127 $this->repository_search_gui = $repository_search_gui;
128 $this->individual_plan_gui = $individual_plan_gui;
130 $this->progress_objects = array();
131 $this->
object = null;
132 $this->permissions = null;
139 $this->parent_gui = $a_parent_gui;
144 $this->ref_id = $ref_id;
151 $cmd = $this->ctrl->getCmd();
152 $next_class = $this->ctrl->getNextClass($this);
158 switch ($next_class) {
159 case "ilstudyprogrammerepositorysearchgui":
160 $this->repository_search_gui->setCallback($this,
"addUsers");
161 $this->ctrl->setReturn($this,
"view");
162 $this->ctrl->forwardCommand($this->repository_search_gui);
164 case "ilobjstudyprogrammeindividualplangui":
165 $this->individual_plan_gui->setParentGUI($this);
166 $this->individual_plan_gui->setRefId($this->ref_id);
167 $this->ctrl->forwardCommand($this->individual_plan_gui);
169 case "ilstudyprogrammemailmembersearchgui":
170 $this->tabs->clearTargets();
171 $this->tabs->setBackTarget(
172 $this->lng->txt(
'btn_back'),
176 $mail_search =
$dic[
'ilStudyProgrammeMailMemberSearchGUI'];
178 $mail_search->setBackTarget(
179 $this->ctrl->getLinkTarget($this, $this->getDefaultCommand())
181 $this->ctrl->forwardCommand($mail_search);
183 case "ilstudyprogrammechangeexpiredategui":
184 $this->tabs->clearTargets();
185 $this->tabs->setBackTarget(
186 $this->lng->txt(
'btn_back'),
190 $gui =
$dic[
'ilStudyProgrammeChangeExpireDateGUI'];
191 $gui->setRefId($this->ref_id);
193 $this->ctrl->forwardCommand($gui);
195 case "ilstudyprogrammechangedeadlinegui":
196 $this->tabs->clearTargets();
197 $this->tabs->setBackTarget(
198 $this->lng->txt(
'btn_back'),
202 $gui =
$dic[
'ilStudyProgrammeChangeDeadlineGUI'];
203 $gui->setRefId($this->ref_id);
205 $this->ctrl->forwardCommand($gui);
210 case "markAccredited":
211 case "markAccreditedMulti":
212 case "unmarkAccredited":
213 case "unmarkAccreditedMulti":
215 case "removeUserMulti":
216 case "addUsersWithAcknowledgedCourses":
217 case "markNotRelevantMulti":
218 case "markRelevantMulti":
219 case "updateFromCurrentPlanMulti":
222 case "changeDeadlineMulti":
223 case "changeExpireDateMulti":
224 $cont = $this->$cmd();
225 $this->tpl->setContent($cont);
227 case "confirmedRemoveUsers":
231 throw new ilException(
"ilObjStudyProgrammeMembersGUI: " .
232 "Command not supported: $cmd");
237 "ilObjStudyProgrammeMembersGUI: Can't forward to next class $next_class" 244 return self::DEFAULT_CMD;
249 $assignments = $this->
object->getAssignments();
252 return $assignment->
getRootId() == $this->
object->getId();
265 $this->sp_user_progress_db,
277 protected function view() : string
290 return $table->getHTML();
296 $table->resetOffset();
297 $table->writeFilterToSession();
298 $this->ctrl->redirect($this,
"view");
304 $table->resetOffset();
305 $table->resetFilter();
306 $this->ctrl->redirect($this,
"view");
319 $completed_courses = array();
320 foreach ($user_ids as $user_id) {
321 $completed_crss = $prg->getCompletedCourses((
int) $user_id);
322 if ($completed_crss) {
323 $completed_courses[$user_id] = $completed_crss;
327 if (count($completed_courses) > 0) {
334 $this->ctrl->redirect($this,
"view");
348 "tpl.acknowledge_completed_courses.html",
351 "Modules/StudyProgramme" 353 $tpl->setVariable(
"TITLE", $this->lng->txt(
"prg_acknowledge_completed_courses"));
354 $tpl->setVariable(
"CAPTION_ADD", $this->lng->txt(
"btn_next"));
355 $tpl->setVariable(
"CAPTION_CANCEL", $this->lng->txt(
"cancel"));
356 $tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
357 $tpl->setVariable(
"ADD_CMD",
"addUsersWithAcknowledgedCourses");
358 $tpl->setVariable(
"CANCEL_CMD",
"view");
360 foreach ($completed_courses as $user_id => $completed_courses) {
362 $tpl->setCurrentBlock(
"usr_section");
363 $tpl->setVariable(
"FIRSTNAME", $names[
"firstname"]);
364 $tpl->setVariable(
"LASTNAME", $names[
"lastname"]);
370 $tpl->setVariable(
"TABLE", $table->getHTML());
371 $tpl->parseCurrentBlock();
374 foreach ($users as $usr_id) {
375 $tpl->setCurrentBlock(
"usr_ids_section");
376 $tpl->setVariable(
"USR_ID", $usr_id);
377 $tpl->parseCurrentBlock();
380 $this->tpl->setContent(
$tpl->get());
391 $completed_programmes =
$_POST[
"courses"];
393 if (is_array($completed_programmes)) {
394 foreach ($completed_programmes as $user_id => $prg_ref_ids) {
395 $ass_id = $assignments[$user_id]->getId();
396 foreach ($prg_ref_ids as $ids) {
397 [$prg_ref_id, $crs_id, $crsr_id] = explode(
";", $ids);
400 if ($prg->isActive()) {
401 $progress = $prg->getProgressForAssignment((
int) $ass_id);
402 $prg->succeed($progress->getId(), (int) $crsr_id);
408 $this->ctrl->redirect($this,
"view");
416 $to_add = $this->permissions->filterUserIds(
421 $cnt_not_added = count($users) - count($to_add);
422 if ($cnt_not_added > 0) {
425 $this->lng->txt(
'could_not_add_users_no_permissons'),
444 $assignments = array();
446 foreach ($user_ids as $user_id) {
447 $assignments[$user_id] = $prg->assignUser((
int) $user_id);
450 if (count($assignments) == 1) {
451 ilUtil::sendSuccess($this->lng->txt(
"prg_added_member"),
true);
453 if (count($assignments) > 1) {
454 ilUtil::sendSuccess($this->lng->txt(
"prg_added_members"),
true);
465 if (
$_POST[
'select_cmd_all']) {
466 $prgrs_ids =
$_POST[self::F_ALL_PROGRESS_IDS];
467 $prgrs_ids = explode(
',', $prgrs_ids);
469 $prgrs_ids =
$_POST[self::F_SELECTED_PROGRESS_IDS];
471 if ($prgrs_ids === null) {
473 $this->ctrl->redirect($this,
"view");
475 return array_map(
'intval', $prgrs_ids);
480 $prgrs_ids =
$_GET[
'prgrs_ids'];
481 if (is_null($prgrs_ids)) {
484 return explode(
',', $prgrs_ids);
489 if (!is_numeric(
$_GET[
"prgrs_id"])) {
490 throw new ilException(
"Expected integer 'prgrs_id'");
492 return (
int)
$_GET[
"prgrs_id"];
502 $this->ctrl->redirect($this,
"view");
509 foreach ($prgrs_ids as $key => $prgrs_id) {
513 $this->ctrl->redirect($this,
"view");
519 $usr_id = $prgrs->getUserId();
521 $msgs->
add(
false,
'No permission to edit progress of user', (
string) $prgrs_id);
524 $programme->markAccredited($prgrs_id, $this->
user->getId(), $msgs);
534 $this->ctrl->redirect($this,
"view");
541 foreach ($prgrs_ids as $key => $prgrs_id) {
545 $this->ctrl->redirect($this,
"view");
551 $usr_id = $prgrs->getUserId();
553 $msgs->
add(
false,
'No permission to edit progress of user', (
string) $prgrs_id);
556 $programme->unmarkAccredited($prgrs_id, $this->
user->getId(), $msgs);
565 foreach ($prgrs_ids as $key => $prgrs_id) {
567 $msgs->add(
false,
'No permission to edit progress of user', (
string) $prgrs_id);
569 $programme->markRelevant($prgrs_id, $this->
user->getId(), $msgs);
573 $this->ctrl->redirect($this,
"view");
581 foreach ($prgrs_ids as $key => $prgrs_id) {
583 $msgs->add(
false,
'No permission to edit progress of user', (
string) $prgrs_id);
585 $programme->markNotRelevant($prgrs_id, $this->
user->getId(), $msgs);
589 $this->ctrl->redirect($this,
"view");
596 foreach ($prgrs_ids as $key => $prgrs_id) {
598 $msgs->add(
false,
'no_permission_to_update_plan_of_user', (
string) $prgrs_id);
602 $this->
object->updatePlanFromRepository(
604 $this->
user->getId(),
609 $this->ctrl->redirect($this,
"view");
615 $this->ctrl->setParameterByClass(
616 'ilStudyProgrammeChangeDeadlineGUI',
621 $link = $this->ctrl->getLinkTargetByClass(
622 'ilStudyProgrammeChangeDeadlineGUI',
623 'showDeadlineConfig',
629 $this->ctrl->clearParameterByClass(
'ilStudyProgrammeChangeDeadlineGUI',
'prgrs_ids');
630 $this->ctrl->redirectToURL($link);
635 $this->ctrl->setParameterByClass(
636 'ilStudyProgrammeChangeExpireDateGUI',
641 $link = $this->ctrl->getLinkTargetByClass(
642 'ilStudyProgrammeChangeExpireDateGUI',
643 'showExpireDateConfig',
649 $this->ctrl->clearParameterByClass(
'ilStudyProgrammeChangeExpireDateGUI',
'prgrs_ids');
650 $this->ctrl->redirectToURL($link);
668 $not_removed = array();
669 foreach ($prgrs_ids as $key => $prgrs_id) {
671 $this->
remove((int) $prgrs_id);
673 $not_removed[] = $prgrs_id;
676 if (count($not_removed) == count($prgrs_ids)) {
678 } elseif (count($not_removed) > 0) {
683 $this->ctrl->redirect($this,
"view");
688 $this->confirmation_gui->setFormAction($this->ctrl->getFormAction($this));
689 $this->confirmation_gui->setHeaderText($this->lng->txt(
'confirm_to_remove_selected_assignments'));
690 $this->confirmation_gui->setConfirm($this->lng->txt(
'prg_remove_user'),
'confirmedRemoveUsers');
691 $this->confirmation_gui->setCancel($this->lng->txt(
'cancel'),
'view');
693 foreach ($progress_ids as $progress_id) {
696 $name =
$user .
' (' . $progress->getId() .
')';
698 $this->confirmation_gui->addItem(
699 self::F_SELECTED_PROGRESS_IDS .
'[]',
704 return $this->confirmation_gui->getHTML();
710 protected function remove(
int $prgrs_id) :
void 719 'No permission to manage membership of user' 723 $ass = $this->sp_user_assignment_db->get($prgrs->getAssignmentId());
725 if ($prg_ref_id != $this->ref_id) {
726 throw new ilException(
"Can only remove users from the node they where assigned to.");
729 $prg->removeAssignment($ass);
737 if (!array_key_exists($prgrs_id, $this->progress_objects)) {
738 $this->progress_objects[$prgrs_id] = $this->sp_user_progress_db->get(
742 return $this->progress_objects[$prgrs_id];
750 ilUtil::sendSuccess($this->lng->txt(
"prg_$lng_var"),
true);
767 "auto_complete_name" => $this->lng->txt(
"user"),
768 "submit_name" => $this->lng->txt(
"add"),
781 $this->lng->txt(
'mail_assignments'),
782 $this->ctrl->getLinkTargetByClass(
783 'ilStudyProgrammeMailMemberSearchGUI',
784 'showSelectableUsers' 795 if ($ref_id === null) {
796 $ref_id = $this->ref_id;
807 case self::ACTION_MARK_ACCREDITED:
808 $target_name =
"markAccredited";
810 case self::ACTION_UNMARK_ACCREDITED:
811 $target_name =
"unmarkAccredited";
813 case self::ACTION_SHOW_INDIVIDUAL_PLAN:
814 return $this->individual_plan_gui->getLinkTargetView($ass_id);
815 case self::ACTION_REMOVE_USER:
816 $target_name =
"removeUser";
822 $this->ctrl->setParameter($this,
"prgrs_id", $prgrs_id);
823 $link = $this->ctrl->getLinkTarget($this, $target_name);
824 $this->ctrl->setParameter($this,
"prgrs_id", null);
839 return $this->messages->getMessageCollection($topic);
844 $this->messages->showMessages($msg);
static _lookupName($a_user_id)
lookup user name
confirmRemoveUsers(array $progress_ids)
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.
Util around ilPRGMessageCollection factors and output collections.
static _lookupFullname($a_user_id)
Lookup Full Name.
Class ChatMainBarProvider .
unmarkAccreditedByProgressId(int $prgrs_id, ilPRGMessageCollection $msgs)
getProgressObject(int $prgrs_id)
Get progress object for prgrs id.
mayCurrentUserEditProgress(int $progress_id)
setParentGUI(ilObjectGUI $a_parent_gui)
add(bool $success, string $message, string $record_identitifer)
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.
getMessageCollection(string $topic)
addUsersWithAcknowledgedCourses()
Assign users if they have any completed course.
Class ilObjStudyProgrammeIndividualPlanGUI.
const ACTION_CHANGE_DEADLINE
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_CHANGE_EXPIRE_DATE
getAddableUsers(array $users)
const ACTION_MARK_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.
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjId($a_id)
const ACTION_SHOW_INDIVIDUAL_PLAN
__construct(\ilGlobalTemplateInterface $tpl, \ilCtrl $ilCtrl, \ilToolbarGUI $ilToolbar, \ilLanguage $lng, \ilObjUser $user, \ilTabsGUI $tabs, ilStudyProgrammeProgressRepository $sp_user_progress_db, ilStudyProgrammeAssignmentRepository $sp_user_assignment_db, ilStudyProgrammeRepositorySearchGUI $repository_search_gui, ilObjStudyProgrammeIndividualPlanGUI $individual_plan_gui, ilPRGMessagePrinter $messages, \ILIAS\Data\Factory $data_factory, ilConfirmationGUI $confirmation_gui)
view()
Shows table with all members of the SP.
Represents one assignment of the user to a program tree.
ilObjStudyProgrammeMembersGUI: ilStudyProgrammeRepositorySearchGUI ilObjStudyProgrammeMembersGUI: il...
const F_SELECTED_PROGRESS_IDS
static specificDicFor(\ilObjStudyProgramme $prg)
const ACTION_UNMARK_ACCREDITED
Class ilStudyProgrammeProgress.
updateFromCurrentPlanMulti()
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)
Covers the persistence of settings belonging to a study programme (SP).
static getRefIdFor(int $obj_id)
markAccreditedByProgressId(int $prgrs_id, ilPRGMessageCollection $msgs)
showMessages(ilPRGMessageCollection $msg)
_addUsers(array $user_ids)
Add users to SP.
addUsers(array $user_ids)
Assigns a users to SP.
Confirmation screen class.
Holds information about multi-actions, mainly in context of member-assignemnts and status changes...