19declare(strict_types=1);
91 bool $a_call_by_reference =
true,
92 bool $a_prepare_output =
true
96 $this->
ctrl = $DIC->ctrl();
97 $this->rbacsystem =
$DIC->rbac()->system();
98 $this->
error = $DIC[
"ilErr"];
99 $this->
access = $DIC->access();
100 $this->
tabs = $DIC->tabs();
101 $this->
lng = $DIC->language();
103 $this->tpl =
$DIC[
"tpl"];
104 $this->
toolbar = $DIC->toolbar();
105 $this->
user = $DIC->user();
106 $ilCtrl =
$DIC->ctrl();
107 $this->
ui = $DIC->ui();
108 $this->main_tpl =
$DIC->ui()->mainTemplate();
109 $this->
locator = $DIC[
"ilLocator"];
110 $this->admin_gui_request =
$DIC->skills()->internal()->gui()->admin_request();
111 $this->skill_ui_service =
$DIC->skills()->ui();
113 $this->type =
"skee";
116 $this->
lng->loadLanguageModule(
'skmg');
118 $this->skill_tree_repo =
$DIC->skills()->internal()->repo()->getTreeRepo();
119 $this->skill_tree_factory =
$DIC->skills()->internal()->factory()->tree();
120 $this->skill_tree = $this->skill_tree_factory->getTreeById($this->
object->getId());
122 $ilCtrl->saveParameter($this,
"node_id");
124 $this->tool_context =
$DIC->globalScreen()->tool()->context();
126 $this->requested_node_id = $this->admin_gui_request->getNodeId();
127 $this->requested_tref_id = $this->admin_gui_request->getTrefId();
128 $this->requested_templates_tree = $this->admin_gui_request->getTemplatesTree();
129 $this->requested_skexpand = $this->admin_gui_request->getSkillExpand();
130 $this->requested_tmpmode = $this->admin_gui_request->getTemplateMode();
131 $this->requested_titles = $this->admin_gui_request->getTitles();
132 $this->requested_node_ids = $this->admin_gui_request->getNodeIds();
133 $this->requested_table_action = $this->admin_gui_request->getTableTreeAction();
134 $this->requested_table_tree_ids = $this->admin_gui_request->getTableTreeIds();
139 $this->skill_tree_manager = $skill_manager->getTreeManager();
140 $this->skill_tree_node_manager = $skill_manager->getTreeNodeManager($this->
object->getId());
141 $this->skill_tree_access_manager = $skill_manager->getTreeAccessManager($this->
object->getRefId());
142 $this->skill_management_access_manager = $skill_manager->getManagementAccessManager(
143 $this->skill_tree_manager->getSkillManagementRefId()
145 $this->skill_deletion_manager = $skill_manager->getDeletionManager();
146 $this->skill_usage_manager = $skill_manager->getUsageManager();
155 $next_class = $this->
ctrl->getNextClass($this);
156 $cmd = $this->
ctrl->getCmd();
162 if (!$this->skill_tree_access_manager->hasReadTreePermission()) {
166 switch ($next_class) {
167 case 'ilskillrootgui':
168 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
172 $this->skill_tree_node_manager,
173 $this->requested_node_id
175 $skrt_gui->setParentGUI($this);
176 $ret = $this->
ctrl->forwardCommand($skrt_gui);
179 case 'ilskillcategorygui':
180 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
183 $this->tabs_gui->activateTab(
"skills");
185 $this->skill_tree_node_manager,
186 $this->requested_node_id
188 $scat_gui->setParentGUI($this);
189 $this->
showTree(
false, $scat_gui,
"listItems");
190 $ret = $this->
ctrl->forwardCommand($scat_gui);
193 case 'ilbasicskillgui':
194 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
197 $this->tabs_gui->activateTab(
"skills");
199 $this->skill_tree_node_manager,
200 $this->requested_node_id
202 $skill_gui->setParentGUI($this);
203 $this->
showTree(
false, $skill_gui,
"edit");
204 $ret = $this->
ctrl->forwardCommand($skill_gui);
207 case 'ilskilltemplatecategorygui':
208 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
211 $this->tabs_gui->activateTab(
"skill_templates");
213 $this->skill_tree_node_manager,
214 $this->requested_node_id,
215 $this->requested_tref_id
217 $sctp_gui->setParentGUI($this);
218 $this->
showTree(($this->requested_tref_id == 0), $sctp_gui,
"listItems");
219 $ret = $this->
ctrl->forwardCommand($sctp_gui);
222 case 'ilbasicskilltemplategui':
223 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
226 $this->tabs_gui->activateTab(
"skill_templates");
228 $this->skill_tree_node_manager,
229 $this->requested_node_id,
230 $this->requested_tref_id
232 $sktp_gui->setParentGUI($this);
233 $this->
showTree(($this->requested_tref_id == 0), $sktp_gui,
"edit");
234 $ret = $this->
ctrl->forwardCommand($sktp_gui);
237 case 'ilskilltemplatereferencegui':
238 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
241 $this->tabs_gui->activateTab(
"skills");
243 $this->skill_tree_node_manager,
244 $this->requested_tref_id
246 $sktr_gui->setParentGUI($this);
247 $this->
showTree(
false, $sktr_gui,
"listItems");
248 $ret = $this->
ctrl->forwardCommand($sktr_gui);
251 case "ilskillprofilegui":
252 if (!$this->skill_tree_access_manager->hasReadProfilesPermission()) {
255 $ilTabs->activateTab(
"profiles");
257 $this->skill_tree_access_manager,
258 $this->skill_tree->getTreeId()
260 $ret = $this->
ctrl->forwardCommand($skprof_gui);
263 case "ilskillprofileuploadhandlergui":
265 $ret = $this->
ctrl->forwardCommand($skprof_upl_gui);
268 case 'ilpermissiongui':
269 if (!$this->skill_tree_access_manager->hasEditTreePermissionsPermission()) {
272 $this->tabs_gui->activateTab(
'permissions');
274 $ret = $this->
ctrl->forwardCommand($perm_gui);
278 if (!$this->skill_tree_access_manager->hasEditTreeSettingsPermission()) {
281 $this->tabs_gui->activateTab(
'export');
283 $exp_gui->addFormat(
"xml");
285 $this->
object->setType(
"skmg");
286 $ret = $this->
ctrl->forwardCommand($exp_gui);
287 $this->
object->setType(
"skee");
291 if (!$cmd || $cmd ==
'view') {
295 if ($cmd ==
"showTree") {
296 $this->
showTree((
bool) $this->requested_templates_tree);
312 "ilobjsystemfoldergui",
317 $this->
lng->txt(
"administration"),
318 $this->ctrl->getLinkTargetByClass(array(
"iladministrationgui",
"ilobjsystemfoldergui"),
"")
321 $this->
lng->txt(
"obj_skmg"),
322 $this->getSkillManagementLink()
336 $this->
ctrl->clearParametersByClass(
"ilobjskillmanagementgui");
337 $this->
ctrl->setParameterByClass(
338 "ilobjskillmanagementgui",
340 $this->skill_tree_manager->getSkillManagementRefId()
342 return $this->
ctrl->getLinkTargetByClass(
"ilobjskillmanagementgui",
"");
355 $this->getSkillManagementLink()
358 $mtpl->setContent(
$ui->
renderer()->render($this->initTreeForm()));
361 protected function edit(): void
368 if (!$this->skill_tree_access_manager->hasEditTreeSettingsPermission()) {
372 $mtpl->setContent(
$ui->
renderer()->render($this->initTreeForm(
true)));
382 $fields[
"title"] =
$f->input()->field()->text(
$lng->
txt(
"title"))->withRequired(
true);
384 $fields[
"title"] = $fields[
"title"]->withValue($this->
object->getTitle());
387 $fields[
"description"] =
$f->input()->field()->textarea(
$lng->
txt(
"description"));
389 $fields[
"description"] = $fields[
"description"]->withValue($this->
object->getDescription());
393 $section1 =
$f->input()->field()->section($fields,
$lng->
txt(
"skmg_add_skill_tree"));
400 return $f->input()->container()->form()->standard(
$form_action, [
"props" => $section1]);
413 if (
$request->getMethod() ==
"POST") {
414 $form = $form->withRequest(
$request);
415 $data = $form->getData();
416 if (isset(
$data[
"props"]) && is_array(
$data[
"props"])) {
417 $props =
$data[
"props"];
418 $this->skill_tree_manager->createTree(
420 $props[
"description"]
422 $this->main_tpl->setOnScreenMessage(
'info',
$lng->
txt(
"msg_obj_modified"),
true);
428 $this->getSkillManagementLink()
436 public function update(): void
443 if (
$request->getMethod() ==
"POST") {
444 $form = $form->withRequest(
$request);
445 $data = $form->getData();
446 if (isset(
$data[
"props"]) && is_array(
$data[
"props"])) {
447 $props =
$data[
"props"];
450 $this->skill_tree_manager->updateTree(
453 $props[
"description"]
455 $this->main_tpl->setOnScreenMessage(
'info',
$lng->
txt(
"msg_obj_modified"),
true);
461 public function delete():
void
466 if ($this->requested_table_action ===
"deleteTrees"
467 && !empty($this->requested_table_tree_ids)
468 && $this->requested_table_tree_ids[0] ===
"ALL_OBJECTS"
470 $all_trees = $this->skill_tree_manager->getTrees();
471 foreach ($all_trees as $tree_obj) {
472 $tree = $this->skill_tree_factory->getTreeById($tree_obj->getId());
475 } elseif ($this->requested_table_action ===
"deleteTrees") {
476 $node_ids = array_map(
"intval", $this->requested_table_tree_ids);
479 $remaining_node_ids = [];
480 foreach ($node_ids as
$id) {
481 $tree_id = $this->skill_tree_repo->getTreeIdForNodeId(
$id);
482 $tree_obj = $this->skill_tree_manager->getTree($tree_id);
483 if (!$this->skill_tree_access_manager->hasDeleteTreePermission($tree_obj->getRefId())) {
486 $remaining_node_ids[] =
$id;
489 if (count($remaining_node_ids) != count($node_ids)) {
490 $this->tpl->setOnScreenMessage(GlobalTemplate::MESSAGE_TYPE_FAILURE, $this->
lng->txt(
"no_permission"),
true);
491 $this->
ctrl->redirectByClass(
"ilskilltreeadmingui",
"listTrees");
495 $this->requested_node_ids = $remaining_node_ids;
506 $this->tabs_gui->setBackTarget(
508 $this->getSkillManagementLink()
511 if ($this->skill_tree_access_manager->hasReadTreePermission()) {
512 if ($this->skill_tree_access_manager->hasReadCompetencesPermission()) {
513 $this->tabs_gui->addTab(
516 $this->ctrl->getLinkTarget($this,
"editSkills")
518 $this->tabs_gui->addTab(
520 $lng->
txt(
"skmg_skill_templates"),
521 $this->ctrl->getLinkTarget($this,
"editSkillTemplates")
525 if ($this->skill_tree_access_manager->hasReadProfilesPermission()) {
526 $this->tabs_gui->addTab(
528 $lng->
txt(
"skmg_skill_profiles"),
529 $this->ctrl->getLinkTargetByClass(
"ilskillprofilegui")
533 if ($this->skill_tree_access_manager->hasEditTreeSettingsPermission()) {
534 $this->tabs_gui->addTab(
537 $this->ctrl->getLinkTarget($this,
"edit")
541 if ($this->skill_tree_access_manager->hasEditTreeSettingsPermission()) {
542 $this->tabs_gui->addTab(
545 $this->ctrl->getLinkTargetByClass(
"ilexportgui",
"")
550 if ($this->skill_tree_access_manager->hasEditTreePermissionsPermission()) {
551 $this->tabs_gui->addTab(
554 $this->ctrl->getLinkTargetByClass(
'ilpermissiongui',
"perm")
566 $ilTabs->activateTab(
"skills");
569 $ilCtrl->redirectByClass(
"ilskillrootgui",
"listSkills");
577 if (!count($this->requested_titles) == 0) {
578 foreach ($this->requested_titles as
$id => $title) {
580 if (is_object($node_obj)) {
586 $this->main_tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
589 $ilCtrl->redirect($this,
"editSkills");
597 if (!count($this->requested_titles) == 0) {
598 foreach ($this->requested_titles as
$id => $title) {
600 if (is_object($node_obj)) {
606 $this->main_tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
609 $ilCtrl->redirect($this,
"editSkillTemplates");
612 public function expandAll(
bool $a_redirect =
true): void
614 $this->requested_skexpand =
"";
615 $n_id = ($this->requested_node_id > 0)
616 ? $this->requested_node_id
617 : $this->skill_tree->readRootId();
618 $stree = $this->skill_tree->getSubTree($this->skill_tree->getNodeData($n_id));
620 foreach ($stree as $n) {
621 $n_arr[] = $n[
"child"];
629 $this->requested_skexpand =
"";
630 $n_id = ($this->requested_node_id > 0)
631 ? $this->requested_node_id
632 : $this->skill_tree->readRootId();
633 $stree = $this->skill_tree->getSubTree($this->skill_tree->getNodeData($n_id));
635 foreach ($stree as $n) {
636 if (in_array($n[
"child"], $old) && $n[
"child"] != $n_id) {
637 $k = array_search($n[
"child"], $old);
652 if (empty($this->requested_node_ids)) {
654 $ilCtrl->redirectByClass(
"ilskilltreeadmingui",
"listTrees");
657 $ilTabs->clearTargets();
663 foreach ($this->requested_node_ids as
$id) {
665 if (!$this->skill_management_access_manager->hasCreateTreePermission()) {
670 $tree_ids[] = $tree_node_id;
673 if ($mode ==
"templates") {
675 $ilCtrl->redirectByClass(
"ilskilltreeadmingui",
"listTrees");
684 $cskill_ids[] = array(
"skill_id" => $skill_id,
"tref_id" => $tref_id);
687 if ($mode ==
"basic") {
689 $ilCtrl->redirectByClass(
"ilskilltreeadmingui",
"listTrees");
694 $cskill_ids[] = array(
"skill_id" =>
$id,
"tref_id" => $tref_id);
702 if ($mode ==
"tree") {
703 $usages = $this->skill_usage_manager->getAllUsagesInfoOfTrees($tree_ids);
704 } elseif ($mode ==
"basic" || $mode ==
"templates") {
705 $usages = $this->skill_usage_manager->getAllUsagesInfoOfSubtrees($cskill_ids);
708 $ilCtrl->redirectByClass(
"ilskilltreeadmingui",
"listTrees");
712 if (count($usages) > 0) {
713 foreach ($usages as $k => $usage) {
714 $usages_ui = $this->skill_ui_service->getUsagesUI($k, $usage, $mode);
715 $usage_html .= $usages_ui->render() .
"<br/><br/>";
717 $ilCtrl->saveParameter($a_gui,
"tmpmode");
725 $ilCtrl->setParameter($a_gui,
"tmpmode", (
int) $this->requested_tmpmode);
726 $a_form_action = $this->
ctrl->getFormAction($a_gui);
727 $confirmation_gui->setFormAction($a_form_action);
728 if (count($usages) > 0) {
729 $confirmation_text = $this->
lng->txt(
"skmg_delete_warning");
731 $confirmation_text = $this->
lng->txt(
"info_delete_sure");
733 $confirmation_gui->setHeaderText($confirmation_text);
736 foreach ($this->requested_node_ids as
$id) {
739 if ($mode ==
"tree") {
740 $tree_id = $this->skill_tree_repo->getTreeIdForNodeId(
$id);
741 $tree_obj = $this->skill_tree_manager->getTree($tree_id);
742 $obj_title = $tree_obj->getTitle();
744 $obj_title = (!in_array($node_obj->getType(), [
"sktp",
"sctp"]))
745 ? $node_obj->getTitle()
746 : $node_obj->getTitle() .
748 $this->
lng->txt(
"skmg_count_references") .
" " .
752 $confirmation_gui->addItem(
754 (
string) $node_obj->getId(),
761 $confirmation_gui->setCancel(
$lng->
txt(
"cancel"),
"cancelDelete");
762 if ($mode ==
"tree") {
763 $confirmation_gui->setConfirm(
$lng->
txt(
"confirm"),
"confirmedDeleteTrees");
765 $confirmation_gui->setConfirm(
$lng->
txt(
"confirm"),
"confirmedDelete");
773 $this->
ctrl->redirectByClass(
"ilobjskillmanagementgui",
"");
781 foreach ($this->requested_node_ids as
$id) {
782 $this->skill_deletion_manager->deleteTree(
$id);
786 $this->main_tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"info_deleted"),
true);
793 foreach ($this->requested_node_ids as
$id) {
794 $this->skill_deletion_manager->deleteNode(
$id, $this->skill_tree);
796 $this->skill_deletion_manager->updateProfileCompletions($this->skill_tree);
799 $this->main_tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"info_deleted"),
true);
813 $ilTabs->activateTab(
"skill_templates");
814 $ilCtrl->
setParameter($this,
"node_id", $this->skill_tree->readRootId());
815 $ilCtrl->redirectByClass(
"ilskillrootgui",
"listTemplates");
822 public function showTree(
bool $a_templates, $a_gui =
"", $a_gui_cmd =
""): void
830 if ($this->requested_node_id == 0 || $this->requested_node_id == $this->skill_tree->readRootId()) {
834 if ($this->requested_node_id != $this->skill_tree->readRootId()) {
835 $path = $this->skill_tree->getPathId($this->requested_node_id);
842 $ilCtrl->setParameter($this,
"templates_tree", (
int) $a_templates);
853 if (!$exp->handleCommand()) {
Provides fluid interface to RBAC services.
renderer()
Get a renderer for UI components.
factory()
Get the factory that crafts UI components.
Request wrapper for guis in skill administration.
Skill internal manager service.
Basic skill template GUI class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
redirectByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
@inheritDoc
getLinkTarget(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
@inheritDoc
redirect(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
@inheritDoc
setParameterByClass(string $a_class, string $a_parameter, $a_value)
@inheritDoc
Error Handling & global info handling.
Export User Interface Class.
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Tree SkillTreeFactory $skill_tree_factory
Usage SkillUsageManager $skill_usage_manager
saveAllTitles(bool $a_succ_mess=true)
init(Service\SkillInternalManagerService $skill_manager)
initTreeForm(bool $edit=false)
expandAll(bool $a_redirect=true)
ScreenContext ContextServices $tool_context
Tree SkillTreeManager $skill_tree_manager
getAdminTabs()
administration tabs show only permissions and trash folder
array $requested_node_ids
string $requested_skexpand
ilGlobalTemplateInterface $main_tpl
deleteNodes(object $a_gui)
Node SkillTreeNodeManager $skill_tree_node_manager
collapseAll(bool $a_redirect=true)
__construct( $a_data, int $a_id, bool $a_call_by_reference=true, bool $a_prepare_output=true)
ilSkillTreeRepository $skill_tree_repo
showTree(bool $a_templates, $a_gui="", $a_gui_cmd="")
Access SkillManagementAccess $skill_management_access_manager
saveAllTemplateTitles(bool $a_succ_mess=true)
string $requested_table_action
int $requested_templates_tree
Access SkillTreeAccess $skill_tree_access_manager
Service SkillAdminGUIRequest $admin_gui_request
Node SkillDeletionManager $skill_deletion_manager
array $requested_table_tree_ids
Service SkillUIService $skill_ui_service
Class ilObjectGUI Basic methods of all Output classes.
ilGlobalTemplateInterface $tpl
prepareOutput(bool $show_sub_objects=true)
ServerRequestInterface $request
Class ilObject Basic functions for all objects.
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
static get(string $a_var)
static set(string $a_var, $a_val)
Set a value.
Skill category GUI class.
Class ilSkillProfileUploadHandlerGUI.
Skill template category GUI class.
Skill template reference GUI class.
static _lookupTrefIdsForTopTemplateId(int $a_template_id)
static _lookupTrefIdsForTemplateId(int $a_tid)
static _lookupTemplateId(int $a_obj_id)
Explorer class that works on tree objects (Services/Tree)
Explorer class that works on tree objects (Services/Tree)
static getInstance(int $a_id=0)
static _writeTitle(int $a_obj_id, string $a_title)
static _lookupType(int $a_obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setBackTarget(string $a_title, string $a_target, string $a_frame="")
clearTargets()
clear all targets
activateTab(string $a_id)
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
setLeftNavContent(string $a_content)
Sets content of left navigation column.
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
setContent(string $a_html)
Sets content for standard template.
Interface ilSkillTreeRepository.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc