40        $this->lng = 
$DIC->language();
 
   41        if (isset(
$DIC[
"ilUser"])) {
 
   42            $this->
user = $DIC->user();
 
   44        if (isset(
$DIC[
"ilClientIniFile"])) {
 
   45            $this->client_ini = 
$DIC[
"ilClientIniFile"];
 
   47        if (isset(
$DIC[
"tree"])) {
 
   48            $this->tree = 
$DIC->repositoryTree();
 
   54        return "skll_notification";
 
   60        $lng->loadLanguageModule(
"skll");
 
   61        return $lng->txt(
"skll_skill_notification");
 
   67        $lng->loadLanguageModule(
"skll");
 
   68        return $lng->txt(
"skll_skill_notification_desc");
 
   98        $log->debug(
"===Skill Notifications=== start");
 
  101        $status_details = 
null;
 
  104        $last_run = $setting->get(get_class($this));
 
  108            $last_run = date(
"Y-m-d H:i:s", strtotime(
"yesterday"));
 
  110            $status_details = 
"No previous run found - starting from yesterday.";
 
  112        elseif (strlen($last_run) == 10) {
 
  113            $last_run .= 
" 00:00:00";
 
  115            $status_details = 
"Switched from daily runs to open schedule.";
 
  129        foreach ($achievements as $user_id => 
$a) {
 
  140        $log->debug(
"save run");
 
  143        $setting->set(get_class($this), date(
"Y-m-d H:i:s"));
 
  148        if ($status_details) {
 
  149            $result->setMessage($status_details);
 
  152        $log->debug(
"===Skill Notifications=== done");
 
  165    protected function sendMail($a_user_id, array $a_achievements, $a_last_run)
 
  171        $ntf->setLangModules(array(
"skll"));
 
  174        $lng = $ntf->getUserLanguage($a_user_id);
 
  182        $a_achievements = $vtree->getOrderedNodeset($a_achievements, 
"skill_id", 
"tref_id");
 
  184        foreach ($a_achievements as $skill_level) {
 
  189            foreach (
$tree->getPathId($skill_level[
"trigger_ref_id"]) as $node) {
 
  192            $path = implode(
"-", $path);
 
  194            $ref_id = $skill_level[
"trigger_ref_id"];
 
  195            $obj_id = $skill_level[
"trigger_obj_id"];
 
  196            $type = $skill_level[
"trigger_obj_type"];
 
  197            $title = $skill_level[
"trigger_title"];
 
  199            if ($skill_level[
"trigger_obj_id"] != $last_obj_id) {
 
  200                $last_obj_id = $skill_level[
"trigger_obj_id"];
 
  202                if (
$tree->isInTree($ref_id)) {
 
  212        $ntf->setIntroductionLangId(
"skll_intro_skill_notification_for");
 
  216            $lng->txt(
"skll_new_skill_achievements"),
 
  222        $ntf->addAdditionalInfo(
 
  229        $client = $ilClientIniFile->readVariable(
'client', 
'name');
 
  230        $subject = sprintf(
$lng->txt(
"skll_competence_achievements"), 
$client);
 
  241            $ntf->composeAndGetMessage($a_user_id, 
null, 
"read", 
true),
 
An exception for terminatinating execution or to throw for unit testing.
static getNewAchievementsPerUser(string $a_timestamp, string $a_timestamp_to=null, int $a_user_id=0, int $a_self_eval=0)
static lookupLevelTitle(int $a_id)
Cron job result data container.
Cron job application base class.
const SCHEDULE_TYPE_DAILY
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
static setUseRelativeDates($a_status)
set use relative dates
static useRelativeDates()
check if relative dates are used
@classDescription Date and time handling
static _getStaticLink( $a_ref_id, $a_type='', $a_fallback_goto=true, $append="")
Get static link.
static getLogger($a_component_id)
Get component logger.
static _lookupLogin($a_user_id)
lookup login
Course/group skill notification.
hasFlexibleSchedule()
Can the schedule be configured?
sendMail($a_user_id, array $a_achievements, $a_last_run)
Send news mail for 1 user and n objects.
__construct()
Constructor.
getDefaultScheduleValue()
Get schedule value.
getDefaultScheduleType()
Get schedule type.
hasAutoActivation()
Is to be activated on "installation".
getDescription()
Get description.
static _lookupTitle($a_obj_id, $a_tref_id=0)
Lookup Title.
Wrapper classes for system notifications.
if($_SERVER['argc']< 4) $client
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples