19 declare(strict_types=1);
36 $this->
ctrl = $DIC->ctrl();
37 $this->tpl = $DIC[
"tpl"];
38 $this->
tabs = $DIC->tabs();
39 $this->
lng = $DIC->language();
40 $this->
help = $DIC[
"ilHelp"];
41 $ilCtrl = $DIC->ctrl();
43 $ilCtrl->saveParameter($this,
"node_id");
44 $ilCtrl->saveParameter($this,
"tref_id");
48 $this->tref_id = $a_tref_id;
49 if (is_object($this->node_object)) {
50 $this->base_skill_id = $this->node_object->getSkillTemplateId();
67 $next_class = $ilCtrl->getNextClass($this);
68 $cmd = $ilCtrl->getCmd();
70 switch ($next_class) {
77 public function setTabs($a_tab =
"levels"): void
85 $ilTabs->clearTargets();
88 if (is_object($this->node_object)) {
89 $sk_id = $this->node_object->getSkillTemplateId();
92 if ($obj_type ==
"sctp") {
97 $ilCtrl->getLinkTarget($this,
'listItems')
103 $lng->
txt(
"skmg_skill_levels"),
104 $ilCtrl->getLinkTarget($this,
'listItems')
112 $ilCtrl->getLinkTarget($this,
'editProperties')
119 if ($obj_type !=
"sctp") {
123 $ilCtrl->setParameterByClass(
126 $this->skill_tree_node_manager->getRootId()
128 $ilTabs->setBackTarget(
130 $ilCtrl->getLinkTargetByClass(
"ilskillrootgui",
"listSkills")
132 $ilCtrl->setParameterByClass(
135 $this->requested_node_id
141 parent::setTitleIcon();
143 $lng->
txt(
"skmg_sktr") .
": " . $this->node_object->getTitle() . $add
147 $ilTabs->activateTab($a_tab);
156 $ilCtrl->saveParameter($this,
"parent_id");
157 $ilCtrl->saveParameter($this,
"target");
173 public function initForm(
string $a_mode =
"edit"): void
183 $tmplts = $this->skill_tree_node_manager->getTopTemplates();
187 $ti->setRequired(
true);
188 $this->
form->addItem($ti);
191 if ($a_mode ==
"edit") {
195 $ne->setValue($desc);
196 $ne->setInfo(
$lng->
txt(
"skmg_description_info"));
197 $this->
form->addItem($ne);
203 "" =>
$lng->
txt(
"please_select"),
205 foreach ($tmplts as $tmplt) {
206 $options[$tmplt[
"child"]] = $tmplt[
"title"];
208 if ($a_mode !=
"edit") {
211 $si->setRequired(
true);
212 $this->
form->addItem($si);
215 $ne->setValue($options[$this->node_object->getSkillTemplateId()] ??
"");
216 $this->
form->addItem($ne);
224 $cb->setInfo(
$lng->
txt(
"skmg_selectable_info"));
225 $this->
form->addItem($cb);
227 if ($this->tree_access_manager->hasManageCompetencesPermission()) {
228 if ($a_mode ==
"create") {
229 $this->
form->addCommandButton(
"save",
$lng->
txt(
"save"));
230 $this->
form->addCommandButton(
"cancelSave",
$lng->
txt(
"cancel"));
233 $this->
form->addCommandButton(
"updateSkillTemplateReference",
$lng->
txt(
"save"));
234 $this->
form->setTitle(
$lng->
txt(
"skmg_edit_sktr"));
237 foreach ($this->
form->getItems() as $item) {
238 $item->setDisabled(
true);
242 $this->
form->setFormAction($ilCtrl->getFormAction($this));
248 $values[
"skill_template_id"] = $this->node_object->getSkillTemplateId();
249 $values[
"title"] = $this->node_object->getTitle();
250 $values[
"description"] = $this->node_object->getDescription();
251 $values[
"selectable"] = $this->node_object->getSelfEvaluation();
252 $values[
"status"] = $this->node_object->getStatus();
253 $this->
form->setValuesByArray($values);
258 if (!$this->tree_access_manager->hasManageCompetencesPermission()) {
263 $sktr->setTitle($this->
form->getInput(
"title"));
264 $sktr->setDescription($this->
form->getInput(
"description"));
265 $sktr->setSkillTemplateId((
int) $this->
form->getInput(
"skill_template_id"));
266 $sktr->setSelfEvaluation((
bool) $this->
form->getInput(
"selectable"));
267 $sktr->setStatus((
int) $this->
form->getInput(
"status"));
270 $this->node_object = $sktr;
277 if (!$this->tree_access_manager->hasManageCompetencesPermission()) {
282 "ilskilltemplatereferencegui",
284 $this->node_object->getId()
286 $ilCtrl->setParameterByClass(
287 "ilskilltemplatereferencegui",
289 $this->node_object->getSkillTemplateId()
291 $ilCtrl->redirectByClass(
"ilskilltemplatereferencegui",
"listItems");
300 if (!$this->tree_access_manager->hasManageCompetencesPermission()) {
305 if ($this->
form->checkInput()) {
307 $this->node_object->setTitle($this->
form->getInput(
"title"));
308 $this->node_object->setDescription($this->
form->getInput(
"description"));
309 $this->node_object->setSelfEvaluation((
bool) $this->
form->getInput(
"selectable"));
310 $this->node_object->setStatus((
int) $this->
form->getInput(
"status"));
311 $this->node_object->update();
313 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
314 $ilCtrl->redirect($this,
"editProperties");
317 $this->
form->setValuesByPost();
327 $this->tpl->setOnScreenMessage(
'info',
$lng->
txt(
"skmg_skill_in_use"));
332 $sk_id = $this->node_object->getSkillTemplateId();
335 if ($obj_type ==
"sctp") {
341 $this->node_object->getId()
344 } elseif ($obj_type ==
"sktp") {
349 $this->node_object->getId(),
351 $this->tree_access_manager->hasManageCompetencesPermission()
363 $objects = $this->usage_manager->getAssignedObjectsForSkill($this->base_skill_id, $this->tref_id);
365 $table = $this->table_manager->getAssignedObjectsTable(
368 $this->base_skill_id,
380 $ilCtrl->redirectByClass(
"ilskillrootgui",
"listSkills");
static _lookupTemplateId(int $a_obj_id)
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...
Skill Template Reference.
setSkillNodeDescription()
addUsageTab(ilTabsGUI $a_tabs)
static _lookupTitle(int $a_obj_id, int $a_tref_id=0)
setContent(string $a_html)
Sets content for standard template.
setParameterByClass(string $a_class, string $a_parameter, $a_value)
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.
initForm(string $a_mode="edit")
static _lookupType(int $a_obj_id)
static _lookupDescription(int $a_obj_id)
setScreenIdComponent(string $a_comp)
addObjectsTab(ilTabsGUI $a_tabs)
Skill template reference GUI class.
redirectToParent(bool $a_tmp_mode=false)
updateSkillTemplateReference()
form( $class_path, string $cmd, string $submit_caption="")
__construct(Container $dic, ilPlugin $plugin)
ilGlobalTemplateInterface $tpl
__construct(Node\SkillTreeNodeManager $node_manager, int $a_tref_id=0)
Basic skill template GUI class.
addStatusInput(ilPropertyFormGUI $a_form)