ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPaymentNotification Class Reference
+ Inheritance diagram for ilPaymentNotification:
+ Collaboration diagram for ilPaymentNotification:

Public Member Functions

 __construct ()
 
 send ()
 
- Public Member Functions inherited from ilMailNotification
 __construct ($a_is_personal_workspace=false)
 Constructor. More...
 
 setType ($a_type)
 Set notification type. More...
 
 getType ()
 Get notification type. More...
 
 setSender ($a_usr_id)
 Set sender of mail. More...
 
 getSender ()
 get sender of mail More...
 
 setRecipients ($a_rcp)
 set mail recipients More...
 
 getRecipients ()
 get array of recipients More...
 
 setAttachments ($a_att)
 Set attachments. More...
 
 getAttachments ()
 Get attachments. More...
 
 setLangModules (array $a_modules)
 Set lang modules. More...
 
 getUserLanguage ($a_usr_id)
 Get user language. More...
 
 setRefId ($a_id)
 Set ref id. More...
 
 getRefId ()
 get reference id More...
 
 getObjId ()
 get object id More...
 
 setObjId ($a_obj_id)
 set obj id More...
 
 getObjType ()
 Get object type. More...
 
 setAdditionalInformation ($a_info)
 Additional information for creating notification mails. More...
 
 getAdditionalInformation ()
 Get additional information for generating notification mails. More...
 
 sendMail ($a_rcp, $a_type, $a_parse_recipients=true)
 Send Mail. More...
 
 getBlockBorder ()
 Get (ascii) block border. More...
 

Private Member Functions

 _getObjectsToRemind ()
 

Additional Inherited Members

- Data Fields inherited from ilMailNotification
const SUBJECT_TITLE_LENGTH = 60
 
- Protected Member Functions inherited from ilMailNotification
 setSubject ($a_subject)
 Set mail subject. More...
 
 getSubject ()
 Get mail subject. More...
 
 setBody ($a_body)
 Set mail body. More...
 
 appendBody ($a_body)
 Append body text. More...
 
 getBody ()
 Get body. More...
 
 initLanguage ($a_usr_id)
 Init language. More...
 
 initLanguageByIso2Code ($a_code='')
 Init language by ISO2 code. More...
 
 setLanguage ($a_language)
 A language. More...
 
 getLanguage ()
 get language object More...
 
 getLanguageText ($a_keyword)
 Replace new lines. More...
 
 getObjectTitle ($a_shorten=false)
 Get object title. More...
 
 initMail ()
 Init mail. More...
 
 getMail ()
 Get mail object. More...
 
 createPermanentLink ($a_params=array(), $a_append='')
 Create a permanent link for an object. More...
 
 userToString ($a_usr_id)
 Utility function. More...
 
 isRefIdAccessible ($a_user_id, $a_ref_id, $a_permission="read")
 Check if ref id is accessible for user. More...
 
- Protected Attributes inherited from ilMailNotification
 $type = null
 
 $sender = null
 
 $mail = null
 
 $subject = ''
 
 $body = ''
 
 $attachments = array()
 
 $language = null
 
 $lang_modules = array()
 
 $recipients = array()
 
 $ref_id = null
 
 $obj_id = null
 
 $obj_type = null
 
 $additional_info = array()
 
 $is_in_wsp
 
 $wsp_tree
 
 $wsp_access_handler
 

Detailed Description

Author
Nadia Ahmad nahma.nosp@m.d@da.nosp@m.tabay.nosp@m..de
Version
$Id:$

Definition at line 13 of file class.ilPaymentNotification.php.

Constructor & Destructor Documentation

◆ __construct()

ilPaymentNotification::__construct ( )

Definition at line 15 of file class.ilPaymentNotification.php.

16  {
17  parent::__construct();
18  }

Member Function Documentation

◆ _getObjectsToRemind()

ilPaymentNotification::_getObjectsToRemind ( )
private

Definition at line 74 of file class.ilPaymentNotification.php.

References $ilDB, $ilSetting, $res, and $row.

Referenced by send().

75  {
76  global $ilDB, $ilSetting;
77 
78  $num_days = $ilSetting->get('payment_notification_days');
79  $reminder_date = date("Y-m-d H:i:s", time() + ($num_days * 24 * 60 * 60));
80 
81  $res = $ilDB->queryF('
82  SELECT ps.pobject_id, ps.customer_id, ps.object_title, ps.access_enddate, po.ref_id, po.subtype
83  FROM payment_statistic ps
84  INNER JOIN payment_objects po ON po.pobject_id = ps.pobject_id
85  LEFT JOIN payment_prices pp ON pp.pobject_id = ps.pobject_id
86  WHERE ps.duration > %s
87  AND ps.access_enddate = %s
88  AND po.status > %s
89  AND pp.extension = %s
90  ORDER BY ps.customer_id ASC',
91  array('integer', 'date', 'integer', 'integer'),
92  array(0, $reminder_date, 0 , 1));
93 
94  $counter = 0;
95  $objects = array();
96  $customer_id = NULL;
97  while($row = $ilDB->fetchAssoc($res))
98  {
99  if($customer_id == NULL)
100  {
101  $customer_id = $row['customer_id'];
102  }
103  else if ($customer_id != $row['customer_id'])
104  {
105  $counter = 0;
106  $customer_id = $row['customer_id'];
107  }
108 
109  $objects[$customer_id][$counter]['ref_id'] = $row['ref_id'];
110  $objects[$customer_id][$counter]['pobject_id'] = $row['pobject_id'];
111  $objects[$customer_id][$counter]['customer_id'] = $row['customer_id'];
112  $objects[$customer_id][$counter]['access_enddate'] = $row['access_enddate'];
113  $objects[$customer_id][$counter]['object_title'] = $row['object_title'];
114  $objects[$customer_id][$counter]['subtype'] = $row['subtype'];
115 
116  $counter++;
117  }
118  return $objects;
119  }
global $ilSetting
Definition: privfeed.php:40
global $ilDB
+ Here is the caller graph for this function:

◆ send()

ilPaymentNotification::send ( )

Definition at line 20 of file class.ilPaymentNotification.php.

References $lng, ilMail\_getAutoGeneratedMessageString(), ilMail\_getInstallationSignature(), _getObjectsToRemind(), ilObjUser\_lookupEmail(), ilMailNotification\appendBody(), ilMailNotification\getBody(), ilMailNotification\getLanguage(), ilMailNotification\getLanguageText(), ilMail\getSalutation(), ilMailNotification\getSubject(), ilMailNotification\initLanguage(), ilMailNotification\initMail(), ilMailNotification\setBody(), ilMailNotification\setRecipients(), and ilMailNotification\setSubject().

21  {
22  global $lng;
23 
24  $customer_array = $this->_getObjectsToRemind();
25 
26  foreach ($customer_array as $user_id=>$objects_array)
27  {
28 
29  $this->initLanguage($user_id);
30  $user_lang = $this->getLanguage() ? $this->getLanguage() : $lng;
31 
32  $this->initMail();
33 
34  $this->setRecipients($user_id);
35  $this->setSubject($this->getLanguageText('payment_reminder_notification_subject'));
36 
37  $this->setBody(ilMail::getSalutation($user_id, $this->getLanguage()));
38  $this->appendBody("\n\n");
39  $this->appendBody($user_lang->txt('bought_objects_expire_soon'));
40  $this->appendBody("\n\n");
41 
42  foreach($objects_array as $key=>$pobject)
43  {
44  $this->appendBody("----------------------------------------------------------------------------------------------");
45  $this->appendBody("\n\n");
46  $this->appendBody($user_lang->txt('title').": ".$objects_array[$key]['object_title']."\n");
47  $this->appendBody($user_lang->txt('access_enddate') .": ".$objects_array[$key]['access_enddate']);
48  $this->appendBody("\n");
49 
50  $this->appendBody("\n\n");
51  }
52 
53  $this->appendBody("----------------------------------------------------------------------------------------------");
54 
55  //@todo fix this: $mailbox_link
56  $this->appendBody($mailbox_link);
57  $this->appendBody("\n\n");
58 
59 
62 
63  $mmail = new ilMimeMail();
64  $mmail->autoCheck(false);
65  $mmail->From('noreply');
66  $mmail->To(ilObjUser::_lookupEmail($user_id));
67 
68  $mmail->Subject($this->getSubject());
69  $mmail->Body($this->getBody());
70  $mmail->Send();
71  }
72  }
getLanguage()
get language object
setBody($a_body)
Set mail body.
setRecipients($a_rcp)
set mail recipients
getLanguageText($a_keyword)
Replace new lines.
initLanguage($a_usr_id)
Init language.
setSubject($a_subject)
Set mail subject.
getSubject()
Get mail subject.
this class encapsulates the PHP mail() function.
static getSalutation($a_usr_id, $a_language=null)
Get salutation.
_lookupEmail($a_user_id)
Lookup email.
global $lng
Definition: privfeed.php:40
appendBody($a_body)
Append body text.
static _getAutoGeneratedMessageString($lang=null)
get auto generated info string
static _getInstallationSignature()
Static getter for the installation signature.
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: