ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 {
21  public $ctrl;
22 
26  public $tpl;
27 
31  public $access;
32 
36  public $object;
37 
41  public $lng;
42 
46  public $toolbar;
47 
51  public $user;
52 
56  protected $tabs;
57 
61  protected $parent_gui;
62 
67 
71  protected $progress_objects;
72 
73  public function __construct(
75  \ilCtrl $ilCtrl,
76  \ilToolbarGUI $ilToolbar,
82  ilStudyProgrammeUserAssignmentDB $sp_user_assignment_db,
83  ilStudyProgrammeRepositorySearchGUI $repository_search_gui,
84  ilObjStudyProgrammeIndividualPlanGUI $individual_plan_gui,
85  ilStudyProgrammePositionBasedAccess $position_based_access
86  ) {
87  $this->tpl = $tpl;
88  $this->ctrl = $ilCtrl;
89  $this->toolbar = $ilToolbar;
90  $this->access = $access;
91  $this->lng = $lng;
92  $this->user = $user;
93  $this->tabs = $tabs;
94  $this->sp_user_assignment_db = $sp_user_assignment_db;
95  $this->sp_user_progress_db = $sp_user_progress_db;
96 
97  $this->repository_search_gui = $repository_search_gui;
98  $this->individual_plan_gui = $individual_plan_gui;
99 
100  $this->progress_objects = array();
101  $this->position_based_access = $position_based_access;
102  $this->object = null;
103 
104  $lng->loadLanguageModule("prg");
105  }
106 
107  public function setParentGUI(ilObjectGUI $a_parent_gui) : void
108  {
109  $this->parent_gui = $a_parent_gui;
110  }
111 
112  public function setRefId(int $ref_id) : void
113  {
114  $this->ref_id = $ref_id;
115  $this->object = \ilObjStudyProgramme::getInstanceByRefId($ref_id);
116  }
117 
118  public function executeCommand() : void
119  {
120  $cmd = $this->ctrl->getCmd();
121  $next_class = $this->ctrl->getNextClass($this);
122 
123  if ($cmd == "") {
124  $cmd = "view";
125  }
126 
127  # TODO: Check permission of user!!
128 
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);
134  break;
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);
139  break;
140  case "ilstudyprogrammemailmembersearchgui":
141  $this->tabs->clearTargets();
142  $this->tabs->setBackTarget(
143  $this->lng->txt('btn_back'),
144  $this->ctrl->getLinkTarget($this, $this->getDefaultCommand())
145  );
147  $mail_search = $dic['ilStudyProgrammeMailMemberSearchGUI'];
148  $mail_search->setAssignments($this->getAssignmentsById());
149  $mail_search->setBackTarget(
150  $this->ctrl->getLinkTarget($this, $this->getDefaultCommand())
151  );
152  $this->ctrl->forwardCommand($mail_search);
153  break;
154  case "ilstudyprogrammechangeexpiredategui":
155  $this->tabs->clearTargets();
156  $this->tabs->setBackTarget(
157  $this->lng->txt('btn_back'),
158  $this->ctrl->getLinkTarget($this, $this->getDefaultCommand())
159  );
161  $gui = $dic['ilStudyProgrammeChangeExpireDateGUI'];
162  $gui->setRefId($this->ref_id);
163  $gui->setProgressIds($this->getGetPrgsIds());
164  $this->ctrl->forwardCommand($gui);
165  break;
166  case "ilstudyprogrammechangedeadlinegui":
167  $this->tabs->clearTargets();
168  $this->tabs->setBackTarget(
169  $this->lng->txt('btn_back'),
170  $this->ctrl->getLinkTarget($this, $this->getDefaultCommand())
171  );
173  $gui = $dic['ilStudyProgrammeChangeDeadlineGUI'];
174  $gui->setRefId($this->ref_id);
175  $gui->setProgressIds($this->getGetPrgsIds());
176  $this->ctrl->forwardCommand($gui);
177  break;
178  case false:
179  switch ($cmd) {
180  case "view":
181  case "markAccredited":
182  case "markAccreditedMulti":
183  case "unmarkAccredited":
184  case "unmarkAccreditedMulti":
185  case "removeUser":
186  case "removeUserMulti":
187  case "addUsersWithAcknowledgedCourses":
188  case "markNotRelevantMulti":
189  case "markRelevantMulti":
190  case "updateFromCurrentPlanMulti":
191  case "applyFilter":
192  case "resetFilter":
193  case "changeDeadlineMulti":
194  case "changeExpireDateMulti":
195  $cont = $this->$cmd();
196  $this->tpl->setContent($cont);
197  break;
198  default:
199  throw new ilException("ilObjStudyProgrammeMembersGUI: " .
200  "Command not supported: $cmd");
201  }
202  break;
203  default:
204  throw new ilException(
205  "ilObjStudyProgrammeMembersGUI: Can't forward to next class $next_class"
206  );
207  }
208  }
209 
210  protected function getDefaultCommand() : string
211  {
212  return "view";
213  }
214 
215  protected function getAssignmentsById() : array
216  {
217  $assignments = $this->object->getAssignments();
218 
219  return array_filter($assignments, function (ilStudyProgrammeUserAssignment $assignment) {
220  return $assignment->getStudyProgramme()->getId() == $this->object->getId();
221  });
222  }
223 
225  {
226  $prg_id = ilObject::_lookupObjId($this->ref_id);
227  $table = new ilStudyProgrammeMembersTableGUI(
228  $prg_id,
229  $this->ref_id,
230  $this,
231  "view",
232  "",
233  $this->sp_user_progress_db,
234  $this->position_based_access
235  );
236  return $table;
237  }
238 
244  protected function view() : string
245  {
246  if ($this->getStudyProgramme()->isActive()) {
247  $this->initSearchGUI();
248  $this->initMailToMemberButton($this->toolbar, true);
249  }
250 
251  if (!$this->getStudyProgramme()->isActive()) {
252  ilUtil::sendInfo($this->lng->txt("prg_no_members_not_active"));
253  }
254  $table = $this->getMembersTableGUI();
255  return $table->getHTML();
256  }
257 
258  public function applyFilter() : void
259  {
260  $table = $this->getMembersTableGUI();
261  $table->resetOffset();
262  $table->writeFilterToSession();
263  $this->ctrl->redirect($this, "view");
264  }
265 
266  public function resetFilter() : void
267  {
268  $table = $this->getMembersTableGUI();
269  $table->resetOffset();
270  $table->resetFilter();
271  $this->ctrl->redirect($this, "view");
272  }
273 
274 
282  public function addUsers(array $users) : bool
283  {
284  $prg = $this->getStudyProgramme();
285  $users = $this->getAddableUsers($users);
286 
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;
292  }
293  }
294 
295  if (count($completed_courses) > 0) {
296  $this->viewCompletedCourses($completed_courses, $users);
297  return true;
298  }
299 
300  $this->_addUsers($users);
301 
302  $this->ctrl->redirect($this, "view");
303  }
304 
313  public function viewCompletedCourses(array $completed_courses, array $users) : void
314  {
315  $tpl = new ilTemplate(
316  "tpl.acknowledge_completed_courses.html",
317  true,
318  true,
319  "Modules/StudyProgramme"
320  );
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");
327 
328  foreach ($completed_courses as $user_id => $completed_courses) {
329  $names = ilObjUser::_lookupName($user_id);
330  $tpl->setCurrentBlock("usr_section");
331  $tpl->setVariable("FIRSTNAME", $names["firstname"]);
332  $tpl->setVariable("LASTNAME", $names["lastname"]);
334  $this,
335  $user_id,
336  $completed_courses
337  );
338  $tpl->setVariable("TABLE", $table->getHTML());
339  $tpl->parseCurrentBlock();
340  }
341 
342  foreach ($users as $usr_id) {
343  $tpl->setCurrentBlock("usr_ids_section");
344  $tpl->setVariable("USR_ID", $usr_id);
345  $tpl->parseCurrentBlock();
346  }
347 
348  $this->tpl->setContent($tpl->get());
349  }
350 
354  public function addUsersWithAcknowledgedCourses() : void
355  {
356  $users = $_POST["users"];
357  $users = $this->getAddableUsers($users);
358  $assignments = $this->_addUsers($users);
359 
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);
366  $prg = $this->getStudyProgramme((int) $prg_ref_id);
367  $progress = $prg->getProgressForAssignment((int) $ass_id);
368  $progress->setLPCompleted((int) $crsr_id, $user_id);
369  }
370  }
371  }
372 
373  $this->ctrl->redirect($this, "view");
374  }
375 
376  protected function getAddableUsers(array $users) : array
377  {
378  if ($this->mayManageMembers()) {
379  return $users;
380  }
381 
382  if ($this->getStudyProgramme()->getAccessControlByOrguPositionsGlobal()) {
383  $to_add = $this->position_based_access->filterUsersAccessibleForOperation(
384  $this->getStudyProgramme(),
386  $users
387  );
388  $cnt_not_added = count($users) - count($to_add);
389  if ($cnt_not_added > 0) {
391  sprintf(
392  $this->lng->txt('could_not_add_users_no_permissons'),
393  $cnt_not_added
394  ),
395  true
396  );
397  }
398  return $to_add;
399  }
400  }
401 
409  protected function _addUsers(array $users) : array
410  {
411  $prg = $this->getStudyProgramme();
412 
413  $assignments = array();
414 
415  foreach ($users as $user_id) {
416  $assignments[$user_id] = $prg->assignUser((int) $user_id);
417  }
418 
419  if (count($users) == 1) {
420  ilUtil::sendSuccess($this->lng->txt("prg_added_member"), true);
421  }
422  if (count($users) > 1) {
423  ilUtil::sendSuccess($this->lng->txt("prg_added_members"), true);
424  }
425 
426  return $assignments;
427  }
428 
434  protected function getPostPrgsIds() : array
435  {
436  $prgrs_ids = $_POST['prgs_ids'];
437  if ($prgrs_ids === null) {
438  $this->showInfoMessage("no_user_selected");
439  $this->ctrl->redirect($this, "view");
440  }
441  return $prgrs_ids;
442  }
443 
444  protected function getGetPrgsIds() : array
445  {
446  $prgrs_ids = $_GET['prgrs_ids'];
447  if (is_null($prgrs_ids)) {
448  return array();
449  }
450  return explode(',', $prgrs_ids);
451  }
452 
456  public function markAccredited() : void
457  {
458  $prgrs_id = $this->getPrgrsId();
459  $this->markAccreditedById($prgrs_id);
460  $this->showSuccessMessage("mark_accredited_success");
461  $this->ctrl->redirect($this, "view");
462  }
463 
467  public function markAccreditedMulti() : void
468  {
469  $prgrs_ids = $this->getPostPrgsIds();
470  $errors = 0;
471  foreach ($prgrs_ids as $key => $prgrs_id) {
472  try {
473  $this->markAccreditedById((int) $prgrs_id);
475  $errors++;
476  }
477  }
478  if ($errors === 0) {
479  $this->showSuccessMessage("mark_accredited_multi_success");
480  } else {
481  $this->showInfoMessage("some_users_may_not_be_accredited");
482  }
483  $this->ctrl->redirect($this, "view");
484  }
485 
489  protected function markAccreditedById(int $prgrs_id) : void
490  {
491  $prgrs = $this->getProgressObject($prgrs_id);
492  $usr_id = $prgrs->getUserId();
493  if (
494  $this->object->getAccessControlByOrguPositionsGlobal() &&
495  !in_array($usr_id, $this->editIndividualPlan()) &&
496  !$this->mayManageMembers()
497  ) {
499  'No permission to edit progress of user'
500  );
501  }
502  $prgrs->markAccredited($this->user->getId());
503 
504  $ass = $this->sp_user_assignment_db->getInstanceById($prgrs->getAssignmentId());
506  }
507 
511  public function unmarkAccredited() : void
512  {
513  $prgrs_id = $this->getPrgrsId();
514  $this->unmarkAccreditedByProgressId($prgrs_id);
515  $this->showSuccessMessage("unmark_accredited_success");
516  $this->ctrl->redirect($this, "view");
517  }
518 
522  protected function unmarkAccreditedByProgressId(int $prgrs_id) : void
523  {
524  $prgrs = $this->getProgressObject($prgrs_id);
525  $usr_id = $prgrs->getUserId();
526  if (
527  $this->object->getAccessControlByOrguPositionsGlobal() &&
528  !in_array($usr_id, $this->editIndividualPlan()) &&
529  !$this->mayManageMembers()
530  ) {
532  'No permission to edit progress of user'
533  );
534  }
535  $prgrs->unmarkAccredited();
536 
537  $ass = $this->sp_user_assignment_db->getInstanceById($prgrs->getAssignmentId());
539  }
540 
544  public function unmarkAccreditedMulti() : void
545  {
546  $prgrs_ids = $this->getPostPrgsIds();
547  $errors = 0;
548  foreach ($prgrs_ids as $key => $prgrs_id) {
549  $prgrs_status = $this->getProgressObject((int) $prgrs_id)->getStatus();
550  if ($prgrs_status == ilStudyProgrammeProgress::STATUS_ACCREDITED) {
551  try {
552  $this->unmarkAccreditedByProgressId((int) $prgrs_id);
554  $errors++;
555  }
556  }
557  }
558  if ($errors === 0) {
559  $this->showSuccessMessage("unmark_accredited_multi_success");
560  } else {
561  $this->showInfoMessage("some_users_may_not_be_unmarked_accredited");
562  }
563  $this->ctrl->redirect($this, "view");
564  }
565 
569  public function markRelevantMulti() : void
570  {
571  $prgrs_ids = $this->getPostPrgsIds();
572  $errors = 0;
573  foreach ($prgrs_ids as $key => $prgrs_id) {
574  $prgrs = $this->getProgressObject((int) $prgrs_id);
575  $usr_id = $prgrs->getUserId();
576  if ($this->object->getAccessControlByOrguPositionsGlobal() &&
577  !in_array($usr_id, $this->editIndividualPlan()) &&
578  !$this->mayManageMembers()
579  ) {
580  $errors++;
581  continue;
582  }
583 
584  $prgrs_status = $this->getProgressObject((int) $prgrs_id)->getStatus();
585  if (
588  ) {
589  continue;
590  }
591  $prgrs->markRelevant($this->user->getId());
592  }
593  if ($errors === 0) {
594  $this->showSuccessMessage("mark_relevant_multi_success");
595  } else {
596  $this->showInfoMessage("some_users_may_not_be_marked_relevant");
597  }
598  $this->ctrl->redirect($this, "view");
599  }
600 
604  public function markNotRelevantMulti() : void
605  {
606  $prgrs_ids = $this->getPostPrgsIds();
607  $errors = 0;
608  foreach ($prgrs_ids as $key => $prgrs_id) {
609  $prgrs = $this->getProgressObject((int) $prgrs_id);
610  $usr_id = $prgrs->getUserId();
611  if ($this->object->getAccessControlByOrguPositionsGlobal() &&
612  !in_array($usr_id, $this->editIndividualPlan()) &&
613  !$this->mayManageMembers()
614  ) {
615  $errors++;
616  continue;
617  }
618  $prgrs->markNotRelevant($this->user->getId());
619  }
620  if ($errors === 0) {
621  $this->showSuccessMessage("mark_not_relevant_multi_success");
622  } else {
623  $this->showInfoMessage("some_users_may_not_be_marked_not_relevant");
624  }
625  $this->ctrl->redirect($this, "view");
626  }
627 
631  public function updateFromCurrentPlanMulti() : void
632  {
633  $prgrs_ids = $this->getPostPrgsIds();
634  $not_updated = array();
635 
636  foreach ($prgrs_ids as $key => $prgrs_id) {
637  //** ilStudyProgrammeUserProgress */
638  $prgrs = $this->getProgressObject((int) $prgrs_id);
639  //** ilStudyProgrammeUserAssignment */
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;
644  continue;
645  }
646 
648  }
649 
650  if (count($not_updated) == count($prgrs_ids)) {
651  $this->showInfoMessage("update_from_current_plan_not_possible");
652  } elseif (count($not_updated) > 0) {
653  $this->showSuccessMessage("update_from_current_plan_partitial_success");
654  } else {
655  $this->showSuccessMessage("update_from_current_plan_success");
656  }
657 
658  $this->ctrl->redirect($this, "view");
659  }
660 
661  public function changeDeadlineMulti() : void
662  {
663  $this->ctrl->setParameterByClass(
664  'ilStudyProgrammeChangeDeadlineGUI',
665  'prgrs_ids',
666  implode(',', $this->getPostPrgsIds())
667  );
668 
669  $link = $this->ctrl->getLinkTargetByClass(
670  'ilStudyProgrammeChangeDeadlineGUI',
671  'showDeadlineConfig',
672  '',
673  false,
674  false
675  );
676 
677  $this->ctrl->clearParameterByClass('ilStudyProgrammeChangeDeadlineGUI', 'prgrs_ids');
678  $this->ctrl->redirectToURL($link);
679  }
680 
681  public function changeExpireDateMulti() : void
682  {
683  $this->ctrl->setParameterByClass(
684  'ilStudyProgrammeChangeExpireDateGUI',
685  'prgrs_ids',
686  implode(',', $this->getPostPrgsIds())
687  );
688 
689  $link = $this->ctrl->getLinkTargetByClass(
690  'ilStudyProgrammeChangeExpireDateGUI',
691  'showExpireDateConfig',
692  '',
693  false,
694  false
695  );
696 
697  $this->ctrl->clearParameterByClass('ilStudyProgrammeChangeExpireDateGUI', 'prgrs_ids');
698  $this->ctrl->redirectToURL($link);
699  }
700 
704  public function removeUser() : void
705  {
706  $prgrs_id = $this->getPrgrsId();
707  $this->remove($prgrs_id);
708  $this->showSuccessMessage("remove_user_success");
709  $this->ctrl->redirect($this, "view");
710  }
711 
715  protected function removeUserMulti() : void
716  {
717  $prgrs_ids = $this->getPostPrgsIds();
718  $not_removed = array();
719  foreach ($prgrs_ids as $key => $prgrs_id) {
720  try {
721  $this->remove((int) $prgrs_id);
722  } catch (ilException $e) {
723  $not_removed[] = $prgrs_id;
724  }
725  }
726  if (count($not_removed) == count($prgrs_ids)) {
727  $this->showInfoMessage("remove_users_not_possible");
728  } elseif (count($not_removed) > 0) {
729  $this->showSuccessMessage("remove_users_partitial_success");
730  } else {
731  $this->showSuccessMessage("remove_users_success");
732  }
733  $this->ctrl->redirect($this, "view");
734  }
735 
739  protected function remove(int $prgrs_id) : void
740  {
741  $prgrs = $this->getProgressObject($prgrs_id);
742  $usr_id = $prgrs->getUserId();
743  if (
744  $this->object->getAccessControlByOrguPositionsGlobal() &&
745  !in_array($usr_id, $this->manageMembers()) &&
746  !$this->mayManageMembers()
747  ) {
749  'No permission to manage membership of user'
750  );
751  }
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.");
756  }
757  $ass->deassign();
758  }
759 
763  protected function getProgressObject(int $prgrs_id) : ilStudyProgrammeUserProgress
764  {
765  if (!array_key_exists($prgrs_id, $this->progress_objects)) {
766  $this->progress_objects[$prgrs_id] = $this->sp_user_progress_db->getInstanceById(
767  $prgrs_id
768  );
769  }
770  return $this->progress_objects[$prgrs_id];
771  }
772 
776  protected function getPrgrsId() : int
777  {
778  if (!is_numeric($_GET["prgrs_id"])) {
779  throw new ilException("Expected integer 'prgrs_id'");
780  }
781  return (int) $_GET["prgrs_id"];
782  }
783 
787  protected function showSuccessMessage(string $lng_var) : void
788  {
789  ilUtil::sendSuccess($this->lng->txt("prg_$lng_var"), true);
790  }
791 
795  protected function showInfoMessage(string $lng_var) : void
796  {
797  ilUtil::sendInfo($this->lng->txt("prg_$lng_var"), true);
798  }
799 
800  protected function initSearchGUI() : void
801  {
803  $this,
804  $this->toolbar,
805  array(
806  "auto_complete_name" => $this->lng->txt("user"),
807  "submit_name" => $this->lng->txt("add"),
808  "add_search" => true
809  )
810  );
811  }
812 
813  protected function initMailToMemberButton(ilToolbarGUI $toolbar, bool $separator = false) : void
814  {
815  if ($separator) {
816  $toolbar->addSeparator();
817  }
818 
819  $toolbar->addButton(
820  $this->lng->txt('mail_members'),
821  $this->ctrl->getLinkTargetByClass(
822  'ilStudyProgrammeMailMemberSearchGUI',
823  'showSelectableUsers'
824  )
825  );
826  }
827 
832  public function getStudyProgramme(int $ref_id = null) : ilObjStudyProgramme
833  {
834  if ($ref_id === null) {
835  $ref_id = $this->ref_id;
836  }
838  }
839 
843  public function getLinkTargetForAction(string $action, int $prgrs_id, int $ass_id) : string
844  {
845  switch ($action) {
847  $target_name = "markAccredited";
848  break;
850  $target_name = "unmarkAccredited";
851  break;
853  return $this->individual_plan_gui->getLinkTargetView($ass_id);
855  $target_name = "removeUser";
856  break;
857  default:
858  throw new ilException("Unknown action: $action");
859  }
860 
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);
864  return $link;
865  }
866 
867  public function visibleUsers() : array
868  {
869  return array_unique(array_merge(
870  $this->viewMembers(),
871  $this->readLearningProgress(),
872  $this->viewIndividualPlan(),
873  $this->editIndividualPlan(),
874  $this->manageMembers()
875  ));
876  }
877 
878  protected $view_members;
879  public function viewMembers()
880  {
881  if (!$this->view_members) {
882  $this->view_members =
883  array_unique(array_merge(
884  $this->position_based_access->getUsersInPrgAccessibleForOperation(
885  $this->object,
887  ),
888  $this->manageMembers()
889  ));
890  }
891  return $this->view_members;
892  }
893 
895  public function readLearningProgress()
896  {
897  if (!$this->read_learning_progress) {
898  $this->read_learning_progress =
899  array_unique(array_merge(
900  $this->position_based_access->getUsersInPrgAccessibleForOperation(
901  $this->object,
903  ),
904  $this->viewIndividualPlan()
905  ));
906  }
908  }
909 
911  public function viewIndividualPlan()
912  {
913  if (!$this->view_individual_plan) {
914  $this->view_individual_plan =
915  array_unique(array_merge(
916  $this->position_based_access->getUsersInPrgAccessibleForOperation(
917  $this->object,
919  ),
920  $this->editIndividualPlan()
921  ));
922  }
924  }
925 
927  public function editIndividualPlan()
928  {
929  if (!$this->edit_individual_plan) {
930  $this->edit_individual_plan =
931  $this->position_based_access->getUsersInPrgAccessibleForOperation(
932  $this->object,
934  );
935  }
937  }
938 
939  protected $manage_members;
940  public function manageMembers()
941  {
942  if (!$this->manage_members) {
943  $this->manage_members =
944  $this->position_based_access->getUsersInPrgAccessibleForOperation(
945  $this->object,
947  );
948  }
949  return $this->manage_members;
950  }
951 
952  public function mayManageMembers() : bool
953  {
954  return $this->access->checkAccessOfUser(
955  $this->user->getId(),
956  'manage_members',
957  '',
958  $this->object->getRefId()
959  );
960  }
961 
962  public function getLocalMembers() : array
963  {
964  return $this->object->getMembers();
965  }
966 
967  public function isOperationAllowedForUser(int $usr_id, string $operation) : bool
968  {
969  return $this->mayManageMembers()
970  || $this->position_based_access->isUserAccessibleForOperationAtPrg($usr_id, $this->object, $operation);
971  }
972 
974  {
975  $ass->updateFromProgram();
978  }
979 }
addUsers(array $users)
Assigns a users to SP.
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.
$errors
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.
markNotRelevantMulti()
Mark SP as not relevant for users.
Tabs GUI.
$_GET["client_id"]
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.
Class ilAccessHandler.
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.
markRelevantMulti()
Mark SP as relevant for users.
global $ilCtrl
Definition: ilias.php:18
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.
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.
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjId($a_id)
view()
Shows table with all members of the SP.
ilObjStudyProgrammeMembersGUI: ilStudyProgrammeRepositorySearchGUI ilObjStudyProgrammeMembersGUI: il...
isOperationAllowedForUser(int $usr_id, string $operation)
addSeparator()
Add separator.
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.
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)
__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)
$dic
Definition: result.php:13
unmarkAccreditedByProgressId(int $prgrs_id)
Deaccredited SP.
language handling
$_POST["username"]
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.