ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilMStShowUserCompetencesGUI.php
Go to the documentation of this file.
1 <?php
2 
5 
14 {
15  const CMD_SHOW_SKILLS = 'showSkills';
16  const CMD_INDEX = self::CMD_SHOW_SKILLS;
17  const SUB_TAB_SKILLS = 'skills';
21  protected $usr_id;
25  protected $table;
29  protected $access;
33  private $dic;
34 
35 
39  public function __construct(Container $dic)
40  {
41  $this->dic = $dic;
42  $this->access = ilMyStaffAccess::getInstance();
43 
44  $this->usr_id = $this->dic->http()->request()->getQueryParams()['usr_id'];
45  $this->dic->ctrl()->setParameter($this, 'usr_id', $this->usr_id);
46  }
47 
48 
52  protected function checkAccessOrFail()
53  {
54  if (!$this->usr_id) {
55  ilUtil::sendFailure($this->dic->language()->txt("permission_denied"), true);
56  $this->dic->ctrl()->redirectByClass(ilDashboardGUI::class, "");
57  }
58 
59  if ($this->access->hasCurrentUserAccessToMyStaff()
60  && $this->access->hasCurrentUserAccessToUser($this->usr_id)
61  ) {
62  return;
63  } else {
64  ilUtil::sendFailure($this->dic->language()->txt("permission_denied"), true);
65  $this->dic->ctrl()->redirectByClass(ilDashboardGUI::class, "");
66  }
67  }
68 
69 
73  public function executeCommand()
74  {
75  $this->checkAccessOrFail();
76 
77  $cmd = $this->dic->ctrl()->getCmd();
78  $next_class = $this->dic->ctrl()->getNextClass();
79 
80  switch ($next_class) {
81  default:
82  switch ($cmd) {
83  case self::CMD_INDEX:
84  case self::CMD_SHOW_SKILLS:
85  default:
86  $this->addSubTabs(self::SUB_TAB_SKILLS);
87  $this->showSkills();
88  break;
89  }
90  }
91  }
92 
93 
97  protected function addSubTabs(string $active_sub_tab)
98  {
99  $this->dic->language()->loadLanguageModule('skmg');
100  $this->dic->tabs()->addSubTab(
101  self::SUB_TAB_SKILLS,
102  $this->dic->language()->txt('skmg_selected_skills'),
103  $this->dic->ctrl()->getLinkTarget($this, self::CMD_SHOW_SKILLS)
104  );
105 
106  $this->dic->tabs()->activateSubTab($active_sub_tab);
107  }
108 
109 
113  protected function showSkills()
114  {
115  $skills_gui = new ilPersonalSkillsGUI();
116  $skills = ilPersonalSkill::getSelectedUserSkills($this->usr_id);
117  $html = '';
118  foreach ($skills as $skill) {
119  $html .= $skills_gui->getSkillHTML($skill["skill_node_id"], $this->usr_id);
120  }
121  $this->dic->ui()->mainTemplate()->setContent($html);
122  }
123 }
static getSelectedUserSkills($a_user_id)
Get personal selected user skills.
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:17
Personal skills GUI class.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Class ilMStShowUserCompetencesGUI.