19 declare(strict_types=1);
86 $this->export_factory =
new ExportFactory();
88 $this->
ctrl = $DIC->ctrl();
89 $this->
lng = $DIC->language();
90 $this->
locator = $DIC[
"ilLocator"];
91 $this->tpl = $DIC[
"tpl"];
92 $this->
user = $DIC->user();
93 $this->ui_fac = $DIC->ui()->factory();
94 $this->ui_ren = $DIC->ui()->renderer();
95 $ilAccess = $DIC->access();
96 $this->tree = $DIC->repositoryTree();
97 $this->
tabs = $DIC->tabs();
98 $this->admin_gui_request = $DIC->skills()->internal()->gui()->admin_request();
99 $this->skill_ui_service = $DIC->skills()->ui();
101 $this->node_object =
null;
102 $this->
access = $ilAccess;
104 $this->requested_ref_id = $this->admin_gui_request->getRefId();
105 $this->requested_node_id = $this->admin_gui_request->getNodeId();
106 $this->requested_backcmd = $this->admin_gui_request->getBackCommand();
107 $this->requested_tmpmode = $this->admin_gui_request->getTemplateMode();
108 $this->requested_node_ids = $this->admin_gui_request->getNodeIds();
109 $this->requested_node_order = $this->admin_gui_request->getOrder();
111 $this->skill_tree_node_manager = $node_manager;
112 $this->tree_access_manager = $DIC->skills()->internal()->manager()->getTreeAccessManager($this->requested_ref_id);
113 $this->table_manager = $DIC->skills()->internal()->manager()->getTableManager();
114 $this->usage_manager = $DIC->skills()->internal()->manager()->getUsageManager();
115 $this->tree_repo = $DIC->skills()->internal()->repo()->getTreeRepo();
116 $this->skill_tree_id = $this->tree_repo->getTreeIdForNodeId($this->requested_node_id);
118 if ($a_node_id > 0 &&
126 if (!is_object($this->node_object)) {
129 if ($this->use_checked) {
133 $usages = $this->usage_manager->getAllUsagesInfoOfSubtrees($cskill_ids);
134 if (count($usages) > 0) {
135 $this->in_use =
true;
137 $this->in_use =
false;
144 $this->parentgui = $a_parentgui;
165 $ilCtrl->redirect($this,
"showOrganization");
175 $ilCtrl->
setParameter($this,
"backcmd", $this->requested_backcmd);
186 if (empty($this->requested_node_ids)) {
192 foreach ($items as $k => $item) {
197 foreach ($todel as $k) {
202 $this->tpl->setOnScreenMessage(
'info', $lng->
txt(
"skmg_insert_please_choose_one_type_only"),
true);
206 $this->skill_tree_node_manager->clipboardCut($items);
208 $this->tpl->setOnScreenMessage(
'info', $lng->
txt(
"skmg_selected_items_have_been_cut"),
true);
210 $this->skill_tree_node_manager->saveChildsOrder(
211 $this->requested_node_id,
213 $this->requested_tmpmode
227 if (empty($this->requested_node_ids)) {
233 foreach ($items as $k => $item) {
238 foreach ($todel as $k) {
242 $this->tpl->setOnScreenMessage(
'info', $lng->
txt(
"skmg_insert_please_choose_one_type_only"),
true);
245 $this->skill_tree_node_manager->clipboardCopy($items);
247 $this->tpl->setOnScreenMessage(
'info', $lng->
txt(
"skmg_selected_items_have_been_copied"),
true);
266 if (!$this->tree_access_manager->hasManageCompetencesPermission()) {
271 $this->skill_tree_node_manager->saveChildsOrder(
272 $this->requested_node_id,
274 $this->requested_tmpmode
299 $ilCtrl->getLinkTarget($this,
"redirectToParent")
314 $radg->addOption($op);
326 $this->tpl->setOnScreenMessage(
'info', $lng->
txt(
"skmg_skill_in_use"));
341 $values[
"title"] = $this->node_object->getTitle();
342 $values[
"description"] = $this->node_object->getDescription();
343 $values[
"order_nr"] = $this->node_object->getOrderNr();
344 $values[
"self_eval"] = $this->node_object->getSelfEvaluation();
345 $values[
"status"] = (string) $this->node_object->getStatus();
347 $this->
form->setValuesByArray($values);
360 if (!$this->tree_access_manager->hasManageCompetencesPermission()) {
365 if ($this->
form->checkInput()) {
367 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"msg_obj_modified"),
true);
368 $this->skill_tree_node_manager->saveChildsOrder(
369 $this->requested_node_id,
371 in_array($this->getType(), array(
"sktp",
"sctp"))
375 $this->
form->setValuesByPost();
396 if (!$this->tree_access_manager->hasManageCompetencesPermission()) {
401 if ($this->
form->checkInput()) {
403 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"msg_obj_modified"),
true);
406 $this->
form->setValuesByPost();
415 $ilCtrl->
redirect($this,
"editProperties");
418 public function initForm(
string $a_mode =
"edit"): void
427 $ti->setMaxLength(200);
429 $ti->setRequired(
true);
430 $this->
form->addItem($ti);
435 $this->
form->addItem($ta);
438 if ($a_mode ==
"create") {
439 $this->
form->addCommandButton(
"save", $lng->
txt(
"save"));
440 $this->
form->addCommandButton(
"cancelSave", $lng->
txt(
"cancel"));
441 $this->
form->setTitle($lng->
txt(
"skmg_create_" . $this->getType()));
443 $this->
form->addCommandButton(
"update", $lng->
txt(
"save"));
444 $this->
form->setTitle($lng->
txt(
"skmg_edit_" . $this->getType()));
447 $ilCtrl->setParameter($this,
"node_id", $this->requested_node_id);
448 $this->
form->setFormAction($ilCtrl->getFormAction($this));
463 if ($this->requested_tmpmode) {
471 $ilCtrl->setParameterByClass(
"ilskillrootgui",
"node_id", $this->requested_node_id);
473 $ilCtrl->redirectByClass(
"ilskillrootgui",
"listTemplates");
475 $ilCtrl->redirectByClass(
"ilskillrootgui",
"listSkills");
480 $ilCtrl->setParameterByClass(
"ilskilltemplatecategorygui",
"node_id", $this->requested_node_id);
481 $ilCtrl->redirectByClass(
"ilskilltemplatecategorygui",
"listItems");
485 $ilCtrl->setParameterByClass(
"ilskillcategorygui",
"node_id", $this->requested_node_id);
486 $ilCtrl->redirectByClass(
"ilskillcategorygui",
"listItems");
495 if (!$this->tree_access_manager->hasManageCompetencesPermission()) {
499 $this->skill_tree_node_manager->saveChildsOrder(
500 $this->requested_node_id,
501 $this->requested_node_order,
502 $this->requested_tmpmode
504 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"msg_obj_modified"),
true);
510 $this->skill_tree_node_manager->insertItemsFromClip(
"skll", $this->requested_node_id);
516 $this->skill_tree_node_manager->insertItemsFromClip(
"scat", $this->requested_node_id);
522 $this->skill_tree_node_manager->insertItemsFromClip(
"sktr", $this->requested_node_id);
528 $this->skill_tree_node_manager->insertItemsFromClip(
"sktp", $this->requested_node_id);
534 $this->skill_tree_node_manager->insertItemsFromClip(
"sctp", $this->requested_node_id);
542 $obj_id = (is_object($this->node_object))
543 ? $this->node_object->getId()
566 $lng->
txt(
"skmg_usage"),
567 $ilCtrl->getLinkTarget($this,
"showUsage")
575 $this->setTabs(
"usage");
577 $base_skill_id = ($this->base_skill_id > 0)
578 ? $this->base_skill_id
579 : $this->node_object->getId();
580 $usages = $this->usage_manager->getAllUsagesInfoOfSubtree($base_skill_id, $this->tref_id);
583 foreach ($usages as $k => $usage) {
584 $usages_ui = $this->skill_ui_service->getUsagesUI($k, $usage);
585 $html .= $usages_ui->render() .
"<br/><br/>";
598 $lng->
txt(
"skmg_assigned_objects"),
599 $ilCtrl->getLinkTarget($this,
"showObjects")
607 $this->setTabs(
"objects");
609 $base_skill_id = ($this->base_skill_id > 0)
610 ? $this->base_skill_id
611 : $this->node_object->getId();
612 $objects = $this->usage_manager->getAssignedObjectsForSkill($base_skill_id, $this->tref_id);
614 $table = $this->table_manager->getAssignedObjectsTable(
621 $tpl->
setContent($this->ui_ren->render($table));
624 public function exportSelectedNodes():
void 628 if (empty($this->requested_node_ids)) {
633 $configs = $this->export_factory->consumer()->exportConfig()->allExportConfigs();
634 $config = $configs->getElementByComponent(
'components/ILIAS/Skill');
635 $config->setSelectedNodes($this->requested_node_ids);
636 $config->setSkillTreeId($this->skill_tree_id);
639 $obj->setRefId($this->requested_ref_id);
640 $obj->setType(
'skee');
642 $obj->setType(
'skmg');
643 $this->export_factory->consumer()->handler()->createStandardExportByObject($this->
user->getId(), $obj, $configs);
644 $ilCtrl->redirectByClass(array(
"ilobjskilltreegui",
"ilexportgui"),
"");
static getAllCSkillIdsForNodeIds(array $a_node_ids)
Get all possible common skill IDs for node IDs.
cutItems()
Copy items to clipboard, then cut them from the current tree.
This class represents an option in a radio group.
insertTemplateReferenceClip()
array $requested_node_order
static _lookupStatus(int $a_obj_id)
SkillUIService $skill_ui_service
initForm(string $a_mode="edit")
static getAllStatus()
Get all status as array, key is value, value is lang text.
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...
setSkillNodeDescription()
addUsageTab(ilTabsGUI $a_tabs)
readNodeObject(int $a_node_id)
Get node object instance.
Request wrapper for guis in skill administration.
Table TableManager $table_manager
Usage SkillUsageManager $usage_manager
update()
Update skill tree node.
redirectToParent(bool $a_tmp_mode=false)
Redirect to parent (identified by current node_id)
setContent(string $a_html)
Sets content for standard template.
static _lookupType(int $a_obj_id)
deleteNodes()
Delete nodes in the hierarchy.
ilSkillTreeRepository $tree_repo
static getInstance(int $a_id=0)
array $requested_node_ids
getPropertyValues()
Get property values for edit form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
copyItems()
Copy items to clipboard.
setParentGUI(object $a_parentgui)
create()
Create skill tree node.
Basic GUI class for skill tree nodes.
confirmedDelete()
confirmed delete
redirect(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addObjectsTab(ilTabsGUI $a_tabs)
string $requested_backcmd
ExportFactoryInterface $export_factory
setBackTarget(string $a_title, string $a_target, string $a_frame="")
ilGlobalTemplateInterface $tpl
static getIconPath(int $a_obj_id, string $a_type, string $a_size="", int $a_status=0)
Node SkillTreeNodeManager $skill_tree_node_manager
setTitleIcon(string $a_icon_path, string $a_icon_desc="")
set title icon
SkillAdminGUIRequest $admin_gui_request
DataFactory $data_factory
save()
Save skill tree node.
__construct(Node\SkillTreeNodeManager $node_manager, int $a_node_id=0)
form( $class_path, string $cmd, string $submit_caption="")
insertSkillCategoryClip()
setDescription(string $a_descr)
Sets description below title in standard template.
This class represents a text area property in a property form.
insertSkillTemplateClip()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
SkillTreeAccess $tree_access_manager
static uniqueTypesCheck(array $a_items)
Check for unique types.
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
static getStatusInfo(int $a_status)
addStatusInput(ilPropertyFormGUI $a_form)
addTab(string $a_id, string $a_text, string $a_link, string $a_frame="")
Add a Tab.
insertTemplateCategoryClip()