ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilObjStudyProgrammeMembersGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 2015 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4 
5 declare(strict_types=1);
6 
17 {
18  const DEFAULT_CMD = "view";
19 
20  const ACTION_MARK_ACCREDITED = "mark_accredited";
21  const ACTION_UNMARK_ACCREDITED = "unmark_accredited";
22  const ACTION_SHOW_INDIVIDUAL_PLAN = "show_individual_plan";
23  const ACTION_REMOVE_USER = "remove_user";
24  const ACTION_CHANGE_EXPIRE_DATE = "change_expire_date";
25  const ACTION_CHANGE_DEADLINE = "change_deadline";
26 
27  const F_ALL_PROGRESS_IDS = 'all_progress_ids';
28  const F_SELECTED_PROGRESS_IDS = 'prgs_ids';
29 
33  public $ctrl;
34 
38  public $tpl;
39 
43  public $access;
44 
48  public $object;
49 
53  public $lng;
54 
58  public $toolbar;
59 
63  public $user;
64 
68  protected $tabs;
69 
73  protected $parent_gui;
74 
79 
83  protected $progress_objects;
84 
88  protected $messages;
89 
93  protected $data_factory;
94 
98  protected $permissions;
99 
100  public function __construct(
102  \ilCtrl $ilCtrl,
103  \ilToolbarGUI $ilToolbar,
104  \ilLanguage $lng,
105  \ilObjUser $user,
106  \ilTabsGUI $tabs,
108  ilStudyProgrammeAssignmentRepository $sp_user_assignment_db,
109  ilStudyProgrammeRepositorySearchGUI $repository_search_gui,
110  ilObjStudyProgrammeIndividualPlanGUI $individual_plan_gui,
112  \ILIAS\Data\Factory $data_factory,
113  ilConfirmationGUI $confirmation_gui
114  ) {
115  $this->tpl = $tpl;
116  $this->ctrl = $ilCtrl;
117  $this->toolbar = $ilToolbar;
118  $this->lng = $lng;
119  $this->user = $user;
120  $this->tabs = $tabs;
121  $this->sp_user_assignment_db = $sp_user_assignment_db;
122  $this->sp_user_progress_db = $sp_user_progress_db;
123  $this->messages = $messages;
124  $this->data_factory = $data_factory;
125  $this->confirmation_gui = $confirmation_gui;
126 
127  $this->repository_search_gui = $repository_search_gui;
128  $this->individual_plan_gui = $individual_plan_gui;
129 
130  $this->progress_objects = array();
131  $this->object = null;
132  $this->permissions = null;
133 
134  $lng->loadLanguageModule("prg");
135  }
136 
137  public function setParentGUI(ilObjectGUI $a_parent_gui) : void
138  {
139  $this->parent_gui = $a_parent_gui;
140  }
141 
142  public function setRefId(int $ref_id) : void
143  {
144  $this->ref_id = $ref_id;
145  $this->object = \ilObjStudyProgramme::getInstanceByRefId($ref_id);
146  $this->permissions = ilStudyProgrammeDIC::specificDicFor($this->object)['permissionhelper'];
147  }
148 
149  public function executeCommand() : void
150  {
151  $cmd = $this->ctrl->getCmd();
152  $next_class = $this->ctrl->getNextClass($this);
153 
154  if ($cmd == "") {
155  $cmd = $this->getDefaultCommand();
156  }
157 
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);
163  break;
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);
168  break;
169  case "ilstudyprogrammemailmembersearchgui":
170  $this->tabs->clearTargets();
171  $this->tabs->setBackTarget(
172  $this->lng->txt('btn_back'),
173  $this->ctrl->getLinkTarget($this, $this->getDefaultCommand())
174  );
176  $mail_search = $dic['ilStudyProgrammeMailMemberSearchGUI'];
177  $mail_search->setAssignments($this->getAssignmentsById());
178  $mail_search->setBackTarget(
179  $this->ctrl->getLinkTarget($this, $this->getDefaultCommand())
180  );
181  $this->ctrl->forwardCommand($mail_search);
182  break;
183  case "ilstudyprogrammechangeexpiredategui":
184  $this->tabs->clearTargets();
185  $this->tabs->setBackTarget(
186  $this->lng->txt('btn_back'),
187  $this->ctrl->getLinkTarget($this, $this->getDefaultCommand())
188  );
190  $gui = $dic['ilStudyProgrammeChangeExpireDateGUI'];
191  $gui->setRefId($this->ref_id);
192  $gui->setProgressIds($this->getGetPrgsIds());
193  $this->ctrl->forwardCommand($gui);
194  break;
195  case "ilstudyprogrammechangedeadlinegui":
196  $this->tabs->clearTargets();
197  $this->tabs->setBackTarget(
198  $this->lng->txt('btn_back'),
199  $this->ctrl->getLinkTarget($this, $this->getDefaultCommand())
200  );
202  $gui = $dic['ilStudyProgrammeChangeDeadlineGUI'];
203  $gui->setRefId($this->ref_id);
204  $gui->setProgressIds($this->getGetPrgsIds());
205  $this->ctrl->forwardCommand($gui);
206  break;
207  case false:
208  switch ($cmd) {
209  case "view":
210  case "markAccredited":
211  case "markAccreditedMulti":
212  case "unmarkAccredited":
213  case "unmarkAccreditedMulti":
214  case "removeUser":
215  case "removeUserMulti":
216  case "addUsersWithAcknowledgedCourses":
217  case "markNotRelevantMulti":
218  case "markRelevantMulti":
219  case "updateFromCurrentPlanMulti":
220  case "applyFilter":
221  case "resetFilter":
222  case "changeDeadlineMulti":
223  case "changeExpireDateMulti":
224  $cont = $this->$cmd();
225  $this->tpl->setContent($cont);
226  break;
227  case "confirmedRemoveUsers":
228  $this->confirmedRemoveUsers();
229  break;
230  default:
231  throw new ilException("ilObjStudyProgrammeMembersGUI: " .
232  "Command not supported: $cmd");
233  }
234  break;
235  default:
236  throw new ilException(
237  "ilObjStudyProgrammeMembersGUI: Can't forward to next class $next_class"
238  );
239  }
240  }
241 
242  protected function getDefaultCommand() : string
243  {
244  return self::DEFAULT_CMD;
245  }
246 
247  protected function getAssignmentsById() : array
248  {
249  $assignments = $this->object->getAssignments();
250 
251  return array_filter($assignments, function (ilStudyProgrammeAssignment $assignment) {
252  return $assignment->getRootId() == $this->object->getId();
253  });
254  }
255 
257  {
258  $prg_id = ilObject::_lookupObjId($this->ref_id);
259  $table = new ilStudyProgrammeMembersTableGUI(
260  $prg_id,
261  $this->ref_id,
262  $this,
263  "view",
264  "",
265  $this->sp_user_progress_db,
266  $this->permissions,
267  $this->data_factory
268  );
269  return $table;
270  }
271 
277  protected function view() : string
278  {
279  if ($this->getStudyProgramme()->isActive()
280  && $this->permissions->may(ilOrgUnitOperation::OP_MANAGE_MEMBERS)
281  ) {
282  $this->initSearchGUI();
283  $this->initMailToMemberButton($this->toolbar, true);
284  }
285 
286  if (!$this->getStudyProgramme()->isActive()) {
287  ilUtil::sendInfo($this->lng->txt("prg_no_members_not_active"));
288  }
289  $table = $this->getMembersTableGUI();
290  return $table->getHTML();
291  }
292 
293  public function applyFilter() : void
294  {
295  $table = $this->getMembersTableGUI();
296  $table->resetOffset();
297  $table->writeFilterToSession();
298  $this->ctrl->redirect($this, "view");
299  }
300 
301  public function resetFilter() : void
302  {
303  $table = $this->getMembersTableGUI();
304  $table->resetOffset();
305  $table->resetFilter();
306  $this->ctrl->redirect($this, "view");
307  }
308 
314  public function addUsers(array $user_ids) : bool
315  {
316  $prg = $this->getStudyProgramme();
317  $user_ids = $this->getAddableUsers($user_ids);
318 
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;
324  }
325  }
326 
327  if (count($completed_courses) > 0) {
328  $this->viewCompletedCourses($completed_courses, $user_ids);
329  return true;
330  }
331 
332  $this->_addUsers($user_ids);
333 
334  $this->ctrl->redirect($this, "view");
335  }
336 
345  public function viewCompletedCourses(array $completed_courses, array $users) : void
346  {
347  $tpl = new ilTemplate(
348  "tpl.acknowledge_completed_courses.html",
349  true,
350  true,
351  "Modules/StudyProgramme"
352  );
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");
359 
360  foreach ($completed_courses as $user_id => $completed_courses) {
361  $names = ilObjUser::_lookupName($user_id);
362  $tpl->setCurrentBlock("usr_section");
363  $tpl->setVariable("FIRSTNAME", $names["firstname"]);
364  $tpl->setVariable("LASTNAME", $names["lastname"]);
366  $this,
367  $user_id,
368  $completed_courses
369  );
370  $tpl->setVariable("TABLE", $table->getHTML());
371  $tpl->parseCurrentBlock();
372  }
373 
374  foreach ($users as $usr_id) {
375  $tpl->setCurrentBlock("usr_ids_section");
376  $tpl->setVariable("USR_ID", $usr_id);
377  $tpl->parseCurrentBlock();
378  }
379 
380  $this->tpl->setContent($tpl->get());
381  }
382 
386  public function addUsersWithAcknowledgedCourses() : void
387  {
388  $users = $_POST["users"];
389  $users = $this->getAddableUsers($users);
390  $assignments = $this->_addUsers($users);
391  $completed_programmes = $_POST["courses"];
392 
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);
398  $prg = $this->getStudyProgramme((int) $prg_ref_id);
399 
400  if ($prg->isActive()) {
401  $progress = $prg->getProgressForAssignment((int) $ass_id);
402  $prg->succeed($progress->getId(), (int) $crsr_id);
403  }
404  }
405  }
406  }
407 
408  $this->ctrl->redirect($this, "view");
409  }
410 
414  protected function getAddableUsers(array $users) : array
415  {
416  $to_add = $this->permissions->filterUserIds(
417  $users,
419  );
420 
421  $cnt_not_added = count($users) - count($to_add);
422  if ($cnt_not_added > 0) {
424  sprintf(
425  $this->lng->txt('could_not_add_users_no_permissons'),
426  $cnt_not_added
427  ),
428  true
429  );
430  }
431  return $to_add;
432  }
433 
441  protected function _addUsers(array $user_ids) : array
442  {
443  $prg = $this->getStudyProgramme();
444  $assignments = array();
445 
446  foreach ($user_ids as $user_id) {
447  $assignments[$user_id] = $prg->assignUser((int) $user_id);
448  }
449 
450  if (count($assignments) == 1) {
451  ilUtil::sendSuccess($this->lng->txt("prg_added_member"), true);
452  }
453  if (count($assignments) > 1) {
454  ilUtil::sendSuccess($this->lng->txt("prg_added_members"), true);
455  }
456 
457  return $assignments;
458  }
459 
463  protected function getPostPrgsIds() : array
464  {
465  if ($_POST['select_cmd_all']) {
466  $prgrs_ids = $_POST[self::F_ALL_PROGRESS_IDS];
467  $prgrs_ids = explode(',', $prgrs_ids);
468  } else {
469  $prgrs_ids = $_POST[self::F_SELECTED_PROGRESS_IDS];
470  }
471  if ($prgrs_ids === null) {
472  $this->showInfoMessage("no_user_selected");
473  $this->ctrl->redirect($this, "view");
474  }
475  return array_map('intval', $prgrs_ids);
476  }
477 
478  protected function getGetPrgsIds() : array
479  {
480  $prgrs_ids = $_GET['prgrs_ids'];
481  if (is_null($prgrs_ids)) {
482  return array();
483  }
484  return explode(',', $prgrs_ids);
485  }
486 
487  protected function getPrgrsId() : int
488  {
489  if (!is_numeric($_GET["prgrs_id"])) {
490  throw new ilException("Expected integer 'prgrs_id'");
491  }
492  return (int) $_GET["prgrs_id"];
493  }
494 
495 
496  protected function markAccredited() : void
497  {
498  $prgrs_id = $this->getPrgrsId();
499  $msgs = $this->getMessageCollection('msg_mark_accredited');
500  $this->markAccreditedByProgressId($prgrs_id, $msgs);
501  $this->showMessages($msgs);
502  $this->ctrl->redirect($this, "view");
503  }
504 
505  protected function markAccreditedMulti() : void
506  {
507  $prgrs_ids = $this->getPostPrgsIds();
508  $msgs = $this->getMessageCollection('msg_mark_accredited');
509  foreach ($prgrs_ids as $key => $prgrs_id) {
510  $this->markAccreditedByProgressId((int) $prgrs_id, $msgs);
511  }
512  $this->showMessages($msgs);
513  $this->ctrl->redirect($this, "view");
514  }
515 
516  protected function markAccreditedByProgressId(int $prgrs_id, ilPRGMessageCollection $msgs) : void
517  {
518  $prgrs = $this->getProgressObject($prgrs_id);
519  $usr_id = $prgrs->getUserId();
520  if (!$this->mayCurrentUserEditProgress($prgrs_id)) {
521  $msgs->add(false, 'No permission to edit progress of user', (string) $prgrs_id);
522  } else {
523  $programme = $this->getStudyProgramme();
524  $programme->markAccredited($prgrs_id, $this->user->getId(), $msgs);
525  }
526  }
527 
528  protected function unmarkAccredited() : void
529  {
530  $prgrs_id = $this->getPrgrsId();
531  $msgs = $this->getMessageCollection('msg_unmark_accredited');
532  $this->unmarkAccreditedByProgressId($prgrs_id, $msgs);
533  $this->showMessages($msgs);
534  $this->ctrl->redirect($this, "view");
535  }
536 
537  public function unmarkAccreditedMulti() : void
538  {
539  $prgrs_ids = $this->getPostPrgsIds();
540  $msgs = $this->getMessageCollection('msg_unmark_accredited');
541  foreach ($prgrs_ids as $key => $prgrs_id) {
542  $this->unmarkAccreditedByProgressId((int) $prgrs_id, $msgs);
543  }
544  $this->showMessages($msgs);
545  $this->ctrl->redirect($this, "view");
546  }
547 
548  protected function unmarkAccreditedByProgressId(int $prgrs_id, ilPRGMessageCollection $msgs) : void
549  {
550  $prgrs = $this->getProgressObject($prgrs_id);
551  $usr_id = $prgrs->getUserId();
552  if (!$this->mayCurrentUserEditProgress($prgrs_id)) {
553  $msgs->add(false, 'No permission to edit progress of user', (string) $prgrs_id);
554  } else {
555  $programme = $this->getStudyProgramme();
556  $programme->unmarkAccredited($prgrs_id, $this->user->getId(), $msgs);
557  }
558  }
559 
560  public function markRelevantMulti() : void
561  {
562  $prgrs_ids = $this->getPostPrgsIds();
563  $msgs = $this->getMessageCollection('msg_mark_relevant');
564  $programme = $this->getStudyProgramme();
565  foreach ($prgrs_ids as $key => $prgrs_id) {
566  if (!$this->mayCurrentUserEditProgress($prgrs_id)) {
567  $msgs->add(false, 'No permission to edit progress of user', (string) $prgrs_id);
568  } else {
569  $programme->markRelevant($prgrs_id, $this->user->getId(), $msgs);
570  }
571  }
572  $this->showMessages($msgs);
573  $this->ctrl->redirect($this, "view");
574  }
575 
576  public function markNotRelevantMulti() : void
577  {
578  $prgrs_ids = $this->getPostPrgsIds();
579  $msgs = $this->getMessageCollection('msg_mark_not_relevant');
580  $programme = $this->getStudyProgramme();
581  foreach ($prgrs_ids as $key => $prgrs_id) {
582  if (!$this->mayCurrentUserEditProgress($prgrs_id)) {
583  $msgs->add(false, 'No permission to edit progress of user', (string) $prgrs_id);
584  } else {
585  $programme->markNotRelevant($prgrs_id, $this->user->getId(), $msgs);
586  }
587  }
588  $this->showMessages($msgs);
589  $this->ctrl->redirect($this, "view");
590  }
591 
592  public function updateFromCurrentPlanMulti() : void
593  {
594  $prgrs_ids = $this->getPostPrgsIds();
595  $msgs = $this->getMessageCollection('msg_update_from_settings');
596  foreach ($prgrs_ids as $key => $prgrs_id) {
597  if (!$this->mayCurrentUserEditProgress($prgrs_id)) {
598  $msgs->add(false, 'no_permission_to_update_plan_of_user', (string) $prgrs_id);
599  continue;
600  }
601 
602  $this->object->updatePlanFromRepository(
603  $prgrs_id,
604  $this->user->getId(),
605  $msgs
606  );
607  }
608  $this->showMessages($msgs);
609  $this->ctrl->redirect($this, "view");
610  }
611 
612 
613  public function changeDeadlineMulti() : void
614  {
615  $this->ctrl->setParameterByClass(
616  'ilStudyProgrammeChangeDeadlineGUI',
617  'prgrs_ids',
618  implode(',', $this->getPostPrgsIds())
619  );
620 
621  $link = $this->ctrl->getLinkTargetByClass(
622  'ilStudyProgrammeChangeDeadlineGUI',
623  'showDeadlineConfig',
624  '',
625  false,
626  false
627  );
628 
629  $this->ctrl->clearParameterByClass('ilStudyProgrammeChangeDeadlineGUI', 'prgrs_ids');
630  $this->ctrl->redirectToURL($link);
631  }
632 
633  public function changeExpireDateMulti() : void
634  {
635  $this->ctrl->setParameterByClass(
636  'ilStudyProgrammeChangeExpireDateGUI',
637  'prgrs_ids',
638  implode(',', $this->getPostPrgsIds())
639  );
640 
641  $link = $this->ctrl->getLinkTargetByClass(
642  'ilStudyProgrammeChangeExpireDateGUI',
643  'showExpireDateConfig',
644  '',
645  false,
646  false
647  );
648 
649  $this->ctrl->clearParameterByClass('ilStudyProgrammeChangeExpireDateGUI', 'prgrs_ids');
650  $this->ctrl->redirectToURL($link);
651  }
652 
653  public function removeUser() : string
654  {
655  $prgrs_id = $this->getPrgrsId();
656  return $this->confirmRemoveUsers([$prgrs_id]);
657  }
658 
659  protected function removeUserMulti() : string
660  {
661  $prgrs_ids = $this->getPostPrgsIds();
662  return $this->confirmRemoveUsers($prgrs_ids);
663  }
664 
665  protected function confirmedRemoveUsers() : void
666  {
667  $prgrs_ids = $this->getPostPrgsIds();
668  $not_removed = array();
669  foreach ($prgrs_ids as $key => $prgrs_id) {
670  try {
671  $this->remove((int) $prgrs_id);
672  } catch (ilException $e) {
673  $not_removed[] = $prgrs_id;
674  }
675  }
676  if (count($not_removed) == count($prgrs_ids)) {
677  $this->showInfoMessage("remove_users_not_possible");
678  } elseif (count($not_removed) > 0) {
679  $this->showSuccessMessage("remove_users_partial_success");
680  } else {
681  $this->showSuccessMessage("remove_users_success");
682  }
683  $this->ctrl->redirect($this, "view");
684  }
685 
686  protected function confirmRemoveUsers(array $progress_ids) : string
687  {
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');
692 
693  foreach ($progress_ids as $progress_id) {
694  $progress = $this->getProgressObject($progress_id);
695  $user = ilObjUser::_lookupFullname($progress->getUserId());
696  $name = $user . ' (' . $progress->getId() . ')';
697 
698  $this->confirmation_gui->addItem(
699  self::F_SELECTED_PROGRESS_IDS . '[]',
700  $progress_id,
701  $name
702  );
703  }
704  return $this->confirmation_gui->getHTML();
705  }
706 
710  protected function remove(int $prgrs_id) : void
711  {
712  $prgrs = $this->getProgressObject($prgrs_id);
713 
714  if (!in_array(
715  $prgrs->getUserId(),
716  $this->permissions->getUserIdsSusceptibleTo(ilOrgUnitOperation::OP_MANAGE_MEMBERS)
717  )) {
719  'No permission to manage membership of user'
720  );
721  }
722 
723  $ass = $this->sp_user_assignment_db->get($prgrs->getAssignmentId());
724  $prg_ref_id = ilObjStudyProgramme::getRefIdFor($ass->getRootId());
725  if ($prg_ref_id != $this->ref_id) {
726  throw new ilException("Can only remove users from the node they where assigned to.");
727  }
728  $prg = ilObjStudyProgramme::getInstanceByRefId($prg_ref_id);
729  $prg->removeAssignment($ass);
730  }
731 
735  protected function getProgressObject(int $prgrs_id) : ilStudyProgrammeProgress
736  {
737  if (!array_key_exists($prgrs_id, $this->progress_objects)) {
738  $this->progress_objects[$prgrs_id] = $this->sp_user_progress_db->get(
739  $prgrs_id
740  );
741  }
742  return $this->progress_objects[$prgrs_id];
743  }
744 
748  protected function showSuccessMessage(string $lng_var) : void
749  {
750  ilUtil::sendSuccess($this->lng->txt("prg_$lng_var"), true);
751  }
752 
756  protected function showInfoMessage(string $lng_var) : void
757  {
758  ilUtil::sendInfo($this->lng->txt("prg_$lng_var"), true);
759  }
760 
761  protected function initSearchGUI() : void
762  {
764  $this,
765  $this->toolbar,
766  array(
767  "auto_complete_name" => $this->lng->txt("user"),
768  "submit_name" => $this->lng->txt("add"),
769  "add_search" => true
770  )
771  );
772  }
773 
774  protected function initMailToMemberButton(ilToolbarGUI $toolbar, bool $separator = false) : void
775  {
776  if ($separator) {
777  $toolbar->addSeparator();
778  }
779 
780  $toolbar->addButton(
781  $this->lng->txt('mail_assignments'),
782  $this->ctrl->getLinkTargetByClass(
783  'ilStudyProgrammeMailMemberSearchGUI',
784  'showSelectableUsers'
785  )
786  );
787  }
788 
793  public function getStudyProgramme(int $ref_id = null) : ilObjStudyProgramme
794  {
795  if ($ref_id === null) {
796  $ref_id = $this->ref_id;
797  }
799  }
800 
804  public function getLinkTargetForAction(string $action, int $prgrs_id, int $ass_id) : string
805  {
806  switch ($action) {
807  case self::ACTION_MARK_ACCREDITED:
808  $target_name = "markAccredited";
809  break;
810  case self::ACTION_UNMARK_ACCREDITED:
811  $target_name = "unmarkAccredited";
812  break;
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";
817  break;
818  default:
819  throw new ilException("Unknown action: $action");
820  }
821 
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);
825  return $link;
826  }
827 
828 
829  protected function mayCurrentUserEditProgress(int $progress_id) : bool
830  {
831  return in_array(
832  $this->getProgressObject($progress_id)->getUserId(),
833  $this->permissions->getUserIdsSusceptibleTo(ilOrgUnitOperation::OP_EDIT_INDIVIDUAL_PLAN)
834  );
835  }
836 
837  protected function getMessageCollection(string $topic) : ilPRGMessageCollection
838  {
839  return $this->messages->getMessageCollection($topic);
840  }
841 
842  protected function showMessages(ilPRGMessageCollection $msg)
843  {
844  $this->messages->showMessages($msg);
845  }
846 }
static _lookupName($a_user_id)
lookup user name
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.
Tabs GUI.
$_GET["client_id"]
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.
add(bool $success, string $message, string $record_identitifer)
user()
Definition: user.php:4
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.
addUsersWithAcknowledgedCourses()
Assign users if they have any completed course.
Class ilObjStudyProgrammeMembersTableGUI.
static getInstanceByRefId($a_ref_id)
initMailToMemberButton(ilToolbarGUI $toolbar, bool $separator=false)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if($format !==null) $name
Definition: metadata.php:230
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)
__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...
addSeparator()
Add separator.
static specificDicFor(\ilObjStudyProgramme $prg)
Class ilStudyProgrammeProgress.
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.
addButton( $a_txt, $a_cmd, $a_target="", $a_acc_key="", $a_additional_attrs='', $a_id="", $a_class='submit')
Add button to toolbar.
loadLanguageModule($a_module)
Covers the persistence of settings belonging to a study programme (SP).
$dic
Definition: result.php:13
static getRefIdFor(int $obj_id)
markAccreditedByProgressId(int $prgrs_id, ilPRGMessageCollection $msgs)
_addUsers(array $user_ids)
Add users to SP.
addUsers(array $user_ids)
Assigns a users to SP.
$_POST["username"]
Confirmation screen class.
Holds information about multi-actions, mainly in context of member-assignemnts and status changes...