19 declare(strict_types=1);
29 public const ID =
'sahs_context_lp';
39 $lng = $DIC->language();
41 $lng->loadLanguageModule(
'sahs');
43 return $lng->txt(
'sahs_mail_context_lp');
49 $lng = $DIC->language();
51 $lng->loadLanguageModule(
'sahs');
53 return $lng->txt(
'sahs_mail_context_lp_info');
66 $lng = $DIC->language();
68 $lng->loadLanguageModule(
'trac');
75 $placeholders[
'scorm_title'] = [
76 'placeholder' =>
'SCORM_TITLE',
77 'label' =>
$lng->txt(
'obj_sahs')
80 $placeholders[
'scorm_status'] = [
81 'placeholder' =>
'SCORM_STATUS',
82 'label' =>
$lng->txt(
'trac_status')
85 $placeholders[
'scorm_mark'] = [
86 'placeholder' =>
'SCORM_MARK',
87 'label' =>
$lng->txt(
'trac_mark')
91 $lng->loadLanguageModule(
'content');
92 $placeholders[
'scorm_score'] = [
93 'placeholder' =>
'SCORM_SCORE',
94 'label' =>
$lng->txt(
'cont_score')
98 $placeholders[
'scorm_time_spent'] = [
99 'placeholder' =>
'SCORM_TIME_SPENT',
100 'label' =>
$lng->txt(
'trac_spent_seconds')
105 $placeholders[
'scorm_first_access'] = [
106 'placeholder' =>
'SCORM_FIRST_ACCESS',
107 'label' =>
$lng->txt(
'trac_first_access')
110 $placeholders[
'scorm_last_access'] = [
111 'placeholder' =>
'SCORM_LAST_ACCESS',
112 'label' =>
$lng->txt(
'trac_last_access')
117 $placeholders[
'scorm_link'] = [
118 'placeholder' =>
'SCORM_LINK',
119 'label' =>
$lng->txt(
'perma_link')
122 return $placeholders;
129 string $placeholder_id,
130 array $context_parameters,
137 $ilObjDataCache = $DIC[
'ilObjDataCache'];
139 $obj_id = $ilObjDataCache->lookupObjId((
int) $context_parameters[
'ref_id']);
142 switch ($placeholder_id) {
144 return $ilObjDataCache->lookupTitle($obj_id);
147 return ilLink::_getLink((
int) $context_parameters[
'ref_id'],
'sahs');
150 if ($recipient === null) {
163 if ($recipient === null) {
167 return trim($mark) !==
'' ? $mark :
'-';
170 if ($recipient === null) {
177 if ($coll !== null && $coll->getItems()) {
185 foreach ($SCOStatusForUser as $item) {
186 $scores[] = $item[
'title'] .
': ' . $item[
'score'];
189 return implode(
"\n", $scores);
191 case 'scorm_time_spent':
192 if ($recipient === null) {
198 if (isset($progress[
'spent_seconds'])) {
200 $progress[
'spent_seconds'],
208 case 'scorm_first_access':
209 if ($recipient === null) {
215 if (isset($progress[
'access_time_min'])) {
221 $progress[
'access_time_min'],
232 case 'scorm_last_access':
233 if ($recipient === null) {
239 if (isset($progress[
'access_time'])) {
const EXTENDED_DATA_LAST_ACCESS
static _getProgress(int $a_user_id, int $a_obj_id)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
static getSCOsStatusForUser(int $a_user_id, int $a_parent_obj_id, array $a_sco_ids)
getSpecificPlaceholders()
static setLanguage(ilLanguage $a_lng)
static secondsToString(int $seconds, bool $force_with_seconds=false, ?ilLanguage $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
static useRelativeDates()
static _lookupObjId(int $ref_id)
resolveSpecificPlaceholder(string $placeholder_id, array $context_parameters, ilObjUser $recipient=null)
Class ilMailTemplateContext.
static _getStatusText(int $a_status, ?ilLanguage $a_lng=null)
Get status alt text.
static _lookupStatus(int $a_obj_id, int $a_user_id, bool $a_create=true)
Lookup status.
const EXTENDED_DATA_SPENT_SECONDS
const LP_STATUS_NOT_ATTEMPTED_NUM
static _lookupMark(int $a_usr_id, int $a_obj_id)
static setUseRelativeDates(bool $a_status)
set use relative dates
static getInstance(int $obj_id)