ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
 

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->user = is_null($user)
42 ? $DIC->user()
43 : $user;
44
45 $this->settings = $DIC->settings();
46
47 $this->profile_mode = new ilPersonalProfileMode($this->user, $DIC->settings());
48 }
user()
Definition: user.php:4
Personal profile publishing mode of a iser.
settings()
Definition: settings.php:2
$DIC
Definition: xapitoken.php:46

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 76 of file ilProfileChecklistStatus.php.

76 : bool
77 {
78 $awrn_set = new ilSetting("awrn");
79 if ($awrn_set->get("awrn_enabled", false) ||
80 ilBuddySystem::getInstance()->isEnabled()) {
81 return true;
82 }
83
84 return false;
85 }
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:

◆ getStatus()

ilProfileChecklistStatus::getStatus ( int  $step)

Get status of step.

Parameters
int
Returns
int

Definition at line 93 of file ilProfileChecklistStatus.php.

94 {
96 $user = $this->user;
97
98 switch ($step) {
100 if ($user->getPref("profile_personal_data_saved")) {
101 $status = self::STATUS_SUCCESSFUL;
102 };
103 if ($user->getProfileIncomplete()) {
104 $status = self::STATUS_IN_PROGRESS;
105 }
106 break;
108 if ($user->getPref("profile_publish_opt_saved")) {
109 $status = self::STATUS_SUCCESSFUL;
110 };
111 break;
113 if ($user->getPref("profile_visibility_opt_saved") ||
114 (!$this->anyVisibilitySettings() && $user->getPref("profile_publish_opt_saved"))) {
115 $status = self::STATUS_SUCCESSFUL;
116 };
117 break;
118 }
119
120 return $status;
121 }

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 129 of file ilProfileChecklistStatus.php.

129 : string
130 {
132 $user = $this->user;
133 $status = $this->getStatus($step);
134 $details = "";
135 switch ($step) {
137 if ($status == self::STATUS_SUCCESSFUL) {
138 $details = $lng->txt("user_profile_data_checked");
139 } else {
140 $details = $lng->txt("user_check_profile_data");
141 }
142 break;
143
145 if ($status == self::STATUS_SUCCESSFUL) {
146 $details = $this->profile_mode->getModeInfo();
147 } else {
148 $details = $lng->txt("user_set_publishing_options");
149 }
150 break;
151
153 if ($status == self::STATUS_SUCCESSFUL) {
154 $awrn_set = new ilSetting("awrn");
155 $status = [];
156 if ($awrn_set->get("awrn_enabled", false)) {
157 $show = ($user->getPref("hide_own_online_status") == "n" ||
158 ($user->getPref("hide_own_online_status") == "" && $this->settings->get("hide_own_online_status") == "n"));
159 $status[] = (!$show)
160 ? $lng->txt("hide_own_online_status")
161 : $lng->txt("show_own_online_status");
162 }
163 if (ilBuddySystem::getInstance()->isEnabled()) {
164 $status[] = ($user->getPref("bs_allow_to_contact_me") != "y")
165 ? $lng->txt("buddy_allow_to_contact_me_no")
166 : $lng->txt("buddy_allow_to_contact_me_yes");
167 }
168 $details = implode(",<br>", $status);
169 } else {
170 if ($this->anyVisibilitySettings()) {
171 $details = $lng->txt("user_set_visibilty_options");
172 }
173 }
174 break;
175 }
176 return $details;
177 }
anyVisibilitySettings()
Any visibility settings?
getStatus(int $step)
Get status of step.

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

+ Here is the call graph for this function:

◆ getSteps()

ilProfileChecklistStatus::getSteps ( )

Get steps.

Parameters

return

Definition at line 56 of file ilProfileChecklistStatus.php.

57 {
59
60 $txt_visibility = $this->anyVisibilitySettings()
61 ? $lng->txt("user_visibility_settings")
62 : $lng->txt("preview");
63
64 return [
65 self::STEP_PROFILE_DATA => $lng->txt("user_profile_data"),
66 self::STEP_PUBLISH_OPTIONS => $lng->txt("user_publish_options"),
67 self::STEP_VISIBILITY_OPTIONS => $txt_visibility
68 ];
69 }

References $lng, and anyVisibilitySettings().

+ Here is the call graph for this function:

◆ saveStepSucess()

ilProfileChecklistStatus::saveStepSucess (   $step)

Save step success.

Parameters
$step

Definition at line 185 of file ilProfileChecklistStatus.php.

186 {
187 $user = $this->user;
188 switch ($step) {
190 $user->setPref("profile_personal_data_saved", "1");
191 break;
193 $user->setPref("profile_publish_opt_saved", "1");
194 break;
196 $user->setPref("profile_visibility_opt_saved", "1");
197 break;
198 }
199 $user->update();
200 }

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: