Stud.IP  4.0
 All Data Structures Namespaces Files Functions Variables Groups
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, $id=false)
 
 first_decision ($userid)
 
 get_local_visibility_by_id ($user_id, $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)
 

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)
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.
get_ext_vis_query (   $table_alias = 'aum')
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
  • 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.
get_vis_query (   $table_alias = 'auth_user_md5',
  $context = '' 
)
get_visibility_by_id (   $user_id)
get_visibility_by_state (   $state,
  $user_id 
)
get_visibility_by_username (   $username)
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.
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?
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?
vis_chooser (   $vis,
  $new = false,
  $id = false 
)

Variable Documentation

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