ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilSurveySkillThresholdsGUI.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 {
20  function __construct(ilObjSurvey $a_survey)
21  {
22  $this->survey = $a_survey;
23  }
24 
28  function executeCommand()
29  {
30  global $ilCtrl;
31 
32  $cmd = $ilCtrl->getCmd();
33 
34  $ilCtrl->saveParameter($this, array("sk_id", "tref_id"));
35 
36  if (in_array($cmd, array("listCompetences", "listSkillThresholds", "selectSkill",
37  "saveThresholds")))
38  {
39  $this->$cmd();
40  }
41  }
42 
49  function listCompetences()
50  {
51  global $tpl;
52 
53  include_once("./Modules/Survey/classes/class.ilSurveySkillTableGUI.php");
54  $tab = new ilSurveySkillTableGUI($this, "listCompetences", $this->survey);
55  $tpl->setContent($tab->getHTML());
56  }
57 
58 
63  {
64  global $tpl, $ilToolbar, $lng, $ilCtrl, $ilTabs;
65 
66  $ilTabs->clearTargets();
67  $ilTabs->setBackTarget($lng->txt("svy_back"),
68  $ilCtrl->getLinkTarget($this, "listCompetences"));
69 
70  include_once("./Modules/Survey/classes/class.ilSurveySkillThresholdsTableGUI.php");
71  $tab = new ilSurveySkillThresholdsTableGUI($this, "listSkillThresholds",
72  $this->survey, (int) $_GET["sk_id"], (int) $_GET["tref_id"]);
73  $tpl->setContent($tab->getHTML());
74  }
75 
82  function selectSkill()
83  {
84  global $ilCtrl;
85 
86  $o = explode(":", $_POST["skill"]);
87  $ilCtrl->setParameter($this, "sk_id", (int) $o[0]);
88  $ilCtrl->setParameter($this, "tref_id", (int) $o[1]);
89  $ilCtrl->redirect($this, "listSkillThresholds");
90  }
91 
98  function saveThresholds()
99  {
100  global $ilCtrl, $lng;
101 
102  include_once("./Modules/Survey/classes/class.ilSurveySkillThresholds.php");
103  $thres = new ilSurveySkillThresholds($this->survey);
104 
105  if (is_array($_POST["threshold"]))
106  {
107  foreach ($_POST["threshold"] as $l => $t)
108  {
109  $thres->writeThreshold((int) $_GET["sk_id"],
110  (int) $_GET["tref_id"], (int) $l, (int) $t);
111  }
112  ilUtil::sendSuccess($lng->txt("msg_obj_modified"));
113  }
114 
115  $ilCtrl->redirect($this, "listSkillThresholds");
116  }
117 
118 }
119 
120 ?>