ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilPRGStatusInfoBuilder Class Reference

Builds PageContent "Status Information". More...

+ Collaboration diagram for ilPRGStatusInfoBuilder:

Public Member Functions

 __construct (UIFactory $ui_factory, Renderer $ui_renderer, ilLanguage $lng, ilCtrl $ctrl, ilTemplate $tpl, PRGAssignmentRepository $repo_assignment, ilStudyProgrammeSettingsRepository $repo_settings, ilCertificateDownloadValidator $cert_validator, int $usr_id)
 
 getStatusInfoFor (int $prg_obj_id)
 

Protected Member Functions

 getRestartPeriodOfProgrammeNode (int $prg_obj_id)
 
 maybeGetCertificateLink (int $prg_obj_id)
 

Protected Attributes

UIFactory $ui_factory
 
Renderer $ui_renderer
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilTemplate $tpl
 
PRGAssignmentRepository $repo_assignment
 
ilStudyProgrammeSettingsRepository $repo_settings
 
ilCertificateDownloadValidator $cert_validator
 
int $usr_id
 

Detailed Description

Builds PageContent "Status Information".

Definition at line 27 of file ilPRGStatusInfoBuilder.php.

Constructor & Destructor Documentation

◆ __construct()

ilPRGStatusInfoBuilder::__construct ( UIFactory  $ui_factory,
Renderer  $ui_renderer,
ilLanguage  $lng,
ilCtrl  $ctrl,
ilTemplate  $tpl,
PRGAssignmentRepository  $repo_assignment,
ilStudyProgrammeSettingsRepository  $repo_settings,
ilCertificateDownloadValidator  $cert_validator,
int  $usr_id 
)

Definition at line 39 of file ilPRGStatusInfoBuilder.php.

References $cert_validator, $ctrl, $DIC, $repo_assignment, $repo_settings, $tpl, $ui_factory, $ui_renderer, $usr_id, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

49  {
50  global $DIC;
51  $this->ui_factory = $ui_factory;
52  $this->ui_renderer = $ui_renderer;
53  $this->lng = $DIC->language();
54  $this->ctrl = $ctrl;
55  $this->tpl = $tpl;
56  $this->repo_assignment = $repo_assignment;
57  $this->repo_settings = $repo_settings;
58  $this->cert_validator = $cert_validator;
59  $this->usr_id = $usr_id;
60  }
ilStudyProgrammeSettingsRepository $repo_settings
global $DIC
Definition: shib_login.php:22
ilCertificateDownloadValidator $cert_validator
PRGAssignmentRepository $repo_assignment
+ Here is the call graph for this function:

Member Function Documentation

◆ getRestartPeriodOfProgrammeNode()

ilPRGStatusInfoBuilder::getRestartPeriodOfProgrammeNode ( int  $prg_obj_id)
protected

Definition at line 113 of file ilPRGStatusInfoBuilder.php.

References null.

Referenced by getStatusInfoFor().

113  : ?DateInterval
114  {
115  $settings = $this->repo_settings->get($prg_obj_id);
116  $offset_days = $settings->getValidityOfQualificationSettings()->getRestartPeriod();
117  if ($offset_days) {
118  return new DateInterval('P' . $offset_days . 'D');
119  }
120  return null;
121  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ getStatusInfoFor()

ilPRGStatusInfoBuilder::getStatusInfoFor ( int  $prg_obj_id)

Definition at line 62 of file ilPRGStatusInfoBuilder.php.

References ilUtil\getImagePath(), getRestartPeriodOfProgrammeNode(), ILIAS\Repository\lng(), maybeGetCertificateLink(), and null.

62  : string
63  {
64  $status = 'pc_prgstatus_status_no_qualification';
65  $status_txt = 'pc_prgstatus_text_no_qualification';
66  $validity_txt = '';
67  $icon = 'standard/icon_not_ok.svg';
68  $restart_date = null;
69 
70  $ass = $this->repo_assignment->getLongestValidAssignment($prg_obj_id, $this->usr_id)
71  ?? $this->repo_assignment->getLatestAssignment($prg_obj_id, $this->usr_id);
72 
73  if ($ass) {
74  $pgs = $ass->getProgressTree();
75  $now = new DateTimeImmutable();
76  if ($pgs->hasValidQualification($now)) {
77  $status = 'pc_prgstatus_status_valid_qualification';
78  $status_txt = 'pc_prgstatus_unlimited_validation';
79  $icon = 'standard/icon_ok.svg';
80  }
81 
82  if ($validity = $pgs->getValidityOfQualification()) {
83  $status_txt = 'pc_prgstatus_expiration_date';
84  $validity_txt = ' ' . $validity->format('d.m.Y');
85 
86  $restart = $this->getRestartPeriodOfProgrammeNode($prg_obj_id);
87  if (!is_null($restart)) {
88  $restart_date = $validity->sub($restart)->format('d.m.Y');
89  }
90  }
91  }
92 
93  $icon = $this->ui_renderer->render(
94  $this->ui_factory->symbol()->icon()->custom(
95  \ilUtil::getImagePath($icon),
96  $this->lng->txt($status_txt)
97  )
98  ->withSize('large')
99  );
100  $this->tpl->setVariable("ICON", $icon);
101  $this->tpl->setVariable("HEADLINE", $this->lng->txt("pc_prgstatus_qualification_headline"));
102  $this->tpl->setVariable("STATUS", $this->lng->txt($status));
103  $this->tpl->setVariable("STATUS_TEXT", $this->lng->txt($status_txt) . $validity_txt);
104  if ($certificate_link = $this->maybeGetCertificateLink($prg_obj_id)) {
105  $this->tpl->setVariable("CERTIFICATE", $certificate_link);
106  }
107  if ($restart_date) {
108  $this->tpl->setVariable("EDIT_QUALIFICATION", $this->lng->txt("pc_prgstatus_edit_qualification") . " " . $restart_date);
109  }
110  return $this->tpl->get();
111  }
maybeGetCertificateLink(int $prg_obj_id)
getRestartPeriodOfProgrammeNode(int $prg_obj_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:

◆ maybeGetCertificateLink()

ilPRGStatusInfoBuilder::maybeGetCertificateLink ( int  $prg_obj_id)
protected

Definition at line 123 of file ilPRGStatusInfoBuilder.php.

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and null.

Referenced by getStatusInfoFor().

123  : ?string
124  {
125  if ($this->cert_validator->isCertificateDownloadable($this->usr_id, $prg_obj_id)) {
126  $target = $this->ctrl->getLinkTargetByClass("ilObjStudyProgrammeGUI", "deliverCertificate");
127  return $this->ui_renderer->render($this->ui_factory->link()->standard($this->lng->txt('download_certificate'), $target));
128  }
129  return null;
130  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $cert_validator

ilCertificateDownloadValidator ilPRGStatusInfoBuilder::$cert_validator
protected

Definition at line 36 of file ilPRGStatusInfoBuilder.php.

Referenced by __construct().

◆ $ctrl

ilCtrl ilPRGStatusInfoBuilder::$ctrl
protected

Definition at line 32 of file ilPRGStatusInfoBuilder.php.

Referenced by __construct().

◆ $lng

ilLanguage ilPRGStatusInfoBuilder::$lng
protected

Definition at line 31 of file ilPRGStatusInfoBuilder.php.

◆ $repo_assignment

PRGAssignmentRepository ilPRGStatusInfoBuilder::$repo_assignment
protected

Definition at line 34 of file ilPRGStatusInfoBuilder.php.

Referenced by __construct().

◆ $repo_settings

ilStudyProgrammeSettingsRepository ilPRGStatusInfoBuilder::$repo_settings
protected

Definition at line 35 of file ilPRGStatusInfoBuilder.php.

Referenced by __construct().

◆ $tpl

ilTemplate ilPRGStatusInfoBuilder::$tpl
protected

Definition at line 33 of file ilPRGStatusInfoBuilder.php.

Referenced by __construct().

◆ $ui_factory

UIFactory ilPRGStatusInfoBuilder::$ui_factory
protected

Definition at line 29 of file ilPRGStatusInfoBuilder.php.

Referenced by __construct().

◆ $ui_renderer

Renderer ilPRGStatusInfoBuilder::$ui_renderer
protected

Definition at line 30 of file ilPRGStatusInfoBuilder.php.

Referenced by __construct().

◆ $usr_id

int ilPRGStatusInfoBuilder::$usr_id
protected

Definition at line 37 of file ilPRGStatusInfoBuilder.php.

Referenced by __construct().


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