ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilContSkillPresentationGUI.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
23 
31 {
32  protected ilCtrl $ctrl;
33  protected ilTabsGUI $tabs;
34  protected ilLanguage $lng;
38  protected ilObjUser $user;
39  protected \ILIAS\Container\Skills\ContainerSkillManager $cont_skill_manager;
40  protected int $cont_member_role_id = 0;
41 
42  public function __construct(ilContainerGUI $a_container_gui)
43  {
44  global $DIC;
45 
46  $this->ctrl = $DIC->ctrl();
47  $this->tabs = $DIC->tabs();
48  $this->lng = $DIC->language();
49  $this->tpl = $DIC["tpl"];
50  $this->user = $DIC->user();
51 
52  $this->container_gui = $a_container_gui;
53  /* @var $obj ilContainer */
54  $obj = $this->container_gui->getObject();
55  $this->container = $obj;
56  $this->cont_member_role_id = ilParticipants::getDefaultMemberRole($this->container->getRefId());
57 
58  $this->cont_skill_manager = $DIC->skills()->internalContainer()->manager()->getSkillManager(
59  $this->container->getId(),
60  $this->container->getRefId()
61  );
62  }
63 
64  public function executeCommand(): void
65  {
66  $ctrl = $this->ctrl;
67 
68  $next_class = $this->ctrl->getNextClass($this);
69  $cmd = $this->ctrl->getCmd("showProfiles");
70  $this->setPermanentLink();
71 
72  switch ($next_class) {
73  case "ilpersonalskillsgui":
74  $ctrl->forwardCommand($this->getPersonalSkillsGUI());
75  break;
76 
77  default:
78  if (in_array($cmd, ["showProfiles", "showRecords"])) {
79  $this->$cmd();
80  }
81  }
82  }
83 
84  protected function setPermanentLink(): void
85  {
86  $type = $this->container->getType();
87  $ref_id = $this->container->getRefId();
88  $this->tpl->setPermanentLink($type, $ref_id, "comp");
89  }
90 
92  {
93  $lng = $this->lng;
94 
95  $gui = new ilPersonalSkillsGUI();
96  $gui->setGapAnalysisActualStatusModePerObject($this->container->getId());
97  $gui->setTriggerObjectsFilter($this->getSubtreeObjectIds());
98  $gui->setHistoryView(true); // NOT IMPLEMENTED YET
99  $skills = $this->cont_skill_manager->getSkillsForPresentationGUI();
100  $gui->setObjectSkills($this->container->getId(), $skills);
101  $gui->setObjectSkillProfiles($this->cont_member_role_id);
102  return $gui;
103  }
104 
105  public function showProfiles(): void
106  {
107  $tabs = $this->tabs;
108 
109  $tabs->activateSubTab("mem_profiles");
110 
111  $gui = $this->getPersonalSkillsGUI();
112  $gui->listAllProfilesForGap();
113  }
114 
115  public function showRecords(): void
116  {
117  $tabs = $this->tabs;
118 
119  $tabs->activateSubTab("mem_records");
120 
121  $gui = $this->getPersonalSkillsGUI();
122  $gui->listRecordsForGap();
123  }
124 
125  protected function getSubtreeObjectIds(): array
126  {
127  global $DIC; /* @var ILIAS\DI\Container $DIC */
128 
129  $nodes = $DIC->repositoryTree()->getSubTree(
130  $DIC->repositoryTree()->getNodeData($this->container->getRefId())
131  );
132 
133  $objects = [];
134 
135  foreach ($nodes as $node) {
136  $objects[] = $node['obj_id'];
137  }
138 
139  return $objects;
140  }
141 
142  public static function isAccessible(int $ref_id): bool
143  {
144  global $DIC;
145 
146  $access = $DIC->access();
147 
148  $obj_id = ilObject::_lookupObjId($ref_id);
149  if ($access->checkAccess('read', '', $ref_id) && ilContainer::_lookupContainerSetting(
150  $obj_id,
152  '0'
153  )) {
154  $skmg_set = new ilSetting("skmg");
155  if ($skmg_set->get("enable_skmg")) {
156  return true;
157  }
158  }
159  return false;
160  }
161 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilContainerGUI $a_container_gui)
activateSubTab(string $a_id)
static getDefaultMemberRole(int $a_ref_id)
forwardCommand(object $a_gui_object)
static _lookupContainerSetting(int $a_id, string $a_keyword, string $a_default_value=null)
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28
Personal skills GUI class.
$ref_id
Definition: ltiauth.php:67
Skill presentation for container (course/group)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS Container Skills ContainerSkillManager $cont_skill_manager
Class ilContainerGUI This is a base GUI class for all container objects in ILIAS: root folder...