Stud.IP  2.0 Revision 48548
 All Data Structures Namespaces Files Functions Variables Pages
user_visible.inc.php File Reference

Functions

 get_visibility_by_id ($user_id)
 get_visibility_by_username ($username)
 get_visibility_by_state ($state, $user_id)
 get_vis_query ($table_alias= 'auth_user_md5', $context='')
 get_ext_vis_query ($table_alias= 'aum')
 vis_chooser ($vis, $new=false)
 first_decision ($userid)
 get_global_visibility_by_id ($user_id)
 get_global_visibility_by_username ($username)
 get_local_visibility_by_id ($user_id, $context, $return_user_perm=false)
 get_local_visibility_by_username ($username, $context, $return_user_perm=false)
 is_element_visible_for_user ($user_id, $owner_id, $element_visibility)
 is_element_visible_externally ($owner_id, $owner_perm, $field_name, $element_visibility)
 get_default_homepage_visibility ($user_id)
 get_visible_email ($user_id)
 get_homepage_element_visibility ($user_id, $element_name)
 set_homepage_element_visibility ($user_id, $element_name, $visibility)

Variables

const VISIBILITY_ME = 1
const VISIBILITY_BUDDIES = 2
const VISIBILITY_DOMAIN = 3
const VISIBILITY_STUDIP = 4
const VISIBILITY_EXTERN = 5

Function Documentation

first_decision (   $userid)

Here is the call graph for this function:

get_default_homepage_visibility (   $user_id)

Retrieves the standard visibility level for a homepage element if the user hasn't specified anything explicitly. This default can be set via the global configuration (variable "HOMEPAGE_VISIBILITY_DEFAULT").

Returns
int Default visibility level.

Here is the call graph for this function:

Here is the caller graph for this function:

get_ext_vis_query (   $table_alias = 'aum')

Here is the call graph for this function:

Here is the caller graph for this function:

get_global_visibility_by_id (   $user_id)

Gets the global visibility for the given user ID.

Parameters
string$user_iduser ID to check
Returns
string User visibility.

Here is the call graph for this function:

Here is the caller graph for this function:

get_global_visibility_by_username (   $username)

Gets the global visibility for a given username. This is just a wrapper function for get_global_visibility_by_id, operating with a usename instead of an ID.

Parameters
string$usernameusername to check
Returns
string User visibility as returned by get_global_visibility_by_id.

Here is the call graph for this function:

get_homepage_element_visibility (   $user_id,
  $element_name 
)

Gets the visibility setting of a special element on a user's homepage. The resulting value is one of the constants VISIBILITY_ME, VISIBILITY_BUDDIES, VISIBILITY_DOMAIN, VISIBILITY_STUDIP and VISIBILITY_EXTERN.

Parameters
string$user_idwhich user is required?
string$element_nameunique name of the homepage element.
Returns
int Visibility of the given element or default system visibility if the user hasn't set anything special.

Here is the call graph for this function:

Here is the caller graph for this function:

get_local_visibility_by_id (   $user_id,
  $context,
  $return_user_perm = false 
)

Gets a user's visibility settings for special context. Valid contexts are at the moment:

  • online: Visibility in "Who is online" list
  • chat: Visibility of private chatroom in active chats list
  • search: Can the user be found via person search?
  • email: Is user's email address shown?
  • homepage: Visibility of all user homepage elements, stored as JSON-serialized array
Parameters
string$user_iduser ID to check
string$contextlocal visibility in which context?
boolean$return_user_permreturn not only visibility, but also the user's global permission level
Returns
mixed Visibility flag or array with visibility and user permission level.

Here is the call graph for this function:

Here is the caller graph for this function:

get_local_visibility_by_username (   $username,
  $context,
  $return_user_perm = false 
)

Wrapper function for checking a user's local visibility by username instead of user ID.

Parameters
string$usernameusername to check
string$contextlocal visibility in which context?
See Also
get_local_visibility_by_id
Parameters
boolean$return_user_permreturn not only visibility, but also the user's global permission level
Returns
mixed Visibility flag or array with visibility and user permission level.

Here is the call graph for this function:

get_vis_query (   $table_alias = 'auth_user_md5',
  $context = '' 
)

Here is the call graph for this function:

Here is the caller graph for this function:

get_visibility_by_id (   $user_id)

Here is the call graph for this function:

Here is the caller graph for this function:

get_visibility_by_state (   $state,
  $user_id 
)

Here is the call graph for this function:

Here is the caller graph for this function:

get_visibility_by_username (   $username)

Here is the call graph for this function:

Here is the caller graph for this function:

get_visible_email (   $user_id)

Gets a user's email address. If the address should not be shown according to the user's privacy settings, we try to get the email address of the default institute (this can be one of the institutes the user is assigned to). If no default institute is found, the email address of the first found institute is given. If the user isn't assigned to any institute, an empty string is returned.

Parameters
string$user_idwhich user's email address is required?
Returns
string User email address or email address of the user's default institute or empty string.

Here is the call graph for this function:

Here is the caller graph for this function:

is_element_visible_externally (   $owner_id,
  $owner_perm,
  $field_name,
  $element_visibility 
)

Checks whether a homepage element is visible on external pages. We do not give an element name and look up its visibility setting in the database, because that would generate many database requests for a single user homepage. Instead, the homepage itself loads all element visibilities and we only need to check if the given element visibility allows showing it.

Parameters
string$owner_iduser ID of the homepage owner
string$owner_permpermission level of the homepage owner, needed because every permission level can have its own not hideable fields.
string$field_nameName of the homepage field to check, needed for checking if the element is not hideable
int$element_visibilityvisibility level of the element, one of the constants VISIBILITY_ME, VISIBILITY_BUDDIES, VISIBILITY_DOMAIN, VISIBILITY_STUDIP, VISIBILITY_EXTERN
Returns
boolean May the element be shown on external pages?

Here is the call graph for this function:

Here is the caller graph for this function:

is_element_visible_for_user (   $user_id,
  $owner_id,
  $element_visibility 
)

Checks whether an element of a user homepage is visible for another user. We do not give an element name and look up its visibility setting in the database, because that would generate many database requests for a single user homepage. Instead, the homepage itself loads all element visibilities and we only need to check if the given element visibility allows showing it to the visiting user. We need not check for not hideable fields here, because that is already done when loading the element visibilities.

Parameters
string$user_idID of the user who wants to see the element
string$owner_idID of the homepage owner
int$element_visibilityvisibility level of the element, one of the constants VISIBILITY_ME, VISIBILITY_BUDDIES, VISIBILITY_DOMAIN, VISIBILITY_STUDIP, VISIBILITY_EXTERN
Returns
boolean Is the element visible?

Here is the call graph for this function:

set_homepage_element_visibility (   $user_id,
  $element_name,
  $visibility 
)

Sets the visibility of a homepage element to the given value.

Parameters
string$user_idwhose homepage is it?
string$element_nameunique name of the homepage element to change
int$visibilitynew value for element visibility
Returns
int Number of affected database rows.

Here is the call graph for this function:

vis_chooser (   $vis,
  $new = false 
)

Variable Documentation

const VISIBILITY_BUDDIES = 2
const VISIBILITY_DOMAIN = 3
const VISIBILITY_EXTERN = 5
const VISIBILITY_ME = 1
const VISIBILITY_STUDIP = 4