ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 ()
 
 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.

46 {
47 $this->logger = \ilLoggerFactory::getLogger('user');
48 $this->profile_request = new GUIRequest(
49 $http,
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.
ILIAS Setting Class.
$http
Definition: deliver.php:30
global $lng
Definition: privfeed.php:31

References ILIAS\$db, $http, $lng, ILIAS\UI\examples\Layout\Page\Standard\$refinery, ilLoggerFactory\getLogger(), ILIAS\Repository\logger(), and ILIAS\UI\examples\Deck\repository().

+ Here is the call graph for this function:

Member Function Documentation

◆ execute()

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

Reimplemented from ILIAS\Init\StartupSequence\StartUpSequenceStep.

Definition at line 139 of file StartUpStep.php.

139 : void
140 {
141 if ($this->update_prompt) {
142 $this->logger->debug('Update last prompt date for user :' . $this->user->getId());
143 $this->repository->updateLastUserPrompt($this->user->getId());
144 }
145
146 $this->ctrl->setParameterByClass(PersonalProfileGUI::class, 'prompted', '1');
147 $this->ctrl->redirectByClass([\ilDashboardGUI::class, PersonalProfileGUI::class], 'showPersonalData');
148 }

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

+ Here is the call graph for this function:

◆ isInFulfillment()

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

Reimplemented from ILIAS\Init\StartupSequence\StartUpSequenceStep.

Definition at line 64 of file StartUpStep.php.

64 : bool
65 {
66 $baseClass = $this->profile_request->getBaseClass();
67 if ($baseClass === '' || strtolower($baseClass) !== 'ildashboardgui') {
68 return false;
69 }
70
71 $class_path = $this->ctrl->getCurrentClassPath();
72 return strtolower(array_pop($class_path)) === strtolower(PersonalProfileGUI::class)
73 && in_array(
74 strtolower($this->ctrl->getCmd()),
75 [
76 'savepersonaldata',
77 'showpersonaldata',
78 'showprofile',
79 'showpublicprofile',
80 'savepublicprofile'
81 ]
82 );
83 }

References ILIAS\Repository\ctrl().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ shouldInterceptRequest()

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

Reimplemented from ILIAS\Init\StartupSequence\StartUpSequenceStep.

Definition at line 85 of file StartUpStep.php.

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

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, ILIAS\UI\examples\Deck\repository(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ shouldStoreRequestTarget()

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

Reimplemented from ILIAS\Init\StartupSequence\StartUpSequenceStep.

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: