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 if (!in_array($placeholder_id, [
'sahs_title',
'sahs_link'])) {
143 $obj_id = $ilObjDataCache->lookupObjId((
int) $context_parameters[
'ref_id']);
146 switch ($placeholder_id) {
148 return $ilObjDataCache->lookupTitle($obj_id);
151 return ilLink::_getLink((
int) $context_parameters[
'ref_id'],
'sahs');
154 if ($recipient ===
null) {
167 if ($recipient ===
null) {
171 return trim($mark) !==
'' ? $mark :
'-';
174 if ($recipient ===
null) {
181 if ($coll !==
null && $coll->getItems()) {
189 foreach ($SCOStatusForUser as $item) {
190 $scores[] = $item[
'title'] .
': ' . $item[
'score'];
193 return implode(
"\n", $scores);
195 case 'scorm_time_spent':
196 if ($recipient ===
null) {
202 if (isset($progress[
'spent_seconds'])) {
204 $progress[
'spent_seconds'],
212 case 'scorm_first_access':
213 if ($recipient ===
null) {
219 if (isset($progress[
'access_time_min'])) {
225 $progress[
'access_time_min'],
236 case 'scorm_last_access':
237 if ($recipient ===
null) {
243 if (isset($progress[
'access_time'])) {
const EXTENDED_DATA_LAST_ACCESS
static array static setUseRelativeDates(bool $a_status)
set use relative dates
static _getProgress(int $a_user_id, int $a_obj_id)
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)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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)
resolveSpecificPlaceholder(string $placeholder_id, array $context_parameters, ?ilObjUser $recipient=null)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
static getInstance(int $obj_id)