ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilContSkillPresentationGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2017 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
13 {
17  protected $ctrl;
18 
22  protected $tabs;
23 
27  protected $lng;
28 
32  protected $tpl;
33 
37  protected $container_gui;
38 
42  protected $container;
43 
47  protected $user;
48 
52  protected $container_skills;
53 
58 
63 
68 
74  public function __construct($a_container_gui)
75  {
76  global $DIC;
77 
78  $this->ctrl = $DIC->ctrl();
79  $this->tabs = $DIC->tabs();
80  $this->lng = $DIC->language();
81  $this->tpl = $DIC["tpl"];
82  $this->user = $DIC->user();
83 
84  $this->container_gui = $a_container_gui;
85  $this->container = $a_container_gui->object;
86 
87  include_once("./Services/Container/Skills/classes/class.ilContainerSkills.php");
88  $this->container_skills = new ilContainerSkills($this->container->getId());
89  $this->container_global_profiles = new ilContainerGlobalProfiles($this->container->getId());
90  $this->container_local_profiles = new ilContainerLocalProfiles($this->container->getId());
91 
92  $this->container_skill_collector = new ilContSkillCollector(
93  $this->container_skills,
94  $this->container_global_profiles,
95  $this->container_local_profiles
96  );
97  }
98 
102  public function executeCommand()
103  {
104  $ctrl = $this->ctrl;
105  $tabs = $this->tabs;
106 
107  $tabs->activateSubTab("list");
108 
109  $next_class = $this->ctrl->getNextClass($this);
110  $cmd = $this->ctrl->getCmd("show");
111  $this->setPermanentLink();
112 
113  switch ($next_class) {
114  case "ilpersonalskillsgui":
115  $ctrl->forwardCommand($this->getPersonalSkillsGUI());
116  break;
117 
118  default:
119  if (in_array($cmd, array("show"))) {
120  $this->$cmd();
121  }
122  }
123  }
124 
130  protected function setPermanentLink()
131  {
132  $type = $this->container->getType();
133  $ref_id = $this->container->getRefId();
134  $this->tpl->setPermanentLink($type, "", $ref_id . "_comp", "", "");
135  }
136 
142  protected function getPersonalSkillsGUI()
143  {
144  $lng = $this->lng;
145 
146  $gui = new ilPersonalSkillsGUI();
147  $gui->setGapAnalysisActualStatusModePerObject($this->container->getId());
148  $gui->setTriggerObjectsFilter($this->getSubtreeObjectIds());
149  $gui->setHistoryView(true); // NOT IMPLEMENTED YET
150  $skills = $this->container_skill_collector->getSkillsForPresentationGUI();
151  $gui->setObjectSkills($this->container_skills->getId(), $skills);
152  $gui->setObjectSkillProfiles($this->container_global_profiles, $this->container_local_profiles);
153  return $gui;
154  }
155 
156 
157 
161  public function show()
162  {
163  $gui = $this->getPersonalSkillsGUI();
164  $gui->listProfilesForGap();
165  }
166 
167  protected function getSubtreeObjectIds()
168  {
169  global $DIC; /* @var ILIAS\DI\Container $DIC */
170 
171  $nodes = $DIC->repositoryTree()->getSubTree(
172  $DIC->repositoryTree()->getNodeData($this->container->getRefId())
173  );
174 
175  $objects = array();
176 
177  foreach ($nodes as $node) {
178  $objects[] = $node['obj_id'];
179  }
180 
181 
182  return $objects;
183  }
184 
190  public static function isAccessible($ref_id)
191  {
192  global $DIC;
193 
194  $access = $DIC->access();
195 
196  $obj_id = ilObject::_lookupObjId($ref_id);
197  if ($access->checkAccess('read', '', $ref_id) && ilContainer::_lookupContainerSetting(
198  $obj_id,
200  false
201  )) {
202  $skmg_set = new ilSetting("skmg");
203  if ($skmg_set->get("enable_skmg")) {
204  return true;
205  }
206  }
207  return false;
208  }
209 }
__construct($a_container_gui)
Constructor.
$type
Skills of a container.
user()
Definition: user.php:4
Personal skills GUI class.
Global competence profiles of a container.
static _lookupObjId($a_id)
Skill presentatio for container (course/group)
global $DIC
Definition: goto.php:24
getPersonalSkillsGUI()
Get personal skills gui.
Local competence profiles of a container.
static isAccessible($ref_id)
Is container skill presentation accessible.
Collector of skills for a container.
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=null)
Lookup a container setting.