ILIAS  release_7 Revision v7.30-3-g800a261c036
ilProfileChecklistStatus Class Reference
+ Collaboration diagram for ilProfileChecklistStatus:

Public Member Functions

 __construct ($lng=null, $user=null)
 Constructor. More...
 
 getSteps ()
 Get steps. More...
 
 anyVisibilitySettings ()
 Any visibility settings? More...
 
 getStatus (int $step)
 Get status of step. More...
 
 getStatusDetails (int $step)
 Get status details. More...
 
 saveStepSucess ($step)
 Save step success. More...
 

Data Fields

const STEP_PROFILE_DATA = 0
 
const STEP_PUBLISH_OPTIONS = 1
 
const STEP_VISIBILITY_OPTIONS = 2
 
const STATUS_NOT_STARTED = 0
 
const STATUS_IN_PROGRESS = 1
 
const STATUS_SUCCESSFUL = 2
 

Protected Attributes

 $lng
 
 $settings
 

Private Member Functions

 areOnScreenChatOptionsVisible ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilProfileChecklistStatus::__construct (   $lng = null,
  $user = null 
)

Constructor.

Definition at line 33 of file ilProfileChecklistStatus.php.

34 {
35 global $DIC;
36
37 $this->lng = is_null($lng)
38 ? $DIC->language()
39 : $lng;
40
41 $this->lng->loadLanguageModule('chatroom');
42 $this->user = is_null($user)
43 ? $DIC->user()
44 : $user;
45
46 $this->settings = $DIC->settings();
47
48 $this->profile_mode = new ilPersonalProfileMode($this->user, $DIC->settings());
49 }
user()
Definition: user.php:4
Personal profile publishing mode of a iser.
global $DIC
Definition: goto.php:24
settings()
Definition: settings.php:2

References $DIC, $lng, settings(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ anyVisibilitySettings()

ilProfileChecklistStatus::anyVisibilitySettings ( )

Any visibility settings?

Returns
bool

Definition at line 91 of file ilProfileChecklistStatus.php.

91 : bool
92 {
93 $awrn_set = new ilSetting("awrn");
94 if (
95 $awrn_set->get("awrn_enabled", false) ||
96 ilBuddySystem::getInstance()->isEnabled() ||
97 $this->areOnScreenChatOptionsVisible()
98 ) {
99 return true;
100 }
101
102 return false;
103 }
ILIAS Setting Class.

References ilBuddySystem\getInstance().

Referenced by getStatusDetails(), and getSteps().

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

◆ areOnScreenChatOptionsVisible()

ilProfileChecklistStatus::areOnScreenChatOptionsVisible ( )
private
Returns
bool

Definition at line 54 of file ilProfileChecklistStatus.php.

54 : bool
55 {
56 $chatSettings = new ilSetting('chatroom');
57 $notificationSettings = new ilSetting('notifications');
58
59 return (
60 $chatSettings->get('enable_osc', false) &&
61 !(bool) $notificationSettings->get('usr_settings_hide_chat_osc_accept_msg', false)
62 );
63 }

Referenced by getStatusDetails().

+ Here is the caller graph for this function:

◆ getStatus()

ilProfileChecklistStatus::getStatus ( int  $step)

Get status of step.

Parameters
int
Returns
int

Definition at line 111 of file ilProfileChecklistStatus.php.

112 {
113 $status = self::STATUS_NOT_STARTED;
114 $user = $this->user;
115
116 switch ($step) {
118 if ($user->getPref("profile_personal_data_saved")) {
119 $status = self::STATUS_SUCCESSFUL;
120 }
121
122 if ($user->getProfileIncomplete()) {
123 $status = self::STATUS_IN_PROGRESS;
124 }
125 break;
126
128 if ($user->getPref("profile_publish_opt_saved")) {
129 $status = self::STATUS_SUCCESSFUL;
130 }
131 break;
132
134 if ($user->getPref("profile_visibility_opt_saved") ||
135 (!$this->anyVisibilitySettings() && $user->getPref("profile_publish_opt_saved"))) {
136 $status = self::STATUS_SUCCESSFUL;
137 }
138 break;
139 }
140
141 return $status;
142 }

References STATUS_IN_PROGRESS, STATUS_NOT_STARTED, STATUS_SUCCESSFUL, STEP_PROFILE_DATA, STEP_PUBLISH_OPTIONS, and STEP_VISIBILITY_OPTIONS.

Referenced by getStatusDetails().

+ Here is the caller graph for this function:

◆ getStatusDetails()

ilProfileChecklistStatus::getStatusDetails ( int  $step)

Get status details.

Parameters
int$step
Returns
string

Definition at line 150 of file ilProfileChecklistStatus.php.

150 : string
151 {
153 $user = $this->user;
154 $status = $this->getStatus($step);
155 $details = "";
156 switch ($step) {
158 if ($status == self::STATUS_SUCCESSFUL) {
159 $details = $lng->txt("user_profile_data_checked");
160 } else {
161 $details = $lng->txt("user_check_profile_data");
162 }
163 break;
164
166 if ($status == self::STATUS_SUCCESSFUL) {
167 $details = $this->profile_mode->getModeInfo();
168 } else {
169 $details = $lng->txt("user_set_publishing_options");
170 }
171 break;
172
174 if ($status == self::STATUS_SUCCESSFUL) {
175 $awrn_set = new ilSetting("awrn");
176 $status = [];
177 if ($awrn_set->get("awrn_enabled", false)) {
178 $show = ($user->getPref("hide_own_online_status") == "n" ||
179 ($user->getPref("hide_own_online_status") == "" && $this->settings->get("hide_own_online_status") == "n"));
180 $status[] = (!$show)
181 ? $lng->txt("hide_own_online_status")
182 : $lng->txt("show_own_online_status");
183 }
184 if (ilBuddySystem::getInstance()->isEnabled()) {
185 $status[] = ($user->getPref("bs_allow_to_contact_me") != "y")
186 ? $lng->txt("buddy_allow_to_contact_me_no")
187 : $lng->txt("buddy_allow_to_contact_me_yes");
188 }
189 if ($this->areOnScreenChatOptionsVisible()) {
190 $status[] = ilUtil::yn2tf($this->user->getPref('chat_osc_accept_msg'))
191 ? $lng->txt("chat_use_osc")
192 : $lng->txt("chat_not_use_osc");
193 }
194 $details = implode(",<br>", $status);
195 } else {
196 if ($this->anyVisibilitySettings()) {
197 $details = $lng->txt("user_set_visibilty_options");
198 }
199 }
200 break;
201 }
202 return $details;
203 }
anyVisibilitySettings()
Any visibility settings?
getStatus(int $step)
Get status of step.
static yn2tf($a_yn)
convert "y"/"n" to true/false

References $lng, anyVisibilitySettings(), areOnScreenChatOptionsVisible(), ilBuddySystem\getInstance(), getStatus(), settings(), STEP_PROFILE_DATA, STEP_PUBLISH_OPTIONS, STEP_VISIBILITY_OPTIONS, user(), and ilUtil\yn2tf().

+ Here is the call graph for this function:

◆ getSteps()

ilProfileChecklistStatus::getSteps ( )

Get steps.

Parameters

return

Definition at line 71 of file ilProfileChecklistStatus.php.

72 {
74
75 $txt_visibility = $this->anyVisibilitySettings()
76 ? $lng->txt("user_visibility_settings")
77 : $lng->txt("preview");
78
79 return [
80 self::STEP_PROFILE_DATA => $lng->txt("user_profile_data"),
81 self::STEP_PUBLISH_OPTIONS => $lng->txt("user_publish_options"),
82 self::STEP_VISIBILITY_OPTIONS => $txt_visibility
83 ];
84 }

References $lng, and anyVisibilitySettings().

+ Here is the call graph for this function:

◆ saveStepSucess()

ilProfileChecklistStatus::saveStepSucess (   $step)

Save step success.

Parameters
$step

Definition at line 211 of file ilProfileChecklistStatus.php.

212 {
213 $user = $this->user;
214 switch ($step) {
216 $user->setPref("profile_personal_data_saved", "1");
217 break;
219 $user->setPref("profile_publish_opt_saved", "1");
220 break;
222 $user->setPref("profile_visibility_opt_saved", "1");
223 break;
224 }
225 $user->update();
226 }

References STEP_PROFILE_DATA, STEP_PUBLISH_OPTIONS, and STEP_VISIBILITY_OPTIONS.

Field Documentation

◆ $lng

ilProfileChecklistStatus::$lng
protected

Definition at line 23 of file ilProfileChecklistStatus.php.

Referenced by __construct(), getStatusDetails(), and getSteps().

◆ $settings

ilProfileChecklistStatus::$settings
protected

Definition at line 28 of file ilProfileChecklistStatus.php.

◆ STATUS_IN_PROGRESS

const ilProfileChecklistStatus::STATUS_IN_PROGRESS = 1

◆ STATUS_NOT_STARTED

const ilProfileChecklistStatus::STATUS_NOT_STARTED = 0

◆ STATUS_SUCCESSFUL

const ilProfileChecklistStatus::STATUS_SUCCESSFUL = 2

◆ STEP_PROFILE_DATA

const ilProfileChecklistStatus::STEP_PROFILE_DATA = 0

◆ STEP_PUBLISH_OPTIONS

const ilProfileChecklistStatus::STEP_PUBLISH_OPTIONS = 1

◆ STEP_VISIBILITY_OPTIONS

const ilProfileChecklistStatus::STEP_VISIBILITY_OPTIONS = 2

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