Forum notifications.
More...
◆ __construct()
ilForumCronNotification::__construct |
( |
| ) |
|
◆ activationWasToggled()
ilForumCronNotification::activationWasToggled |
( |
|
$a_currently_active | ) |
|
◆ getDefaultScheduleType()
ilForumCronNotification::getDefaultScheduleType |
( |
| ) |
|
◆ getDefaultScheduleValue()
ilForumCronNotification::getDefaultScheduleValue |
( |
| ) |
|
◆ getDescription()
ilForumCronNotification::getDescription |
( |
| ) |
|
◆ getId()
ilForumCronNotification::getId |
( |
| ) |
|
◆ getTitle()
ilForumCronNotification::getTitle |
( |
| ) |
|
◆ hasAutoActivation()
ilForumCronNotification::hasAutoActivation |
( |
| ) |
|
◆ hasCustomSettings()
ilForumCronNotification::hasCustomSettings |
( |
| ) |
|
◆ hasFlexibleSchedule()
ilForumCronNotification::hasFlexibleSchedule |
( |
| ) |
|
◆ run()
ilForumCronNotification::run |
( |
| ) |
|
Definition at line 74 of file class.ilForumCronNotification.php.
References $ilLog, $ilSetting, $lng, $res, $result, sendMails(), ilCronJobResult\STATUS_NO_ACTION, and ilCronJobResult\STATUS_OK.
80 $lng->loadLanguageModule(
'forum');
82 if(!($last_run_datetime = $ilSetting->get(
'cron_forum_notification_last_date')))
84 $last_run_datetime = null;
91 if($last_run_datetime != null &&
92 checkDate(date(
'm', strtotime($last_run_datetime)), date(
'd', strtotime($last_run_datetime)), date(
'Y', strtotime($last_run_datetime))))
94 $threshold = max(strtotime($last_run_datetime), strtotime(
'-' . (
int)$this->settings->get(
'max_notification_age', 30) .
' days', time()));
98 $threshold = strtotime(
'-' . (
int)$this->settings->get(
'max_notification_age', 30) .
' days', time());
101 $date_condition =
' frm_posts.pos_date >= %s AND ';
102 $types[] =
'timestamp';
103 $values[] = date(
'Y-m-d H:i:s', $threshold);
105 $cj_start_date = date(
'Y-m-d H:i:s');
108 $res = $ilDB->queryf(
' 109 SELECT frm_threads.thr_subject thr_subject, 110 frm_data.top_name top_name, 111 frm_data.top_frm_fk obj_id, 112 frm_notification.user_id user_id, 114 FROM frm_notification, frm_posts, frm_threads, frm_data 115 WHERE '.$date_condition.
' frm_posts.pos_thr_fk = frm_threads.thr_pk 116 AND frm_threads.thr_top_fk = frm_data.top_pk 117 AND frm_data.top_frm_fk = frm_notification.frm_id 118 ORDER BY frm_posts.pos_date ASC',
126 $res = $ilDB->queryf(
' 127 SELECT frm_threads.thr_subject thr_subject, 128 frm_data.top_name top_name, 129 frm_data.top_frm_fk obj_id, 130 frm_notification.user_id user_id, 132 FROM frm_notification, frm_posts, frm_threads, frm_data 133 WHERE '.$date_condition.
' frm_posts.pos_thr_fk = frm_threads.thr_pk 134 AND frm_threads.thr_pk = frm_notification.thread_id 135 AND frm_data.top_pk = frm_threads.thr_top_fk 136 ORDER BY frm_posts.pos_date ASC',
143 $ilSetting->set(
'cron_forum_notification_last_date', $cj_start_date);
145 $mess =
'Send '.$numRows.
' messages.';
146 $ilLog->write(__METHOD__.
': '.$mess);
Cron job result data container.
◆ saveCustomSettings()
◆ sendMails()
ilForumCronNotification::sendMails |
( |
|
$res | ) |
|
|
protected |
Definition at line 158 of file class.ilForumCronNotification.php.
References $lng, $ref_id, $res, $row, ilObject\_getAllReferences(), ilForum\_getLanguageInstanceByUsrId(), ilObjUser\_lookupLogin(), ilCronJob\addToExternalSettingsForm(), and ilAdministrationSettingsFormHandler\FORM_FORUM.
Referenced by run().
160 global $ilAccess, $ilDB,
$lng;
162 static $cache = array();
163 static $attachments_cache = array();
165 include_once
'Modules/Forum/classes/class.ilObjForum.php';
166 include_once
'Services/Mail/classes/class.ilMail.php';
167 include_once
'Services/User/classes/class.ilObjUser.php';
168 include_once
'Services/Language/classes/class.ilLanguage.php';
171 $frm = $forumObj->Forum;
174 $mail_obj =
new ilMail(ANONYMOUS_USER_ID);
175 $mail_obj->enableSOAP(
false);
176 while(
$row = $ilDB->fetchAssoc(
$res))
179 if(
$row[
'pos_usr_id'] !=
$row[
'user_id'])
182 if(
$row[
'pos_usr_id'])
186 else if(strlen(
$row[
'pos_usr_alias']))
188 $row[
'pos_usr_name'] =
$row[
'pos_usr_alias'].
' ('.$lng->txt(
'frm_pseudonym').
')';
191 if(
$row[
'pos_usr_name'] ==
'')
193 $row[
'pos_usr_name'] = $lng->txt(
'forums_anonymous');
197 if(!isset($cache[
$row[
'obj_id']]))
201 $has_attachments =
false;
202 if(!isset($attachments_cache[$row[
'obj_id']][$row[
'pos_pk']]))
205 $filesOfPost = $fileDataForum->getFilesOfPost();
206 foreach($filesOfPost as $attachment)
208 $attachments_cache[$row[
'obj_id']][$row[
'pos_pk']][] = $attachment[
'name'];
209 $has_attachments =
true;
214 $has_attachments =
true;
219 foreach((array)$cache[$row[
'obj_id']] as
$ref_id)
221 if($ilAccess->checkAccessOfUser($row[
'user_id'],
'read',
'', $ref_id))
228 $attached_files = array();
229 if($has_attachments ==
true)
231 $attached_files = $attachments_cache[$row[
'obj_id']][$row[
'pos_pk']];
239 $frm->formatNotificationSubject($row),
240 $frm->formatNotification($row, 1, $attached_files, $row[
'user_id']),
static _getAllReferences($a_id)
get all reference ids of object
Class Mail this class handles base functions for mail handling.
_lookupLogin($a_user_id)
lookup login
This class handles all operations on files for the forum object.
static _getLanguageInstanceByUsrId($usr_id)
Get the ilLanguage instance for the passed user id.
◆ $settings
ilForumCronNotification::$settings |
|
protected |
The documentation for this class was generated from the following file: