ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilCronDeleteInactiveUserReminderMail Class Reference
+ Collaboration diagram for ilCronDeleteInactiveUserReminderMail:

Static Public Member Functions

static removeEntriesFromTableIfLastLoginIsNewer ()
 
static checkIfReminderMailShouldBeSend (ilObjUser $user, $reminderTime, $time_frame_for_deletion)
 
static flushDataTable ()
 
static removeSingleUserFromTable ($usr_id)
 

Data Fields

const TABLE_NAME = "usr_cron_mail_reminder"
 

Private Member Functions

 mailSent ($usr_id)
 

Static Private Member Functions

static sendReminder (ilObjUser $user, $reminderTime, $time_frame_for_deletion)
 

Detailed Description

Member Function Documentation

◆ checkIfReminderMailShouldBeSend()

static ilCronDeleteInactiveUserReminderMail::checkIfReminderMailShouldBeSend ( ilObjUser  $user,
  $reminderTime,
  $time_frame_for_deletion 
)
static

Definition at line 69 of file class.ilCronDeleteInactiveUserReminderMail.php.

References $ilDB, $query, $res, $row, array, ilDBConstants\FETCHMODE_OBJECT, and ilObject\getId().

Referenced by ilCronDeleteInactiveUserAccounts\hasCustomSettings().

70  {
71  global $ilDB;
72  $query = "SELECT ts FROM " . self::TABLE_NAME . " WHERE usr_id = %s";
73  $res = $ilDB->queryF($query, array('integer'), array($user->getId()));
75  if($row->ts == null)
76  {
77  self::sendReminder($user, $reminderTime, $time_frame_for_deletion);
78  return true;
79  }
80  return false;
81  }
getId()
get object id public
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flushDataTable()

static ilCronDeleteInactiveUserReminderMail::flushDataTable ( )
static

Definition at line 83 of file class.ilCronDeleteInactiveUserReminderMail.php.

References $ilDB.

Referenced by ilCronDeleteInactiveUserAccounts\saveCustomSettings().

84  {
85  global $ilDB;
86  $ilDB->manipulate("DELETE FROM " . self::TABLE_NAME);
87  }
global $ilDB
+ Here is the caller graph for this function:

◆ mailSent()

ilCronDeleteInactiveUserReminderMail::mailSent (   $usr_id)
private

Definition at line 16 of file class.ilCronDeleteInactiveUserReminderMail.php.

References $ilDB, array, and time.

17  {
18  global $ilDB;
19  $ilDB->manipulateF("INSERT INTO " . self::TABLE_NAME . " (usr_id, ts) VALUES (%s, %s)",
20  array(
21  "integer",
22  "integer"
23  ),
24  array(
25  $usr_id,
26  time()
27  )
28  );
29  }
Create styles array
The data for the language used.
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.

◆ removeEntriesFromTableIfLastLoginIsNewer()

static ilCronDeleteInactiveUserReminderMail::removeEntriesFromTableIfLastLoginIsNewer ( )
static

Definition at line 47 of file class.ilCronDeleteInactiveUserReminderMail.php.

References $ilDB, $query, $res, $row, ilObjUser\_lookupLastLogin(), array, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilCronDeleteInactiveUserAccounts\hasCustomSettings().

48  {
49  global $ilDB;
50  $query = "SELECT usr_id,ts FROM " . self::TABLE_NAME;
51  $res = $ilDB->queryF($query, array(
52  'integer',
53  'integer'
54  ), array(
55  'usr_id',
56  'ts'
57  ));
58  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
59  {
60  $lastLoginUnixtime = strtotime(ilObjUser::_lookupLastLogin($row->usr_id));
61  $lastReminderSent = (int)$row->ts;
62  if($lastLoginUnixtime >= $lastReminderSent)
63  {
64  self::removeSingleUserFromTable($row->usr_id);
65  }
66  }
67  }
Create styles array
The data for the language used.
global $ilDB
static _lookupLastLogin($a_user_id)
lookup last login
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeSingleUserFromTable()

static ilCronDeleteInactiveUserReminderMail::removeSingleUserFromTable (   $usr_id)
static

Definition at line 89 of file class.ilCronDeleteInactiveUserReminderMail.php.

References $ilDB, $query, and array.

Referenced by ilObjUser\delete().

90  {
91  global $ilDB;
92  $query = "DELETE FROM " . self::TABLE_NAME . " WHERE usr_id = %s";
93  $ilDB->manipulateF($query, array('integer'), array($usr_id));
94  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ sendReminder()

static ilCronDeleteInactiveUserReminderMail::sendReminder ( ilObjUser  $user,
  $reminderTime,
  $time_frame_for_deletion 
)
staticprivate

Definition at line 31 of file class.ilCronDeleteInactiveUserReminderMail.php.

References ilUtil\_getHttpPath(), array, and ilObject\getId().

32  {
33  include_once 'Services/User/classes/class.ilCronDeleteInactiveUserReminderMailNotification.php';
35  $mail->setRecipients(array($user));
36  $mail->setAdditionalInformation(
37  array(
38  "www" => ilUtil::_getHttpPath(),
39  "days" => $reminderTime,
40  "date" => $time_frame_for_deletion
41  )
42  );
43  $mail->send();
44  self::mailSent($user->getId());
45  }
getId()
get object id public
Create styles array
The data for the language used.
static _getHttpPath()
+ Here is the call graph for this function:

Field Documentation

◆ TABLE_NAME

const ilCronDeleteInactiveUserReminderMail::TABLE_NAME = "usr_cron_mail_reminder"

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