19declare(strict_types=1);
41 private readonly \
ilCtrl $ctrl,
66 $baseClass = $this->profile_request->getBaseClass();
67 if ($baseClass ===
'' || strtolower($baseClass) !==
'ildashboardgui') {
71 $class_path = $this->
ctrl->getCurrentClassPath();
72 return strtolower(array_pop($class_path)) === strtolower(PersonalProfileGUI::class)
74 strtolower($this->
ctrl->getCmd()),
87 $prompt_settings = $this->
repository->getSettings();
88 $user_prompt = $this->
repository->getUserPrompt($this->
user->getId());
90 $this->
logger->debug(
'Check Profile');
96 if ($this->
user->getProfileIncomplete()) {
97 $this->
logger->debug(
'Is Incomplete');
101 if (in_array($this->
user->getPref(
'public_profile'), [
'y',
'g'])) {
105 $this->
logger->debug(
'Is not public');
107 $this->
logger->debug(
'Mode: X days after login');
108 if ($user_prompt->getFirstLogin() ===
null || $user_prompt->getLastPrompt() !==
null) {
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;
122 $this->
logger->debug(
'Mode: Repeat all x days');
124 $last_interaction_date = max($user_prompt->getFirstLogin(), $user_prompt->getLastPrompt());
125 if ($last_interaction_date ===
null) {
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;
141 if ($this->update_prompt) {
142 $this->
logger->debug(
'Update last prompt date for user :' . $this->
user->getId());
146 $this->
ctrl->setParameterByClass(PersonalProfileGUI::class,
'prompted',
'1');
147 $this->
ctrl->redirectByClass([\ilDashboardGUI::class, PersonalProfileGUI::class],
'showPersonalData');
GUI class for personal profile.
const MODE_ONCE_AFTER_LOGIN
readonly Repository $repository
shouldStoreRequestTarget()
readonly GUIRequest $profile_request
const LOGGING_DATE_TIME_FORMAT
__construct(private readonly \ilObjUser $user, private readonly \ilCtrl $ctrl, \ilDBInterface $db, Language $lng, HTTPServices $http, Refinery $refinery)
Class ilCtrl provides processing control methods.
static getLogger(string $a_component_id)
Get component logger.