ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups 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.
 setType ($a_type)
 Set notification type.
 getType ()
 Get notification type.
 setSender ($a_usr_id)
 Set sender of mail.
 getSender ()
 get sender of mail
 setRecipients ($a_rcp)
 set mail recipients
 getRecipients ()
 get array of recipients
 setAttachments ($a_att)
 Set attachments.
 getAttachments ()
 Get attachments.
 setLangModules (array $a_modules)
 Set lang modules.
 getUserLanguage ($a_usr_id)
 Get user language.
 setRefId ($a_id)
 Set ref id.
 getRefId ()
 get reference id
 getObjId ()
 get object id
 setObjId ($a_obj_id)
 set obj id
 getObjType ()
 Get object type.
 setAdditionalInformation ($a_info)
 Additional information for creating notification mails.
 getAdditionalInformation ()
 Get additional information for generating notification mails.
 sendMail ($a_rcp, $a_type, $a_parse_recipients=true)
 Send Mail.
 getBlockBorder ()
 Get (ascii) block border.

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.
 getSubject ()
 Get mail subject.
 setBody ($a_body)
 Set mail body.
 appendBody ($a_body)
 Append body text.
 getBody ()
 Get body.
 initLanguage ($a_usr_id)
 Init language.
 initLanguageByIso2Code ($a_code= '')
 Init language by ISO2 code.
 setLanguage ($a_language)
 A language.
 getLanguage ()
 get language object
 getLanguageText ($a_keyword)
 Replace new lines.
 getObjectTitle ($a_shorten=false)
 Get object title.
 initMail ()
 Init mail.
 getMail ()
 Get mail object.
 createPermanentLink ($a_params=array(), $a_append= '')
 Create a permanent link for an object.
 userToString ($a_usr_id)
 Utility function.
 isRefIdAccessible ($a_user_id, $a_ref_id, $a_permission="read")
 Check if ref id is accessible for user.
- 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

ilPaymentNotification::__construct ( )

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

Member Function Documentation

ilPaymentNotification::_getObjectsToRemind ( )
private

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

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

Referenced by send().

{
global $ilDB, $ilSetting;
$num_days = $ilSetting->get('payment_notification_days');
$reminder_date = date("Y-m-d H:i:s", time() + ($num_days * 24 * 60 * 60));
$res = $ilDB->queryF('
SELECT ps.pobject_id, ps.customer_id, ps.object_title, ps.access_enddate, po.ref_id, po.subtype
FROM payment_statistic ps
INNER JOIN payment_objects po ON po.pobject_id = ps.pobject_id
LEFT JOIN payment_prices pp ON pp.pobject_id = ps.pobject_id
WHERE ps.duration > %s
AND ps.access_enddate = %s
AND po.status > %s
AND pp.extension = %s
ORDER BY ps.customer_id ASC',
array('integer', 'date', 'integer', 'integer'),
array(0, $reminder_date, 0 , 1));
$counter = 0;
$objects = array();
$customer_id = NULL;
while($row = $ilDB->fetchAssoc($res))
{
if($customer_id == NULL)
{
$customer_id = $row['customer_id'];
}
else if ($customer_id != $row['customer_id'])
{
$counter = 0;
$customer_id = $row['customer_id'];
}
$objects[$customer_id][$counter]['ref_id'] = $row['ref_id'];
$objects[$customer_id][$counter]['pobject_id'] = $row['pobject_id'];
$objects[$customer_id][$counter]['customer_id'] = $row['customer_id'];
$objects[$customer_id][$counter]['access_enddate'] = $row['access_enddate'];
$objects[$customer_id][$counter]['object_title'] = $row['object_title'];
$objects[$customer_id][$counter]['subtype'] = $row['subtype'];
$counter++;
}
return $objects;
}

+ Here is the caller graph for this function:

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().

{
global $lng;
$customer_array = $this->_getObjectsToRemind();
foreach ($customer_array as $user_id=>$objects_array)
{
$this->initLanguage($user_id);
$user_lang = $this->getLanguage() ? $this->getLanguage() : $lng;
$this->initMail();
$this->setRecipients($user_id);
$this->setSubject($this->getLanguageText('payment_reminder_notification_subject'));
$this->setBody(ilMail::getSalutation($user_id, $this->getLanguage()));
$this->appendBody("\n\n");
$this->appendBody($user_lang->txt('bought_objects_expire_soon'));
$this->appendBody("\n\n");
foreach($objects_array as $key=>$pobject)
{
$this->appendBody("----------------------------------------------------------------------------------------------");
$this->appendBody("\n\n");
$this->appendBody($user_lang->txt('title').": ".$objects_array[$key]['object_title']."\n");
$this->appendBody($user_lang->txt('access_enddate') .": ".$objects_array[$key]['access_enddate']);
$this->appendBody("\n");
$this->appendBody("\n\n");
}
$this->appendBody("----------------------------------------------------------------------------------------------");
//@todo fix this: $mailbox_link
$this->appendBody($mailbox_link);
$this->appendBody("\n\n");
$mmail = new ilMimeMail();
$mmail->autoCheck(false);
$mmail->From('noreply');
$mmail->To(ilObjUser::_lookupEmail($user_id));
$mmail->Subject($this->getSubject());
$mmail->Body($this->getBody());
$mmail->Send();
}
}

+ Here is the call graph for this function:


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