ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilMStListCompetencesGUI.php
Go to the documentation of this file.
1<?php
2
5
16{
17 const CMD_APPLY_FILTER = 'applyFilter';
18 const CMD_INDEX = 'index';
19 const CMD_GET_ACTIONS = "getActions";
20 const CMD_RESET_FILTER = 'resetFilter';
21 const SUB_TAB_SKILLS = 'skills';
25 protected $table;
29 protected $access;
33 private $dic;
34
35
39 public function __construct(Container $dic = null)
40 {
41 if (is_null($dic)) {
42 global $DIC;
43 $dic = $DIC;
44 }
45 $this->access = ilMyStaffAccess::getInstance();
46 $this->dic = $dic;
47 }
48
49
53 protected function checkAccessOrFail()
54 {
55 if ($this->access->hasCurrentUserAccessToMyStaff()) {
56 return;
57 } else {
58 ilUtil::sendFailure($this->dic->language()->txt("permission_denied"), true);
59 $this->dic->ctrl()->redirectByClass(ilDashboardGUI::class, "");
60 }
61 }
62
63
67 public function executeCommand()
68 {
69 $cmd = $this->dic->ctrl()->getCmd();
70 $next_class = $this->dic->ctrl()->getNextClass();
71 switch ($next_class) {
72 case strtolower(ilMStListCompetencesSkillsGUI::class):
73 $this->addSubTabs(self::SUB_TAB_SKILLS);
74 $gui = new ilMStListCompetencesSkillsGUI($this->dic);
75 $this->dic->ctrl()->forwardCommand($gui);
76 break;
77 default:
78 switch ($cmd) {
79 case self::CMD_INDEX:
80 $this->$cmd();
81 break;
82 default:
83 $this->index();
84 break;
85 }
86 break;
87 }
88 }
89
90
94 protected function addSubTabs(string $subtab_active) : void
95 {
96 $this->dic->language()->loadLanguageModule('skmg');
97 $this->dic->tabs()->addSubTab(
98 self::SUB_TAB_SKILLS,
99 $this->dic->language()->txt('skmg_selected_skills'),
100 $this->dic->ctrl()->getLinkTargetByClass([
101 self::class,
102 ilMStListCompetencesSkillsGUI::class
103 ])
104 );
105
106 $this->dic->tabs()->activateSubTab($subtab_active);
107 }
108
109
113 public function index()
114 {
115 $this->dic->ctrl()->redirectByClass(ilMStListCompetencesSkillsGUI::class);
116 }
117
118
122 public function getActions()
123 {
124 $mst_co_usr_id = $this->dic->http()->request()->getQueryParams()['mst_lco_usr_id'];
125 $mst_lco_crs_ref_id = $this->dic->http()->request()->getQueryParams()['mst_lco_crs_ref_id'];
126
127 if ($mst_co_usr_id > 0 && $mst_lco_crs_ref_id > 0) {
128 $selection = new ilAdvancedSelectionListGUI();
129
130 if ($this->dic->access()->checkAccess("visible", "", $mst_lco_crs_ref_id)) {
131 $link = ilLink::_getStaticLink($mst_lco_crs_ref_id, ilMyStaffAccess::DEFAULT_CONTEXT);
132 $selection->addItem(ilObject2::_lookupTitle(ilObject2::_lookupObjectId($mst_lco_crs_ref_id)), '', $link);
133 };
134
136 foreach (
137 ilOrgUnitUserAssignment::innerjoin('object_reference', 'orgu_id', 'ref_id')->where(array(
138 'user_id' => $mst_co_usr_id,
139 'object_reference.deleted' => null
140 ), array('user_id' => '=', 'object_reference.deleted' => '!='))->get() as $org_unit_assignment
141 ) {
142 if ($this->dic->access()->checkAccess("read", "", $org_unit_assignment->getOrguId())) {
143 $link = ilLink::_getStaticLink($org_unit_assignment->getOrguId(), 'orgu');
144 $selection->addItem($org_units[$org_unit_assignment->getOrguId()], '', $link);
145 }
146 }
147
148 $selection = ilMyStaffGUI::extendActionMenuWithUserActions($selection, $mst_co_usr_id, rawurlencode($this->dic->ctrl()
149 ->getLinkTarget($this, self::CMD_INDEX)));
150
151 echo $selection->getHTML(true);
152 }
153 exit;
154 }
155}
static innerjoin($tablename, $on_this, $on_external, $fields=array(' *'), $operator='=', $both_external=false)
An exception for terminatinating execution or to throw for unit testing.
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:18
User interface class for advanced drop-down selection lists.
Class ilMStListCompetencesGUI.
static _lookupTitle($a_id)
lookup object title
static _lookupObjectId($a_ref_id)
lookup object id
static getTextRepresentationOfOrgUnits($sort_by_title=true)
Get ref id path array.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
exit
Definition: login.php:29
$DIC
Definition: xapitoken.php:46