ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ILIAS\User\Profile\Prompt\StartUpStep Class Reference
+ Inheritance diagram for ILIAS\User\Profile\Prompt\StartUpStep:
+ Collaboration diagram for ILIAS\User\Profile\Prompt\StartUpStep:

Public Member Functions

 __construct (private readonly \ilObjUser $user, private readonly \ilCtrl $ctrl, \ilDBInterface $db, Language $lng, HTTPServices $http, Refinery $refinery)
 
 shouldStoreRequestTarget ()
 
 isInFulfillment ()
 
 shouldInterceptRequest ()
 
 execute ()
 
- Public Member Functions inherited from ILIAS\Init\StartupSequence\StartUpSequenceStep
 shouldStoreRequestTarget ()
 
 shouldInterceptRequest ()
 
 isInFulfillment ()
 
 execute ()
 

Private Attributes

const LOGGING_DATE_TIME_FORMAT = 'Y-m-d H:i:s'
 
ilLogger $logger
 
readonly GUIRequest $profile_request
 
readonly Repository $repository
 
bool $update_prompt = false
 

Detailed Description

Definition at line 30 of file StartUpStep.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\User\Profile\Prompt\StartUpStep::__construct ( private readonly \ilObjUser  $user,
private readonly \ilCtrl  $ctrl,
\ilDBInterface  $db,
Language  $lng,
HTTPServices  $http,
Refinery  $refinery 
)

Definition at line 39 of file StartUpStep.php.

References ilLoggerFactory\getLogger(), ILIAS\Repository\logger(), and ILIAS\UI\examples\Deck\repository().

46  {
47  $this->logger = \ilLoggerFactory::getLogger('user');
48  $this->profile_request = new GUIRequest(
49  $http,
50  $refinery
51  );
52  $this->repository = new Repository(
53  $db,
54  $lng,
55  new \ilSetting('user')
56  );
57  }
static getLogger(string $a_component_id)
Get component logger.
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
$http
Definition: deliver.php:30
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:

Member Function Documentation

◆ execute()

ILIAS\User\Profile\Prompt\StartUpStep::execute ( )

Definition at line 140 of file StartUpStep.php.

References ILIAS\Repository\ctrl(), ILIAS\Repository\logger(), ILIAS\UI\examples\Deck\repository(), and ILIAS\Repository\user().

140  : void
141  {
142  if ($this->update_prompt) {
143  $this->logger->debug('Update last prompt date for user :' . $this->user->getId());
144  $this->repository->updateLastUserPrompt($this->user->getId());
145  }
146 
147  $this->ctrl->setParameterByClass('ilpersonalprofilegui', 'prompted', '1');
148  $this->ctrl->redirectByClass(['ildashboardgui', 'ilpersonalprofilegui'], 'showPersonalData');
149  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
+ Here is the call graph for this function:

◆ isInFulfillment()

ILIAS\User\Profile\Prompt\StartUpStep::isInFulfillment ( )

Definition at line 64 of file StartUpStep.php.

References ILIAS\Repository\ctrl().

Referenced by ILIAS\User\Profile\Prompt\StartUpStep\shouldInterceptRequest().

64  : bool
65  {
66  $baseClass = $this->profile_request->getBaseClass();
67  if ($baseClass === '' || strtolower($baseClass) !== 'ildashboardgui') {
68  return false;
69  }
70 
71  return (
72  strtolower($this->ctrl->getCmdClass()) === 'ilpersonalprofilegui'
73  && in_array(
74  strtolower($this->ctrl->getCmd()),
75  [
76  'savepersonaldata',
77  'showpersonaldata',
78  'showprofile',
79  'showpublicprofile',
80  'savepublicprofile'
81  ]
82  )
83  );
84  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ shouldInterceptRequest()

ILIAS\User\Profile\Prompt\StartUpStep::shouldInterceptRequest ( )

Definition at line 86 of file StartUpStep.php.

References ILIAS\User\Profile\Prompt\StartUpStep\isInFulfillment(), ILIAS\Repository\logger(), ILIAS\User\Profile\Prompt\Settings\MODE_ONCE_AFTER_LOGIN, ILIAS\User\Profile\Prompt\Settings\MODE_REPEAT, null, ILIAS\UI\examples\Deck\repository(), and ILIAS\Repository\user().

86  : bool
87  {
88  $prompt_settings = $this->repository->getSettings();
89  $user_prompt = $this->repository->getUserPrompt($this->user->getId());
90 
91  $this->logger->debug('Check Profile');
92 
93  if ($this->isInFulfillment()) {
94  return false;
95  }
96 
97  if ($this->user->getProfileIncomplete()) {
98  $this->logger->debug('Is Incomplete');
99  return true;
100  }
101 
102  if (in_array($this->user->getPref('public_profile'), ['y', 'g'])) {
103  return false;
104  }
105 
106  $this->logger->debug('Is not public');
107  if ($prompt_settings->getMode() === Settings::MODE_ONCE_AFTER_LOGIN) {
108  $this->logger->debug('Mode: X days after login');
109  if ($user_prompt->getFirstLogin() === null || $user_prompt->getLastPrompt() !== null) {
110  return false;
111  }
112  $this->logger->debug('User has logged in and not prompted yet');
113  $deadline = $user_prompt->getFirstLogin()
114  ->add(new \DateInterval("P{$prompt_settings->getDays()}D"));
115  if ($deadline->getTimestamp() < time()) {
116  $this->logger->debug('Deadline is due');
117  $this->update_prompt = true;
118  return true;
119  }
120  }
121 
122  if ($prompt_settings->getMode() === Settings::MODE_REPEAT) {
123  $this->logger->debug('Mode: Repeat all x days');
124 
125  $last_interaction_date = max($user_prompt->getFirstLogin(), $user_prompt->getLastPrompt());
126  if ($last_interaction_date === null) {
127  return false;
128  }
129  $this->logger->debug('User logged in already.');
130  $deadline = $last_interaction_date->add(new \DateInterval("P{$prompt_settings->getDays()}D"));
131  if ($deadline->getTimestamp() < time()) {
132  $this->logger->debug('Deadline is due');
133  $this->update_prompt = true;
134  return true;
135  }
136  }
137  return false;
138  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ shouldStoreRequestTarget()

ILIAS\User\Profile\Prompt\StartUpStep::shouldStoreRequestTarget ( )

Definition at line 59 of file StartUpStep.php.

59  : bool
60  {
61  return true;
62  }

Field Documentation

◆ $logger

ilLogger ILIAS\User\Profile\Prompt\StartUpStep::$logger
private

Definition at line 33 of file StartUpStep.php.

◆ $profile_request

readonly GUIRequest ILIAS\User\Profile\Prompt\StartUpStep::$profile_request
private

Definition at line 35 of file StartUpStep.php.

◆ $repository

readonly Repository ILIAS\User\Profile\Prompt\StartUpStep::$repository
private

Definition at line 36 of file StartUpStep.php.

◆ $update_prompt

bool ILIAS\User\Profile\Prompt\StartUpStep::$update_prompt = false
private

Definition at line 37 of file StartUpStep.php.

◆ LOGGING_DATE_TIME_FORMAT

const ILIAS\User\Profile\Prompt\StartUpStep::LOGGING_DATE_TIME_FORMAT = 'Y-m-d H:i:s'
private

Definition at line 32 of file StartUpStep.php.


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