ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilUserProfileIncompleteRequestTargetAdjustmentCase Class Reference

Class ilUserProfileIncompleteRequestTargetAdjustmentCase. More...

+ Inheritance diagram for ilUserProfileIncompleteRequestTargetAdjustmentCase:
+ Collaboration diagram for ilUserProfileIncompleteRequestTargetAdjustmentCase:

Public Member Functions

 shouldStoreRequestTarget ()
 
 isInFulfillment ()
 
 shouldAdjustRequest ()
 
 adjust ()
 
- Public Member Functions inherited from ilUserRequestTargetAdjustmentCase
 __construct (ilObjUser $user, ilCtrl $ctrl, ServerRequestInterface $request)
 
 shouldStoreRequestTarget ()
 
 shouldAdjustRequest ()
 
 isInFulfillment ()
 
 adjust ()
 

Protected Attributes

 $update_prompt = false
 
- Protected Attributes inherited from ilUserRequestTargetAdjustmentCase
 $user
 
 $ctrl
 
 $request
 

Detailed Description

Member Function Documentation

◆ adjust()

ilUserProfileIncompleteRequestTargetAdjustmentCase::adjust ( )
Returns
void

Reimplemented from ilUserRequestTargetAdjustmentCase.

Definition at line 112 of file class.ilUserProfileIncompleteRequestTargetAdjustmentCase.php.

112 : void
113 {
114 $user_log = ilLoggerFactory::getLogger("user");
115
116 if ($this->update_prompt) {
117 $user_log->debug("Update last prompt date for user :" . $this->user->getId());
118 $user_prompt_service = new ilUserProfilePromptService();
119 $user_prompt_service->data()->saveLastUserPrompt((int) $this->user->getId());
120 }
121
122 $_GET['baseClass'] = 'ildashboardgui';
123 // sm: directly redirect to personal desktop -> personal profile
124 $this->ctrl->setTargetScript('ilias.php');
125 $this->ctrl->setParameterByClass("ilpersonalprofilegui", "prompted", "1");
126 ilUtil::redirect($this->ctrl->getLinkTargetByClass(array('ildashboardgui', 'ilpersonalprofilegui'), 'showPersonalData', '', false, false));
127 }
user()
Definition: user.php:4
$_GET["client_id"]
static getLogger($a_component_id)
Get component logger.
static redirect($a_script)

References $_GET, ilLoggerFactory\getLogger(), ilUtil\redirect(), and user().

+ Here is the call graph for this function:

◆ isInFulfillment()

ilUserProfileIncompleteRequestTargetAdjustmentCase::isInFulfillment ( )
Returns
boolean

Reimplemented from ilUserRequestTargetAdjustmentCase.

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

27 : bool
28 {
29 if (!isset($_GET['baseClass']) || strtolower($_GET['baseClass']) != 'ildashboardgui') {
30 return false;
31 }
32
33 return (
34 strtolower($this->ctrl->getCmdClass()) == 'ilpersonalprofilegui' &&
35 in_array(strtolower($this->ctrl->getCmd()), array(
36 'savepersonaldata',
37 'showpersonaldata',
38 'showprofile',
39 'showpublicprofile',
40 'savepublicprofile'))
41 );
42 }

References $_GET.

Referenced by shouldAdjustRequest().

+ Here is the caller graph for this function:

◆ shouldAdjustRequest()

ilUserProfileIncompleteRequestTargetAdjustmentCase::shouldAdjustRequest ( )
Returns
boolean

Reimplemented from ilUserRequestTargetAdjustmentCase.

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

47 : bool
48 {
49 $user_log = ilLoggerFactory::getLogger("user");
50
51 $user_prompt_service = new ilUserProfilePromptService();
52 $prompt_settings = $user_prompt_service->data()->getSettings();
53 $user_prompt = $user_prompt_service->data()->getUserPrompt($this->user->getId());
54
55 $user_log->debug("Check Profile");
56
57 if (!$this->isInFulfillment()) {
58 // profile incomplete
59 if ($this->user->getProfileIncomplete()) {
60 $user_log->debug("Is Incomplete");
61 return true;
62 }
63 // if profile is not shared yet
64 if (!in_array($this->user->getPref("public_profile"), array("y", "g"))) {
65 $user_log->debug("Is not public");
66 // x days after first login
67 if ($prompt_settings->getMode() == ilProfilePromptSettings::MODE_ONCE_AFTER_LOGIN) {
68 $user_log->debug("Mode: X days after login");
69 // if user has logged in and not received a prompt yet
70 if ($user_prompt->getFirstLogin() != "" && $user_prompt->getLastPrompt() == "") {
71 $user_log->debug("User has logged in and not prompted yet");
72 // check if first login + days < now
73 $deadline = new ilDateTime($user_prompt->getFirstLogin(), IL_CAL_DATETIME);
74 $deadline->increment(IL_CAL_DAY, (int) $prompt_settings->getDays());
75 $user_log->debug("Check Deadline: " . $deadline->get(IL_CAL_DATETIME) .
76 " < now: " . ilUtil::now());
77 if ($deadline->get(IL_CAL_DATETIME) < ilUtil::now()) {
78 $user_log->debug("Deadline is due");
79 $this->update_prompt = true;
80 return true;
81 }
82 }
83 }
84
85 // repeat every x days
86 if ($prompt_settings->getMode() == ilProfilePromptSettings::MODE_REPEAT) {
87 $user_log->debug("Mode: Repeat all x days");
88 // check if max(first login,last prompted) + days < now
89 $deadline = max($user_prompt->getFirstLogin(), $user_prompt->getLastPrompt());
90 if ($deadline != "") {
91 $user_log->debug("User logged in already.");
92 $deadline = new ilDateTime($deadline, IL_CAL_DATETIME);
93 $deadline->increment(IL_CAL_DAY, (int) $prompt_settings->getDays());
94 $user_log->debug("Check Deadline: " . $deadline->get(IL_CAL_DATETIME) .
95 " < now: " . ilUtil::now());
96 if ($deadline->get(IL_CAL_DATETIME) < ilUtil::now()) {
97 $user_log->debug("Deadline is due");
98 $this->update_prompt = true;
99 return true;
100 }
101 }
102 }
103 }
104 }
105
106 return false;
107 }
const IL_CAL_DATETIME
const IL_CAL_DAY
@classDescription Date and time handling
static now()
Return current timestamp in Y-m-d H:i:s format.

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

+ Here is the call graph for this function:

◆ shouldStoreRequestTarget()

ilUserProfileIncompleteRequestTargetAdjustmentCase::shouldStoreRequestTarget ( )
Returns
boolean

Reimplemented from ilUserRequestTargetAdjustmentCase.

Definition at line 19 of file class.ilUserProfileIncompleteRequestTargetAdjustmentCase.php.

19 : bool
20 {
21 return true;
22 }

Field Documentation

◆ $update_prompt

ilUserProfileIncompleteRequestTargetAdjustmentCase::$update_prompt = false
protected

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