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