ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSearchRootSelector.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
28{
29 protected ilCtrl $ctrl;
31
32 private string $selectable_type = '';
33 private int $ref_id = 0;
34 private string $target_class = '';
35 private array $clickable_types = [];
36 private string $cmd = '';
43 public function __construct($a_target)
44 {
45 global $DIC;
46
47 $this->ctrl = $DIC->ctrl();
48 $this->system = $DIC->rbac()->system();
49
50 parent::__construct($a_target);
51 $this->root_id = $this->tree->readRootId();
52 $this->order_column = "title";
53
54 $this->setSessionExpandVariable("search_root_expand");
55
56 // add here all container objects
57 $this->addFilter("root");
58 $this->addFilter("cat");
59 $this->addFilter("grp");
60 $this->addFilter("fold");
61 $this->addFilter("crs");
62 $this->setClickableTypes(array("root", "cat", "grp", "fold", "crs"));
63
64 $this->setFiltered(true);
66
68 }
69
70 public function setPathOpen(int $ref_id): void
71 {
72 if (count($this->expanded) <= 1) {
73 foreach ($this->tree->getPathId($ref_id) as $id) {
74 $this->setExpand($id);
75 }
76 }
77 }
78
79 public function setClickableTypes(array $a_types): void
80 {
81 $this->clickable_types = $a_types;
82 }
83
84 public function isClickable(string $type, int $ref_id = 0): bool
85 {
86 return (in_array($type, $this->clickable_types));
87 }
88
89 public function setTargetClass(string $a_class): void
90 {
91 $this->target_class = $a_class;
92 }
93 public function getTargetClass(): string
94 {
95 return $this->target_class ?: 'ilsearchgui';
96 }
97 public function setCmd(string $a_cmd): void
98 {
99 $this->cmd = $a_cmd;
100 }
101 public function getCmd(): string
102 {
103 return $this->cmd ?: 'selectRoot';
104 }
105
106 public function setSelectableType(string $a_type): void
107 {
108 $this->selectable_type = $a_type;
109 }
110 public function getSelectableType(): string
111 {
113 }
114 public function setRefId(int $a_ref_id): void
115 {
116 $this->ref_id = $a_ref_id;
117 }
118 public function getRefId(): int
119 {
120 return $this->ref_id;
121 }
122
123
124 public function buildLinkTarget($a_node_id, string $a_type): string
125 {
126 $this->ctrl->setParameterByClass($this->getTargetClass(), "root_id", $a_node_id);
127
128 return $this->ctrl->getLinkTargetByClass($this->getTargetClass(), $this->getCmd());
129 }
130
131 public function buildFrameTarget(string $a_type, $a_child = 0, $a_obj_id = 0): string
132 {
133 return '';
134 }
135
136 public function showChilds($a_parent_id): bool
137 {
138 if ($a_parent_id == 0) {
139 return true;
140 }
141
142 if ($this->system->checkAccess("read", (int) $a_parent_id)) {
143 return true;
144 } else {
145 return false;
146 }
147 }
148
149
153 public function formatHeader(ilTemplate $tpl, $a_obj_id, array $a_option): void
154 {
155 #$tpl = new ilTemplate("tpl.tree.html", true, true, "components/ILIAS/UIComponent/Explorer");
156
157 if (in_array("root", $this->clickable_types)) {
158 $tpl->setCurrentBlock("link");
159 //$tpl->setVariable("LINK_NAME",$lng->txt('repository'));
160
161 $this->ctrl->setParameterByClass($this->getTargetClass(), 'root_id', ROOT_FOLDER_ID);
162 $tpl->setVariable("LINK_TARGET", $this->ctrl->getLinkTargetByClass($this->getTargetClass(), $this->getCmd()));
163 $tpl->setVariable("TITLE", $this->lng->txt("repository"));
164
165 $tpl->parseCurrentBlock();
166 }
167 }
168}
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
const IL_FM_POSITIVE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilCtrl provides processing control methods.
class for explorer view in admin frame
addFilter(string $a_item)
setExpand($a_node_id)
set the expand option this value is stored in a SESSION variable to save it different view (lo view,...
setFilterMode(int $a_mode=IL_FM_NEGATIVE)
setSessionExpandVariable(string $a_var_name="expand")
setTitleLength(int $a_length)
setFiltered(bool $a_bool)
ilGlobalTemplateInterface $tpl
const TITLE_LENGTH
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
isClickable(string $type, int $ref_id=0)
buildLinkTarget($a_node_id, string $a_type)
formatHeader(ilTemplate $tpl, $a_obj_id, array $a_option)
@inheritDoc
buildFrameTarget(string $a_type, $a_child=0, $a_obj_id=0)
__construct($a_target)
Constructor @access public.
showChilds($a_parent_id)
determines wether the childs of an object should be shown or not note: this standard implementation a...
special template class to simplify handling of ITX/PEAR
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
const ROOT_FOLDER_ID
Definition: constants.php:32
setVariable(string $variable, $value='')
Sets the given variable to the given value.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26