ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilUserProfileStartUpStep Class Reference

Class ilUserProfileStartUpStep. More...

+ Inheritance diagram for ilUserProfileStartUpStep:
+ Collaboration diagram for ilUserProfileStartUpStep:

Public Member Functions

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

Protected Attributes

 $update_prompt = false
 

Private Attributes

 $user
 
 $ctrl
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

ilUserProfileStartUpStep constructor.

Parameters
ilObjUser$user
ilCtrl$ctrl

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

References $ctrl, $user, and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ execute()

ilUserProfileStartUpStep::execute ( )
Returns
void

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

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

128  : void
129  {
130  $user_log = ilLoggerFactory::getLogger("user");
131 
132  if ($this->update_prompt) {
133  $user_log->debug("Update last prompt date for user :" . $this->user->getId());
134  $user_prompt_service = new ilUserProfilePromptService();
135  $user_prompt_service->data()->saveLastUserPrompt((int) $this->user->getId());
136  }
137 
138  $_GET['baseClass'] = 'ildashboardgui';
139  // sm: directly redirect to personal desktop -> personal profile
140  $this->ctrl->setTargetScript('ilias.php');
141  $this->ctrl->setParameterByClass("ilpersonalprofilegui", "prompted", "1");
142  ilUtil::redirect($this->ctrl->getLinkTargetByClass(array('ildashboardgui', 'ilpersonalprofilegui'), 'showPersonalData', '', false, false));
143  }
User profile prompt subservice.
$_GET["client_id"]
user()
Definition: user.php:4
static getLogger($a_component_id)
Get component logger.
static redirect($a_script)
+ Here is the call graph for this function:

◆ isInFulfillment()

ilUserProfileStartUpStep::isInFulfillment ( )
Returns
boolean

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

References $_GET.

Referenced by shouldInterceptRequest().

43  : bool
44  {
45  if (!isset($_GET['baseClass']) || strtolower($_GET['baseClass']) != 'ildashboardgui') {
46  return false;
47  }
48 
49  return (
50  strtolower($this->ctrl->getCmdClass()) == 'ilpersonalprofilegui' &&
51  in_array(strtolower($this->ctrl->getCmd()), array(
52  'savepersonaldata',
53  'showpersonaldata',
54  'showprofile',
55  'showpublicprofile',
56  'savepublicprofile'))
57  );
58  }
$_GET["client_id"]
+ Here is the caller graph for this function:

◆ shouldInterceptRequest()

ilUserProfileStartUpStep::shouldInterceptRequest ( )
Returns
boolean

Definition at line 63 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 user().

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

◆ shouldStoreRequestTarget()

ilUserProfileStartUpStep::shouldStoreRequestTarget ( )
Returns
boolean

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

35  : bool
36  {
37  return true;
38  }

Field Documentation

◆ $ctrl

ilUserProfileStartUpStep::$ctrl
private

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

Referenced by __construct().

◆ $update_prompt

ilUserProfileStartUpStep::$update_prompt = false
protected

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

◆ $user

ilUserProfileStartUpStep::$user
private

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

Referenced by __construct().


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