ILIAS  release_7 Revision v7.30-3-g800a261c036
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"
 
const DATE_FORMAT = 'd-m-Y H:i:s'
 

Protected Member Functions

 getNewestProgressForUser (ilObjStudyProgramme $obj, int $user_id)
 
 statusToRepr (int $status, string $lang)
 
 date2String (DateTimeImmutable $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 32 of file class.ilStudyProgrammeMailTemplateContext.php.

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

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

Member Function Documentation

◆ date2String()

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

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

Referenced by getSpecificPlaceholders().

309  : string
310  {
311  if (is_null($date_time)) {
312  return '';
313  }
314  return $date_time->format(self::DATE_FORMAT);
315  }
+ Here is the caller graph for this function:

◆ getDescription()

ilStudyProgrammeMailTemplateContext::getDescription ( )
Returns
string

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

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

◆ getId()

ilStudyProgrammeMailTemplateContext::getId ( )
Returns
string

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

54  : string
55  {
56  return self::ID;
57  }

◆ getNewestProgressForUser()

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

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

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

Referenced by getSpecificPlaceholders().

264  {
265  $progress = $obj->getProgressesOf($user_id);
266 
267  $successfully_progress = array_filter($progress, function (ilStudyProgrammeProgress $a) {
268  return $a->isSuccessful() || $a->isSuccessfulExpired() || $a->isAccredited();
269  });
270 
271  if (count($successfully_progress) == 0) {
272  return $progress[0];
273  }
274 
275  usort($successfully_progress, function (ilStudyProgrammeProgress $a, ilStudyProgrammeProgress $b) {
276  if ($a->getCompletionDate() > $b->getCompletionDate()) {
277  return -1;
278  } elseif ($a->getCompletionDate() < $b->getCompletionDate()) {
279  return 1;
280  } else {
281  return 0;
282  }
283  });
284 
285  return array_shift($successfully_progress);
286  }
Class ilStudyProgrammeProgress.
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
+ 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 79 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().

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

◆ getTitle()

ilStudyProgrammeMailTemplateContext::getTitle ( )
Returns
string

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

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

◆ statusToRepr()

ilStudyProgrammeMailTemplateContext::statusToRepr ( int  $status,
string  $lang 
)
protected

Definition at line 288 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().

288  : string
289  {
291  return $this->lng->txtlng('prg', 'prg_status_in_progress', $lang);
292  }
294  return $this->lng->txtlng('prg', 'prg_status_completed', $lang);
295  }
297  return $this->lng->txtlng('prg', 'prg_status_accredited', $lang);
298  }
300  return $this->lng->txtlng('prg', 'prg_status_not_relevant', $lang);
301  }
303  return $this->lng->txtlng('prg', 'prg_status_failed', $lang);
304  }
305 
306  throw new ilException("Unknown status: '$status'");
307  }
$lang
Definition: xapiexit.php:8
+ 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"

◆ DATE_FORMAT

const ilStudyProgrammeMailTemplateContext::DATE_FORMAT = 'd-m-Y H:i:s'

◆ 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: