ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilProfileChecklistStatus Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilProfileChecklistStatus:

Public Member Functions

 __construct (?ilLanguage $lng=null, ?ilObjUser $user=null)
 
 getSteps ()
 
 anyVisibilitySettings ()
 Any visibility settings? More...
 
 getStatus (int $step)
 Get status of step. More...
 
 getStatusDetails (int $step)
 Get status details. More...
 
 saveStepSucess (int $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

ilPersonalProfileMode $profile_mode
 
ilObjUser $user
 
ilLanguage $lng
 
ilSetting $settings
 

Private Member Functions

 areOnScreenChatOptionsVisible ()
 
 areChatTypingBroadcastOptionsVisible ()
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 22 of file ilProfileChecklistStatus.php.

Constructor & Destructor Documentation

◆ __construct()

ilProfileChecklistStatus::__construct ( ?ilLanguage  $lng = null,
?ilObjUser  $user = null 
)

Definition at line 37 of file ilProfileChecklistStatus.php.

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

40  {
41  global $DIC;
42 
43  $this->lng = is_null($lng)
44  ? $DIC->language()
45  : $lng;
46 
47  $this->lng->loadLanguageModule('chatroom');
48  $this->user = is_null($user)
49  ? $DIC->user()
50  : $user;
51 
52  $this->settings = $DIC->settings();
53 
54  $this->profile_mode = new ilPersonalProfileMode($this->user, $DIC->settings());
55  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ anyVisibilitySettings()

ilProfileChecklistStatus::anyVisibilitySettings ( )

Any visibility settings?

Definition at line 99 of file ilProfileChecklistStatus.php.

References areChatTypingBroadcastOptionsVisible(), areOnScreenChatOptionsVisible(), and ilBuddySystem\getInstance().

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

99  : bool
100  {
101  $awrn_set = new ilSetting("awrn");
102  if (
103  $awrn_set->get("awrn_enabled", '0') ||
104  ilBuddySystem::getInstance()->isEnabled() ||
107  ) {
108  return true;
109  }
110 
111  return false;
112  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ areChatTypingBroadcastOptionsVisible()

ilProfileChecklistStatus::areChatTypingBroadcastOptionsVisible ( )
private

Definition at line 68 of file ilProfileChecklistStatus.php.

References ILIAS\Repository\settings().

Referenced by anyVisibilitySettings(), and getStatusDetails().

68  : bool
69  {
70  $chatSettings = new ilSetting('chatroom');
71 
72  return (
73  $chatSettings->get('chat_enabled', '0') &&
74  !(bool) $this->settings->get('usr_settings_hide_chat_broadcast_typing', '0')
75  );
76  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ areOnScreenChatOptionsVisible()

ilProfileChecklistStatus::areOnScreenChatOptionsVisible ( )
private

Definition at line 57 of file ilProfileChecklistStatus.php.

References ILIAS\Repository\settings().

Referenced by anyVisibilitySettings(), and getStatusDetails().

57  : bool
58  {
59  $chatSettings = new ilSetting('chatroom');
60 
61  return (
62  $chatSettings->get('chat_enabled', '0') &&
63  $chatSettings->get('enable_osc', '0') &&
64  !(bool) $this->settings->get('usr_settings_hide_chat_osc_accept_msg', '0')
65  );
66  }
+ 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.

Definition at line 117 of file ilProfileChecklistStatus.php.

References $user, anyVisibilitySettings(), ilObjUser\getPref(), and ilObjUser\getProfileIncomplete().

Referenced by getStatusDetails(), and ilProfileChecklistGUI\render().

117  : int
118  {
119  $status = self::STATUS_NOT_STARTED;
120  $user = $this->user;
121 
122  switch ($step) {
123  case self::STEP_PROFILE_DATA:
124  if ($user->getPref("profile_personal_data_saved")) {
125  $status = self::STATUS_SUCCESSFUL;
126  }
127 
128  if ($user->getProfileIncomplete()) {
129  $status = self::STATUS_IN_PROGRESS;
130  }
131  break;
132 
133  case self::STEP_PUBLISH_OPTIONS:
134  if ($user->getPref("profile_publish_opt_saved")) {
135  $status = self::STATUS_SUCCESSFUL;
136  }
137  break;
138 
139  case self::STEP_VISIBILITY_OPTIONS:
140  if ($user->getPref("profile_visibility_opt_saved") ||
141  (!$this->anyVisibilitySettings() && $user->getPref("profile_publish_opt_saved"))) {
142  $status = self::STATUS_SUCCESSFUL;
143  }
144  break;
145  }
146 
147  return $status;
148  }
anyVisibilitySettings()
Any visibility settings?
getPref(string $a_keyword)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStatusDetails()

ilProfileChecklistStatus::getStatusDetails ( int  $step)

Get status details.

Definition at line 153 of file ilProfileChecklistStatus.php.

References ILIAS\LTI\ToolProvider\$details, $lng, $user, anyVisibilitySettings(), areChatTypingBroadcastOptionsVisible(), areOnScreenChatOptionsVisible(), ilBuddySystem\getInstance(), ilObjUser\getPref(), getStatus(), ILIAS\Repository\settings(), ilLanguage\txt(), ILIAS\Repository\user(), and ilUtil\yn2tf().

Referenced by ilProfileChecklistGUI\render().

153  : string
154  {
155  $lng = $this->lng;
156  $user = $this->user;
157  $status = $this->getStatus($step);
158  $details = "";
159  switch ($step) {
160  case self::STEP_PROFILE_DATA:
161  if ($status == self::STATUS_SUCCESSFUL) {
162  $details = $lng->txt("user_profile_data_checked");
163  } else {
164  $details = $lng->txt("user_check_profile_data");
165  }
166  break;
167 
168  case self::STEP_PUBLISH_OPTIONS:
169  if ($status == self::STATUS_SUCCESSFUL) {
170  $details = $this->profile_mode->getModeInfo();
171  } else {
172  $details = $lng->txt("user_set_publishing_options");
173  }
174  break;
175 
176  case self::STEP_VISIBILITY_OPTIONS:
177  if ($status == self::STATUS_SUCCESSFUL) {
178  $awrn_set = new ilSetting("awrn");
179  $status = [];
180  if ($awrn_set->get("awrn_enabled", '0')) {
181  $show = ($user->getPref("hide_own_online_status") === "n" ||
182  ($user->getPref("hide_own_online_status") == "" && $this->settings->get("hide_own_online_status") === "n"));
183  $status[] = (!$show)
184  ? $lng->txt("hide_own_online_status")
185  : $lng->txt("show_own_online_status");
186  }
187  if (ilBuddySystem::getInstance()->isEnabled()) {
188  $status[] = ($user->getPref("bs_allow_to_contact_me") !== "y")
189  ? $lng->txt("buddy_allow_to_contact_me_no")
190  : $lng->txt("buddy_allow_to_contact_me_yes");
191  }
192  if ($this->areOnScreenChatOptionsVisible()) {
193  $status[] = ilUtil::yn2tf((string) $this->user->getPref('chat_osc_accept_msg'))
194  ? $lng->txt("chat_use_osc")
195  : $lng->txt("chat_not_use_osc");
196  }
198  $status[] = ilUtil::yn2tf((string) $this->user->getPref('chat_broadcast_typing'))
199  ? $lng->txt("chat_use_typing_broadcast")
200  : $lng->txt("chat_no_use_typing_broadcast");
201  }
202  $details = implode(",<br>", $status);
203  } else {
204  if ($this->anyVisibilitySettings()) {
205  $details = $lng->txt("user_set_visibilty_options");
206  }
207  }
208  break;
209  }
210  return $details;
211  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
anyVisibilitySettings()
Any visibility settings?
array $details
Details for error message relating to last request processed.
Definition: System.php:109
getPref(string $a_keyword)
getStatus(int $step)
Get status of step.
static yn2tf(string $a_yn)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSteps()

ilProfileChecklistStatus::getSteps ( )
Returns
array<int,string>

Definition at line 81 of file ilProfileChecklistStatus.php.

References $lng, anyVisibilitySettings(), and ilLanguage\txt().

81  : array
82  {
83  $lng = $this->lng;
84 
85  $txt_visibility = $this->anyVisibilitySettings()
86  ? $lng->txt("user_visibility_settings")
87  : $lng->txt("preview");
88 
89  return [
90  self::STEP_PROFILE_DATA => $lng->txt("user_profile_data"),
91  self::STEP_PUBLISH_OPTIONS => $lng->txt("user_publish_options"),
92  self::STEP_VISIBILITY_OPTIONS => $txt_visibility
93  ];
94  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
anyVisibilitySettings()
Any visibility settings?
+ Here is the call graph for this function:

◆ saveStepSucess()

ilProfileChecklistStatus::saveStepSucess ( int  $step)

Save step success.

Definition at line 217 of file ilProfileChecklistStatus.php.

References $user, ilObjUser\setPref(), and ilObjUser\update().

217  : void
218  {
219  $user = $this->user;
220  switch ($step) {
221  case self::STEP_PROFILE_DATA:
222  $user->setPref("profile_personal_data_saved", "1");
223  break;
224  case self::STEP_PUBLISH_OPTIONS:
225  $user->setPref("profile_publish_opt_saved", "1");
226  break;
227  case self::STEP_VISIBILITY_OPTIONS:
228  $user->setPref("profile_visibility_opt_saved", "1");
229  break;
230  }
231  $user->update();
232  }
setPref(string $a_keyword, ?string $a_value)
+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilLanguage ilProfileChecklistStatus::$lng
protected

Definition at line 34 of file ilProfileChecklistStatus.php.

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

◆ $profile_mode

ilPersonalProfileMode ilProfileChecklistStatus::$profile_mode
protected

Definition at line 31 of file ilProfileChecklistStatus.php.

◆ $settings

ilSetting ilProfileChecklistStatus::$settings
protected

Definition at line 35 of file ilProfileChecklistStatus.php.

◆ $user

ilObjUser ilProfileChecklistStatus::$user
protected

◆ 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: