19declare(strict_types=1);
90 bool $a_call_by_reference =
true,
91 bool $a_prepare_output =
true
95 $this->
ctrl = $DIC->ctrl();
96 $this->rbacsystem =
$DIC->rbac()->system();
97 $this->
error = $DIC[
"ilErr"];
98 $this->
access = $DIC->access();
99 $this->
tabs = $DIC->tabs();
100 $this->
lng = $DIC->language();
102 $this->tpl =
$DIC[
"tpl"];
103 $this->
toolbar = $DIC->toolbar();
104 $this->
user = $DIC->user();
105 $ilCtrl =
$DIC->ctrl();
106 $this->
ui = $DIC->ui();
107 $this->main_tpl =
$DIC->ui()->mainTemplate();
108 $this->
locator = $DIC[
"ilLocator"];
109 $this->admin_gui_request =
$DIC->skills()->internal()->gui()->admin_request();
110 $this->skill_ui_service =
$DIC->skills()->ui();
112 $this->type =
"skee";
115 $this->
lng->loadLanguageModule(
'skmg');
117 $this->skill_tree_repo =
$DIC->skills()->internal()->repo()->getTreeRepo();
118 $this->skill_tree_factory =
$DIC->skills()->internal()->factory()->tree();
119 $this->skill_tree = $this->skill_tree_factory->getTreeById($this->
object->getId());
121 $ilCtrl->saveParameter($this,
"node_id");
123 $this->tool_context =
$DIC->globalScreen()->tool()->context();
125 $this->requested_node_id = $this->admin_gui_request->getNodeId();
126 $this->requested_tref_id = $this->admin_gui_request->getTrefId();
127 $this->requested_templates_tree = $this->admin_gui_request->getTemplatesTree();
128 $this->requested_skexpand = $this->admin_gui_request->getSkillExpand();
129 $this->requested_tmpmode = $this->admin_gui_request->getTemplateMode();
130 $this->requested_titles = $this->admin_gui_request->getTitles();
131 $this->requested_node_ids = $this->admin_gui_request->getNodeIds();
132 $this->requested_table_action = $this->admin_gui_request->getTableTreeAction();
133 $this->requested_table_tree_ids = $this->admin_gui_request->getTableTreeIds();
138 $this->skill_tree_manager = $skill_manager->getTreeManager();
139 $this->skill_tree_node_manager = $skill_manager->getTreeNodeManager($this->
object->getId());
140 $this->skill_tree_access_manager = $skill_manager->getTreeAccessManager($this->
object->getRefId());
141 $this->skill_management_access_manager = $skill_manager->getManagementAccessManager(
142 $this->skill_tree_manager->getSkillManagementRefId()
144 $this->skill_deletion_manager = $skill_manager->getDeletionManager();
145 $this->skill_usage_manager = $skill_manager->getUsageManager();
154 $next_class = $this->
ctrl->getNextClass($this);
155 $cmd = $this->
ctrl->getCmd();
161 if (!$this->skill_tree_access_manager->hasReadTreePermission()) {
165 switch ($next_class) {
166 case 'ilskillrootgui':
167 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
171 $this->skill_tree_node_manager,
172 $this->requested_node_id
174 $skrt_gui->setParentGUI($this);
175 $ret = $this->
ctrl->forwardCommand($skrt_gui);
178 case 'ilskillcategorygui':
179 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
182 $this->tabs_gui->activateTab(
"skills");
184 $this->skill_tree_node_manager,
185 $this->requested_node_id
187 $scat_gui->setParentGUI($this);
188 $this->
showTree(
false, $scat_gui,
"listItems");
189 $ret = $this->
ctrl->forwardCommand($scat_gui);
192 case 'ilbasicskillgui':
193 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
196 $this->tabs_gui->activateTab(
"skills");
198 $this->skill_tree_node_manager,
199 $this->requested_node_id
201 $skill_gui->setParentGUI($this);
202 $this->
showTree(
false, $skill_gui,
"edit");
203 $ret = $this->
ctrl->forwardCommand($skill_gui);
206 case 'ilskilltemplatecategorygui':
207 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
210 $this->tabs_gui->activateTab(
"skill_templates");
212 $this->skill_tree_node_manager,
213 $this->requested_node_id,
214 $this->requested_tref_id
216 $sctp_gui->setParentGUI($this);
217 $this->
showTree(($this->requested_tref_id == 0), $sctp_gui,
"listItems");
218 $ret = $this->
ctrl->forwardCommand($sctp_gui);
221 case 'ilbasicskilltemplategui':
222 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
225 $this->tabs_gui->activateTab(
"skill_templates");
227 $this->skill_tree_node_manager,
228 $this->requested_node_id,
229 $this->requested_tref_id
231 $sktp_gui->setParentGUI($this);
232 $this->
showTree(($this->requested_tref_id == 0), $sktp_gui,
"edit");
233 $ret = $this->
ctrl->forwardCommand($sktp_gui);
236 case 'ilskilltemplatereferencegui':
237 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
240 $this->tabs_gui->activateTab(
"skills");
242 $this->skill_tree_node_manager,
243 $this->requested_tref_id
245 $sktr_gui->setParentGUI($this);
246 $this->
showTree(
false, $sktr_gui,
"listItems");
247 $ret = $this->
ctrl->forwardCommand($sktr_gui);
250 case "ilskillprofilegui":
251 if (!$this->skill_tree_access_manager->hasReadProfilesPermission()) {
254 $ilTabs->activateTab(
"profiles");
256 $this->skill_tree_access_manager,
257 $this->skill_tree->getTreeId()
259 $ret = $this->
ctrl->forwardCommand($skprof_gui);
262 case "ilskillprofileuploadhandlergui":
264 $ret = $this->
ctrl->forwardCommand($skprof_upl_gui);
267 case 'ilpermissiongui':
268 if (!$this->skill_tree_access_manager->hasEditTreePermissionsPermission()) {
271 $this->tabs_gui->activateTab(
'permissions');
273 $ret = $this->
ctrl->forwardCommand($perm_gui);
277 if (!$this->skill_tree_access_manager->hasEditTreeSettingsPermission()) {
280 $this->tabs_gui->activateTab(
'export');
282 $exp_gui->addFormat(
"xml");
284 $this->
object->setType(
"skmg");
285 $ret = $this->
ctrl->forwardCommand($exp_gui);
286 $this->
object->setType(
"skee");
290 if (!$cmd || $cmd ==
'view') {
294 if ($cmd ==
"showTree") {
295 $this->
showTree((
bool) $this->requested_templates_tree);
311 "ilobjsystemfoldergui",
316 $this->
lng->txt(
"administration"),
317 $this->ctrl->getLinkTargetByClass(array(
"iladministrationgui",
"ilobjsystemfoldergui"),
"")
320 $this->
lng->txt(
"obj_skmg"),
321 $this->getSkillManagementLink()
335 $this->
ctrl->clearParametersByClass(
"ilobjskillmanagementgui");
336 $this->
ctrl->setParameterByClass(
337 "ilobjskillmanagementgui",
339 $this->skill_tree_manager->getSkillManagementRefId()
341 return $this->
ctrl->getLinkTargetByClass(
"ilobjskillmanagementgui",
"");
354 $this->getSkillManagementLink()
357 $mtpl->setContent(
$ui->
renderer()->render($this->initTreeForm()));
360 protected function edit(): void
367 if (!$this->skill_tree_access_manager->hasEditTreeSettingsPermission()) {
371 $mtpl->setContent(
$ui->
renderer()->render($this->initTreeForm(
true)));
381 $fields[
"title"] =
$f->input()->field()->text(
$lng->
txt(
"title"))->withRequired(
true);
383 $fields[
"title"] = $fields[
"title"]->withValue($this->
object->getTitle());
386 $fields[
"description"] =
$f->input()->field()->textarea(
$lng->
txt(
"description"));
388 $fields[
"description"] = $fields[
"description"]->withValue($this->
object->getDescription());
392 $section1 =
$f->input()->field()->section($fields,
$lng->
txt(
"skmg_add_skill_tree"));
399 return $f->input()->container()->form()->standard(
$form_action, [
"props" => $section1]);
412 if (
$request->getMethod() ==
"POST") {
413 $form = $form->withRequest(
$request);
414 $data = $form->getData();
415 if (isset(
$data[
"props"]) && is_array(
$data[
"props"])) {
416 $props =
$data[
"props"];
417 $this->skill_tree_manager->createTree(
419 $props[
"description"]
421 $this->main_tpl->setOnScreenMessage(
'info',
$lng->
txt(
"msg_obj_modified"),
true);
427 $this->getSkillManagementLink()
435 public function update(): void
442 if (
$request->getMethod() ==
"POST") {
443 $form = $form->withRequest(
$request);
444 $data = $form->getData();
445 if (isset(
$data[
"props"]) && is_array(
$data[
"props"])) {
446 $props =
$data[
"props"];
449 $this->skill_tree_manager->updateTree(
452 $props[
"description"]
454 $this->main_tpl->setOnScreenMessage(
'info',
$lng->
txt(
"msg_obj_modified"),
true);
460 public function delete():
void
464 if ($this->requested_table_action ===
"deleteTrees"
465 && !empty($this->requested_table_tree_ids)
466 && $this->requested_table_tree_ids[0] ===
"ALL_OBJECTS"
468 $all_trees = $this->skill_tree_manager->getTrees();
469 foreach ($all_trees as $tree_obj) {
470 $tree = $this->skill_tree_factory->getTreeById($tree_obj->getId());
473 } elseif ($this->requested_table_action ===
"deleteTrees") {
474 $this->requested_node_ids = array_map(
"intval", $this->requested_table_tree_ids);
487 $this->tabs_gui->setBackTarget(
489 $this->getSkillManagementLink()
492 if ($this->skill_tree_access_manager->hasReadTreePermission()) {
493 if ($this->skill_tree_access_manager->hasReadCompetencesPermission()) {
494 $this->tabs_gui->addTab(
497 $this->ctrl->getLinkTarget($this,
"editSkills")
499 $this->tabs_gui->addTab(
501 $lng->
txt(
"skmg_skill_templates"),
502 $this->ctrl->getLinkTarget($this,
"editSkillTemplates")
506 if ($this->skill_tree_access_manager->hasReadProfilesPermission()) {
507 $this->tabs_gui->addTab(
509 $lng->
txt(
"skmg_skill_profiles"),
510 $this->ctrl->getLinkTargetByClass(
"ilskillprofilegui")
514 if ($this->skill_tree_access_manager->hasEditTreeSettingsPermission()) {
515 $this->tabs_gui->addTab(
518 $this->ctrl->getLinkTarget($this,
"edit")
522 if ($this->skill_tree_access_manager->hasEditTreeSettingsPermission()) {
523 $this->tabs_gui->addTab(
526 $this->ctrl->getLinkTargetByClass(
"ilexportgui",
"")
531 if ($this->skill_tree_access_manager->hasEditTreePermissionsPermission()) {
532 $this->tabs_gui->addTab(
535 $this->ctrl->getLinkTargetByClass(
'ilpermissiongui',
"perm")
547 $ilTabs->activateTab(
"skills");
550 $ilCtrl->redirectByClass(
"ilskillrootgui",
"listSkills");
558 if (!count($this->requested_titles) == 0) {
559 foreach ($this->requested_titles as
$id => $title) {
561 if (is_object($node_obj)) {
567 $this->main_tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
570 $ilCtrl->redirect($this,
"editSkills");
578 if (!count($this->requested_titles) == 0) {
579 foreach ($this->requested_titles as
$id => $title) {
581 if (is_object($node_obj)) {
587 $this->main_tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
590 $ilCtrl->redirect($this,
"editSkillTemplates");
593 public function expandAll(
bool $a_redirect =
true): void
595 $this->requested_skexpand =
"";
596 $n_id = ($this->requested_node_id > 0)
597 ? $this->requested_node_id
598 : $this->skill_tree->readRootId();
599 $stree = $this->skill_tree->getSubTree($this->skill_tree->getNodeData($n_id));
601 foreach ($stree as $n) {
602 $n_arr[] = $n[
"child"];
610 $this->requested_skexpand =
"";
611 $n_id = ($this->requested_node_id > 0)
612 ? $this->requested_node_id
613 : $this->skill_tree->readRootId();
614 $stree = $this->skill_tree->getSubTree($this->skill_tree->getNodeData($n_id));
616 foreach ($stree as $n) {
617 if (in_array($n[
"child"], $old) && $n[
"child"] != $n_id) {
618 $k = array_search($n[
"child"], $old);
633 if (empty($this->requested_node_ids)) {
635 $ilCtrl->redirectByClass(
"ilskilltreeadmingui",
"listTrees");
638 $ilTabs->clearTargets();
644 foreach ($this->requested_node_ids as
$id) {
646 if (!$this->skill_management_access_manager->hasCreateTreePermission()) {
651 $tree_ids[] = $tree_node_id;
654 if ($mode ==
"templates") {
656 $ilCtrl->redirectByClass(
"ilskilltreeadmingui",
"listTrees");
665 $cskill_ids[] = array(
"skill_id" => $skill_id,
"tref_id" => $tref_id);
668 if ($mode ==
"basic") {
670 $ilCtrl->redirectByClass(
"ilskilltreeadmingui",
"listTrees");
675 $cskill_ids[] = array(
"skill_id" =>
$id,
"tref_id" => $tref_id);
683 if ($mode ==
"tree") {
684 $usages = $this->skill_usage_manager->getAllUsagesInfoOfTrees($tree_ids);
685 } elseif ($mode ==
"basic" || $mode ==
"templates") {
686 $usages = $this->skill_usage_manager->getAllUsagesInfoOfSubtrees($cskill_ids);
689 $ilCtrl->redirectByClass(
"ilskilltreeadmingui",
"listTrees");
693 if (count($usages) > 0) {
694 foreach ($usages as $k => $usage) {
695 $usages_ui = $this->skill_ui_service->getUsagesUI($k, $usage, $mode);
696 $usage_html .= $usages_ui->render() .
"<br/><br/>";
698 $ilCtrl->saveParameter($a_gui,
"tmpmode");
706 $ilCtrl->setParameter($a_gui,
"tmpmode", (
int) $this->requested_tmpmode);
707 $a_form_action = $this->
ctrl->getFormAction($a_gui);
708 $confirmation_gui->setFormAction($a_form_action);
709 if (count($usages) > 0) {
710 $confirmation_text = $this->
lng->txt(
"skmg_delete_warning");
712 $confirmation_text = $this->
lng->txt(
"info_delete_sure");
714 $confirmation_gui->setHeaderText($confirmation_text);
717 foreach ($this->requested_node_ids as
$id) {
720 if ($mode ==
"tree") {
721 $tree_id = $this->skill_tree_repo->getTreeIdForNodeId(
$id);
722 $tree_obj = $this->skill_tree_manager->getTree($tree_id);
723 $obj_title = $tree_obj->getTitle();
725 $obj_title = (!in_array($node_obj->getType(), [
"sktp",
"sctp"]))
726 ? $node_obj->getTitle()
727 : $node_obj->getTitle() .
729 $this->
lng->txt(
"skmg_count_references") .
" " .
733 $confirmation_gui->addItem(
735 (
string) $node_obj->getId(),
742 $confirmation_gui->setCancel(
$lng->
txt(
"cancel"),
"cancelDelete");
743 if ($mode ==
"tree") {
744 $confirmation_gui->setConfirm(
$lng->
txt(
"confirm"),
"confirmedDeleteTrees");
746 $confirmation_gui->setConfirm(
$lng->
txt(
"confirm"),
"confirmedDelete");
754 $this->
ctrl->redirectByClass(
"ilobjskillmanagementgui",
"");
762 foreach ($this->requested_node_ids as
$id) {
763 $this->skill_deletion_manager->deleteTree(
$id);
767 $this->main_tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"info_deleted"),
true);
774 foreach ($this->requested_node_ids as
$id) {
775 $this->skill_deletion_manager->deleteNode(
$id, $this->skill_tree);
777 $this->skill_deletion_manager->updateProfileCompletions($this->skill_tree);
780 $this->main_tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"info_deleted"),
true);
794 $ilTabs->activateTab(
"skill_templates");
795 $ilCtrl->
setParameter($this,
"node_id", $this->skill_tree->readRootId());
796 $ilCtrl->redirectByClass(
"ilskillrootgui",
"listTemplates");
803 public function showTree(
bool $a_templates, $a_gui =
"", $a_gui_cmd =
""): void
811 if ($this->requested_node_id == 0 || $this->requested_node_id == $this->skill_tree->readRootId()) {
815 if ($this->requested_node_id != $this->skill_tree->readRootId()) {
816 $path = $this->skill_tree->getPathId($this->requested_node_id);
823 $ilCtrl->setParameter($this,
"templates_tree", (
int) $a_templates);
834 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