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,
121 $setting->set(get_class($this), date(
"Y-m-d"));
134 $result->setMessage($status_details);
147 protected function sendMail($a_user_id, $a_ref_id, array $news)
154 include_once
"./Services/Notification/classes/class.ilSystemNotification.php";
156 $ntf->setLangModules(array(
"crs",
"news"));
157 $ntf->setRefId($a_ref_id);
158 $ntf->setGotoLangId(
'url');
159 $ntf->setSubjectLangId(
'crs_subject_course_group_notification');
162 $lng = $ntf->getUserLanguage($a_user_id);
165 $ntf->setIntroductionDirect(sprintf($lng->txt(
"crs_intro_course_group_notification_for"), $obj_title));
167 $subject = sprintf($lng->txt(
"crs_subject_course_group_notification"), $obj_title);
172 foreach($news as $item)
175 $item[
"title"], $item[
"content_is_lang_var"], $item[
"agg_ref_id"],
176 $item[
"aggregation"]);
178 $item[
"content"], $item[
"content_text_is_lang_var"]);
184 include_once
'./Services/Locator/classes/class.ilLocatorGUI.php';
186 $cont_loc->addContextItems($item[
"ref_id"],
true);
187 $cont_loc->setTextOnly(
true);
191 @include_once
"HTML/Template/ITX.php";
192 if (class_exists(
"HTML_Template_ITX"))
194 include_once
"./Services/UICore/classes/class.ilTemplateHTMLITX.php";
198 include_once
"HTML/ITX.php";
199 include_once
"./Services/UICore/classes/class.ilTemplateITX.php";
201 require_once
"./Services/UICore/classes/class.ilTemplate.php";
202 $loc =
"[".$cont_loc->getHTML().
"]";
206 $txt .= $ntf->getBlockBorder();
208 $txt .=
'#'.$counter.
" - ".$loc.
" ".$obj_title.
"\n\n";
212 $txt .=
"\n".$content;
218 $ntf->addAdditionalInfo(
"news", $txt,
true);
221 $mail =
new ilMail($ilUser->getId());
227 $ntf->composeAndGetMessage($a_user_id, null,
"read",
true),
240 $a_fields[
"enable_course_group_notifications"] = $a_is_active ?
241 $lng->txt(
"enabled") :
242 $lng->txt(
"disabled");
252 $ilSetting->set(
"crsgrp_ntf", (
bool)$a_currently_active);