Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00034 require_once("classes/class.ilExplorer.php");
00035
00036 class ilMailExplorer extends ilExplorer
00037 {
00043 var $user_id;
00044
00050 var $root_id;
00051
00058 function ilMailExplorer($a_target,$a_user_id)
00059 {
00060 parent::ilExplorer($a_target);
00061 $this->tree = new ilTree($a_user_id);
00062 $this->tree->setTableNames('mail_tree','mail_obj_data');
00063 $this->root_id = $this->tree->readRootId();
00064 $this->user_id = $a_user_id;
00065 }
00066
00073 function getOutput()
00074 {
00075 global $tpl;
00076
00077 $this->format_options[0]["tab"] = array();
00078
00079 $depth = $this->tree->getMaximumDepth();
00080
00081 for ($i=0;$i<$depth;++$i)
00082 {
00083 $this->createLines($i);
00084 }
00085
00086 $tpl->addBlockFile("EXPLORER_TOP", "exp_top", "tpl.explorer_top.html");
00087
00088
00089 $tpl->setVariable("BODY_CLASS", "il_Explorer");
00090
00091 $tpl_tree = new ilTemplate("tpl.tree.html", true, true);
00092
00093 $cur_depth = -1;
00094
00095 foreach ($this->format_options as $key => $options)
00096 {
00097 if (!$options["visible"])
00098 {
00099 continue;
00100 }
00101
00102
00103 $this->handleListEndTags($tpl_tree, $cur_depth, $options["depth"]);
00104
00105
00106 $this->handleListStartTags($tpl_tree, $cur_depth, $options["depth"]);
00107
00108 $cur_depth = $options["depth"];
00109
00110 if ($options["visible"] and $key != 0)
00111 {
00112 $this->formatObject($tpl_tree, $options["child"],$options);
00113 }
00114 if($key == 0)
00115 {
00116 $this->formatHeader($tpl_tree, $options["child"],$options);
00117 }
00118 }
00119
00120 $this->handleListEndTags($tpl_tree, $cur_depth, -1);
00121
00122 return $tpl_tree->get();
00123 }
00124
00125
00135 function setOutput($a_parent, $a_depth = 1)
00136 {
00137 global $lng;
00138 static $counter = 0;
00139
00140 if ($objects = $this->tree->getChilds($a_parent,"title,type"))
00141 {
00142
00143 $tab = ++$a_depth - 2;
00144
00145 if($a_depth < 4)
00146 {
00147 for($i=0;$i<count($objects);++$i)
00148 {
00149 $objects[$i]["title"] = $lng->txt("mail_".$objects[$i]["title"]);
00150 }
00151 }
00152
00153 foreach ($objects as $key => $object)
00154 {
00155
00156 if ($object["child"] != $this->root_id)
00157 {
00158
00159 $parent_index = $this->getIndex($object);
00160 }
00161 $this->format_options["$counter"]["parent"] = $object["parent"];
00162 $this->format_options["$counter"]["child"] = $object["child"];
00163 $this->format_options["$counter"]["title"] = $object["title"];
00164 $this->format_options["$counter"]["type"] = $object["type"];
00165 $this->format_options["$counter"]["desc"] = $object["type"];
00166 $this->format_options["$counter"]["depth"] = $tab;
00167 $this->format_options["$counter"]["container"] = false;
00168 $this->format_options["$counter"]["visible"] = true;
00169
00170
00171 for ($i = 0; $i < $tab; ++$i)
00172 {
00173 $this->format_options["$counter"]["tab"][] = 'blank';
00174 }
00175
00176
00177 if ($parent_index == 0)
00178 {
00179 if (!in_array($object["parent"], $this->expanded))
00180 {
00181 $this->expanded[] = $object["parent"];
00182 }
00183 }
00184
00185
00186 if ($object["child"] != $this->root_id and (!in_array($object["parent"],$this->expanded)
00187 or !$this->format_options["$parent_index"]["visible"]))
00188 {
00189 $this->format_options["$counter"]["visible"] = false;
00190 }
00191
00192
00193 if ($object["child"] != $this->root_id)
00194 {
00195 $this->format_options["$parent_index"]["container"] = true;
00196
00197 if (in_array($object["parent"],$this->expanded))
00198 {
00199 $this->format_options["$parent_index"]["tab"][($tab-2)] = 'minus';
00200 }
00201 else
00202 {
00203 $this->format_options["$parent_index"]["tab"][($tab-2)] = 'plus';
00204 }
00205 }
00206
00207 ++$counter;
00208
00209
00210 $this->setOutput($object["child"],$a_depth);
00211 }
00212 }
00213 }
00214
00222 function formatHeader($a_obj_id,$a_option)
00223 {
00224 }
00225
00232 function setExpand($a_node_id)
00233 {
00234
00235 if(!is_array($_SESSION["mexpand"]))
00236 {
00237 $_SESSION["mexpand"] = array();
00238 }
00239
00240 if($a_node_id > 0 && !in_array($a_node_id,$_SESSION["mexpand"]))
00241 {
00242 array_push($_SESSION["mexpand"],$a_node_id);
00243 }
00244
00245 if($a_node_id < 0)
00246 {
00247 $key = array_keys($_SESSION["mexpand"],-(int) $a_node_id);
00248 unset($_SESSION["mexpand"][$key[0]]);
00249 }
00250 $this->expanded = $_SESSION["mexpand"];
00251 }
00259 function createTarget($a_type,$a_child)
00260 {
00261
00262
00263
00264 $a_child = $a_type == '+' ? $a_child : -(int) $a_child;
00265
00266 return $_SERVER["PATH_INFO"]."?mexpand=".$a_child;
00267 }
00268 }
00269 ?>