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

classes/class.ilFormatMail.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 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 
00035 include_once "classes/class.ilMail.php";
00036 
00037 class ilFormatMail extends ilMail
00038 {
00039 
00046         function ilFormatMail($a_user_id)
00047         {
00048                 parent::ilMail($a_user_id);
00049         }
00050 
00056         function formatReplyMessage()
00057         {
00058                 if(empty($this->mail_data))
00059                 {
00060                         return false;
00061                 }
00062 #               debug($this->mail_data["m_message"]);
00063                 $bodylines = explode(chr(13).chr(10), $this->mail_data["m_message"]);
00064 #               var_dump("<pre>",$bodylines,"</pre");
00065                 for ($i = 0; $i < count($bodylines); $i++)
00066                 {
00067                         $bodylines[$i] = "> ".$bodylines[$i];
00068                 }
00069                 return $this->mail_data["m_message"] = implode(chr(13).chr(10), $bodylines);
00070         }
00071 
00077         function formatReplySubject()
00078         {
00079                 if(empty($this->mail_data))
00080                 {
00081                         return false;
00082                 }
00083                 return $this->mail_data["m_subject"] = "RE: ".$this->mail_data["m_subject"];
00084         }
00090         function formatReplyRecipient()
00091         {
00092                 if(empty($this->mail_data))
00093                 {
00094                         return false;
00095                 }
00096 
00097                 require_once "classes/class.ilObjUser.php";
00098 
00099                 $user = new ilObjUser($this->mail_data["sender_id"]);
00100                 return $this->mail_data["rcp_to"] = $user->getLogin();
00101         }
00107         function formatForwardSubject()
00108         {
00109                 if(empty($this->mail_data))
00110                 {
00111                         return false;
00112                 }
00113                 return $this->mail_data["m_subject"] = "[FWD: ".$this->mail_data["m_subject"]."]";
00114         }
00115 
00123         function appendSearchResult($a_names,$a_type)
00124         {
00125                 if(empty($this->mail_data))
00126                 {
00127                         return false;
00128                 }
00129                 $name_str = implode(',',$a_names);
00130                 switch($a_type)
00131                 {
00132                         case 'to':
00133                                 $this->mail_data["rcp_to"] = trim($this->mail_data["rcp_to"]);
00134                                 if($this->mail_data["rcp_to"])
00135                                 {
00136                                         $this->mail_data["rcp_to"] = $this->mail_data["rcp_to"].",";
00137                                 }
00138                                 $this->mail_data["rcp_to"] = $this->mail_data["rcp_to"] . $name_str;
00139                                 break;
00140 
00141                         case 'cc':
00142                                 $this->mail_data["rcp_cc"] = trim($this->mail_data["rcp_cc"]);
00143                                 if($this->mail_data["rcp_cc"])
00144                                 {
00145                                         $this->mail_data["rcp_cc"] = $this->mail_data["rcp_cc"].",";
00146                                 }
00147                                 $this->mail_data["rcp_cc"] = $this->mail_data["rcp_cc"] . $name_str;
00148                                 break;
00149 
00150                         case 'bc':
00151                                 $this->mail_data["rcp_bcc"] = trim($this->mail_data["rcp_bcc"]);
00152                                 if($this->mail_data["rcp_bcc"])
00153                                 {
00154                                         $this->mail_data["rcp_bcc"] = $this->mail_data["rcp_bcc"].",";
00155                                 }
00156                                 $this->mail_data["rcp_bcc"] = $this->mail_data["rcp_bcc"] . $name_str;
00157                                 break;
00158 
00159                 }
00160                 return $this->mail_data;
00161         }
00168         function formatLinebreakMessage($a_message)
00169         {
00170                 $formatted = array();
00171 
00172 #               debug($a_message);
00173                 $linebreak = $this->mail_options->getLinebreak();
00174                 // SPLIT INTO LINES returns always an array
00175                 $lines = explode(chr(13).chr(10),$a_message);
00176                 for($i=0;$i<count($lines);$i++)
00177                 {
00178                         if(substr($lines[$i],0,1) != '>')
00179                         {
00180                                 $formatted[] = wordwrap($lines[$i],$linebreak,chr(13).chr(10));
00181                         }
00182                         else
00183                         {
00184                                 $formatted[] = $lines[$i];
00185                         }
00186                 }
00187                 $formatted = implode(chr(13).chr(10),$formatted);
00188 #               debug($formatted);
00189                 return $formatted;
00190         }
00191                                         
00192                                 
00193 
00199         function appendSignature()
00200         {
00201                 return $this->mail_data["m_message"] .= $this->mail_options->getSignature();
00202         }
00203 } // END class.ilFormatMail
00204 ?>

Generated on Fri Dec 13 2013 13:52:07 for ILIAS Release_3_7_x_branch .rev 46817 by  doxygen 1.7.1