ILIAS  release_8 Revision v8.23
ilCronDeleteInactiveUserReminderMail Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilCronDeleteInactiveUserReminderMail:

Static Public Member Functions

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

Data Fields

const TABLE_NAME = "usr_cron_mail_reminder"
 

Static Private Member Functions

static mailSent (int $usr_id)
 
static sendReminder (ilObjUser $user, int $reminderTime, int $time_frame_for_deletion)
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning This checks if a mail has to be send after a certain INACTIVITY period

Author
Guido Vollbach gvoll.nosp@m.bach.nosp@m.@data.nosp@m.bay..nosp@m.de

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

Member Function Documentation

◆ flushDataTable()

static ilCronDeleteInactiveUserReminderMail::flushDataTable ( )
static

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

References $DIC, and $ilDB.

Referenced by ilCronDeleteInactiveUserAccounts\saveCustomSettings().

103  : void
104  {
105  global $DIC;
106 
107  $ilDB = $DIC['ilDB'];
108  $ilDB->manipulate("DELETE FROM " . self::TABLE_NAME);
109  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ mailSent()

static ilCronDeleteInactiveUserReminderMail::mailSent ( int  $usr_id)
staticprivate

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

References $DIC, and $ilDB.

27  : void
28  {
29  global $DIC;
30 
31  $ilDB = $DIC['ilDB'];
32  $ilDB->manipulateF(
33  "INSERT INTO " . self::TABLE_NAME . " (usr_id, ts) VALUES (%s, %s)",
34  array(
35  "integer",
36  "integer"
37  ),
38  array(
39  $usr_id,
40  time()
41  )
42  );
43  }
global $DIC
Definition: feed.php:28

◆ removeEntriesFromTableIfLastLoginIsNewer()

static ilCronDeleteInactiveUserReminderMail::removeEntriesFromTableIfLastLoginIsNewer ( )
static

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

References $DIC, $ilDB, $query, $res, ilObjUser\_lookupLastLogin(), ilDBConstants\FETCHMODE_OBJECT, if, and ILIAS\Repository\int().

Referenced by ilCronDeleteInactiveUserAccounts\hasCustomSettings().

63  : void
64  {
65  global $DIC;
66 
67  $ilDB = $DIC['ilDB'];
68  $query = "SELECT usr_id,ts FROM " . self::TABLE_NAME;
69  $res = $ilDB->queryF($query, array(
70  'integer',
71  'integer'
72  ), array(
73  'usr_id',
74  'ts'
75  ));
76  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
77  $lastLoginUnixtime = strtotime(ilObjUser::_lookupLastLogin($row->usr_id));
78  $lastReminderSent = (int) $row->ts;
79  if ($lastLoginUnixtime >= $lastReminderSent) {
80  self::removeSingleUserFromTable($row->usr_id);
81  }
82  }
83  }
$res
Definition: ltiservices.php:69
static _lookupLastLogin(int $a_user_id)
global $DIC
Definition: feed.php:28
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: confirmReg.php:20
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeSingleUserFromTable()

static ilCronDeleteInactiveUserReminderMail::removeSingleUserFromTable ( int  $usr_id)
static

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

References $DIC, $ilDB, and $query.

Referenced by ilObjUser\delete().

111  : void
112  {
113  global $DIC;
114 
115  $ilDB = $DIC['ilDB'];
116  $query = "DELETE FROM " . self::TABLE_NAME . " WHERE usr_id = %s";
117  $ilDB->manipulateF($query, array('integer'), array($usr_id));
118  }
global $DIC
Definition: feed.php:28
$query
+ Here is the caller graph for this function:

◆ sendReminder()

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

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

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

49  : void {
51  $mail->setRecipients(array($user));
52  $mail->setAdditionalInformation(
53  array(
54  "www" => ilUtil::_getHttpPath(),
55  "days" => $reminderTime,
56  "date" => $time_frame_for_deletion
57  )
58  );
59  $mail->send();
60  self::mailSent($user->getId());
61  }
static _getHttpPath()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ sendReminderMailIfNeeded()

static ilCronDeleteInactiveUserReminderMail::sendReminderMailIfNeeded ( ilObjUser  $user,
int  $reminderTime,
int  $time_frame_for_deletion 
)
static

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

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

Referenced by ilCronDeleteInactiveUserAccounts\hasCustomSettings().

89  : bool {
90  global $DIC;
91 
92  $ilDB = $DIC['ilDB'];
93  $query = "SELECT ts FROM " . self::TABLE_NAME . " WHERE usr_id = %s";
94  $res = $ilDB->queryF($query, array('integer'), array($user->getId()));
95  $row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT);
96  if ($row === false || $row->ts === null) {
97  self::sendReminder($user, $reminderTime, $time_frame_for_deletion);
98  return true;
99  }
100  return false;
101  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$query
+ Here is the call graph for this function:
+ Here is the caller 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: