ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilUserProfileStartUpStep Class Reference
+ Inheritance diagram for ilUserProfileStartUpStep:
+ Collaboration diagram for ilUserProfileStartUpStep:

Public Member Functions

 __construct (ilObjUser $user, ilCtrl $ctrl)
 
 shouldStoreRequestTarget ()
 
 isInFulfillment ()
 
 shouldInterceptRequest ()
 
 execute ()
 
- Public Member Functions inherited from ILIAS\Init\StartupSequence\StartUpSequenceStep
 shouldStoreRequestTarget ()
 
 shouldInterceptRequest ()
 
 isInFulfillment ()
 
 execute ()
 

Protected Attributes

ILIAS User ProfileGUIRequest $profile_request
 
bool $update_prompt = false
 

Private Attributes

ilObjUser $user
 
ilCtrl $ctrl
 

Detailed Description

Definition at line 23 of file class.ilUserProfileStartUpStep.php.

Constructor & Destructor Documentation

◆ __construct()

ilUserProfileStartUpStep::__construct ( ilObjUser  $user,
ilCtrl  $ctrl 
)

Definition at line 30 of file class.ilUserProfileStartUpStep.php.

References $ctrl, $DIC, $user, ILIAS\Repository\ctrl(), and ILIAS\Repository\user().

31  {
32  global $DIC;
33 
34  $this->user = $user;
35  $this->ctrl = $ctrl;
36  $this->profile_request = new \ILIAS\User\ProfileGUIRequest(
37  $DIC->http(),
38  $DIC->refinery()
39  );
40  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ execute()

ilUserProfileStartUpStep::execute ( )

Definition at line 127 of file class.ilUserProfileStartUpStep.php.

References ILIAS\Repository\ctrl(), ilLoggerFactory\getLogger(), and ILIAS\Repository\user().

127  : void
128  {
129  $user_log = ilLoggerFactory::getLogger("user");
130 
131  if ($this->update_prompt) {
132  $user_log->debug("Update last prompt date for user :" . $this->user->getId());
133  $user_prompt_service = new ilUserProfilePromptService();
134  $user_prompt_service->data()->saveLastUserPrompt($this->user->getId());
135  }
136 
137  $this->ctrl->setParameterByClass("ilpersonalprofilegui", "prompted", "1");
138  $this->ctrl->redirectByClass(array('ildashboardgui', 'ilpersonalprofilegui'), 'showPersonalData');
139  }
static getLogger(string $a_component_id)
Get component logger.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ isInFulfillment()

ilUserProfileStartUpStep::isInFulfillment ( )

Definition at line 47 of file class.ilUserProfileStartUpStep.php.

References ILIAS\Repository\ctrl().

Referenced by shouldInterceptRequest().

47  : bool
48  {
49  $baseClass = $this->profile_request->getBaseClass();
50  if ($baseClass == "" || strtolower($baseClass) != 'ildashboardgui') {
51  return false;
52  }
53 
54  return (
55  strtolower($this->ctrl->getCmdClass()) == 'ilpersonalprofilegui' &&
56  in_array(strtolower($this->ctrl->getCmd()), array(
57  'savepersonaldata',
58  'showpersonaldata',
59  'showprofile',
60  'showpublicprofile',
61  'savepublicprofile'))
62  );
63  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ shouldInterceptRequest()

ilUserProfileStartUpStep::shouldInterceptRequest ( )

Definition at line 65 of file class.ilUserProfileStartUpStep.php.

References ilLoggerFactory\getLogger(), IL_CAL_DATETIME, IL_CAL_DAY, isInFulfillment(), ilProfilePromptSettings\MODE_ONCE_AFTER_LOGIN, ilProfilePromptSettings\MODE_REPEAT, ilUtil\now(), and ILIAS\Repository\user().

65  : bool
66  {
67  $user_log = ilLoggerFactory::getLogger("user");
68 
69  $user_prompt_service = new ilUserProfilePromptService();
70  $prompt_settings = $user_prompt_service->data()->getSettings();
71  $user_prompt = $user_prompt_service->data()->getUserPrompt($this->user->getId());
72 
73  $user_log->debug("Check Profile");
74 
75  if (!$this->isInFulfillment()) {
76  // profile incomplete
77  if ($this->user->getProfileIncomplete()) {
78  $user_log->debug("Is Incomplete");
79  return true;
80  }
81  // if profile is not shared yet
82  if (!in_array($this->user->getPref("public_profile"), array("y", "g"))) {
83  $user_log->debug("Is not public");
84  // x days after first login
85  if ($prompt_settings->getMode() == ilProfilePromptSettings::MODE_ONCE_AFTER_LOGIN) {
86  $user_log->debug("Mode: X days after login");
87  // if user has logged in and not received a prompt yet
88  if ($user_prompt->getFirstLogin() != "" && $user_prompt->getLastPrompt() == "") {
89  $user_log->debug("User has logged in and not prompted yet");
90  // check if first login + days < now
91  $deadline = new ilDateTime($user_prompt->getFirstLogin(), IL_CAL_DATETIME);
92  $deadline->increment(IL_CAL_DAY, $prompt_settings->getDays());
93  $user_log->debug("Check Deadline: " . $deadline->get(IL_CAL_DATETIME) .
94  " < now: " . ilUtil::now());
95  if ($deadline->get(IL_CAL_DATETIME) < ilUtil::now()) {
96  $user_log->debug("Deadline is due");
97  $this->update_prompt = true;
98  return true;
99  }
100  }
101  }
102 
103  // repeat every x days
104  if ($prompt_settings->getMode() == ilProfilePromptSettings::MODE_REPEAT) {
105  $user_log->debug("Mode: Repeat all x days");
106  // check if max(first login,last prompted) + days < now
107  $deadline = max($user_prompt->getFirstLogin(), $user_prompt->getLastPrompt());
108  if ($deadline != "") {
109  $user_log->debug("User logged in already.");
110  $deadline = new ilDateTime($deadline, IL_CAL_DATETIME);
111  $deadline->increment(IL_CAL_DAY, $prompt_settings->getDays());
112  $user_log->debug("Check Deadline: " . $deadline->get(IL_CAL_DATETIME) .
113  " < now: " . ilUtil::now());
114  if ($deadline->get(IL_CAL_DATETIME) < ilUtil::now()) {
115  $user_log->debug("Deadline is due");
116  $this->update_prompt = true;
117  return true;
118  }
119  }
120  }
121  }
122  }
123 
124  return false;
125  }
const IL_CAL_DATETIME
static getLogger(string $a_component_id)
Get component logger.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static now()
Return current timestamp in Y-m-d H:i:s format.
const IL_CAL_DAY
+ Here is the call graph for this function:

◆ shouldStoreRequestTarget()

ilUserProfileStartUpStep::shouldStoreRequestTarget ( )

Definition at line 42 of file class.ilUserProfileStartUpStep.php.

42  : bool
43  {
44  return true;
45  }

Field Documentation

◆ $ctrl

ilCtrl ilUserProfileStartUpStep::$ctrl
private

Definition at line 26 of file class.ilUserProfileStartUpStep.php.

Referenced by __construct().

◆ $profile_request

ILIAS User ProfileGUIRequest ilUserProfileStartUpStep::$profile_request
protected

Definition at line 27 of file class.ilUserProfileStartUpStep.php.

◆ $update_prompt

bool ilUserProfileStartUpStep::$update_prompt = false
protected

Definition at line 28 of file class.ilUserProfileStartUpStep.php.

◆ $user

ilObjUser ilUserProfileStartUpStep::$user
private

Definition at line 25 of file class.ilUserProfileStartUpStep.php.

Referenced by __construct().


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