• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Services/Mail/classes/class.ilPDMailGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2005 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00024 #require_once "./include/inc.mail.php";
00025 require_once './Services/User/classes/class.ilObjUser.php';
00026 require_once "Services/Mail/classes/class.ilMail.php";
00027 
00035 class ilPDMailGUI
00036 {
00037 
00041         function getPDMailHTML($a_mail_id, $a_mobj_id)
00042         {
00043                 global $lng, $rbacsystem, $ilias;
00044                 
00045                 $lng->loadLanguageModule("mail");
00046                 
00047                 //get the mail from user
00048                 $umail = new ilMail($_SESSION["AccountId"]);
00049                 
00050                 // catch hack attempts
00051                 if (!$rbacsystem->checkAccess("mail_visible",$umail->getMailObjectReferenceId()))
00052                 {
00053                         $ilias->raiseError($lng->txt("permission_denied"),$ilias->error_obj->WARNING);
00054                 }
00055                 
00056                 $umail->markRead(array($a_mail_id));
00057                 $mail_data = $umail->getMail($a_mail_id);
00058                 
00059                 // SET MAIL DATA
00060                 $counter = 1;
00061                 
00062                 $tpl = new ilTemplate("tpl.pd_mail.html", true, true, "Services/Mail"); 
00063 
00064                 // attachments
00065                 if($mail_data["attachments"])
00066                 {
00067                         foreach($mail_data["attachments"] as $file)
00068                         {
00069                                 $tpl->setCurrentBlock("a_row");
00070                                 $tpl->setVariable("HREF_DOWNLOAD",
00071                                         "ilias.php?baseClass=ilMailGUI&type=deliverFile&mail_id=".$_GET["mail_id"].
00072                                         "&filename=".rawurlencode($file));
00073                                 $tpl->setVariable("FILE_NAME", $file);
00074                                 $tpl->setVariable("TXT_DOWNLOAD", $lng->txt("download"));
00075                                 $tpl->parseCurrentBlock();
00076                         }
00077                         $tpl->setCurrentBlock("attachment");
00078                         $tpl->setVariable("TXT_ATTACHMENT", $lng->txt("attachments"));
00079                         $tpl->parseCurrentBlock();
00080                 }
00081 
00082                 // FROM
00083                 $tpl->setVariable("TXT_FROM", $lng->txt("from"));
00084                 $tmp_user = new ilObjUser($mail_data["sender_id"]);
00085                 if($mail_data['sender_id'] != ANONYMOUS_USER_ID)
00086                 {               
00087                         // image
00088                         $tpl->setCurrentBlock("pers_image");
00089                         $tpl->setVariable("IMG_SENDER", $tmp_user->getPersonalPicturePath("xsmall"));
00090                         $tpl->setVariable("ALT_SENDER", $tmp_user->getFullname());
00091                         $tpl->parseCurrentBlock();
00092                         if(ilObjUser::_lookupPref($mail_data['sender_id'], 'public_profile') == 'y')
00093                         {
00094                                 $tpl->setVariable("FROM", $tmp_user->getFullname());
00095                         }
00096         
00097                         if(!($login = $tmp_user->getLogin()))
00098                         {
00099                                 $login = $mail_data["import_name"]." (".$lng->txt("user_deleted").")";
00100                         }
00101                         $tpl->setVariable("MAIL_LOGIN",$login);
00102                 }
00103                 else
00104                 {               
00105                         // image                                                
00106                         $tpl->setCurrentBlock('pers_image');
00107                         $tpl->setVariable('IMG_SENDER', $tmp_user->getPersonalPicturePath('xsmall'));
00108                         $tpl->setVariable('ALT_SENDER', ilMail::_getAnonymousName());
00109                         $tpl->parseCurrentBlock();
00110                         
00111                         $tpl->setVariable('MAIL_LOGIN', ilMail::_getAnonymousName());
00112                         
00113                 }
00114 
00115                 // TO
00116                 $tpl->setVariable("TXT_TO", $lng->txt("mail_to"));
00117                 $tpl->setVariable("TO", $umail->formatNamesForOutput($mail_data['rcp_to']));
00118                 
00119                 // CC
00120                 if($mail_data["rcp_cc"])
00121                 {
00122                         $tpl->setCurrentBlock("cc");
00123                         $tpl->setVariable("TXT_CC",$lng->txt("cc"));
00124                         $tpl->setVariable("CC", $umail->formatNamesForOutput($mail_data['rcp_cc']));
00125                         $tpl->parseCurrentBlock();
00126                 }
00127                 // SUBJECT
00128                 $tpl->setVariable("TXT_SUBJECT",$lng->txt("subject"));
00129                 $tpl->setVariable("SUBJECT",htmlspecialchars($mail_data["m_subject"]));
00130                 
00131                 // DATE
00132                 $tpl->setVariable("TXT_DATE", $lng->txt("date"));
00133                 $tpl->setVariable("DATE", ilFormat::formatDate($mail_data["send_time"]));
00134                 
00135                 // ATTACHMENTS
00136                 /*
00137                 if($mail_data["attachments"])
00138                 {
00139                         $tpl->setCurrentBlock("attachment");
00140                         $tpl->setCurrentBlock("a_row");
00141                         $counter = 1;
00142                         foreach($mail_data["attachments"] as $file)
00143                         {
00144                                 $tpl->setVariable("A_CSSROW",++$counter%2 ? 'tblrow1' : 'tblrow2');
00145                                 $tpl->setVariable("FILE",$file);
00146                                 $tpl->setVariable("FILE_NAME",$file);
00147                                 $tpl->parseCurrentBlock();
00148                         }
00149                         $tpl->setVariable("TXT_ATTACHMENT",$lng->txt("attachments"));
00150                         $tpl->setVariable("TXT_DOWNLOAD",$lng->txt("download"));
00151                         $tpl->parseCurrentBlock();
00152                 }*/
00153                 
00154                 // MESSAGE
00155                 $tpl->setVariable("TXT_MESSAGE", $lng->txt("message"));
00156                 $tpl->setVariable("MAIL_MESSAGE", nl2br(ilUtil::makeClickable(ilUtil::secureString($mail_data["m_message"]))));
00157                 
00158                 return $tpl->get();
00159         }
00160 }
00161 ?>

Generated on Fri Dec 13 2013 17:56:57 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1