ILIAS  trunk Revision v13.0_alpha-52-g21c366bbdd4
TableBuilder.php
Go to the documentation of this file.
1<?php
2
18declare(strict_types=1);
19
20namespace ILIAS\Taxonomy\Nodes;
21
27
29{
30 public function __construct(
31 protected InternalDomainService $domain,
32 protected InternalGUIService $gui,
33 protected \ilTaxonomyTree $tree,
34 protected int $parent_node_id,
35 protected \ilObjTaxonomy $taxonomy,
36 object $parent_gui,
37 string $parent_cmd
38 ) {
39 parent::__construct($parent_gui, $parent_cmd);
40 }
41
42 protected function getId(): string
43 {
44 return "taxonomy_nodes";
45 }
46
47 protected function getTitle(): string
48 {
49 return $this->domain->lng()->txt("tax_nodes");
50 }
51
52 protected function getRetrieval(): RetrievalInterface
53 {
54 return new Retrieval(
55 $this->tree,
56 $this->parent_node_id,
57 $this->taxonomy->getSortingMode() === \ilObjTaxonomy::SORT_MANUAL
58 );
59 }
60
61 protected function transformRow(array $data_row): array
62 {
63 $node_id = (int) $data_row["child"];
64 $ctrl = $this->gui->ctrl();
65 $ctrl->setParameter($this->parent_gui, "tax_node", $node_id);
66 $url = $ctrl->getLinkTarget($this->parent_gui, $this->parent_cmd);
67 $ctrl->setParameter($this->parent_gui, "tax_node", $this->parent_node_id);
68
69 return [
70 "id" => $node_id,
71 "title" => $this->gui->ui()->factory()->link()->standard(
72 (string) $data_row["title"],
73 $url
74 )
75 ];
76 }
77
78 protected function getOrderingCommand(): string
79 {
80 return $this->taxonomy->getSortingMode() === \ilObjTaxonomy::SORT_MANUAL
81 ? "saveSorting"
82 : "";
83 }
84
86 {
87 $lng = $this->domain->lng();
88
89 return $table
90 ->linkColumn("title", $lng->txt("title"))
91 ->singleAction("editTaxNodeTitle", $lng->txt("edit"), true)
92 ->singleAction("confirmDeleteTaxNode", $lng->txt("delete"), true)
93 ->standardAction("moveTaxNode", $lng->txt("move"));
94 }
95}
linkColumn(string $key, string $title, bool $sortable=false)
build(TableAdapterGUI $table)
__construct(protected InternalDomainService $domain, protected InternalGUIService $gui, protected \ilTaxonomyTree $tree, protected int $parent_node_id, protected \ilObjTaxonomy $taxonomy, object $parent_gui, string $parent_cmd)
transformRow(array $data_row)
transform raw data array to table row data array
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...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $lng
Definition: privfeed.php:26