19declare(strict_types=1);
39 $this->
http = $DIC->http();
42 $this->tree =
new ilTree($usr_id);
43 $this->tree->setTableNames(
'mail_tree',
'mail_obj_data');
45 $this->root_folder_id = (
new ilMailbox($usr_id))->getRooFolder();
46 $this->root_node_id = $this->tree->readRootId();
48 if ($this->root_folder_id !== $this->root_node_id) {
49 $DIC->logger()->mail()->error(
50 'Root folder id {root_folder_id} does not match root node id {root_node_id} for user {usr_id}',
52 'root_folder_id' => $this->root_folder_id,
53 'root_node_id' => $this->root_node_id,
70 if ($this->
http->wrapper()->post()->has(
'mobj_id')) {
71 $folder_id = $this->
http->wrapper()->post()->retrieve(
'mobj_id', $this->
refinery->kindlyTo()->int());
72 } elseif ($this->
http->wrapper()->query()->has(
'mobj_id')) {
73 $folder_id = $this->
http->wrapper()->query()->retrieve(
'mobj_id', $this->
refinery->kindlyTo()->int());
75 $folder_id = $this->
refinery->byTrying([
77 $this->refinery->always($this->current_folder_id),
81 $this->current_folder_id = $folder_id;
91 if (!isset($root[
'child']) && $this->root_node_id !== $this->root_folder_id) {
96 $root[
'title'] =
'a_root';
97 $root[
'm_type'] =
'root';
99 $root[
'rgt'] = PHP_INT_MAX;
100 $root[
'user_id'] = $this->tree->getTreeId();
108 return $this->
lng->txt(
"mail_folders");
113 $f = $this->
ui->factory();
117 ->withData($this->tree->getChilds($this->root_node_id))
118 ->withHighlightOnNodeClick(
false);
126 return parent::
build($factory, $record, $environment)
128 $this->current_folder_id === (
int) $record[
'child']
141 return $this->repairRootNode(parent::getRootNode());
148 if ((
int) $a_node[
'child'] === (
int) $this->getNodeId($this->getRootNode())) {
149 $content = $this->
lng->txt(
'mail_folders');
150 } elseif ($a_node[
'depth'] < 3) {
151 $content = $this->
lng->txt(
'mail_' . $a_node[
'title']);
159 return $this->getNodeContent($a_node);
164 if ((
int) $a_node[
'child'] === (
int) $this->getNodeId($this->getRootNode())) {
167 $icon_type = $a_node[
'm_type'];
168 if ($a_node[
'm_type'] ===
'user_folder') {
169 $icon_type =
'local';
180 if ((
int) $a_node[
'child'] === (
int) $this->getNodeId($this->getRootNode())) {
181 $a_node[
'child'] = 0;
184 $this->
ctrl->setParameterByClass(ilMailFolderGUI::class,
'mobj_id', $a_node[
'child']);
185 $href = $this->
ctrl->getLinkTargetByClass([ilMailGUI::class, ilMailFolderGUI::class]);
186 $this->
ctrl->clearParametersByClass(ilMailFolderGUI::class);
setSkipRootNode(bool $a_val)
repairRootNode(array $root)
Workaround for: https://mantis.ilias.de/view.php?id=40716.
getNodeHref($a_node)
Get href for node.
getNodeIcon($a_node)
Get node icon path.
readonly Refinery $refinery
build(Factory $factory, $record, $environment=null)
getNodeContent($a_node)
Get content of a node.
__construct(ilMailGUI $parent_object, int $usr_id)
getNodeIconAlt($a_node)
Get node icon alt attribute.
getNodeStateToggleCmdClasses($record)
Should return an array of ilCtrl-enabled command classes which should be used to build the URL for th...
readonly int $root_folder_id
getRootNode()
Get root node.
readonly GlobalHttpState $http
readonly int $root_node_id
@ilCtrl_Calls ilMailGUI: ilMailFolderGUI, ilMailFormGUI, ilContactGUI, ilMailOptionsGUI,...
static get(string $a_var)
Explorer class that works on tree objects (Services/Tree)
setOrderField(string $a_val, bool $a_numeric=false)
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface GlobalHttpState.
This describes a Tree Node.
This describes a Tree Control.
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc