ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilSurveySkillGUI.php
Go to the documentation of this file.
1 <?php
2 
25 {
26  protected ilObjSurvey $survey;
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  {
82  $tpl = $this->tpl;
83 
85  $this,
86  "listQuestionAssignment",
87  $this->survey
88  );
89  $tpl->setContent($tab->getHTML());
90  }
91 
95  public function assignSkillToQuestion(): void
96  {
97  $tpl = $this->tpl;
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;
116  $lng = $this->lng;
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;
136  $lng = $this->lng;
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;
150  $lng = $this->lng;
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 }
ILIAS Survey Editing EditingGUIRequest $edit_request
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
assignSkillToQuestion()
Assign skill to question.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
getCmd(?string $fallback_command=null)
ilGlobalPageTemplate $tpl
listQuestionAssignment()
List question to skill assignment.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
TableGUI class for survey questions to skill assignment.
global $DIC
Definition: shib_login.php:22
Explorer class that works on tree objects (Services/Tree)
__construct(ilObjSurvey $a_survey)
saveParameter(object $a_gui_obj, $a_parameter)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setSubTabs(string $a_activate)
setContent(string $a_html)
Sets content for standard template.