5 include_once
"Services/Cron/classes/class.ilCronJob.php";
16 return "mem_notification";
23 return $lng->txt(
"enable_course_group_notifications");
30 return $lng->txt(
"enable_course_group_notifications_desc");
58 $status_details = null;
61 $last_run = $setting->get(get_class($this));
64 if($last_run == date(
"Y-m-d"))
67 $status_details =
"Did already run today.";
73 $set = $ilDB->query(
"SELECT usr_id,keyword FROM usr_pref".
74 " WHERE ".$ilDB->like(
"keyword",
"text",
"grpcrs_ntf_%").
75 " AND value = ".$ilDB->quote(
"1",
"text"));
76 while(
$row = $ilDB->fetchAssoc($set))
91 include_once
"Services/News/classes/class.ilNewsItem.php";
92 foreach($objects as $type => $ref_ids)
95 foreach($ref_ids as
$ref_id => $user_ids)
99 if($news_item->checkNewsExistsForGroupCourse(
$ref_id))
101 foreach($user_ids as $user_id)
104 $user_news = $news_item->getNewsForRefId(
$ref_id,
105 false,
false, 1,
false,
false,
false,
false,
124 $setting->set(get_class($this), date(
"Y-m-d"));
137 $result->setMessage($status_details);
150 protected function sendMail($a_user_id, $a_ref_id, array $news)
157 include_once
"./Services/Notification/classes/class.ilSystemNotification.php";
159 $ntf->setLangModules(array(
"crs",
"news"));
160 $ntf->setRefId($a_ref_id);
161 $ntf->setGotoLangId(
'url');
162 $ntf->setSubjectLangId(
'crs_subject_course_group_notification');
165 $lng = $ntf->getUserLanguage($a_user_id);
168 $ntf->setIntroductionDirect(sprintf($lng->txt(
"crs_intro_course_group_notification_for"), $obj_title));
170 $subject = sprintf($lng->txt(
"crs_subject_course_group_notification"), $obj_title);
175 foreach($news as $item)
178 $item[
"title"], $item[
"content_is_lang_var"], $item[
"agg_ref_id"],
179 $item[
"aggregation"]);
181 $item[
"content"], $item[
"content_text_is_lang_var"]);
187 include_once
'./Services/Locator/classes/class.ilLocatorGUI.php';
189 $cont_loc->addContextItems($item[
"ref_id"],
true);
190 $cont_loc->setTextOnly(
true);
194 @include_once
"HTML/Template/ITX.php";
195 if (class_exists(
"HTML_Template_ITX"))
197 include_once
"./Services/UICore/classes/class.ilTemplateHTMLITX.php";
201 include_once
"HTML/ITX.php";
202 include_once
"./Services/UICore/classes/class.ilTemplateITX.php";
204 require_once
"./Services/UICore/classes/class.ilTemplate.php";
205 $loc =
"[".$cont_loc->getHTML().
"]";
209 $txt .= $ntf->getBlockBorder();
211 $txt .=
'#'.$counter.
" - ".$loc.
" ".$obj_title.
"\n\n";
215 $txt .=
"\n".$content;
221 $ntf->addAdditionalInfo(
"news",
$txt,
true);
224 $mail =
new ilMail($ilUser->getId());
230 $ntf->composeAndGetMessage($a_user_id, null,
"read",
true),
243 $a_fields[
"enable_course_group_notifications"] = $a_is_active ?
244 $lng->txt(
"enabled") :
245 $lng->txt(
"disabled");
255 $ilSetting->set(
"crsgrp_ntf", (
bool)$a_currently_active);