ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilStudyProgrammeMailTemplateContext Class Reference
+ Inheritance diagram for ilStudyProgrammeMailTemplateContext:
+ Collaboration diagram for ilStudyProgrammeMailTemplateContext:

Public Member Functions

 __construct (OrgUnitUserService $orgUnitUserService=null, ilMailEnvironmentHelper $envHelper=null, ilMailUserHelper $usernameHelper=null, ilMailLanguageHelper $languageHelper=null)
 
 getId ()
 
 getTitle ()
 
 getDescription ()
 
 getSpecificPlaceholders ()
 Return an array of placeholders. More...
 
- Public Member Functions inherited from ilMailTemplateContext
 __construct (OrgUnitUserService $orgUnitUserService=null, ilMailEnvironmentHelper $envHelper=null, ilMailUserHelper $usernameHelper=null, ilMailLanguageHelper $languageHelper=null)
 ilMailTemplateContext constructor. More...
 
 getLanguage ()
 
 getId ()
 Returns a unique (in the context of mail template contexts) id. More...
 
 getTitle ()
 Returns a translated title (depending on the current language) which is displayed in the user interface. More...
 
 getDescription ()
 Returns a translated description (depending on the current language) which is displayed in the user interface. More...
 
 getPlaceholders ()
 Return an array of placeholders. More...
 
 getSpecificPlaceholders ()
 Return an array of placeholders. More...
 
 resolveSpecificPlaceholder (string $placeholder_id, array $context_parameters, ilObjUser $recipient=null, bool $html_markup=false)
 
 resolvePlaceholder (string $placeholder_id, array $context_parameters, ilObjUser $recipient=null, bool $html_markup=false)
 

Data Fields

const ID = 'prg_context_manual'
 
const TITLE = "prg_title"
 
const DESCRIPTION = "prg_description"
 
const TYPE = "prg_type"
 
const LINK = "prg_link"
 
const ORG_UNIT = "prg_orgus"
 
const STATUS = "prg_status"
 
const COMPLETION_DATE = "prg_completion_date"
 
const COMPLETED_BY = "prg_completion_by"
 
const POINTS_REQUIRED = "prg_points_required"
 
const POINTS_CURRENT = "prg_points_current"
 
const DEADLINE = "prg_deadline"
 
const EXPIRE_DATE = "prg_expiry_date"
 
const VALIDITY = "prg_validity"
 

Protected Member Functions

 getNewestProgressForUser (ilObjStudyProgramme $obj, int $user_id)
 
 statusToRepr (int $status)
 
 date2String (DateTime $date_time=null)
 
- Protected Member Functions inherited from ilMailTemplateContext
 initLanguage (ilObjUser $user)
 
 initLanguageByIso2Code (string $isoCode)
 

Protected Attributes

 $lng
 
- Protected Attributes inherited from ilMailTemplateContext
 $language
 
 $envHelper
 
 $languageHelper
 
 $userHelper
 
 $orgUnitUserService
 

Detailed Description

Definition at line 7 of file class.ilStudyProgrammeMailTemplateContext.php.

Constructor & Destructor Documentation

◆ __construct()

ilStudyProgrammeMailTemplateContext::__construct ( OrgUnitUserService  $orgUnitUserService = null,
ilMailEnvironmentHelper  $envHelper = null,
ilMailUserHelper  $usernameHelper = null,
ilMailLanguageHelper  $languageHelper = null 
)

Definition at line 30 of file class.ilStudyProgrammeMailTemplateContext.php.

References $DIC, ilMailTemplateContext\$envHelper, ilMailTemplateContext\$languageHelper, ilMailTemplateContext\$orgUnitUserService, and ILIAS\GlobalScreen\Provider\__construct().

35  {
37  $orgUnitUserService,
38  $envHelper,
39  $usernameHelper,
40  $languageHelper
41  );
42 
43  global $DIC;
44 
45  $this->lng = $DIC['lng'];
46  $this->lng->loadLanguageModule('prg');
47  }
__construct(Container $dic, ilPlugin $plugin)
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

Member Function Documentation

◆ date2String()

ilStudyProgrammeMailTemplateContext::date2String ( DateTime  $date_time = null)
protected

Definition at line 307 of file class.ilStudyProgrammeMailTemplateContext.php.

Referenced by getSpecificPlaceholders().

307  : string
308  {
309  if (is_null($date_time)) {
310  return '';
311  }
312 
313  return $date_time->format('d-m-Y H:i:s');
314  }
+ Here is the caller graph for this function:

◆ getDescription()

ilStudyProgrammeMailTemplateContext::getDescription ( )
Returns
string

Definition at line 68 of file class.ilStudyProgrammeMailTemplateContext.php.

68  : string
69  {
70  return $this->lng->txt('prg_mail_context_info');
71  }

◆ getId()

ilStudyProgrammeMailTemplateContext::getId ( )
Returns
string

Definition at line 52 of file class.ilStudyProgrammeMailTemplateContext.php.

52  : string
53  {
54  return self::ID;
55  }

◆ getNewestProgressForUser()

ilStudyProgrammeMailTemplateContext::getNewestProgressForUser ( ilObjStudyProgramme  $obj,
int  $user_id 
)
protected

Definition at line 262 of file class.ilStudyProgrammeMailTemplateContext.php.

References Vendor\Package\$a, Vendor\Package\$b, ilStudyProgrammeUserProgress\getCompletionDate(), ilObjStudyProgramme\getProgressesOf(), ilStudyProgrammeUserProgress\isAccredited(), ilStudyProgrammeUserProgress\isSuccessful(), and ilStudyProgrammeUserProgress\isSuccessfulExpired().

Referenced by getSpecificPlaceholders().

263  {
264  $progress = $obj->getProgressesOf($user_id);
265 
266  $successfully_progress = array_filter($progress, function (ilStudyProgrammeUserProgress $a) {
267  return $a->isSuccessful() || $a->isSuccessfulExpired() || $a->isAccredited();
268  });
269 
270  if (count($successfully_progress) == 0) {
271  return $progress[0];
272  }
273 
274  usort($successfully_progress, function (ilStudyProgrammeUserProgress $a, ilStudyProgrammeUserProgress $b) {
275  if ($a->getCompletionDate() > $b->getCompletionDate()) {
276  return -1;
277  } elseif ($a->getCompletionDate() < $b->getCompletionDate()) {
278  return 1;
279  } else {
280  return 0;
281  }
282  });
283 
284  return array_shift($successfully_progress);
285  }
isSuccessfulExpired()
Check, whether a the course is passed and expired due to limited validity.
isSuccessful()
Check whether the user was successful on this node.
isAccredited()
Check whether the user was accredited on this node.
getProgressesOf(int $a_user_id)
Get the progresses the user has on this node.
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
getCompletionDate()
Get the completion date of this node.
Represents the progress of a user at one node of a study programme.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSpecificPlaceholders()

ilStudyProgrammeMailTemplateContext::getSpecificPlaceholders ( )

Return an array of placeholders.

Returns
array

Definition at line 77 of file class.ilStudyProgrammeMailTemplateContext.php.

References ilObject\_exists(), ilLink\_getLink(), ilObject\_lookupDeletedDate(), ilObject\_lookupDescription(), ilObjUser\_lookupLogin(), ilObject\_lookupObjectId(), ilContainerReference\_lookupTargetRefId(), ilContainerReference\_lookupTitle(), ilObject\_lookupTitle(), date2String(), ilObjectFactory\getInstanceByObjId(), ilObjectFactory\getInstanceByRefId(), getNewestProgressForUser(), ilObjUser\lookupOrgUnitsRepresentation(), ilMailTemplateContext\resolveSpecificPlaceholder(), and statusToRepr().

77  : array
78  {
79  $placeholders = array();
80 
81  $placeholders[self::TITLE] = array(
82  'placeholder' => 'STUDY_PROGRAMME_TITLE',
83  'label' => $this->lng->txt(self::TITLE)
84  );
85 
86  $placeholders[self::DESCRIPTION] = array(
87  'placeholder' => 'STUDY_PROGRAMME_DESCRIPTION',
88  'label' => $this->lng->txt(self::DESCRIPTION)
89  );
90 
91  $placeholders[self::TYPE] = array(
92  'placeholder' => 'STUDY_PROGRAMME_TYPE',
93  'label' => $this->lng->txt(self::TYPE)
94  );
95 
96  $placeholders[self::LINK] = array(
97  'placeholder' => 'STUDY_PROGRAMME_LINK',
98  'label' => $this->lng->txt(self::LINK)
99  );
100 
101  $placeholders[self::ORG_UNIT] = array(
102  'placeholder' => 'STUDY_PROGRAMME_ORG_UNITS',
103  'label' => $this->lng->txt(self::ORG_UNIT)
104  );
105 
106  $placeholders[self::STATUS] = array(
107  'placeholder' => 'STUDY_PROGRAMME_STATUS',
108  'label' => $this->lng->txt(self::STATUS)
109  );
110 
111  $placeholders[self::COMPLETION_DATE] = array(
112  'placeholder' => 'STUDY_PROGRAMME_COMPLETION_DATE',
113  'label' => $this->lng->txt(self::COMPLETION_DATE)
114  );
115 
116  $placeholders[self::COMPLETED_BY] = array(
117  'placeholder' => 'STUDY_PROGRAMME_COMPLETED_BY',
118  'label' => $this->lng->txt(self::COMPLETED_BY)
119  );
120 
121  $placeholders[self::POINTS_REQUIRED] = array(
122  'placeholder' => 'STUDY_PROGRAMME_POINTS_REQUIRED',
123  'label' => $this->lng->txt(self::POINTS_REQUIRED)
124  );
125 
126  $placeholders[self::POINTS_CURRENT] = array(
127  'placeholder' => 'STUDY_PROGRAMME_POINTS_CURRENT',
128  'label' => $this->lng->txt(self::POINTS_CURRENT)
129  );
130 
131  $placeholders[self::DEADLINE] = array(
132  'placeholder' => 'STUDY_PROGRAMME_DEADLINE',
133  'label' => $this->lng->txt(self::DEADLINE)
134  );
135 
136  $placeholders[self::EXPIRE_DATE] = array(
137  'placeholder' => 'STUDY_PROGRAMME_EXPIRE_DATE',
138  'label' => $this->lng->txt(self::EXPIRE_DATE)
139  );
140 
141  $placeholders[self::VALIDITY] = array(
142  'placeholder' => 'STUDY_PROGRAMME_VALIDITY',
143  'label' => $this->lng->txt(self::VALIDITY)
144  );
145 
146  return $placeholders;
147  }
+ Here is the call graph for this function:

◆ getTitle()

ilStudyProgrammeMailTemplateContext::getTitle ( )
Returns
string

Definition at line 60 of file class.ilStudyProgrammeMailTemplateContext.php.

60  : string
61  {
62  return $this->lng->txt('prg_mail_context_title');
63  }

◆ statusToRepr()

ilStudyProgrammeMailTemplateContext::statusToRepr ( int  $status)
protected

Definition at line 287 of file class.ilStudyProgrammeMailTemplateContext.php.

References ilStudyProgrammeProgress\STATUS_ACCREDITED, ilStudyProgrammeProgress\STATUS_COMPLETED, ilStudyProgrammeProgress\STATUS_FAILED, ilStudyProgrammeProgress\STATUS_IN_PROGRESS, and ilStudyProgrammeProgress\STATUS_NOT_RELEVANT.

Referenced by getSpecificPlaceholders().

287  : string
288  {
290  return $this->lng->txt("prg_status_in_progress");
291  }
293  return $this->lng->txt("prg_status_completed");
294  }
296  return $this->lng->txt("prg_status_accredited");
297  }
299  return $this->lng->txt("prg_status_not_relevant");
300  }
302  return $this->lng->txt("prg_status_failed");
303  }
304  throw new ilException("Unknown status: '$status'");
305  }
+ Here is the caller graph for this function:

Field Documentation

◆ $lng

ilStudyProgrammeMailTemplateContext::$lng
protected

◆ COMPLETED_BY

const ilStudyProgrammeMailTemplateContext::COMPLETED_BY = "prg_completion_by"

◆ COMPLETION_DATE

const ilStudyProgrammeMailTemplateContext::COMPLETION_DATE = "prg_completion_date"

◆ DEADLINE

const ilStudyProgrammeMailTemplateContext::DEADLINE = "prg_deadline"

◆ DESCRIPTION

const ilStudyProgrammeMailTemplateContext::DESCRIPTION = "prg_description"

◆ EXPIRE_DATE

const ilStudyProgrammeMailTemplateContext::EXPIRE_DATE = "prg_expiry_date"

◆ ID

const ilStudyProgrammeMailTemplateContext::ID = 'prg_context_manual'

◆ LINK

const ilStudyProgrammeMailTemplateContext::LINK = "prg_link"

◆ ORG_UNIT

const ilStudyProgrammeMailTemplateContext::ORG_UNIT = "prg_orgus"

◆ POINTS_CURRENT

const ilStudyProgrammeMailTemplateContext::POINTS_CURRENT = "prg_points_current"

◆ POINTS_REQUIRED

const ilStudyProgrammeMailTemplateContext::POINTS_REQUIRED = "prg_points_required"

◆ STATUS

const ilStudyProgrammeMailTemplateContext::STATUS = "prg_status"

◆ TITLE

const ilStudyProgrammeMailTemplateContext::TITLE = "prg_title"

◆ TYPE

const ilStudyProgrammeMailTemplateContext::TYPE = "prg_type"

◆ VALIDITY

const ilStudyProgrammeMailTemplateContext::VALIDITY = "prg_validity"

The documentation for this class was generated from the following file: