ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSurveySkillThresholdsGUI.php
Go to the documentation of this file.
1<?php
2
25{
27 protected \ILIAS\Survey\Editing\EditingGUIRequest $edit_request;
28 protected ilCtrl $ctrl;
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->toolbar = $DIC->toolbar();
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
58 $ilCtrl->saveParameter($this, array("sk_id", "tref_id"));
59
60 if (in_array($cmd, array("listCompetences", "listSkillThresholds", "selectSkill",
61 "saveThresholds"))) {
62 $this->$cmd();
63 }
64 }
65
66 public function listCompetences(): void
67 {
69
70 $tab = new ilSurveySkillTableGUI($this, "listCompetences", $this->survey);
71 $tpl->setContent($tab->getHTML());
72 }
73
74 public function listSkillThresholds(): void
75 {
78 $ilCtrl = $this->ctrl;
79 $ilTabs = $this->tabs;
80
81 $ilTabs->clearTargets();
82 $ilTabs->setBackTarget(
83 $lng->txt("svy_back"),
84 $ilCtrl->getLinkTarget($this, "listCompetences")
85 );
86
88 $this,
89 "listSkillThresholds",
90 $this->survey,
91 $this->edit_request->getSkillId(),
92 $this->edit_request->getTrefId()
93 );
94 $tpl->setContent($tab->getHTML());
95 }
96
97 public function selectSkill(): void
98 {
99 $ilCtrl = $this->ctrl;
100
101 $o = explode(":", $this->edit_request->getSkill());
102 $ilCtrl->setParameter($this, "sk_id", (int) $o[0]);
103 $ilCtrl->setParameter($this, "tref_id", (int) $o[1]);
104 $ilCtrl->redirect($this, "listSkillThresholds");
105 }
106
107 public function saveThresholds(): void
108 {
109 $ilCtrl = $this->ctrl;
111
112 $thres = new ilSurveySkillThresholds($this->survey);
113
114 $thresholds = $this->edit_request->getThresholds();
115 if (count($thresholds) > 0) {
116 foreach ($thresholds as $l => $t) {
117 $thres->writeThreshold(
118 $this->edit_request->getSkillId(),
119 $this->edit_request->getTrefId(),
120 (int) $l,
121 (int) $t
122 );
123 }
124 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), 1);
125 }
126
127 $ilCtrl->redirect($this, "listSkillThresholds");
128 }
129}
Class ilCtrl provides processing control methods.
getCmd(?string $fallback_command=null)
@inheritDoc
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...
TableGUI class for skill list in survey.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS Survey Editing EditingGUIRequest $edit_request
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...
clearTargets()
clear all targets
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setContent(string $a_html)
Sets content for standard template.
global $DIC
Definition: shib_login.php:26