ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilTaxonomyAdministrationRepositoryTableGUI.php
Go to the documentation of this file.
1<?php
2
24{
26 protected int $obj_id;
27 protected ilObject $obj;
28
29 public function __construct($a_parent_obj, $a_parent_cmd, ilObject $a_obj)
30 {
31 global $DIC;
32
33 $this->ctrl = $DIC->ctrl();
34 $this->lng = $DIC->language();
35 $this->access = $DIC->access();
36
37 $this->obj = $a_obj;
38
39 $this->setId("tax_adm_repo");
40
41 parent::__construct($a_parent_obj, $a_parent_cmd);
42
43 $this->addColumn($this->lng->txt("obj_tax"), "tax_title");
44 $this->addColumn($this->lng->txt("status"), "status");
45 $this->addColumn($this->lng->txt("object"), "obj_title");
46
47 $this->setDefaultOrderField("tax_title");
48 $this->setDefaultOrderDirection("asc");
49
50 $this->setRowTemplate("tpl.tax_admin_repo_row.html", "components/ILIAS/Taxonomy");
51
52 $this->initItems();
53 }
54
55 protected function initItems(): void
56 {
57 $data = array();
58
59 foreach ($this->obj->getRepositoryTaxonomies() as $tax_id => $objs) {
60 foreach ($objs as $obj_id => $obj) {
61 $idx = $tax_id . "_" . $obj_id;
62 if (!isset($data[$idx])) {
63 $data[$idx] = array(
64 "tax_title" => $obj["tax_title"],
65 "obj_title" => $obj["obj_title"],
66 "tax_status" => $obj["tax_status"],
67 "references" => array()
68 );
69 }
70
71 $path = $obj["path"];
72 array_pop($path);
73 $path = implode(" &rsaquo; ", $path);
74
75 $data[$idx]["references"][$obj["ref_id"]] =
76 array(
77 "path" => $path
78 ,
79 "url" => ilLink::_getLink($obj["ref_id"])
80 );
81 }
82 }
83
84 $this->setData($data);
85 }
86
87 protected function fillRow(array $a_set): void
88 {
89 foreach ($a_set["references"] as $ref) {
90 $this->tpl->setCurrentBlock("obj_bl");
91 $this->tpl->setVariable("OBJ_TITLE", $a_set["obj_title"]);
92 $this->tpl->setVariable("OBJ_PATH", $ref["path"]);
93 $this->tpl->setVariable("OBJ_URL", $ref["url"]);
94 $this->tpl->parseCurrentBlock();
95 }
96
97 if ($a_set["tax_status"]) {
98 $this->tpl->setVariable("TAX_STATUS", $this->lng->txt("active"));
99 $this->tpl->setVariable("TAX_STATUS_COLOR", "smallgreen");
100 } else {
101 $this->tpl->setVariable("TAX_STATUS", $this->lng->txt("inactive"));
102 $this->tpl->setVariable("TAX_STATUS_COLOR", "smallred");
103 }
104
105 $this->tpl->setVariable("TAX_TITLE", $a_set["tax_title"]);
106 }
107}
Class ilObject Basic functions for all objects.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setDefaultOrderDirection(string $a_defaultorderdirection)
setData(array $a_data)
Set table data.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
$path
Definition: ltiservices.php:30
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26