ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilContSkillAdminGUI.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
27 
35 {
36  protected \ILIAS\Container\InternalGUIService $gui;
37  protected ilCtrl $ctrl;
38  protected ilTabsGUI $tabs;
39  protected ilLanguage $lng;
46  protected int $ref_id = 0;
47  protected int $cont_member_role_id = 0;
53  protected array $params = [];
55  protected int $requested_usr_id = 0;
56  protected array $requested_usr_ids = [];
57  protected string $requested_selected_skill = "";
58  protected array $requested_combined_skill_ids = [];
59  protected int $requested_selected_profile_id = 0;
60  protected array $requested_profile_ids = [];
61 
62  public function __construct(ilContainerGUI $a_container_gui)
63  {
64  global $DIC;
65 
66  $this->ctrl = $DIC->ctrl();
67  $this->tabs = $DIC->tabs();
68  $this->lng = $DIC->language();
69  $this->tpl = $DIC["tpl"];
70  $this->toolbar = $DIC->toolbar();
71  $this->access = $DIC->access();
72 
73  $this->container_gui = $a_container_gui;
74  /* @var $obj ilContainer */
75  $obj = $this->container_gui->getObject();
76  $this->container = $obj;
77  $this->ref_id = $this->container->getRefId();
78  $this->cont_member_role_id = ilParticipants::getDefaultMemberRole($this->ref_id);
79 
80  $this->tree_service = $DIC->skills()->tree();
81  $this->tree_access_manager = $DIC->skills()->internal()->manager()->getTreeAccessManager($this->ref_id);
82  $this->profile_service = $DIC->skills()->profile();
83  $this->cont_skill_manager = $DIC->skills()->internalContainer()->manager()->getSkillManager(
84  $this->container->getId(),
85  $this->container->getRefId()
86  );
87  $this->usage_service = $DIC->skills()->usage();
88 
89  $this->skmg_settings = new ilSkillManagementSettings();
90  $this->container_gui_request = $DIC->skills()->internalContainer()->gui()->request();
91 
92  $this->ctrl->saveParameter($this, "profile_id");
93  $this->params = $this->ctrl->getParameterArray($this);
94 
95  $this->requested_usr_id = $this->container_gui_request->getUserId();
96  $this->requested_usr_ids = $this->container_gui_request->getUserIds();
97  $this->requested_selected_skill = $this->container_gui_request->getSelectedSkill();
98  $this->requested_combined_skill_ids = $this->container_gui_request->getCombinedSkillIds();
99  $this->requested_selected_profile_id = $this->container_gui_request->getSelectedProfileId();
100  $this->requested_profile_ids = $this->container_gui_request->getProfileIds();
101 
102  $this->lng->loadLanguageModule("skmg");
103  $this->lng->loadLanguageModule("error");
104  $this->gui = $DIC->container()->internal()->gui();
105  }
106 
107  public function executeCommand(): void
108  {
109  $next_class = $this->ctrl->getNextClass($this);
110  $cmd = $this->ctrl->getCmd("listMembers");
111 
112  switch ($next_class) {
113  case "ilskillprofilegui":
114  $profile_gui = new ilSkillProfileGUI($this->tree_access_manager);
115  $this->ctrl->setReturn($this, "listProfiles");
116  $ret = $this->ctrl->forwardCommand($profile_gui);
117  break;
118  case "ilskillprofileuploadhandlergui":
119  $skprof_upl_gui = new ilSkillProfileUploadHandlerGUI();
120  $ret = $this->ctrl->forwardCommand($skprof_upl_gui);
121  break;
122  default:
123  if (
124  ($this->access->checkAccess("write", "", $this->ref_id) &&
125  in_array($cmd, [
126  "listCompetences", "settings", "saveSettings", "selectSkill",
127  "saveSelectedSkill", "confirmRemoveSelectedSkill", "removeSelectedSkill",
128  "listProfiles", "saveSelectedProfile", "confirmRemoveSelectedGlobalProfiles",
129  "removeSelectedGlobalProfiles", "confirmRemoveSingleGlobalProfile", "removeSingleGlobalProfile",
130  "confirmDeleteSingleLocalProfile", "deleteSingleLocalProfile",
131  "confirmDeleteSelectedLocalProfiles", "deleteSelectedLocalProfiles"
132  ]))
133  ||
134  ($this->access->checkAccess("grade", "", $this->ref_id) &&
135  in_array($cmd, [
136  "listMembers", "assignCompetences",
137  "saveCompetenceAssignment", "publishAssignments", "deassignCompetencesConfirm", "deassignCompetences"
138  ]))
139  ) {
140  $this->$cmd();
141  }
142  }
143  }
144 
146 
147  public function listMembers(): void
148  {
149  $tpl = $this->tpl;
150  $tabs = $this->tabs;
151 
152  $tabs->activateSubTab("members");
153 
154  // table
155  $tab = new ilContSkillMemberTableGUI($this, "listMembers", $this->container);
156 
157  $tpl->setContent($tab->getHTML());
158  }
159 
160  public function assignCompetences(): void
161  {
162  $tpl = $this->tpl;
163  $tabs = $this->tabs;
164  $ctrl = $this->ctrl;
165 
166  $ctrl->saveParameter($this, "usr_id");
167  $tabs->activateSubTab("members");
168 
169  $form = $this->initCompetenceAssignmentForm();
170  $tpl->setContent($form->getHTML());
171  }
172 
174  {
175  $tpl = $this->tpl;
176  $ctrl = $this->ctrl;
177  $lng = $this->lng;
178 
179  $form = new ilPropertyFormGUI();
180 
181  // user name
182  $name = ilObjUser::_lookupName($this->requested_usr_id);
183  $ne = new ilNonEditableValueGUI($this->lng->txt("obj_user"), "");
184  $ne->setValue($name["lastname"] . ", " . $name["firstname"] . " [" . $name["login"] . "]");
185  $form->addItem($ne);
186 
187  if (empty($this->cont_skill_manager->getSkillsForContainerOrdered())) {
188  $tpl->setOnScreenMessage('info', $lng->txt("cont_skill_no_skills_selected"), true);
189  $ctrl->redirect($this, "listMembers");
190  }
191 
192  foreach ($this->cont_skill_manager->getSkillsForContainerOrdered() as $sk) {
193  $skill = new ilBasicSkill($sk->getBaseSkillId());
194 
195  // skill level options
196  $options = [
197  "-1" => $this->lng->txt("cont_skill_do_not_set"),
198  ];
199  foreach ($skill->getLevelData() as $l) {
200  $options[$l["id"]] = $l["title"];
201  }
202  $si = new ilSelectInputGUI(
203  ilBasicSkill::_lookupTitle($sk->getBaseSkillId(), $sk->getTrefId()),
204  "skill_" . $sk->getBaseSkillId() . "_" . $sk->getTrefId()
205  );
206  $si->setOptions($options);
207  $si->setInfo($this->getPathString($sk->getBaseSkillId(), $sk->getTrefId()));
208  $mem_level = $this->cont_skill_manager->getMemberSkillLevel(
209  $this->requested_usr_id,
210  $sk->getBaseSkillId(),
211  $sk->getTrefId()
212  );
213  if ($mem_level) {
214  $si->setValue($mem_level);
215  }
216  $form->addItem($si);
217  }
218 
219  // save and cancel commands
220  $form->addCommandButton("saveCompetenceAssignment", $this->lng->txt("save"));
221  $form->addCommandButton("listMembers", $this->lng->txt("cancel"));
222 
223  $form->setTitle($this->lng->txt("cont_assign_skills"));
224  $form->setFormAction($this->ctrl->getFormAction($this));
225 
226  return $form;
227  }
228 
229  public function getPathString(int $a_skill_id, int $a_tref_id = 0): string
230  {
231  $path = $this->tree_service->getSkillTreePath($a_skill_id, $a_tref_id);
232  $titles = [];
233  foreach ($path as $v) {
234  if ($v["type"] !== "skrt" && !($v["skill_id"] == $a_skill_id && $v["tref_id"] == $a_tref_id)) {
235  $titles[] = $v["title"];
236  }
237  }
238 
239  return implode(" > ", $titles);
240  }
241 
242  public function saveCompetenceAssignment(): void
243  {
244  $ctrl = $this->ctrl;
245  $lng = $this->lng;
246 
247  $form = $this->initCompetenceAssignmentForm();
248  $form->checkInput();
249 
250  foreach ($this->cont_skill_manager->getSkillsForContainer() as $sk) {
251  $l = (int) $form->getInput("skill_" . $sk->getBaseSkillId() . "_" . $sk->getTrefId());
252  if ($l === -1) {
253  $this->cont_skill_manager->removeMemberSkillFromContainer(
254  $this->requested_usr_id,
255  $sk->getBaseSkillId(),
256  $sk->getTrefId()
257  );
258  } else {
259  $this->cont_skill_manager->addMemberSkillForContainer(
260  $this->requested_usr_id,
261  $sk->getBaseSkillId(),
262  $sk->getTrefId(),
263  $l
264  );
265  }
266  }
267 
268  if (!ilContainer::_lookupContainerSetting($this->container->getId(), "cont_skill_publish", '0')) {
269  $this->cont_skill_manager->publishMemberSkills($this->requested_usr_id);
270  }
271 
272  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
273  $ctrl->redirect($this, "listMembers");
274  }
275 
276  public function publishAssignments(): void
277  {
278  $ctrl = $this->ctrl;
279  $lng = $this->lng;
280 
281  $user_ids = $this->requested_usr_ids;
282  if (empty($this->requested_usr_ids) && $this->requested_usr_id > 0) {
283  $user_ids[] = $this->requested_usr_id;
284  }
285 
286  $not_changed = [];
287  foreach ($user_ids as $user_id) {
288  if (!$this->cont_skill_manager->publishMemberSkills($user_id)) {
289  $not_changed[] = $user_id;
290  }
291  }
292 
293  if (count($not_changed) === 0) {
294  $this->tpl->setOnScreenMessage('success', $lng->txt("cont_skll_published"), true);
295  } else {
296  $names = array_map(static function (int $id) {
297  return ilUserUtil::getNamePresentation($id, false, false, "", true);
298  }, $not_changed);
299  $this->tpl->setOnScreenMessage('info', $lng->txt("cont_skll_published_some_not") . " (" . implode("; ", $names) . ")", true);
300  }
301 
302  $ctrl->redirect($this, "listMembers");
303  }
304 
305  public function deassignCompetencesConfirm(): void
306  {
307  $ctrl = $this->ctrl;
308  $lng = $this->lng;
309  $tpl = $this->tpl;
310  $tabs = $this->tabs;
311 
312  $tabs->activateSubTab("members");
313 
314  $user_ids = $this->requested_usr_ids;
315  if (empty($this->requested_usr_ids) && $this->requested_usr_id > 0) {
316  $user_ids[] = $this->requested_usr_id;
317  }
318 
319  if (!is_array($user_ids) || count($user_ids) === 0) {
320  $this->tpl->setOnScreenMessage('info', $lng->txt("no_checkbox"), true);
321  $ctrl->redirect($this, "listMembers");
322  } else {
323  $cgui = new ilConfirmationGUI();
324  $cgui->setFormAction($ctrl->getFormAction($this));
325  $cgui->setHeaderText($lng->txt("cont_really_deassign_skills"));
326  $cgui->setCancel($lng->txt("cancel"), "listMembers");
327  $cgui->setConfirm($lng->txt("cont_deassign_competence"), "deassignCompetences");
328 
329  foreach ($user_ids as $i) {
330  $name = ilUserUtil::getNamePresentation($i, false, false, "", true);
331  $cgui->addItem("usr_ids[]", (string) $i, $name);
332  }
333 
334  $tpl->setContent($cgui->getHTML());
335  }
336  }
337 
338  public function deassignCompetences(): void
339  {
340  $ctrl = $this->ctrl;
341  $lng = $this->lng;
342 
343  foreach ($this->requested_usr_ids as $user_id) {
344  $this->cont_skill_manager->removeAllMemberSkillsFromContainer($user_id);
345  }
346 
347  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
348  $ctrl->redirect($this, "listMembers");
349  }
350 
351 
353 
354  public function listCompetences(): void
355  {
356  $tpl = $this->tpl;
357  $tabs = $this->tabs;
358  $toolbar = $this->toolbar;
359  $ctrl = $this->ctrl;
360  $lng = $this->lng;
361 
362  $tabs->activateSubTab("competences");
363 
364  $toolbar->addButton(
365  $lng->txt("cont_add_skill"),
366  $ctrl->getLinkTarget($this, "selectSkill")
367  );
368 
369  // table
370  $tab = new ilContSkillTableGUI(
371  $this,
372  "listCompetences",
373  $this->container
374  );
375 
376  $tpl->setContent($tab->getHTML());
377  }
378 
379  public function selectSkill(): void
380  {
381  $tpl = $this->tpl;
382  $tabs = $this->tabs;
383 
384  $tabs->activateSubTab("competences");
385 
386  $sel = new ilSkillSelectorGUI($this, "selectSkill", $this, "saveSelectedSkill");
387  if (!$sel->handleCommand()) {
388  $tpl->setContent($sel->getHTML());
389  }
390  }
391 
392  public function saveSelectedSkill(): void
393  {
394  $lng = $this->lng;
395  $ctrl = $this->ctrl;
396 
397  $s = explode(":", ($this->requested_selected_skill));
398 
399  $this->cont_skill_manager->addSkillForContainer((int) $s[0], (int) $s[1]);
400  $this->usage_service->addUsage($this->container->getId(), (int) $s[0], (int) $s[1]);
401 
402  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
403 
404  $ctrl->redirect($this, "listCompetences");
405  }
406 
407  public function confirmRemoveSelectedSkill(): void
408  {
409  $lng = $this->lng;
410  $ctrl = $this->ctrl;
411  $tpl = $this->tpl;
412  $tabs = $this->tabs;
413 
414  $tabs->activateSubTab("competences");
415 
416  if (empty($this->requested_combined_skill_ids)) {
417  $this->tpl->setOnScreenMessage('info', $lng->txt("no_checkbox"), true);
418  $ctrl->redirect($this, "listCompetences");
419  } else {
420  $cgui = new ilConfirmationGUI();
421  $cgui->setFormAction($ctrl->getFormAction($this));
422  $cgui->setHeaderText($lng->txt("cont_really_remove_skill_from_course"));
423  $cgui->setCancel($lng->txt("cancel"), "listCompetences");
424  $cgui->setConfirm($lng->txt("remove"), "removeSelectedSkill");
425 
426  foreach ($this->requested_combined_skill_ids as $i) {
427  $s = explode(":", $i);
428  $cgui->addItem("id[]", (string) $i, ilBasicSkill::_lookupTitle((int) $s[0], (int) $s[1]));
429  }
430 
431  $tpl->setContent($cgui->getHTML());
432  }
433  }
434 
435  public function removeSelectedSkill(): void
436  {
437  $lng = $this->lng;
438  $ctrl = $this->ctrl;
439 
440  if (!empty($this->requested_combined_skill_ids)) {
441  foreach ($this->requested_combined_skill_ids as $id) {
442  $s = explode(":", $id);
443  $this->cont_skill_manager->removeSkillFromContainer((int) $s[0], (int) $s[1]);
444  $this->usage_service->removeUsage($this->container->getId(), (int) $s[0], (int) $s[1]);
445  }
446  }
447  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
448 
449  $ctrl->redirect($this, "listCompetences");
450  }
451 
452 
454 
455  public function listProfiles(): void
456  {
457  $tpl = $this->tpl;
458  $tabs = $this->tabs;
459  $toolbar = $this->toolbar;
460  $ctrl = $this->ctrl;
461  $lng = $this->lng;
462 
463  $tabs->activateSubTab("profiles");
464 
465  $options = [];
466  $options[0] = $lng->txt("please_select");
467 
468  $selectable_profiles = [];
469  $all_profiles = $this->profile_service->getAllGlobalProfiles();
470  $selected_profiles = $this->profile_service->getGlobalProfilesOfRole($this->cont_member_role_id);
471  foreach ($all_profiles as $profile) {
472  if (!array_key_exists($profile->getId(), $selected_profiles)) {
473  $selectable_profiles[$profile->getId()] = $profile;
474  }
475  }
476 
477  foreach ($selectable_profiles as $profile) {
478  $tree = $this->tree_service->getObjSkillTreeById($profile->getSkillTreeId());
479  $options[$profile->getId()] = $tree->getTitle() . ": " . $profile->getTitle();
480  }
481 
482  if ($this->skmg_settings->getLocalAssignmentOfProfiles()) {
483  $select = new ilSelectInputGUI($lng->txt("skmg_profile"), "p_id");
484  $select->setOptions($options);
485  $select->setValue(0);
486  $toolbar->addInputItem($select, true);
487 
488  $this->gui->button(
489  $this->lng->txt("cont_add_global_profile"),
490  "saveSelectedProfile"
491  )->submit()->toToolbar();
492  }
493 
494  if ($this->skmg_settings->getLocalAssignmentOfProfiles()
495  && $this->skmg_settings->getAllowLocalProfiles()) {
496  $toolbar->addSeparator();
497  }
498 
499  if ($this->skmg_settings->getAllowLocalProfiles()) {
500  $this->gui->link(
501  $this->lng->txt("cont_add_local_profile"),
502  $ctrl->getLinkTargetByClass("ilskillprofilegui", "createLocal")
503  )->emphasised()->toToolbar();
504  }
505 
506  $toolbar->setFormAction($ctrl->getFormAction($this));
507 
508  // table
509  $tab = new ilContProfileTableGUI(
510  $this,
511  "listProfiles",
512  $this->container->getRefId()
513  );
514 
515  $tpl->setContent($tab->getHTML());
516  }
517 
518  public function saveSelectedProfile(): void
519  {
520  $lng = $this->lng;
521  $ctrl = $this->ctrl;
522 
524 
525  if (!($profile_id > 0)) {
526  $this->tpl->setOnScreenMessage('info', $lng->txt("cont_skill_no_profile_selected"), true);
527  $ctrl->redirect($this, "listProfiles");
528  }
529 
530  $this->profile_service->addRoleToProfile($profile_id, $this->cont_member_role_id);
531 
532  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
533 
534  $ctrl->redirect($this, "listProfiles");
535  }
536 
537  public function confirmRemoveSelectedGlobalProfiles(): void
538  {
539  $lng = $this->lng;
540  $ctrl = $this->ctrl;
541  $tpl = $this->tpl;
542  $tabs = $this->tabs;
543 
544  $tabs->activateSubTab("profiles");
545 
546  if (empty($this->requested_profile_ids)) {
547  $this->tpl->setOnScreenMessage('info', $lng->txt("no_checkbox"), true);
548  $ctrl->redirect($this, "listProfiles");
549  } else {
550  $cgui = new ilConfirmationGUI();
551  $cgui->setFormAction($ctrl->getFormAction($this));
552  $cgui->setHeaderText($lng->txt("cont_skill_really_remove_profiles_from_list"));
553  $cgui->setCancel($lng->txt("cancel"), "listProfiles");
554  $cgui->setConfirm($lng->txt("remove"), "removeSelectedGlobalProfiles");
555 
556  foreach ($this->requested_profile_ids as $i) {
557  if ($this->profile_service->lookupProfileRefId($i) > 0) {
558  $this->tpl->setOnScreenMessage('info', $lng->txt("cont_skill_removal_not_possible"), true);
559  $ctrl->redirect($this, "listProfiles");
560  }
561  $cgui->addItem("id[]", (string) $i, $this->profile_service->lookupProfileTitle($i));
562  }
563 
564  $tpl->setContent($cgui->getHTML());
565  }
566  }
567 
568  public function removeSelectedGlobalProfiles(): void
569  {
570  $lng = $this->lng;
571  $ctrl = $this->ctrl;
572 
573  foreach ($this->requested_profile_ids as $id) {
574  $this->profile_service->removeRoleFromProfile($id, $this->cont_member_role_id);
575  }
576 
577  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
578 
579  $ctrl->redirect($this, "listProfiles");
580  }
581 
582  public function confirmRemoveSingleGlobalProfile(): void
583  {
584  $lng = $this->lng;
585  $ctrl = $this->ctrl;
586  $tpl = $this->tpl;
587  $tabs = $this->tabs;
588 
589  $tabs->activateSubTab("profiles");
590 
591  $profile_id = (int) $this->params["profile_id"];
592 
593  if (!($profile_id > 0)) {
594  $this->tpl->setOnScreenMessage('failure', $lng->txt("error_sry_error"), true);
595  $ctrl->redirect($this, "listProfiles");
596  } else {
597  $cgui = new ilConfirmationGUI();
598  $cgui->setFormAction($ctrl->getFormAction($this));
599  $cgui->setHeaderText($lng->txt("cont_skill_really_remove_profile_from_list"));
600  $cgui->setCancel($lng->txt("cancel"), "listProfiles");
601  $cgui->setConfirm($lng->txt("remove"), "removeSingleGlobalProfile");
602  $cgui->addItem("", (string) $profile_id, $this->profile_service->lookupProfileTitle($profile_id));
603 
604  $tpl->setContent($cgui->getHTML());
605  }
606  }
607 
608  public function removeSingleGlobalProfile(): void
609  {
610  $lng = $this->lng;
611  $ctrl = $this->ctrl;
612 
613  $profile_id = (int) $this->params["profile_id"];
614 
615  if ($profile_id > 0) {
616  $this->profile_service->removeRoleFromProfile($profile_id, $this->cont_member_role_id);
617  }
618  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
619 
620  $ctrl->redirect($this, "listProfiles");
621  }
622 
623  public function confirmDeleteSelectedLocalProfiles(): void
624  {
625  $lng = $this->lng;
626  $ctrl = $this->ctrl;
627  $tpl = $this->tpl;
628  $tabs = $this->tabs;
629 
630  $tabs->activateSubTab("profiles");
631 
632  if (empty($this->requested_profile_ids)) {
633  $this->tpl->setOnScreenMessage('info', $lng->txt("no_checkbox"), true);
634  $ctrl->redirect($this, "listProfiles");
635  } else {
636  $cgui = new ilConfirmationGUI();
637  $cgui->setFormAction($ctrl->getFormAction($this));
638  $cgui->setHeaderText($lng->txt("cont_skill_really_delete_profiles_from_list"));
639  $cgui->setCancel($lng->txt("cancel"), "listProfiles");
640  $cgui->setConfirm($lng->txt("delete"), "deleteSelectedLocalProfiles");
641 
642  foreach ($this->requested_profile_ids as $i) {
643  if (!($this->profile_service->lookupProfileRefId($i) > 0)) {
644  $this->tpl->setOnScreenMessage('info', $lng->txt("cont_skill_deletion_not_possible"), true);
645  $ctrl->redirect($this, "listProfiles");
646  }
647  $cgui->addItem("id[]", (string) $i, $this->profile_service->lookupProfileTitle($i));
648  }
649 
650  $tpl->setContent($cgui->getHTML());
651  }
652  }
653 
654  public function deleteSelectedLocalProfiles(): void
655  {
656  $lng = $this->lng;
657  $ctrl = $this->ctrl;
658 
659  if (!empty($this->requested_profile_ids)) {
660  foreach ($this->requested_profile_ids as $id) {
661  if ($this->profile_service->lookupProfileRefId($id) > 0) {
662  $this->profile_service->deleteProfile($id);
663  }
664  }
665  }
666  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
667 
668  $ctrl->redirect($this, "listProfiles");
669  }
670 
671  public function confirmDeleteSingleLocalProfile(): void
672  {
673  $lng = $this->lng;
674  $ctrl = $this->ctrl;
675  $tpl = $this->tpl;
676  $tabs = $this->tabs;
677 
678  $tabs->activateSubTab("profiles");
679 
680  $profile_id = (int) $this->params["profile_id"];
681 
682  if (!($profile_id > 0)) {
683  $this->tpl->setOnScreenMessage('failure', $lng->txt("error_sry_error"), true);
684  $ctrl->redirect($this, "listProfiles");
685  } else {
686  $cgui = new ilConfirmationGUI();
687  $cgui->setFormAction($ctrl->getFormAction($this));
688  $cgui->setHeaderText($lng->txt("cont_skill_really_delete_profile_from_list"));
689  $cgui->setCancel($lng->txt("cancel"), "listProfiles");
690  $cgui->setConfirm($lng->txt("delete"), "deleteSingleLocalProfile");
691  $cgui->addItem("", (string) $profile_id, $this->profile_service->lookupProfileTitle($profile_id));
692 
693  $tpl->setContent($cgui->getHTML());
694  }
695  }
696 
697  public function deleteSingleLocalProfile(): void
698  {
699  $lng = $this->lng;
700  $ctrl = $this->ctrl;
701 
702  $profile_id = (int) $this->params["profile_id"];
703 
704  if ($profile_id > 0) {
705  $this->profile_service->deleteProfile($profile_id);
706  }
707  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
708 
709  $ctrl->redirect($this, "listProfiles");
710  }
711 
712 
714 
715  public function settings(): void
716  {
717  $tpl = $this->tpl;
718  $tabs = $this->tabs;
719 
720  $tabs->activateSubTab("settings");
721 
722  $form = $this->initSettingsForm();
723 
724  $tpl->setContent($form->getHTML());
725  }
726 
728  {
729  $lng = $this->lng;
730  $ctrl = $this->ctrl;
731 
732  $form = new ilPropertyFormGUI();
733 
734  // publish
735  $radg = new ilRadioGroupInputGUI($lng->txt("cont_skill_publish"), "cont_skill_publish");
736  $op1 = new ilRadioOption($lng->txt("cont_skill_publish_auto"), '0', $lng->txt("cont_skill_publish_auto_info"));
737  $radg->addOption($op1);
738  $op2 = new ilRadioOption($lng->txt("cont_skill_publish_manual"), '1', $lng->txt("cont_skill_publish_manual_info"));
739  $radg->addOption($op2);
740  $form->addItem($radg);
741  $radg->setValue(ilContainer::_lookupContainerSetting($this->container->getId(), "cont_skill_publish", '0'));
742 
743  $form->addCommandButton("saveSettings", $lng->txt("save"));
744 
745  $form->setTitle($lng->txt("settings"));
746  $form->setFormAction($ctrl->getFormAction($this));
747 
748  return $form;
749  }
750 
751  public function saveSettings(): void
752  {
753  $lng = $this->lng;
754  $ctrl = $this->ctrl;
755 
756  $form = $this->initSettingsForm();
757  $form->checkInput();
758  ilContainer::_writeContainerSetting($this->container->getId(), "cont_skill_publish", $form->getInput("cont_skill_publish"));
759 
760  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
761 
762  $ctrl->redirect($this, "settings");
763  }
764 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getLinkTargetByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
Skill profile GUI class.
Class ilSkillProfileUploadHandlerGUI.
This class represents a selection list property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS Container InternalGUIService $gui
setFormAction(string $a_val, bool $a_multipart=false, string $a_target="")
Set form action (if form action is set, toolbar is wrapped into form tags)
activateSubTab(string $a_id)
TableGUI class for competences in containers.
static _lookupTitle(int $a_obj_id, int $a_tref_id=0)
static _lookupName(int $a_user_id)
lookup user name
ilGlobalTemplateInterface $tpl
setOptions(array $a_options)
static getDefaultMemberRole(int $a_ref_id)
TableGUI class for container members / skill assignments.
ContainerSkills SkillContainerGUIRequest $container_gui_request
SkillTreeAccess $tree_access_manager
$path
Definition: ltiservices.php:32
static _lookupContainerSetting(int $a_id, string $a_keyword, string $a_default_value=null)
global $DIC
Definition: feed.php:28
TableGUI class for competence profiles in containers.
This class represents a property in a property form.
addButton(string $a_txt, string $a_cmd, string $a_target="", ?int $a_acc_key=null, string $a_additional_attrs='', string $a_id="", string $a_class='submit')
Request wrapper for skill guis in container classes.
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path='ilpublicuserprofilegui')
Default behaviour is:
setContent(string $a_html)
Sets content for standard template.
ContainerSkills ContainerSkillManager $cont_skill_manager
__construct(ilContainerGUI $a_container_gui)
setValue(string $a_value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _writeContainerSetting(int $a_id, string $a_keyword, string $a_value)
Explorer class that works on tree objects (Services/Tree)
getLinkTarget(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
Container skills administration.
saveParameter(object $a_gui_obj, $a_parameter)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
SkillUsageService $usage_service
Class ilContainerGUI This is a base GUI class for all container objects in ILIAS: root folder...
ilSkillManagementSettings $skmg_settings
SkillProfileService $profile_service
Basic Skill.
getFormAction(object $a_gui_obj, string $a_fallback_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
addInputItem(ilToolbarItem $a_item, bool $a_output_label=false)
getPathString(int $a_skill_id, int $a_tref_id=0)