5 include_once
"Services/Cron/classes/class.ilCronJob.php";
42 $this->lng = $DIC->language();
43 if (isset($DIC[
"ilUser"])) {
44 $this->
user = $DIC->user();
46 if (isset($DIC[
"ilClientIniFile"])) {
47 $this->client_ini = $DIC[
"ilClientIniFile"];
49 if (isset($DIC[
"tree"])) {
50 $this->tree = $DIC->repositoryTree();
56 return "skll_notification";
62 $lng->loadLanguageModule(
"skll");
63 return $lng->txt(
"skll_skill_notification");
69 $lng->loadLanguageModule(
"skll");
70 return $lng->txt(
"skll_skill_notification_desc");
75 return self::SCHEDULE_TYPE_DAILY;
97 $lng = $DIC->language();
100 $log->debug(
"===Skill Notifications=== start");
103 $status_details = null;
106 $last_run = $setting->get(get_class($this));
110 $last_run = date(
"Y-m-d H:i:s", strtotime(
"yesterday"));
112 $status_details =
"No previous run found - starting from yesterday.";
114 elseif (strlen($last_run) == 10) {
115 $last_run .=
" 00:00:00";
117 $status_details =
"Switched from daily runs to open schedule.";
129 include_once(
"./Services/Skill/classes/class.ilBasicSkill.php");
132 foreach ($achievements as $user_id => $a) {
133 $this->
sendMail($user_id, $a, $last_run);
143 $log->debug(
"save run");
146 $setting->set(get_class($this), date(
"Y-m-d H:i:s"));
151 if ($status_details) {
152 $result->setMessage($status_details);
155 $log->debug(
"===Skill Notifications=== done");
168 protected function sendMail($a_user_id, array $a_achievements, $a_last_run)
175 include_once
"./Services/Notification/classes/class.ilSystemNotification.php";
177 $ntf->setLangModules(array(
"skll"));
180 $lng = $ntf->getUserLanguage($a_user_id);
182 include_once
'./Services/Locator/classes/class.ilLocatorGUI.php';
183 require_once
"./Services/UICore/classes/class.ilTemplate.php";
184 require_once
"./Services/Link/classes/class.ilLink.php";
192 include_once(
"./Services/Skill/classes/class.ilVirtualSkillTree.php");
194 $a_achievements = $vtree->getOrderedNodeset($a_achievements,
"skill_id",
"tref_id");
196 foreach ($a_achievements as $skill_level) {
201 foreach (
$tree->getPathId($skill_level[
"trigger_ref_id"]) as $node) {
206 $ref_id = $skill_level[
"trigger_ref_id"];
207 $obj_id = $skill_level[
"trigger_obj_id"];
208 $type = $skill_level[
"trigger_obj_type"];
209 $title = $skill_level[
"trigger_title"];
211 if ($skill_level[
"trigger_obj_id"] != $last_obj_id) {
212 $last_obj_id = $skill_level[
"trigger_obj_id"];
214 if (
$tree->isInTree($ref_id)) {
224 $ntf->setIntroductionLangId(
"skll_intro_skill_notification_for");
228 $lng->txt(
"skll_new_skill_achievements"),
234 $ntf->addAdditionalInfo(
241 $client = $ilClientIniFile->readVariable(
'client',
'name');
242 $subject = sprintf(
$lng->txt(
"skll_competence_achievements"),
$client);
247 $mail =
new ilMail(ANONYMOUS_USER_ID);
248 $mail->enableSOAP(
false);
254 $ntf->composeAndGetMessage($a_user_id, null,
"read",
true),
static _lookupLogin($a_user_id)
lookup login
static lookupLevelTitle($a_id)
Lookup level title.
Cron job application base class.
sendMail($a_user_id, array $a_achievements, $a_last_run)
Send news mail for 1 user and n objects.
static getNewAchievementsPerUser($a_timestamp, $a_timestamp_to=null, $a_user_id=0, $a_self_eval=0)
Get new achievements.
static _getStaticLink( $a_ref_id, $a_type='', $a_fallback_goto=true, $append="")
Get static link.
static setUseRelativeDates($a_status)
set use relative dates
if($_SERVER['argc']< 4) $client
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
__construct()
Constructor.
static useRelativeDates()
check if relative dates are used
getDefaultScheduleValue()
Course/group skill notification.
static _lookupTitle($a_obj_id, $a_tref_id=0)
Lookup Title.
static getLogger($a_component_id)
Get component logger.
Cron job result data container.
Wrapper classes for system notifications.