ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  {
63 
64  $cmd = $ilCtrl->getCmd();
65  $next_class = $ilCtrl->getNextClass();
66 
67  switch ($next_class) {
68  case 'ilsurveyskillthresholdsgui':
69  $this->setSubTabs("skill_thresholds");
70  include_once("./Modules/Survey/classes/class.ilSurveySkillThresholdsGUI.php");
71  $gui = new ilSurveySkillThresholdsGUI($this->survey);
72  $ilCtrl->forwardCommand($gui);
73  break;
74 
75  default:
76  if (in_array($cmd, array("listQuestionAssignment",
77  "assignSkillToQuestion", "selectSkillForQuestion",
78  "removeSkillFromQuestion"))) {
79  $this->setSubTabs("survey_skill_assign");
80  $this->$cmd();
81  }
82  break;
83  }
84  }
85 
89  public function listQuestionAssignment()
90  {
91  $tpl = $this->tpl;
92 
93  include_once("./Modules/Survey/classes/class.ilSurveySkillAssignmentTableGUI.php");
95  $this,
96  "listQuestionAssignment",
97  $this->survey
98  );
99  $tpl->setContent($tab->getHTML());
100  }
101 
105  public function assignSkillToQuestion()
106  {
108  $tpl = $this->tpl;
110  $lng = $this->lng;
111  $ilTabs = $this->tabs;
112 
113  $ilCtrl->saveParameter($this, "q_id");
114 
115 
116  include_once("./Services/Skill/classes/class.ilSkillSelectorGUI.php");
117  $sel = new ilSkillSelectorGUI($this, "assignSkillToQuestion", $this, "selectSkillForQuestion");
118  if (!$sel->handleCommand()) {
119  $tpl->setContent($sel->getHTML());
120  }
121 
122  return;
123  /*
124  include_once("./Services/Skill/classes/class.ilSkillTree.php");
125  $skill_tree = new ilSkillTree();
126 
127  require_once ("./Modules/Survey/classes/class.ilSurveySkillExplorer.php");
128  $exp = new ilSurveySkillExplorer($ilCtrl->getLinkTarget($this, "assignSkillToQuestion"));
129  $exp->setTargetGet("obj_id");
130 
131  $exp->setExpandTarget($ilCtrl->getLinkTarget($this, "assignSkillToQuestion"));
132 
133  if ($_GET["skpexpand"] == "")
134  {
135  $expanded = $skill_tree->readRootId();
136  }
137  else
138  {
139  $expanded = $_GET["skpexpand"];
140  }
141 
142  $exp->setExpand($expanded);
143  // build html-output
144  $exp->setOutput(0);
145  $output = $exp->getOutput();
146 
147  // asynchronous output
148  if ($ilCtrl->isAsynch())
149  {
150  echo $output; exit;
151  }
152 
153  $tpl->setContent($output); */
154  }
155 
159  public function selectSkillForQuestion()
160  {
162  $lng = $this->lng;
163 
164  include_once("./Modules/Survey/classes/class.ilSurveySkill.php");
165  $skill_survey = new ilSurveySkill($this->survey);
166  $skill_id_parts = explode(":", $_GET["selected_skill"]);
167  $skill_survey->addQuestionSkillAssignment(
168  (int) $_GET["q_id"],
169  (int) $skill_id_parts[0],
170  (int) $skill_id_parts[1]
171  );
172  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
173 
174  $ilCtrl->redirect($this, "listQuestionAssignment");
175  }
176 
180  public function removeSkillFromQuestion()
181  {
183  $lng = $this->lng;
184 
185  include_once("./Modules/Survey/classes/class.ilSurveySkill.php");
186  $skill_survey = new ilSurveySkill($this->survey);
187  $skill_survey->removeQuestionSkillAssignment((int) $_GET["q_id"]);
188  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
189 
190  $ilCtrl->redirect($this, "listQuestionAssignment");
191  }
192 
198  public function setSubTabs($a_activate)
199  {
200  $ilTabs = $this->tabs;
201  $lng = $this->lng;
203 
204  $ilTabs->addSubtab(
205  "survey_skill_assign",
206  $lng->txt("survey_skill_assign"),
207  $ilCtrl->getLinkTargetByClass("ilsurveyskillgui", "listQuestionAssignment")
208  );
209 
210  $ilTabs->addSubTab(
211  "skill_thresholds",
212  $lng->txt("survey_skill_thresholds"),
213  $ilCtrl->getLinkTargetByClass("ilsurveyskillthresholdsgui", "listCompetences")
214  );
215 
216  $ilTabs->activateSubtab($a_activate);
217  }
218 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
setSubTabs($a_activate)
Set subtabs.
Survey skill service GUI class.
assignSkillToQuestion()
Assign skill to question.
global $DIC
Definition: saml.php:7
$_GET["client_id"]
user()
Definition: user.php:4
listQuestionAssignment()
List question to skill assignment.
global $ilCtrl
Definition: ilias.php:18
Skill/Competence handling in surveys.
TableGUI class for survey questions to skill assignment.
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
removeSkillFromQuestion()
Remove skill from question.
Explorer class that works on tree objects (Services/Tree)
__construct(ilObjSurvey $a_survey)
Constructor.
Survey skill thresholds GUI class.
selectSkillForQuestion()
Select skill for question.
executeCommand()
Execute command.