ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilMailExplorer Class Reference
+ Inheritance diagram for ilMailExplorer:
+ Collaboration diagram for ilMailExplorer:

Public Member Functions

 __construct (ilMailGUI $parent_object, int $usr_id)
 
 getTreeLabel ()
 
 getTreeComponent ()
 
 build (Factory $factory, $record, $environment=null)
 
 getRootNode ()
 
 getNodeContent ($a_node)
 
 getNodeIconAlt ($a_node)
 
 getNodeIcon ($a_node)
 
 getNodeHref ($a_node)
 
- 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
 build (Node\Factory $factory, $record, $environment=null)
 Build and return a Node. More...
 

Protected Member Functions

 initFolder ()
 
 getNodeStateToggleCmdClasses ($record)
 
- 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

readonly GlobalHttpState $http
 
readonly Refinery $refinery
 
int $current_folder_id = 0
 
readonly int $root_folder_id
 
readonly 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 = "assets/js/Explorer2.js"
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilMailExplorer::__construct ( ilMailGUI  $parent_object,
int  $usr_id 
)

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

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

36  {
37  global $DIC;
38 
39  $this->http = $DIC->http();
40  $this->refinery = $DIC->refinery();
41 
42  $this->tree = new ilTree($usr_id);
43  $this->tree->setTableNames('mail_tree', 'mail_obj_data');
44 
45  $this->root_folder_id = (new ilMailbox($usr_id))->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 {root_folder_id} does not match root node id {root_node_id} for user {usr_id}',
51  [
52  'root_folder_id' => $this->root_folder_id,
53  'root_node_id' => $this->root_node_id,
54  'usr_id' => $usr_id,
55  ]
56  );
57  }
58 
59  parent::__construct('mail_exp', $parent_object, '', $this->tree);
60 
61  $this->initFolder();
62 
63  $this->setSkipRootNode(true);
64  $this->setAjax(false);
65  $this->setOrderField('title,m_type');
66  }
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26
__construct(Container $dic, ilPlugin $plugin)
setOrderField(string $a_val, bool $a_numeric=false)
+ Here is the call graph for this function:

Member Function Documentation

◆ build()

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

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

References ILIAS\UI\Component\Tree\Node\Node\withHighlighted().

125  : Node {
126  return parent::build($factory, $record, $environment)
127  ->withHighlighted(
128  $this->current_folder_id === (int) $record['child']
129  );
130  }
This describes a Tree Node.
Definition: Node.php:30
withHighlighted(bool $expanded)
Set $highlighted to true to have this node highlighted on loading.
+ Here is the call graph for this function:

◆ getNodeContent()

ilMailExplorer::getNodeContent (   $a_node)

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

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

Referenced by getNodeIconAlt().

144  : string
145  {
146  $content = ilLegacyFormElementsUtil::prepareFormOutput($a_node['title']);
147 
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']);
152  }
153 
154  return $content;
155  }
static prepareFormOutput($a_str, bool $a_strip=false)
getNodeId($a_node)
Get id for node.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNodeHref()

ilMailExplorer::getNodeHref (   $a_node)

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

References ILIAS\Repository\ctrl(), ilTreeExplorerGUI\getNodeId(), and getRootNode().

178  : string
179  {
180  if ((int) $a_node['child'] === (int) $this->getNodeId($this->getRootNode())) {
181  $a_node['child'] = 0;
182  }
183 
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);
187 
188  return $href;
189  }
getNodeId($a_node)
Get id for node.
+ Here is the call graph for this function:

◆ getNodeIcon()

ilMailExplorer::getNodeIcon (   $a_node)

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

References ilUtil\getImagePath(), ilTreeExplorerGUI\getNodeId(), and getRootNode().

162  : string
163  {
164  if ((int) $a_node['child'] === (int) $this->getNodeId($this->getRootNode())) {
165  $icon = ilUtil::getImagePath('standard/icon_mail.svg');
166  } else {
167  $icon_type = $a_node['m_type'];
168  if ($a_node['m_type'] === 'user_folder') {
169  $icon_type = 'local';
170  }
171 
172  $icon = ilUtil::getImagePath('standard/icon_' . $icon_type . '.svg');
173  }
174 
175  return $icon;
176  }
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
getNodeId($a_node)
Get id for node.
+ Here is the call graph for this function:

◆ getNodeIconAlt()

ilMailExplorer::getNodeIconAlt (   $a_node)

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

References getNodeContent().

157  : string
158  {
159  return $this->getNodeContent($a_node);
160  }
+ Here is the call graph for this function:

◆ getNodeStateToggleCmdClasses()

ilMailExplorer::getNodeStateToggleCmdClasses (   $record)
protected

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

132  : array
133  {
134  return [
135  ilMailGUI::class,
136  ];
137  }

◆ getRootNode()

ilMailExplorer::getRootNode ( )

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

References repairRootNode().

Referenced by getNodeContent(), getNodeHref(), and getNodeIcon().

139  : array
140  {
141  return $this->repairRootNode(parent::getRootNode());
142  }
repairRootNode(array $root)
Workaround for: https://mantis.ilias.de/view.php?id=40716.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTreeComponent()

ilMailExplorer::getTreeComponent ( )

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

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

111  : Tree
112  {
113  $f = $this->ui->factory();
114 
115  return $f->tree()
116  ->expandable($this->getTreeLabel(), $this)
117  ->withData($this->tree->getChilds($this->root_node_id))
118  ->withHighlightOnNodeClick(false);
119  }
This describes a Tree Control.
Definition: Tree.php:28
+ Here is the call graph for this function:

◆ getTreeLabel()

ilMailExplorer::getTreeLabel ( )

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

References ILIAS\Repository\lng().

Referenced by getTreeComponent().

106  : string
107  {
108  return $this->lng->txt("mail_folders");
109  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFolder()

ilMailExplorer::initFolder ( )
protected

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

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

Referenced by __construct().

68  : void
69  {
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());
74  } else {
75  $folder_id = $this->refinery->byTrying([
76  $this->refinery->kindlyTo()->int(),
77  $this->refinery->always($this->current_folder_id),
78  ])->transform(ilSession::get('mobj_id'));
79  }
80 
81  $this->current_folder_id = $folder_id;
82  }
static get(string $a_var)
static http()
Fetches the global http state from ILIAS.
+ 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 89 of file class.ilMailExplorer.php.

References $root_node_id.

Referenced by getRootNode().

89  : array
90  {
91  if (!isset($root['child']) && $this->root_node_id !== $this->root_folder_id) {
92  $root['child'] = $this->root_node_id;
93  $root['obj_id'] = $this->root_node_id;
94  $root['parent'] = 0;
95  $root['depth'] = 1;
96  $root['title'] = 'a_root';
97  $root['m_type'] = 'root';
98  $root['lft'] = 1;
99  $root['rgt'] = PHP_INT_MAX;
100  $root['user_id'] = $this->tree->getTreeId();
101  }
102 
103  return $root;
104  }
readonly int $root_node_id
+ Here is the caller graph for this function:

Field Documentation

◆ $current_folder_id

int ilMailExplorer::$current_folder_id = 0
private

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

◆ $http

readonly GlobalHttpState ilMailExplorer::$http
private

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

◆ $refinery

readonly Refinery ilMailExplorer::$refinery
private

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

◆ $root_folder_id

readonly int ilMailExplorer::$root_folder_id
private

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

◆ $root_node_id

readonly 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: