ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilSurveySkillGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
14 {
18  protected $ctrl;
19 
23  protected $tpl;
24 
28  protected $user;
29 
33  protected $lng;
34 
38  protected $tabs;
39 
45  public function __construct(ilObjSurvey $a_survey)
46  {
47  global $DIC;
48 
49  $this->ctrl = $DIC->ctrl();
50  $this->tpl = $DIC["tpl"];
51  $this->user = $DIC->user();
52  $this->lng = $DIC->language();
53  $this->tabs = $DIC->tabs();
54  $this->survey = $a_survey;
55  }
56 
60  public function executeCommand()
61  {
62  $ilCtrl = $this->ctrl;
63 
64  $cmd = $ilCtrl->getCmd();
65  $next_class = $ilCtrl->getNextClass();
66 
67  switch ($next_class) {
68  case 'ilsurveyskillthresholdsgui':
69  $this->setSubTabs("skill_thresholds");
70  $gui = new ilSurveySkillThresholdsGUI($this->survey);
71  $ilCtrl->forwardCommand($gui);
72  break;
73 
74  default:
75  if (in_array($cmd, array("listQuestionAssignment",
76  "assignSkillToQuestion", "selectSkillForQuestion",
77  "removeSkillFromQuestion"))) {
78  $this->setSubTabs("survey_skill_assign");
79  $this->$cmd();
80  }
81  break;
82  }
83  }
84 
88  public function listQuestionAssignment()
89  {
90  $tpl = $this->tpl;
91 
93  $this,
94  "listQuestionAssignment",
95  $this->survey
96  );
97  $tpl->setContent($tab->getHTML());
98  }
99 
103  public function assignSkillToQuestion()
104  {
106  $tpl = $this->tpl;
107  $ilCtrl = $this->ctrl;
108  $lng = $this->lng;
109  $ilTabs = $this->tabs;
110 
111  $ilCtrl->saveParameter($this, "q_id");
112 
113 
114  $sel = new ilSkillSelectorGUI($this, "assignSkillToQuestion", $this, "selectSkillForQuestion");
115  if (!$sel->handleCommand()) {
116  $tpl->setContent($sel->getHTML());
117  }
118  }
119 
123  public function selectSkillForQuestion()
124  {
125  $ilCtrl = $this->ctrl;
126  $lng = $this->lng;
127 
128  $skill_survey = new ilSurveySkill($this->survey);
129  $skill_id_parts = explode(":", $_GET["selected_skill"]);
130  $skill_survey->addQuestionSkillAssignment(
131  (int) $_GET["q_id"],
132  (int) $skill_id_parts[0],
133  (int) $skill_id_parts[1]
134  );
135  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
136 
137  $ilCtrl->redirect($this, "listQuestionAssignment");
138  }
139 
143  public function removeSkillFromQuestion()
144  {
145  $ilCtrl = $this->ctrl;
146  $lng = $this->lng;
147 
148  $skill_survey = new ilSurveySkill($this->survey);
149  $skill_survey->removeQuestionSkillAssignment((int) $_GET["q_id"]);
150  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
151 
152  $ilCtrl->redirect($this, "listQuestionAssignment");
153  }
154 
160  public function setSubTabs($a_activate)
161  {
162  $ilTabs = $this->tabs;
163  $lng = $this->lng;
164  $ilCtrl = $this->ctrl;
165 
166  $ilTabs->addSubtab(
167  "survey_skill_assign",
168  $lng->txt("survey_skill_assign"),
169  $ilCtrl->getLinkTargetByClass("ilsurveyskillgui", "listQuestionAssignment")
170  );
171 
172  $ilTabs->addSubTab(
173  "skill_thresholds",
174  $lng->txt("survey_skill_thresholds"),
175  $ilCtrl->getLinkTargetByClass("ilsurveyskillthresholdsgui", "listCompetences")
176  );
177 
178  $ilTabs->activateSubtab($a_activate);
179  }
180 }
setSubTabs($a_activate)
Set subtabs.
Survey skill service GUI class.
assignSkillToQuestion()
Assign skill to question.
$_GET["client_id"]
Class ilObjSurvey.
user()
Definition: user.php:4
listQuestionAssignment()
List question to skill assignment.
Skill/Competence handling in surveys.
TableGUI class for survey questions to skill assignment.
global $DIC
Definition: goto.php:24
removeSkillFromQuestion()
Remove skill from question.
Explorer class that works on tree objects (Services/Tree)
__construct(ilObjSurvey $a_survey)
Constructor.
$ilUser
Definition: imgupload.php:18
Survey skill thresholds GUI class.
selectSkillForQuestion()
Select skill for question.
executeCommand()
Execute command.