3 declare(strict_types=1);
44 protected Data\Factory
$df;
89 $this->
ctrl = $DIC->ctrl();
90 $this->tpl = $DIC[
"tpl"];
91 $this->
tabs = $DIC->tabs();
92 $this->
help = $DIC[
"ilHelp"];
93 $this->
toolbar = $DIC->toolbar();
94 $this->
lng = $DIC->language();
95 $this->df = new \ILIAS\Data\Factory();
96 $this->request = $DIC->http()->request();
97 $this->query = $DIC->http()->wrapper()->query();
98 $ilCtrl = $DIC->ctrl();
99 $this->resource_manager = $DIC->skills()->internal()->manager()->getResourceManager();
101 $ilCtrl->saveParameter($this, array(
"node_id",
"level_id"));
102 $this->base_skill_id = $a_node_id;
106 $this->requested_level_id = $this->admin_gui_request->getLevelId();
107 $this->requested_root_id = $this->admin_gui_request->getRootId();
108 $this->requested_level_order = $this->admin_gui_request->getOrder();
109 $this->requested_level_ids = $this->admin_gui_request->getLevelIds();
110 $this->requested_resource_ids = $this->admin_gui_request->getResourceIds();
111 $this->requested_suggested = $this->admin_gui_request->getSuggested();
112 $this->requested_trigger = $this->admin_gui_request->getTrigger();
113 $this->requested_table_action = $this->admin_gui_request->getTableLevelResourcesAction();
114 $this->requested_table_rep_ref_ids = $this->admin_gui_request->getTableRepoRefIds();
130 $next_class = $ilCtrl->getNextClass($this);
131 $cmd = $ilCtrl->getCmd();
132 switch ($next_class) {
134 $ret = $this->$cmd();
150 if (!$this->tree_access_manager->hasManageCompetencesPermission()) {
155 $it->setTitle($this->
form->getInput(
"title"));
156 $it->setDescription($this->
form->getInput(
"description"));
157 $it->setStatus((
int) $this->
form->getInput(
"status"));
158 $it->setSelfEvaluation((
bool) $this->
form->getInput(
"self_eval"));
161 $this->node_object = $it;
171 $this->node_object->getId()
173 $ilCtrl->redirectByClass(
"ilbasicskillgui",
"edit");
178 if (!$this->tree_access_manager->hasManageCompetencesPermission() && $this->
getType() ==
"skll" 179 || !$this->tree_access_manager->hasManageCompetenceTemplatesPermission() && $this->
getType() ==
"sktp") {
183 $this->node_object->setTitle($this->
form->getInput(
"title"));
184 $this->node_object->setDescription($this->
form->getInput(
"description"));
185 $this->node_object->setSelfEvaluation((
bool) $this->
form->getInput(
"self_eval"));
186 $this->node_object->setStatus((
int) $this->
form->getInput(
"status"));
187 $this->node_object->update();
200 $this->tpl->setOnScreenMessage(
'info', $lng->
txt(
"skmg_skill_in_use"));
201 } elseif ($this->tree_access_manager->hasManageCompetencesPermission()) {
202 $ilToolbar->addButton(
203 $lng->
txt(
"skmg_add_level"),
204 $ilCtrl->getLinkTarget($this,
"addLevel")
209 $this->base_skill_id,
214 $this->tree_access_manager->hasManageCompetencesPermission()
219 public function initForm(
string $a_mode =
"edit"): void
228 $ti->setMaxLength(200);
230 $ti->setRequired(
true);
231 $this->
form->addItem($ti);
236 $this->
form->addItem($ta);
243 $cb->setInfo($lng->
txt(
"skmg_selectable_info"));
244 $this->
form->addItem($cb);
247 if ($this->tree_access_manager->hasManageCompetencesPermission()) {
248 if ($a_mode ==
"create") {
249 $this->
form->addCommandButton(
"save", $lng->
txt(
"save"));
250 $this->
form->addCommandButton(
"cancelSave", $lng->
txt(
"cancel"));
251 $this->
form->setTitle($lng->
txt(
"skmg_create_skll"));
253 $this->
form->addCommandButton(
"update", $lng->
txt(
"save"));
254 $this->
form->setTitle($lng->
txt(
"skmg_edit_skll"));
257 foreach ($this->
form->getItems() as $item) {
258 $item->setDisabled(
true);
262 $ilCtrl->setParameter($this,
"node_id", $this->requested_node_id);
263 $this->
form->setFormAction($ilCtrl->getFormAction($this));
269 parent::editProperties();
292 if (!$this->tree_access_manager->hasManageCompetencesPermission() && $this->
getType() ==
"skll" 293 || !$this->tree_access_manager->hasManageCompetenceTemplatesPermission() && $this->
getType() ==
"sktp") {
298 $this->tpl->setOnScreenMessage(
'info', $lng->
txt(
"skmg_skill_in_use"));
311 if (!$this->tree_access_manager->hasManageCompetencesPermission() && $this->
getType() ==
"skll" 312 || !$this->tree_access_manager->hasManageCompetenceTemplatesPermission() && $this->
getType() ==
"sktp") {
317 if ($this->request->getMethod() ==
"POST" 318 && $this->request->getQueryParams()[
"level_settings"] ==
"level_settings_config") {
320 $result =
$form->getData();
322 if (is_null($result)) {
327 $this->node_object->addLevel(
328 $result[
"section_level"][
"input_ti"],
329 $result[
"section_level"][
"input_desc"]
332 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"msg_obj_modified"),
true);
333 $ilCtrl->redirect($this,
"edit");
345 if (!$this->tree_access_manager->hasManageCompetencesPermission() && $this->
getType() ==
"skll" 346 || !$this->tree_access_manager->hasManageCompetenceTemplatesPermission() && $this->
getType() ==
"sktp") {
351 if ($this->request->getMethod() ==
"POST" 352 && $this->request->getQueryParams()[
"level_settings"] ==
"level_settings_config") {
354 $result =
$form->getData();
356 if (is_null($result)) {
361 $this->node_object->writeLevelTitle(
362 $this->requested_level_id,
363 $result[
"section_level"][
"input_ti"]
366 $this->node_object->writeLevelDescription(
367 $this->requested_level_id,
368 $result[
"section_level"][
"input_desc"]
371 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"msg_obj_modified"),
true);
372 $ilCtrl->redirect($this,
"edit");
384 $ilCtrl->saveParameter($this,
"level_id");
386 $ilTabs->activateTab(
"level_settings");
388 $input_ti = $this->ui_fac->input()->field()->text($lng->
txt(
"title"))
389 ->withRequired(
true);
391 $input_desc = $this->ui_fac->input()->field()->textarea($lng->
txt(
"description"));
393 $ilCtrl->setParameter(
396 'level_settings_config' 399 if ($a_mode ==
"create") {
400 $section_level = $this->ui_fac->input()->field()->section(
401 [
"input_ti" => $input_ti,
402 "input_desc" => $input_desc],
403 $lng->
txt(
"skmg_new_level")
405 $form_action = $ilCtrl->getFormAction($this,
"saveLevel");
407 $data = $this->node_object->getLevelData($this->requested_level_id);
408 $input_ti = $input_ti->withValue(
$data[
"title"]);
409 $input_desc = $input_desc->withValue(
$data[
"description"]);
411 $section_level = $this->ui_fac->input()->field()->section(
412 [
"input_ti" => $input_ti,
413 "input_desc" => $input_desc],
414 $lng->
txt(
"skmg_edit_level")
416 $form_action = $ilCtrl->getFormAction($this,
"updateLevel");
419 $form = $this->ui_fac->input()->container()->form()->standard(
421 [
"section_level" => $section_level]
432 if (!$this->tree_access_manager->hasManageCompetencesPermission() && $this->
getType() ==
"skll" 433 || !$this->tree_access_manager->hasManageCompetenceTemplatesPermission() && $this->
getType() ==
"sktp") {
438 $this->node_object->updateLevelOrder($order);
439 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"msg_obj_modified"),
true);
440 $ilCtrl->redirect($this,
"edit");
449 if (!$this->tree_access_manager->hasManageCompetencesPermission() && $this->
getType() ==
"skll" 450 || !$this->tree_access_manager->hasManageCompetenceTemplatesPermission() && $this->
getType() ==
"sktp") {
456 if (empty($this->requested_level_ids)) {
457 $this->tpl->setOnScreenMessage(
'info', $lng->
txt(
"no_checkbox"),
true);
458 $ilCtrl->redirect($this,
"edit");
461 $cgui->setFormAction($ilCtrl->getFormAction($this));
462 $cgui->setHeaderText($lng->
txt(
"skmg_really_delete_levels"));
463 $cgui->setCancel($lng->
txt(
"cancel"),
"edit");
464 $cgui->setConfirm($lng->
txt(
"delete"),
"deleteLevel");
466 foreach ($this->requested_level_ids as $i) {
479 if (!$this->tree_access_manager->hasManageCompetencesPermission() && $this->
getType() ==
"skll" 480 || !$this->tree_access_manager->hasManageCompetenceTemplatesPermission() && $this->
getType() ==
"sktp") {
484 if (!empty($this->requested_level_ids)) {
485 foreach ($this->requested_level_ids as
$id) {
486 $this->node_object->deleteLevel($id);
488 $this->node_object->fixLevelNumbering();
490 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"msg_obj_modified"),
true);
503 $ilTabs->clearTargets();
506 $ilTabs->setBackTarget(
508 $ilCtrl->getLinkTarget($this,
"edit")
511 if ($this->requested_level_id > 0) {
514 $lng->
txt(
"settings"),
515 $ilCtrl->getLinkTarget($this,
"editLevel")
520 $lng->
txt(
"skmg_resources"),
521 $ilCtrl->getLinkTarget($this,
"showLevelResources")
526 if ($this->requested_level_id > 0) {
527 $tpl->
setTitle($lng->
txt(
"skmg_skill_level") .
": " .
533 $desc = $this->skill_tree_node_manager->getWrittenPath($this->node_object->getId());
537 public function setTabs(
string $a_tab =
"levels"): void
545 $ilTabs->clearTargets();
550 if (is_object($this->node_object)) {
554 $lng->
txt(
"skmg_skill_levels"),
555 $ilCtrl->getLinkTarget($this,
'edit')
561 $lng->
txt(
"settings"),
562 $ilCtrl->getLinkTarget($this,
'editProperties')
571 $parent_node_id = $this->tree_repo->getParentNodeIdForNodeId($this->requested_node_id);
575 if ($parent_type ===
"scat") {
576 $ilCtrl->setParameterByClass(
577 "ilskillcategorygui",
581 $ilTabs->setBackTarget(
583 $ilCtrl->getLinkTargetByClass(
"ilskillcategorygui",
"listItems")
585 $ilCtrl->setParameterByClass(
586 "ilskillcategorygui",
591 $ilCtrl->setParameterByClass(
594 $this->skill_tree_node_manager->getRootId()
596 $ilTabs->setBackTarget(
597 $lng->
txt(
"skmg_skills"),
598 $ilCtrl->getLinkTargetByClass(
"ilskillrootgui",
"listSkills")
600 $ilCtrl->setParameterByClass(
603 $this->requested_node_id
607 $ilTabs->activateTab($a_tab);
610 $this->node_object->getTitle());
617 parent::setTitleIcon();
631 $ilCtrl->setParameterByClass(
"ilskillrootgui",
"node_id", $this->requested_node_id);
632 $ilCtrl->redirectByClass(
"ilskillrootgui",
"listSkills");
636 parent::redirectToParent();
652 if ($this->tree_access_manager->hasManageCompetencesPermission() && $this->
getType() ==
"skll" 653 || $this->tree_access_manager->hasManageCompetenceTemplatesPermission() && $this->
getType() ==
"sktp") {
654 $ilToolbar->addButton(
655 $lng->
txt(
"skmg_add_resource"),
656 $ilCtrl->getLinkTarget($this,
"addLevelResource")
663 $ilTabs->activateTab(
"level_resources");
665 $table = $this->table_manager->getLevelResourcesTable(
666 $this->requested_ref_id,
667 $this->base_skill_id,
669 $this->requested_level_id
672 $tpl->
setContent($this->ui_ren->render($table));
681 $ilTabs->activateTab(
"level_resources");
692 if (!$exp->handleCommand()) {
703 if (!$this->tree_access_manager->hasManageCompetencesPermission() && $this->
getType() ==
"skll" 704 || !$this->tree_access_manager->hasManageCompetenceTemplatesPermission() && $this->
getType() ==
"sktp") {
709 $this->resource_manager->setResource(
710 $this->base_skill_id,
712 $this->requested_level_id,
718 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"msg_obj_modified"),
true);
721 $ilCtrl->redirect($this,
"showLevelResources");
729 if (!$this->tree_access_manager->hasManageCompetencesPermission() && $this->
getType() ==
"skll" 730 || !$this->tree_access_manager->hasManageCompetenceTemplatesPermission() && $this->
getType() ==
"sktp") {
734 if (!empty($this->requested_resource_ids)) {
735 foreach ($this->requested_resource_ids as $i) {
736 $this->resource_manager->removeResource(
737 $this->base_skill_id,
739 $this->requested_level_id,
743 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"msg_obj_modified"),
true);
746 $ilCtrl->redirect($this,
"showLevelResources");
755 if ($this->requested_table_action ==
"setSuggested" 756 && !empty($this->requested_table_rep_ref_ids)
757 && $this->requested_table_rep_ref_ids[0] ===
"ALL_OBJECTS" 759 $resources = $this->resource_manager->getResourcesOfLevel(
760 $this->base_skill_id,
762 $this->requested_level_id
765 $this->resource_manager->setResourceAsSuggested(
766 $resource->getBaseSkillId(),
767 $resource->getTrefId(),
768 $resource->getLevelId(),
769 $resource->getRepoRefId()
772 } elseif ($this->requested_table_action ==
"setSuggested") {
773 if (empty($this->requested_table_rep_ref_ids)) {
775 $ilCtrl->redirect($this,
"showLevelResources");
777 foreach ($this->requested_table_rep_ref_ids as $i) {
778 $this->resource_manager->setResourceAsSuggested(
779 $this->base_skill_id,
781 $this->requested_level_id,
789 $ilCtrl->redirect($this,
"showLevelResources");
798 if ($this->requested_table_action ==
"unsetSuggested" 799 && !empty($this->requested_table_rep_ref_ids)
800 && $this->requested_table_rep_ref_ids[0] ===
"ALL_OBJECTS" 802 $resources = $this->resource_manager->getResourcesOfLevel(
803 $this->base_skill_id,
805 $this->requested_level_id
808 $this->resource_manager->setResourceAsNotSuggested(
809 $resource->getBaseSkillId(),
810 $resource->getTrefId(),
811 $resource->getLevelId(),
812 $resource->getRepoRefId()
815 } elseif ($this->requested_table_action ==
"unsetSuggested") {
816 if (empty($this->requested_table_rep_ref_ids)) {
818 $ilCtrl->redirect($this,
"showLevelResources");
820 foreach ($this->requested_table_rep_ref_ids as $i) {
821 $this->resource_manager->setResourceAsNotSuggested(
822 $this->base_skill_id,
824 $this->requested_level_id,
832 $ilCtrl->redirect($this,
"showLevelResources");
841 if ($this->requested_table_action ==
"setTrigger" 842 && !empty($this->requested_table_rep_ref_ids)
843 && $this->requested_table_rep_ref_ids[0] ===
"ALL_OBJECTS" 845 $resources = $this->resource_manager->getResourcesOfLevel(
846 $this->base_skill_id,
848 $this->requested_level_id
851 $this->resource_manager->setResourceAsTrigger(
852 $resource->getBaseSkillId(),
853 $resource->getTrefId(),
854 $resource->getLevelId(),
855 $resource->getRepoRefId()
858 } elseif ($this->requested_table_action ==
"setTrigger") {
859 if (empty($this->requested_table_rep_ref_ids)) {
861 $ilCtrl->redirect($this,
"showLevelResources");
863 foreach ($this->requested_table_rep_ref_ids as $i) {
864 $this->resource_manager->setResourceAsTrigger(
865 $this->base_skill_id,
867 $this->requested_level_id,
875 $ilCtrl->redirect($this,
"showLevelResources");
884 if ($this->requested_table_action ==
"unsetTrigger" 885 && !empty($this->requested_table_rep_ref_ids)
886 && $this->requested_table_rep_ref_ids[0] ===
"ALL_OBJECTS" 888 $resources = $this->resource_manager->getResourcesOfLevel(
889 $this->base_skill_id,
891 $this->requested_level_id
894 $this->resource_manager->setResourceAsNoTrigger(
895 $resource->getBaseSkillId(),
896 $resource->getTrefId(),
897 $resource->getLevelId(),
898 $resource->getRepoRefId()
901 } elseif ($this->requested_table_action ==
"unsetTrigger") {
902 if (empty($this->requested_table_rep_ref_ids)) {
904 $ilCtrl->redirect($this,
"showLevelResources");
906 foreach ($this->requested_table_rep_ref_ids as $i) {
907 $this->resource_manager->setResourceAsNoTrigger(
908 $this->base_skill_id,
910 $this->requested_level_id,
918 $ilCtrl->redirect($this,
"showLevelResources");
initLevelForm(string $a_mode="edit")
Explorer for selecting repository items.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
setSkillNodeDescription()
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
addUsageTab(ilTabsGUI $a_tabs)
ilGlobalTemplateInterface $tpl
static _lookupTitle(int $a_obj_id, int $a_tref_id=0)
ArrayBasedRequestWrapper $query
setParameterByClass(string $a_class, string $a_parameter, $a_value)
setTabs(string $a_tab="levels")
ServerRequestInterface $request
static lookupLevelTitle(int $a_id)
initForm(string $a_mode="edit")
static _lookupType(int $a_obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Resource SkillResourcesManager $resource_manager
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.
Basic GUI class for skill tree nodes.
setScreenIdComponent(string $a_comp)
addObjectsTab(ilTabsGUI $a_tabs)
array $requested_level_ids
saveResourcesAsNoTrigger()
string $requested_table_action
saveResourcesAsSuggested()
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.
array $requested_resource_ids
array $requested_level_order
form( $class_path, string $cmd, string $submit_caption="")
setDescription(string $a_descr)
Sets description below title in standard template.
This class represents a text area property in a property form.
array $requested_suggested
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
array $requested_table_rep_ref_ids
static stripSlashesArray(array $a_arr, bool $a_strip_html=true, string $a_allow="")
saveResourcesAsNotSuggested()
addStatusInput(ilPropertyFormGUI $a_form)
__construct(Node\SkillTreeNodeManager $node_manager, int $a_node_id=0)
redirectToParent(bool $a_tmp_mode=false)
Redirect to parent (identified by current node_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...