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