ILIAS  release_8 Revision v8.24
ilMailExplorer Class Reference
+ Inheritance diagram for ilMailExplorer:
+ Collaboration diagram for ilMailExplorer:

Public Member Functions

 __construct (ilMailGUI $parentObject, int $userId)
 
 getTreeLabel ()
 
 getTreeComponent ()
 
 build (Factory $factory, $record, $environment=null)
 
 getRootNode ()
 Get root node. More...
 
 getNodeContent ($a_node)
 Get content of a node. More...
 
 getNodeIconAlt ($a_node)
 Get node icon alt attribute. More...
 
 getNodeIcon ($a_node)
 Get node icon path. More...
 
 getNodeHref ($a_node)
 Get href for node. More...
 
- Public Member Functions inherited from ilTreeExplorerGUI
 __construct (string $a_expl_id, $a_parent_obj, string $a_parent_cmd, ilTree $a_tree, string $a_node_parameter_name="node_id")
 
 getTree ()
 
 setOrderField (string $a_val, bool $a_numeric=false)
 
 getOrderField ()
 
 setTypeWhiteList (array $a_val)
 Set type white list. More...
 
 getTypeWhiteList ()
 Get type white list. More...
 
 setTypeBlackList (array $a_val)
 Set type black list. More...
 
 getTypeBlackList ()
 Get type black list. More...
 
 setPreloadChilds (bool $a_val)
 
 getPreloadChilds ()
 
 getSuccessorNode ( $a_node_id, string $a_type="")
 Get successor node (currently only(!) based on lft/rgt tree values) More...
 
 getChildsOfNode ($a_parent_node_id)
 Get childs of node. More...
 
 getNodeId ($a_node)
 Get id for node. More...
 
 getNodeIconAlt ($a_node)
 Get node icon alt attribute. More...
 
 getRootNode ()
 Get root node. More...
 
 setRootId ($a_root)
 
 setPathOpen ($a_id)
 Set node path to be opened. More...
 
 getHTML ($new=false)
 Get HTML. More...
 
 getChildren ($record, $environment=null)
 Get a list of records (that list can also be empty). More...
 
 build (\ILIAS\UI\Component\Tree\Node\Factory $factory, $record, $environment=null)
 
 getTreeLabel ()
 
 getTreeComponent ()
 
 toggleExplorerNodeState ()
 Should be called by an ilCtrl-enabled command class if a tree node toggle action should be processed. More...
 
- Public Member Functions inherited from ilExplorerBaseGUI
 setChildLimit (int $a_val)
 
 getChildLimit ()
 
 setSearchTerm (string $a_val)
 
 getSearchTerm ()
 
 setMainTemplate (ilGlobalTemplateInterface $a_main_tpl=null)
 
 getRootNode ()
 Get root node. More...
 
 getChildsOfNode ($a_parent_node_id)
 Get children of node. More...
 
 getNodeContent ($a_node)
 Get content of a node. More...
 
 getNodeId ($a_node)
 Get id of a node. More...
 
 getNodeHref ($a_node)
 Get href for node. More...
 
 nodeHasVisibleChilds ($a_node)
 Node has children Please note that this standard method may not be optimal depending on what a derived class does in isNodeVisible. More...
 
 sortChilds (array $a_childs, $a_parent_node_id)
 Sort childs. More...
 
 getNodeIcon ($a_node)
 Get node icon path. More...
 
 getNodeIconAlt ($a_node)
 Get node icon alt attribute. More...
 
 getNodeTarget ($a_node)
 Get node target (frame) attribute. More...
 
 getNodeOnClick ($a_node)
 Get node onclick attribute. More...
 
 isNodeVisible ($a_node)
 Is node visible? More...
 
 isNodeHighlighted ($a_node)
 Is node highlighted? More...
 
 isNodeClickable ($a_node)
 Is node clickable? More...
 
 getId ()
 Get id of explorer element. More...
 
 setSkipRootNode (bool $a_val)
 
 getSkipRootNode ()
 
 setAjax (bool $a_val)
 
 getAjax ()
 
 setSecondaryHighlightedNodes (array $a_val)
 Set secondary (background) highlighted nodes. More...
 
 getSecondaryHighlightedNodes ()
 Get secondary (background) highlighted nodes. More...
 
 setNodeOpen ($a_id)
 Set node to be opened (additional custom opened node, not standard expand behaviour) More...
 
 setSelectMode (string $a_postvar, bool $a_multi=false)
 Set select mode (to deactivate, pass an empty string as postvar) More...
 
 setNodeSelected ($a_id)
 Set node to be opened (additional custom opened node, not standard expand behaviour) More...
 
 setOfflineMode (bool $a_val)
 
 getOfflineMode ()
 
 handleCommand ()
 Handle explorer internal command. More...
 
 getContainerId ()
 
 openNode ()
 Open node. More...
 
 closeNode ()
 Close node. More...
 
 getNodeAsync ()
 Get node asynchronously. More...
 
 beforeRendering ()
 Before rendering. More...
 
 getOnLoadCode ()
 Get on load code. More...
 
 getHTML ()
 
 renderNode ($a_node, ilTemplate $tpl)
 Render node. More...
 
 renderChilds ($a_node_id, ilTemplate $tpl)
 Render childs. More...
 
 getDomNodeIdForNodeId ($a_node_id)
 Get DOM node id for node id. More...
 
 getNodeIdForDomNodeId (string $a_dom_node_id)
 Get node id for dom node id. More...
 
 listItemStart (ilTemplate $tpl, $a_node)
 List item start. More...
 
 listItemEnd (ilTemplate $tpl)
 
 listStart (ilTemplate $tpl)
 
 listEnd (ilTemplate $tpl)
 
 isNodeOnclickEnabled ()
 
 setNodeOnclickEnabled (bool $nodeOnclickEnabled)
 
 isEnableDnd ()
 
 setEnableDnd (bool $enable_dnd)
 
- Public Member Functions inherited from ILIAS\UI\Component\Tree\TreeRecursion
 getChildren ( $record, $environment=null)
 Get a list of records (that list can also be empty). More...
 
 build (Node\Factory $factory, $record, $environment=null)
 Build and return a Node. More...
 

Protected Member Functions

 initFolder ()
 
 getNodeStateToggleCmdClasses ($record)
 Should return an array of ilCtrl-enabled command classes which should be used to build the URL for the expand/collapse actions applied on a tree node. More...
 
- Protected Member Functions inherited from ilTreeExplorerGUI
 preloadChilds ()
 
 matches ($node)
 Does a node match a search term (or is search term empty) More...
 
 getRootId ()
 
 createNode (\ILIAS\UI\Component\Tree\Node\Factory $factory, $record)
 Creates at tree node, can be overwritten in derivatives if another node type should be used. More...
 
 getNodeStateToggleCmdClasses ($record)
 Should return an array of ilCtrl-enabled command classes which should be used to build the URL for the expand/collapse actions applied on a tree node. More...
 
 render ()
 
- Protected Member Functions inherited from ilExplorerBaseGUI
 isNodeSelectable ($a_node)
 Is node selectable? More...
 
 getNodeToggleOnClick ($a_node)
 Get onclick attribute for node toggling. More...
 
 getSelectOnClick ($a_node)
 Get onclick attribute for selecting radio/checkbox. More...
 
 isNodeOpen ($node_id)
 Get all open nodes. More...
 
 getJSTreePlugins ()
 
 isNodeRequested (string $a_node_id)
 

Private Member Functions

 repairRootNode (array $root)
 Workaround for: https://mantis.ilias.de/view.php?id=40716. More...
 

Private Attributes

GlobalHttpState $http
 
Refinery $refinery
 
int $currentFolderId = 0
 
int $root_folder_id
 
int $root_node_id
 

Additional Inherited Members

- Static Public Member Functions inherited from ilExplorerBaseGUI
static getLocalExplorerJsPath ()
 
static getLocalJsTreeJsPath ()
 
static getLocalJsTreeCssPath ()
 
static createHTMLExportDirs (string $a_target_dir)
 
static init (ilGlobalTemplateInterface $a_main_tpl=null)
 
- Protected Attributes inherited from ilTreeExplorerGUI
ilLanguage $lng
 
Psr Http Message ServerRequestInterface $httpRequest
 
ilTree $tree = null
 
string $tree_label = ""
 
string $order_field = ""
 
bool $order_field_numeric = false
 
array $type_white_list = array()
 
array $type_black_list = array()
 
array $childs = array()
 
bool $preloaded = false
 
bool $preload_childs = false
 
array $root_node_data = null
 
array $all_childs = array()
 
 $root_id = 0
 
ILIAS DI UIServices $ui
 
- Protected Attributes inherited from ilExplorerBaseGUI
string $node_parameter_name
 
ilLogger $log
 
ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 
bool $skip_root_node = false
 
bool $ajax = false
 
array $custom_open_nodes = array()
 
array $selected_nodes = array()
 
string $select_postvar = ""
 
bool $offline_mode = false
 
array $sec_highl_nodes = array()
 
bool $enable_dnd = false
 
string $search_term = ""
 
array $open_nodes = []
 
ilSessionIStorage $store
 
bool $select_multi = false
 
 $parent_obj
 
int $child_limit = 0
 
string $parent_cmd = ''
 
string $requested_exp_cmd = ""
 
string $requested_exp_cont = ""
 
string $requested_searchterm = ""
 
string $requested_node_id = ""
 
string $id
 
- Static Protected Attributes inherited from ilExplorerBaseGUI
static string $js_tree_path = "./node_modules/jstree/dist/jstree.js"
 
static string $js_tree_path_css = "./node_modules/jstree/dist/themes/default/style.min.css"
 
static string $js_expl_path = "./Services/UIComponent/Explorer2/js/Explorer2.js"
 

Detailed Description

Definition at line 27 of file class.ilMailExplorer.php.

Constructor & Destructor Documentation

◆ __construct()

ilMailExplorer::__construct ( ilMailGUI  $parentObject,
int  $userId 
)

Definition at line 35 of file class.ilMailExplorer.php.

36 {
37 global $DIC;
38
39 $this->http = $DIC->http();
40 $this->refinery = $DIC->refinery();
41
42 $this->tree = new ilTree($userId);
43 $this->tree->setTableNames('mail_tree', 'mail_obj_data');
44
45 $this->root_folder_id = (new ilMailbox($userId))->getRooFolder();
46 $this->root_node_id = $this->tree->readRootId();
47
48 if ($this->root_folder_id !== $this->root_node_id) {
49 $DIC->logger()->mail()->error(
50 "Root folder id $this->root_folder_id does not match root node id $this->root_node_id for user $userId"
51 );
52 }
53
54 parent::__construct('mail_exp', $parentObject, '', $this->tree);
55
56 $this->initFolder();
57
58 $this->setSkipRootNode(true);
59 $this->setAjax(false);
60 $this->setOrderField('title,m_type');
61 }
Mail Box class Base class for creating and handling mail boxes.
setOrderField(string $a_val, bool $a_numeric=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\FileDelivery\http(), initFolder(), ILIAS\Repository\refinery(), ilExplorerBaseGUI\setAjax(), ilTreeExplorerGUI\setOrderField(), and ilExplorerBaseGUI\setSkipRootNode().

+ Here is the call graph for this function:

Member Function Documentation

◆ build()

ilMailExplorer::build ( Factory  $factory,
  $record,
  $environment = null 
)

Definition at line 116 of file class.ilMailExplorer.php.

120 : Node {
121 return parent::build($factory, $record, $environment)
123 $this->currentFolderId === (int) $record['child']
124 );
125 }
This describes a Tree Node.
Definition: Node.php:31
withHighlighted(bool $expanded)
Set $highlighted to true to have this node highlighted on loading.
$factory
Definition: metadata.php:75

◆ getNodeContent()

ilMailExplorer::getNodeContent (   $a_node)

Get content of a node.

Parameters
object | array$a_nodenode array or object
Returns
string content of the node

Reimplemented from ilExplorerBaseGUI.

Definition at line 139 of file class.ilMailExplorer.php.

139 : string
140 {
141 $content = ilLegacyFormElementsUtil::prepareFormOutput($a_node['title']);
142
143 if ((int) $a_node['child'] === (int) $this->getNodeId($this->getRootNode())) {
144 $content = $this->lng->txt('mail_folders');
145 } elseif ($a_node['depth'] < 3) {
146 $content = $this->lng->txt('mail_' . $a_node['title']);
147 }
148
149 return $content;
150 }
static prepareFormOutput($a_str, bool $a_strip=false)
getRootNode()
Get root node.
getNodeId($a_node)
Get id for node.

References ILIAS\Repository\lng(), and ilLegacyFormElementsUtil\prepareFormOutput().

+ Here is the call graph for this function:

◆ getNodeHref()

ilMailExplorer::getNodeHref (   $a_node)

Get href for node.

Parameters
object | array$a_node
Returns
string href attribute

Reimplemented from ilExplorerBaseGUI.

Definition at line 173 of file class.ilMailExplorer.php.

173 : string
174 {
175 if ((int) $a_node['child'] === (int) $this->getNodeId($this->getRootNode())) {
176 $a_node['child'] = 0;
177 }
178
179 $this->ctrl->setParameterByClass(ilMailFolderGUI::class, 'mobj_id', $a_node['child']);
180 $href = $this->ctrl->getLinkTargetByClass([ilMailGUI::class, ilMailFolderGUI::class]);
181 $this->ctrl->clearParametersByClass(ilMailFolderGUI::class);
182
183 return $href;
184 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ getNodeIcon()

ilMailExplorer::getNodeIcon (   $a_node)

Get node icon path.

Parameters
object | array$a_node
Returns
string image file path

Reimplemented from ilExplorerBaseGUI.

Definition at line 157 of file class.ilMailExplorer.php.

157 : string
158 {
159 if ((int) $a_node['child'] === (int) $this->getNodeId($this->getRootNode())) {
160 $icon = ilUtil::getImagePath('icon_mail.svg');
161 } else {
162 $iconType = $a_node['m_type'];
163 if ($a_node['m_type'] === 'user_folder') {
164 $iconType = 'local';
165 }
166
167 $icon = ilUtil::getImagePath('icon_' . $iconType . '.svg');
168 }
169
170 return $icon;
171 }
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)

References ilUtil\getImagePath().

+ Here is the call graph for this function:

◆ getNodeIconAlt()

ilMailExplorer::getNodeIconAlt (   $a_node)

Get node icon alt attribute.

Parameters
object | array$a_nodenode
Returns
string image alt attribute

Reimplemented from ilTreeExplorerGUI.

Definition at line 152 of file class.ilMailExplorer.php.

152 : string
153 {
154 return $this->getNodeContent($a_node);
155 }
getNodeContent($a_node)
Get content of a node.

◆ getNodeStateToggleCmdClasses()

ilMailExplorer::getNodeStateToggleCmdClasses (   $record)
protected

Should return an array of ilCtrl-enabled command classes which should be used to build the URL for the expand/collapse actions applied on a tree node.

Parameters
$record
Returns
array

Reimplemented from ilTreeExplorerGUI.

Definition at line 127 of file class.ilMailExplorer.php.

127 : array
128 {
129 return [
130 ilMailGUI::class,
131 ];
132 }

◆ getRootNode()

ilMailExplorer::getRootNode ( )

Get root node.

Returns
object|array node

Reimplemented from ilTreeExplorerGUI.

Definition at line 134 of file class.ilMailExplorer.php.

134 : array
135 {
136 return $this->repairRootNode(parent::getRootNode());
137 }
repairRootNode(array $root)
Workaround for: https://mantis.ilias.de/view.php?id=40716.

◆ getTreeComponent()

ilMailExplorer::getTreeComponent ( )

Reimplemented from ilTreeExplorerGUI.

Definition at line 106 of file class.ilMailExplorer.php.

106 : Tree
107 {
108 $f = $this->ui->factory();
109
110 return $f->tree()
111 ->expandable($this->getTreeLabel(), $this)
112 ->withData($this->tree->getChilds($this->root_node_id))
113 ->withHighlightOnNodeClick(false);
114 }
This describes a Tree Control.
Definition: Tree.php:29

References Vendor\Package\$f, getTreeLabel(), and ILIAS\Repository\ui().

+ Here is the call graph for this function:

◆ getTreeLabel()

ilMailExplorer::getTreeLabel ( )

Reimplemented from ilTreeExplorerGUI.

Definition at line 101 of file class.ilMailExplorer.php.

101 : string
102 {
103 return $this->lng->txt("mail_folders");
104 }

References ILIAS\Repository\lng().

Referenced by getTreeComponent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFolder()

ilMailExplorer::initFolder ( )
protected

Definition at line 63 of file class.ilMailExplorer.php.

63 : void
64 {
65 if ($this->http->wrapper()->post()->has('mobj_id')) {
66 $folderId = $this->http->wrapper()->post()->retrieve('mobj_id', $this->refinery->kindlyTo()->int());
67 } elseif ($this->http->wrapper()->query()->has('mobj_id')) {
68 $folderId = $this->http->wrapper()->query()->retrieve('mobj_id', $this->refinery->kindlyTo()->int());
69 } else {
70 $folderId = $this->refinery->byTrying([
71 $this->refinery->kindlyTo()->int(),
72 $this->refinery->always($this->currentFolderId),
73 ])->transform(ilSession::get('mobj_id'));
74 }
75
76 $this->currentFolderId = $folderId;
77 }
static get(string $a_var)

References ilSession\get(), ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ repairRootNode()

ilMailExplorer::repairRootNode ( array  $root)
private

Workaround for: https://mantis.ilias.de/view.php?id=40716.

Parameters
array<string,mixed>$root
Returns
array<string, mixed>

Definition at line 84 of file class.ilMailExplorer.php.

84 : array
85 {
86 if (!isset($root['child']) && $this->root_node_id !== $this->root_folder_id) {
87 $root['child'] = $this->root_node_id;
88 $root['obj_id'] = $this->root_node_id;
89 $root['parent'] = 0;
90 $root['depth'] = 1;
91 $root['title'] = 'a_root';
92 $root['m_type'] = 'root';
93 $root['lft'] = 1;
94 $root['rgt'] = PHP_INT_MAX;
95 $root['user_id'] = $this->tree->getTreeId();
96 }
97
98 return $root;
99 }

References $root_node_id.

Field Documentation

◆ $currentFolderId

int ilMailExplorer::$currentFolderId = 0
private

Definition at line 31 of file class.ilMailExplorer.php.

◆ $http

GlobalHttpState ilMailExplorer::$http
private

Definition at line 29 of file class.ilMailExplorer.php.

◆ $refinery

Refinery ilMailExplorer::$refinery
private

Definition at line 30 of file class.ilMailExplorer.php.

◆ $root_folder_id

int ilMailExplorer::$root_folder_id
private

Definition at line 32 of file class.ilMailExplorer.php.

◆ $root_node_id

int ilMailExplorer::$root_node_id
private

Definition at line 33 of file class.ilMailExplorer.php.

Referenced by repairRootNode().


The documentation for this class was generated from the following file: