79 bool $a_call_by_reference =
true,
80 bool $a_prepare_output =
true 84 $this->
ctrl = $DIC->ctrl();
85 $this->rbacsystem = $DIC->rbac()->system();
86 $this->error = $DIC[
"ilErr"];
87 $this->
access = $DIC->access();
88 $this->
tabs = $DIC->tabs();
89 $this->
lng = $DIC->language();
91 $this->tpl = $DIC[
"tpl"];
92 $this->
toolbar = $DIC->toolbar();
93 $this->
user = $DIC->user();
94 $ilCtrl = $DIC->ctrl();
95 $this->
ui = $DIC->ui();
96 $this->main_tpl = $DIC->ui()->mainTemplate();
97 $this->
locator = $DIC[
"ilLocator"];
98 $this->admin_gui_request = $DIC->skills()->internal()->gui()->admin_request();
100 $this->type =
"skee";
103 $this->
lng->loadLanguageModule(
'skmg');
105 $this->skill_tree_repo = $DIC->skills()->internal()->repo()->getTreeRepo();
106 $this->skill_tree_factory = $DIC->skills()->internal()->factory()->tree();
107 $this->skill_tree = $this->skill_tree_factory->getTreeById($this->
object->getId());
109 $ilCtrl->saveParameter($this,
"node_id");
111 $this->tool_context = $DIC->globalScreen()->tool()->context();
113 $this->requested_node_id = $this->admin_gui_request->getNodeId();
114 $this->requested_tref_id = $this->admin_gui_request->getTrefId();
115 $this->requested_templates_tree = $this->admin_gui_request->getTemplatesTree();
116 $this->requested_skexpand = $this->admin_gui_request->getSkillExpand();
117 $this->requested_tmpmode = $this->admin_gui_request->getTemplateMode();
118 $this->requested_titles = $this->admin_gui_request->getTitles();
119 $this->requested_node_ids = $this->admin_gui_request->getNodeIds();
124 $this->skill_tree_manager = $skill_manager->getTreeManager();
125 $this->skill_tree_node_manager = $skill_manager->getTreeNodeManager($this->
object->getId());
126 $this->skill_tree_access_manager = $skill_manager->getTreeAccessManager($this->
object->getRefId());
127 $this->skill_management_access_manager = $skill_manager->getManagementAccessManager(
128 $this->skill_tree_manager->getSkillManagementRefId()
130 $this->profile_manager = $skill_manager->getProfileManager();
131 $this->profile_completion_manager = $skill_manager->getProfileCompletionManager();
140 $next_class = $this->
ctrl->getNextClass($this);
141 $cmd = $this->
ctrl->getCmd();
147 if (!$this->skill_tree_access_manager->hasReadTreePermission()) {
151 switch ($next_class) {
152 case 'ilskillrootgui':
153 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
157 $this->skill_tree_node_manager,
158 $this->requested_node_id
160 $skrt_gui->setParentGUI($this);
161 $ret = $this->
ctrl->forwardCommand($skrt_gui);
164 case 'ilskillcategorygui':
165 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
168 $this->tabs_gui->activateTab(
"skills");
170 $this->skill_tree_node_manager,
171 $this->requested_node_id
173 $scat_gui->setParentGUI($this);
174 $this->
showTree(
false, $scat_gui,
"listItems");
175 $ret = $this->
ctrl->forwardCommand($scat_gui);
178 case 'ilbasicskillgui':
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 $skill_gui->setParentGUI($this);
188 $this->
showTree(
false, $skill_gui,
"edit");
189 $ret = $this->
ctrl->forwardCommand($skill_gui);
192 case 'ilskilltemplatecategorygui':
193 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
196 $this->tabs_gui->activateTab(
"skill_templates");
198 $this->skill_tree_node_manager,
199 $this->requested_node_id,
200 $this->requested_tref_id
202 $sctp_gui->setParentGUI($this);
203 $this->
showTree(($this->requested_tref_id == 0), $sctp_gui,
"listItems");
204 $ret = $this->
ctrl->forwardCommand($sctp_gui);
207 case 'ilbasicskilltemplategui':
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 $sktp_gui->setParentGUI($this);
218 $this->
showTree(($this->requested_tref_id == 0), $sktp_gui,
"edit");
219 $ret = $this->
ctrl->forwardCommand($sktp_gui);
222 case 'ilskilltemplatereferencegui':
223 if (!$this->skill_tree_access_manager->hasReadCompetencesPermission()) {
226 $this->tabs_gui->activateTab(
"skills");
228 $this->skill_tree_node_manager,
229 $this->requested_tref_id
231 $sktr_gui->setParentGUI($this);
232 $this->
showTree(
false, $sktr_gui,
"listItems");
233 $ret = $this->
ctrl->forwardCommand($sktr_gui);
236 case "ilskillprofilegui":
237 if (!$this->skill_tree_access_manager->hasReadProfilesPermission()) {
240 $ilTabs->activateTab(
"profiles");
242 $this->skill_tree_access_manager,
243 $this->skill_tree->getTreeId()
245 $ret = $this->
ctrl->forwardCommand($skprof_gui);
248 case "ilskillprofileuploadhandlergui":
250 $ret = $this->
ctrl->forwardCommand($skprof_upl_gui);
253 case 'ilpermissiongui':
254 if (!$this->skill_tree_access_manager->hasEditTreePermissionsPermission()) {
257 $this->tabs_gui->activateTab(
'permissions');
259 $ret = $this->
ctrl->forwardCommand($perm_gui);
263 if (!$this->skill_tree_access_manager->hasEditTreeSettingsPermission()) {
266 $this->tabs_gui->activateTab(
'export');
268 $exp_gui->addFormat(
"xml");
270 $this->
object->setType(
"skmg");
271 $ret = $this->
ctrl->forwardCommand($exp_gui);
272 $this->
object->setType(
"skee");
276 if (!$cmd || $cmd ==
'view') {
280 if ($cmd ==
"showTree") {
281 $this->
showTree((
bool) $this->requested_templates_tree);
297 "ilobjsystemfoldergui",
302 $this->
lng->txt(
"administration"),
303 $this->
ctrl->getLinkTargetByClass(array(
"iladministrationgui",
"ilobjsystemfoldergui"),
"")
306 $this->
lng->txt(
"obj_skmg"),
321 $this->
ctrl->clearParametersByClass(
"ilobjskillmanagementgui");
322 $this->
ctrl->setParameterByClass(
323 "ilobjskillmanagementgui",
325 $this->skill_tree_manager->getSkillManagementRefId()
327 return $this->
ctrl->getLinkTargetByClass(
"ilobjskillmanagementgui",
"");
346 protected function edit(): void
353 if (!$this->skill_tree_access_manager->hasEditTreeSettingsPermission()) {
367 $fields[
"title"] =
$f->input()->field()->text(
$lng->
txt(
"title"))->withRequired(
true);
369 $fields[
"title"] = $fields[
"title"]->withValue($this->
object->getTitle());
372 $fields[
"description"] =
$f->input()->field()->textarea(
$lng->
txt(
"description"));
374 $fields[
"description"] = $fields[
"description"]->withValue($this->
object->getDescription());
378 $section1 =
$f->input()->field()->section($fields,
$lng->
txt(
"skmg_add_skill_tree"));
385 return $f->input()->container()->form()->standard(
$form_action, [
"props" => $section1]);
398 if (
$request->getMethod() ==
"POST") {
399 $form = $form->withRequest(
$request);
400 $data = $form->getData();
401 if (isset(
$data[
"props"]) && is_array(
$data[
"props"])) {
402 $props =
$data[
"props"];
403 $this->skill_tree_manager->createTree(
405 $props[
"description"]
407 $this->main_tpl->setOnScreenMessage(
'info',
$lng->
txt(
"msg_obj_modified"),
true);
421 public function update():
void 428 if (
$request->getMethod() ==
"POST") {
429 $form = $form->withRequest(
$request);
430 $data = $form->getData();
431 if (isset(
$data[
"props"]) && is_array(
$data[
"props"])) {
432 $props =
$data[
"props"];
435 $this->skill_tree_manager->updateTree(
438 $props[
"description"]
440 $this->main_tpl->setOnScreenMessage(
'info',
$lng->
txt(
"msg_obj_modified"),
true);
446 public function delete():
void 460 $this->tabs_gui->setBackTarget(
465 if ($this->skill_tree_access_manager->hasReadTreePermission()) {
466 if ($this->skill_tree_access_manager->hasReadCompetencesPermission()) {
467 $this->tabs_gui->addTab(
470 $this->
ctrl->getLinkTarget($this,
"editSkills")
472 $this->tabs_gui->addTab(
474 $lng->
txt(
"skmg_skill_templates"),
475 $this->
ctrl->getLinkTarget($this,
"editSkillTemplates")
479 if ($this->skill_tree_access_manager->hasReadProfilesPermission()) {
480 $this->tabs_gui->addTab(
482 $lng->
txt(
"skmg_skill_profiles"),
483 $this->
ctrl->getLinkTargetByClass(
"ilskillprofilegui")
487 if ($this->skill_tree_access_manager->hasEditTreeSettingsPermission()) {
488 $this->tabs_gui->addTab(
491 $this->
ctrl->getLinkTarget($this,
"edit")
495 if ($this->skill_tree_access_manager->hasEditTreeSettingsPermission()) {
496 $this->tabs_gui->addTab(
499 $this->
ctrl->getLinkTargetByClass(
"ilexportgui",
"")
504 if ($this->skill_tree_access_manager->hasEditTreePermissionsPermission()) {
505 $this->tabs_gui->addTab(
508 $this->
ctrl->getLinkTargetByClass(
'ilpermissiongui',
"perm")
520 $ilTabs->activateTab(
"skills");
522 $ilCtrl->
setParameterByClass(
"ilobjskilltreegui",
"node_id", $this->skill_tree->readRootId());
523 $ilCtrl->redirectByClass(
"ilskillrootgui",
"listSkills");
531 if (!count($this->requested_titles) == 0) {
532 foreach ($this->requested_titles as
$id => $title) {
534 if (is_object($node_obj)) {
540 $this->main_tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
543 $ilCtrl->redirect($this,
"editSkills");
551 if (!count($this->requested_titles) == 0) {
552 foreach ($this->requested_titles as
$id => $title) {
554 if (is_object($node_obj)) {
560 $this->main_tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
563 $ilCtrl->redirect($this,
"editSkillTemplates");
566 public function expandAll(
bool $a_redirect =
true): void
568 $this->requested_skexpand =
"";
569 $n_id = ($this->requested_node_id > 0)
570 ? $this->requested_node_id
571 : $this->skill_tree->readRootId();
572 $stree = $this->skill_tree->getSubTree($this->skill_tree->getNodeData($n_id));
574 foreach ($stree as $n) {
575 $n_arr[] = $n[
"child"];
583 $this->requested_skexpand =
"";
584 $n_id = ($this->requested_node_id > 0)
585 ? $this->requested_node_id
586 : $this->skill_tree->readRootId();
587 $stree = $this->skill_tree->getSubTree($this->skill_tree->getNodeData($n_id));
589 foreach ($stree as $n) {
590 if (in_array($n[
"child"], $old) && $n[
"child"] != $n_id) {
591 $k = array_search($n[
"child"], $old);
607 if (empty($this->requested_node_ids)) {
609 $ilCtrl->redirectByClass(
"ilskilltreeadmingui",
"listTrees");
612 $ilTabs->clearTargets();
618 foreach ($this->requested_node_ids as
$id) {
620 if (!$this->skill_management_access_manager->hasCreateTreePermission()) {
625 $tree_ids[] = $tree_node_id;
628 if ($mode ==
"templates") {
630 $ilCtrl->redirectByClass(
"ilskilltreeadmingui",
"listTrees");
639 $cskill_ids[] = array(
"skill_id" => $skill_id,
"tref_id" => $tref_id);
642 if ($mode ==
"basic") {
644 $ilCtrl->redirectByClass(
"ilskilltreeadmingui",
"listTrees");
649 $cskill_ids[] = array(
"skill_id" => $id,
"tref_id" => $tref_id);
658 if ($mode ==
"tree") {
659 $usages = $u->getAllUsagesInfoOfTrees($tree_ids);
660 } elseif ($mode ==
"basic" || $mode ==
"templates") {
661 $usages = $u->getAllUsagesInfoOfSubtrees($cskill_ids);
664 $ilCtrl->redirectByClass(
"ilskilltreeadmingui",
"listTrees");
667 if (count($usages) > 0) {
669 foreach ($usages as $k => $usage) {
671 $html .= $tab->getHTML() .
"<br/><br/>";
674 $ilCtrl->saveParameter($a_gui,
"tmpmode");
675 $ilToolbar->addButton(
677 $ilCtrl->getLinkTarget($a_gui,
"cancelDelete")
679 $this->main_tpl->setOnScreenMessage(
'failure',
$lng->
txt(
"skmg_cannot_delete_nodes_in_use"));
688 $ilCtrl->setParameter($a_gui,
"tmpmode", $this->requested_tmpmode);
689 $a_form_action = $this->
ctrl->getFormAction($a_gui);
690 $confirmation_gui->setFormAction($a_form_action);
691 $confirmation_gui->setHeaderText($this->
lng->txt(
"info_delete_sure"));
694 foreach ($this->requested_node_ids as $id) {
697 if ($mode ==
"tree") {
698 $tree_id = $this->skill_tree_repo->getTreeIdForNodeId($id);
699 $tree_obj = $this->skill_tree_manager->getTree($tree_id);
700 $obj_title = $tree_obj->getTitle();
702 $obj_title = (!in_array($node_obj->getType(), [
"sktp",
"sctp"]))
703 ? $node_obj->getTitle()
704 : $node_obj->getTitle() .
706 $this->
lng->txt(
"skmg_count_references") .
" " .
710 $confirmation_gui->addItem(
719 $confirmation_gui->setCancel(
$lng->
txt(
"cancel"),
"cancelDelete");
720 if ($mode ==
"tree") {
721 $confirmation_gui->setConfirm(
$lng->
txt(
"confirm"),
"confirmedDeleteTrees");
723 $confirmation_gui->setConfirm(
$lng->
txt(
"confirm"),
"confirmedDelete");
731 $this->
ctrl->redirectByClass(
"ilobjskillmanagementgui",
"");
739 foreach ($this->requested_node_ids as
$id) {
742 $tree = $this->skill_tree_repo->getTreeForNodeId($id);
743 $tree_obj = $this->skill_tree_manager->getTree(
$tree->
getTreeId());
747 $tree_profiles = $this->profile_manager->getProfilesForSkillTree(
$tree->
getTreeId());
748 foreach ($tree_profiles as $profile) {
749 $this->profile_manager->delete((
int) $profile[
"id"]);
750 $this->profile_completion_manager->deleteEntriesForProfile((
int) $profile[
"id"]);
753 if (is_object($obj)) {
759 $this->skill_tree_manager->deleteTree($tree_obj);
764 $this->main_tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"info_deleted"),
true);
771 foreach ($this->requested_node_ids as
$id) {
774 $node_data = $this->skill_tree->getNodeData($id);
775 if (is_object($obj)) {
778 if ($this->skill_tree->isInTree($id)) {
779 $this->skill_tree->deleteTree($node_data);
785 $this->main_tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"info_deleted"),
true);
799 $ilTabs->activateTab(
"skill_templates");
800 $ilCtrl->
setParameterByClass(
"ilobjskilltreegui",
"node_id", $this->skill_tree->readRootId());
801 $ilCtrl->redirectByClass(
"ilskillrootgui",
"listTemplates");
808 public function showTree(
bool $a_templates, $a_gui =
"", $a_gui_cmd =
""): void
816 if ($this->requested_node_id == 0 || $this->requested_node_id == $this->skill_tree->readRootId()) {
820 if ($this->requested_node_id != $this->skill_tree->readRootId()) {
821 $path = $this->skill_tree->getPathId($this->requested_node_id);
828 $ilCtrl->setParameter($this,
"templates_tree", (
int) $a_templates);
839 if (!$exp->handleCommand()) {
int $requested_templates_tree
Tree SkillTreeManager $skill_tree_manager
static _lookupTemplateId(int $a_obj_id)
static get(string $a_var)
Access SkillManagementAccess $skill_management_access_manager
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getNodeData(int $a_node_id, ?int $a_tree_pk=null)
get all information of a node.
Skill category GUI class.
saveAllTemplateTitles(bool $a_succ_mess=true)
redirectByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
Class ilSkillProfileUploadHandlerGUI.
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)
__construct( $a_data, int $a_id, bool $a_call_by_reference=true, bool $a_prepare_output=true)
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
Service SkillAdminGUIRequest $admin_gui_request
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
saveAllTitles(bool $a_succ_mess=true)
Tree SkillTreeNodeManager $skill_tree_node_manager
prepareOutput(bool $show_sub_objects=true)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
isInTree(?int $a_node_id)
get all information of a node.
showTree(bool $a_templates, $a_gui="", $a_gui_cmd="")
Explorer class that works on tree objects (Services/Tree)
setParameterByClass(string $a_class, string $a_parameter, $a_value)
deleteTree(array $a_node)
delete node and the whole subtree under this node
string $requested_skexpand
expandAll(bool $a_redirect=true)
static _lookupType(int $a_obj_id)
initTreeForm(bool $edit=false)
static getInstance(int $a_id=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Profile SkillProfileCompletionManager $profile_completion_manager
Access SkillTreeAccess $skill_tree_access_manager
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...
Provides fluid interface to RBAC services.
static _lookupTrefIdsForTemplateId(int $a_tid)
init(Service\SkillInternalManagerService $skill_manager)
static _lookupTrefIdsForTopTemplateId(int $a_template_id)
ilGlobalTemplateInterface $tpl
Profile SkillProfileManager $profile_manager
setContent(string $a_html)
Sets content for standard template.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilGlobalTemplateInterface $main_tpl
Skill internal manager service.
ServerRequestInterface $request
renderer()
Get a renderer for UI components.
Class ilObjectGUI Basic methods of all Output classes.
Skill template reference GUI class.
setBackTarget(string $a_title, string $a_target, string $a_frame="")
ScreenContext ContextServices $tool_context
clearTargets()
clear all targets
TableGUI class for skill usages.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Skill template category GUI class.
activateTab(string $a_id)
getLinkTarget(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
Error Handling & global info handling uses PEAR error class.
collapseAll(bool $a_redirect=true)
deleteNodes(object $a_gui)
Tree SkillTreeFactory $skill_tree_factory
__construct(Container $dic, ilPlugin $plugin)
addItem(string $a_title, string $a_link, string $a_frame="", int $a_ref_id=0, ?string $type=null)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
factory()
Get the factory that crafts UI components.
Explorer class that works on tree objects (Services/Tree)
array $requested_node_ids
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _writeTitle(int $a_obj_id, string $a_title)
ilSkillTreeRepository $skill_tree_repo
static set(string $a_var, $a_val)
Set a value.
Basic skill template GUI class.
setLeftNavContent(string $a_content)
Sets content of left navigation column.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...