ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilMailExplorer.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once("./Services/UIComponent/Explorer2/classes/class.ilTreeExplorerGUI.php");
5 
14 {
18  protected $lng;
19 
23  protected $ctrl;
24 
31  public function __construct($a_parent_obj, $a_parent_cmd, $a_user_id)
32  {
33  global $DIC;
34 
35  $this->lng = $DIC->language();
36  $this->ctrl = $DIC->ctrl();
37 
38  $this->tree = new ilTree($a_user_id);
39  $this->tree->setTableNames('mail_tree', 'mail_obj_data');
40 
41  parent::__construct("mail_exp", $a_parent_obj, $a_parent_cmd, $this->tree);
42 
43  $this->setSkipRootNode(false);
44  $this->setAjax(false);
45  $this->setOrderField("title,m_type");
46  }
47 
48  public function getNodeContent($a_node)
49  {
50  if ($a_node["child"] == $this->getNodeId($this->getRootNode())) {
51  return $this->lng->txt("mail_folders");
52  }
53 
54  if ($a_node["depth"] < 3) {
55  return $this->lng->txt("mail_" . $a_node["title"]);
56  }
57 
58  return $a_node["title"];
59  }
60 
61  public function getNodeIcon($a_node)
62  {
63  if ($a_node["child"] == $this->getNodeId($this->getRootNode())) {
64  return ilUtil::getImagePath("icon_mail.svg");
65  } else {
66  $icon_type = ($a_node["m_type"] == "user_folder")
67  ? "local"
68  : $a_node["m_type"];
69  return ilUtil::getImagePath("icon_" . $icon_type . ".svg");
70  }
71  }
72 
73  public function getNodeIconAlt($a_node)
74  {
75  if ($a_node["child"] == $this->getNodeId($this->getRootNode())) {
76  return $this->lng->txt("icon") . " " . $this->lng->txt("mail_folders");
77  } else {
78  return $this->lng->txt("icon") . " " . $this->lng->txt($a_node["m_type"]);
79  }
80  }
81 
82  public function getNodeHref($a_node)
83  {
84  if ($a_node["child"] == $this->getNodeId($this->getRootNode())) {
85  $a_node["child"] = 0;
86  }
87 
88  $this->ctrl->setParameter($this->parent_obj, "mobj_id", $a_node["child"]);
89  $href = $this->ctrl->getLinkTargetByClass("ilMailFolderGUI");
90  $this->ctrl->setParameter($this->parent_obj, "mobj_id", $_GET["mobj_id"]);
91 
92  return $href;
93  }
94 
95  public function isNodeHighlighted($a_node)
96  {
97  if ($a_node["child"] == $_GET["mobj_id"] ||
98  ($_GET["mobj_id"] == "" && $a_node["child"] == $this->getNodeId($this->getRootNode()))) {
99  return true;
100  }
101  return false;
102  }
103 }
global $DIC
Definition: saml.php:7
$_GET["client_id"]
setSkipRootNode($a_val)
Set skip root node.
Class Mail Explorer class for explorer view for mailboxes.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
getNodeId($a_node)
Get id for node.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
getRootNode()
Get root node.
Explorer class that works on tree objects (Services/Tree)
setOrderField($a_val, $a_numeric=false)
Set order field.
__construct($a_parent_obj, $a_parent_cmd, $a_user_id)
ilMailExplorer constructor.