ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPersonalProfileMode Class Reference

Personal profile publishing mode of a iser. More...

+ Collaboration diagram for ilPersonalProfileMode:

Public Member Functions

 __construct (ilObjUser $user, ilSetting $settings)
 Constructor. More...
 
 getMode ()
 Get mode. More...
 
 isEnabled ()
 Is profile enabled. More...
 
 getModeInfo (string $mode=null)
 Get mode info. More...
 

Data Fields

const PROFILE_DISABLED = "n"
 
const PROFILE_ENABLED_LOGGED_IN_USERS = "y"
 
const PROFILE_ENABLED_GLOBAL = "g"
 

Protected Attributes

 $user
 
 $settings
 
 $lng
 

Detailed Description

Personal profile publishing mode of a iser.

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

Definition at line 10 of file class.ilPersonalProfileMode.php.

Constructor & Destructor Documentation

◆ __construct()

ilPersonalProfileMode::__construct ( ilObjUser  $user,
ilSetting  $settings 
)

Constructor.

Definition at line 34 of file class.ilPersonalProfileMode.php.

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

35  {
36  global $DIC;
37 
38  $this->lng = $DIC->language();
39  $this->user = $user;
40  $this->settings = $settings;
41  }
settings()
Definition: settings.php:2
user()
Definition: user.php:4
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

Member Function Documentation

◆ getMode()

ilPersonalProfileMode::getMode ( )

Get mode.

Returns
string

Definition at line 48 of file class.ilPersonalProfileMode.php.

References $settings, and $user.

Referenced by getModeInfo(), and isEnabled().

48  : string
49  {
52 
53  $pub_prof = in_array($user->prefs["public_profile"], [
54  self::PROFILE_DISABLED,
55  self::PROFILE_ENABLED_LOGGED_IN_USERS,
56  self::PROFILE_ENABLED_GLOBAL
57  ])
58  ? $user->prefs["public_profile"]
59  : self::PROFILE_DISABLED;
60  if (!$settings->get('enable_global_profiles') && $pub_prof == self::PROFILE_ENABLED_GLOBAL) {
61  $pub_prof = self::PROFILE_ENABLED_LOGGED_IN_USERS;
62  }
63  return $pub_prof;
64  }
+ Here is the caller graph for this function:

◆ getModeInfo()

ilPersonalProfileMode::getModeInfo ( string  $mode = null)

Get mode info.

Parameters
string | null$mode
Returns
string

Definition at line 84 of file class.ilPersonalProfileMode.php.

References $lng, and getMode().

84  : string
85  {
86  $lng = $this->lng;
87 
88  if (is_null($mode)) {
89  $mode = $this->getMode();
90  }
91  switch ($mode) {
92  case self::PROFILE_DISABLED:
93  return $lng->txt("usr_public_profile_disabled");
94  break;
95  case self::PROFILE_ENABLED_LOGGED_IN_USERS:
96  return $lng->txt("usr_public_profile_logged_in");
97  break;
98  case self::PROFILE_ENABLED_GLOBAL:
99  return $lng->txt("usr_public_profile_global");
100  break;
101  }
102  }
+ Here is the call graph for this function:

◆ isEnabled()

ilPersonalProfileMode::isEnabled ( )

Is profile enabled.

Returns
bool

Definition at line 71 of file class.ilPersonalProfileMode.php.

References getMode().

71  : bool
72  {
73  return in_array($this->getMode(), [self::PROFILE_ENABLED_LOGGED_IN_USERS,
74  self::PROFILE_ENABLED_GLOBAL
75  ]);
76  }
+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilPersonalProfileMode::$lng
protected

Definition at line 29 of file class.ilPersonalProfileMode.php.

Referenced by getModeInfo().

◆ $settings

ilPersonalProfileMode::$settings
protected

Definition at line 24 of file class.ilPersonalProfileMode.php.

Referenced by __construct(), and getMode().

◆ $user

ilPersonalProfileMode::$user
protected

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

Referenced by __construct(), and getMode().

◆ PROFILE_DISABLED

const ilPersonalProfileMode::PROFILE_DISABLED = "n"

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

◆ PROFILE_ENABLED_GLOBAL

const ilPersonalProfileMode::PROFILE_ENABLED_GLOBAL = "g"

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

◆ PROFILE_ENABLED_LOGGED_IN_USERS

const ilPersonalProfileMode::PROFILE_ENABLED_LOGGED_IN_USERS = "y"

Definition at line 13 of file class.ilPersonalProfileMode.php.


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