ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSurveySkillGUI.php
Go to the documentation of this file.
1<?php
2
25{
27 protected \ILIAS\Survey\Editing\EditingGUIRequest $edit_request;
28 protected ilCtrl $ctrl;
30 protected ilObjUser $user;
31 protected ilLanguage $lng;
32 protected ilTabsGUI $tabs;
33
34 public function __construct(
35 ilObjSurvey $a_survey
36 ) {
37 global $DIC;
38
39 $this->ctrl = $DIC->ctrl();
40 $this->tpl = $DIC["tpl"];
41 $this->user = $DIC->user();
42 $this->lng = $DIC->language();
43 $this->tabs = $DIC->tabs();
44 $this->survey = $a_survey;
45 $this->edit_request = $DIC->survey()
46 ->internal()
47 ->gui()
48 ->editing()
49 ->request();
50 }
51
52 public function executeCommand(): void
53 {
54 $ilCtrl = $this->ctrl;
55
56 $cmd = $ilCtrl->getCmd();
57 $next_class = $ilCtrl->getNextClass();
58
59 switch ($next_class) {
60 case 'ilsurveyskillthresholdsgui':
61 $this->setSubTabs("skill_thresholds");
62 $gui = new ilSurveySkillThresholdsGUI($this->survey);
63 $ilCtrl->forwardCommand($gui);
64 break;
65
66 default:
67 if (in_array($cmd, array("listQuestionAssignment",
68 "assignSkillToQuestion", "selectSkillForQuestion",
69 "removeSkillFromQuestion"))) {
70 $this->setSubTabs("survey_skill_assign");
71 $this->$cmd();
72 }
73 break;
74 }
75 }
76
80 public function listQuestionAssignment(): void
81 {
83
85 $this,
86 "listQuestionAssignment",
87 $this->survey
88 );
89 $tpl->setContent($tab->getHTML());
90 }
91
95 public function assignSkillToQuestion(): void
96 {
98 $ilCtrl = $this->ctrl;
99 $ilCtrl->saveParameter($this, "q_id");
100
101 $sel = new ilSkillSelectorGUI(
102 $this,
103 "assignSkillToQuestion",
104 $this,
105 "selectSkillForQuestion",
106 'selected_skill'
107 );
108 if (!$sel->handleCommand()) {
109 $tpl->setContent($sel->getHTML());
110 }
111 }
112
113 public function selectSkillForQuestion(): void
114 {
115 $ilCtrl = $this->ctrl;
117
118 $skill_survey = new ilSurveySkill($this->survey);
119 $skill_id_parts = explode(
120 ":",
121 $this->edit_request->getSelectedSkill()
122 );
123 $skill_survey->addQuestionSkillAssignment(
124 $this->edit_request->getQuestionId(),
125 (int) $skill_id_parts[0],
126 (int) $skill_id_parts[1]
127 );
128 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
129
130 $ilCtrl->redirect($this, "listQuestionAssignment");
131 }
132
133 public function removeSkillFromQuestion(): void
134 {
135 $ilCtrl = $this->ctrl;
137
138 $skill_survey = new ilSurveySkill($this->survey);
139 $skill_survey->removeQuestionSkillAssignment(
140 $this->edit_request->getQuestionId()
141 );
142 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
143
144 $ilCtrl->redirect($this, "listQuestionAssignment");
145 }
146
147 public function setSubTabs(string $a_activate): void
148 {
149 $ilTabs = $this->tabs;
151 $ilCtrl = $this->ctrl;
152
153 $ilTabs->addSubTab(
154 "survey_skill_assign",
155 $lng->txt("survey_skill_assign"),
156 $ilCtrl->getLinkTargetByClass("ilsurveyskillgui", "listQuestionAssignment")
157 );
158
159 $ilTabs->addSubTab(
160 "skill_thresholds",
161 $lng->txt("survey_skill_thresholds"),
162 $ilCtrl->getLinkTargetByClass("ilsurveyskillthresholdsgui", "listCompetences")
163 );
164
165 $ilTabs->activateSubTab($a_activate);
166 }
167}
Class ilCtrl provides processing control methods.
saveParameter(object $a_gui_obj, $a_parameter)
@inheritDoc
getCmd(?string $fallback_command=null)
@inheritDoc
setContent(string $a_html)
Sets content for standard template.
language handling
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
User class.
Explorer class that works on tree objects (Services/Tree)
TableGUI class for survey questions to skill assignment.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS Survey Editing EditingGUIRequest $edit_request
ilGlobalPageTemplate $tpl
listQuestionAssignment()
List question to skill assignment.
assignSkillToQuestion()
Assign skill to question.
setSubTabs(string $a_activate)
__construct(ilObjSurvey $a_survey)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:26