ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
inc.mail.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 
25 function setLocator($a_obj_id,$a_path,$a_user_id,$a_txt_prefix)
26 {
27  global $lng,$tpl,$ilias_locator, $ilMainMenu;
28 
29  $ilMainMenu->setActive("mail");
30  // IF THERE IS NO OBJ_ID GIVEN GET THE ID OF MAIL ROOT NODE
31  if(!$a_obj_id)
32  {
33  include_once "Services/Mail/classes/class.ilMailbox.php";
34  $mbox = new ilMailBox($_SESSION["AccountId"]);
35  $a_obj_id = $mbox->getInboxFolder();
36  }
37 return;
38  $tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html");
39  $tpl->setVariable("TXT_LOCATOR",$lng->txt("locator"));
40  $mtree = new ilTree($a_user_id);
41  $mtree->setTableNames('mail_tree','mail_obj_data');
42  $path_full = $mtree->getPathFull($a_obj_id,$mtree->readRootId());
43 
44  // ### AA 03.11.10 added new locator GUI class ###
45  $i = 1;
46 
47  $tpl->touchBlock("locator_separator");
48  $tpl->touchBlock("locator_item");
49 
50  if($a_path == 'mail.php')
51  {
52 
53  // Folder
54  $tpl->touchBlock("locator_separator");
55  $tpl->setCurrentBlock("locator_item");
56  $tpl->setVariable("ITEM", $lng->txt("folder"));
57  $tpl->setVariable("LINK_ITEM", "mail.php?mobj_id=".$a_obj_id);
58  $tpl->parseCurrentBlock();
59 
60 
61  unset($path_full[0]);
62  foreach ($path_full as $key => $row)
63  {
64  if($row["type"] != 'user_folder')
65  {
66  $row["title"] = $lng->txt("mail_".$row["title"]);
67  }
68  if ($key < count($path_full))
69  {
70  $tpl->touchBlock("locator_separator");
71  }
72  $tpl->setCurrentBlock("locator_item");
73  $tpl->setVariable("ITEM", $row["title"]);
74  // TODO: SCRIPT NAME HAS TO BE VARIABLE!!!
75  $tpl->setVariable("LINK_ITEM", "mail.php?mobj_id=".$row["child"]);
76  $tpl->parseCurrentBlock();
77 
78  }
79  $tpl->setCurrentBlock("locator");
80  }
81 
82 
83  switch($a_path)
84  {
85  case 'mail_new.php':
86  case 'mail_attachment.php':
87  case 'mail_search.php':
88  $tpl->setCurrentBlock("locator_item");
89  $tpl->setVariable("ITEM", $lng->txt("mail_compose"));
90  $tpl->setVariable("LINK_ITEM", "mail_new.php?mobj_id=$a_obj_id");
91  $tpl->parseCurrentBlock();
92  break;
93 
94  case "mail_addressbook.php":
95  $tpl->setCurrentBlock("locator_item");
96  $tpl->setVariable("ITEM", $lng->txt("mail_addressbook"));
97  $tpl->setVariable("LINK_ITEM", "mail_addressbook.php?mobj_id=$a_obj_id");
98  $tpl->parseCurrentBlock();
99  break;
100 
101  case "mail_options.php":
102  $tpl->setCurrentBlock("locator_item");
103  $tpl->setVariable("ITEM", $lng->txt("mail_options_of"));
104  $tpl->setVariable("LINK_ITEM", "mail_options.php?mobj_id=$a_obj_id");
105  $tpl->parseCurrentBlock();
106  break;
107 
108  default:
109  break;
110  }
111 
112  $tpl->setVariable("TXT_PATH",$a_txt_prefix);
113  $tpl->parseCurrentBlock();
114 }
122 function formSelect ($selected,$varname,$options,$multiple = false)
123 {
124  global $lng;
125 
126  $multiple ? $multiple = " multiple=\"multiple\"" : "";
127  $str = "<select name=\"".$varname ."\"".$multiple.">\n";
128 
129  foreach ($options as $key => $val)
130  {
131 
132  $str .= " <option value=\"".$val."\"";
133 
134  if ($selected == $key)
135  {
136  $str .= " selected=\"selected\"";
137  }
138 
139  $str .= ">".$val."</option>\n";
140  }
141 
142  $str .= "</select>\n";
143 
144  return $str;
145 }
146 
147 function assignMailToPost($a_mail_data)
148 {
149  foreach($a_mail_data as $key => $data)
150  {
151  $_POST[$key] = $data;
152  }
153 }
154 
155 ?>