Stud.IP  6.0
Visibility Class Reference

Static Public Member Functions

static verify ($visibilityid, $ownerid, $userid=null)
 
static addPrivacySetting ($name, $identifier="", $parent=0, $category=1, $user=null, $default=null, $pluginid=null)
 
static addPrivacySettingForAll ($name, $identifier="", $parent_identifier=0, $category=1, $default=null, $pluginid=null)
 
static createDefaultCategories ($user=null)
 
static getStateDescription ($visibilityid, $owner=null)
 
static updatePrivacySetting ($name, $id="", $parent=null, $category=1, $user=null, $default=null, $pluginid=null)
 
static updatePrivacySettingWithTest ($test, $name, $id, $parent=null, $category=1, $user=null, $default=null, $pluginid=null)
 
static getPrivacyIdByIdentifier ($ident, $user=null)
 
static removePrivacySetting ($id, $user=null)
 
static removeAllPrivacySettingForIdentifier ($ident)
 
static removePlugin ($id)
 
static renamePrivacySetting ($id, $new_name, $user=null)
 
static removeUserPrivacySettings ($user_id)
 
static getSettingsArgs ($userid)
 
static updateUserFromRequest ($data, $userid=null)
 
static getColCount ()
 
static getVisibilities ()
 
static getHTMLArgs ($userid=null)
 
static setAllSettingsForUser ($state, $user=null)
 
static get_default_homepage_visibility ($user_id=null)
 
static exists ($id, $user=null)
 
static allowExtendedSettings (\User $user=null)
 
static isFieldHideableForUser (string $field, User $user=null)
 

Member Function Documentation

◆ addPrivacySetting()

static addPrivacySetting (   $name,
  $identifier = "",
  $parent = 0,
  $category = 1,
  $user = null,
  $default = null,
  $pluginid = null 
)
static

Adds a privacysetting for a user. The user can change the setting in his privacytab. To check back if a user is allowed to see any content use the verify method

Parameters
string$nameThe setting's name, that will be displayed in the user's settingtab (Important: Don't mix the name up with the identifier)
string$identifierthe identifier is used to simplify the usage of the visibilityAPI. An identifier maps a string to a visibilityid (under the usage of a userid) therefore all identifier set for one user MUST be unique.
int | string$parentDetermines the parent of the visibility to add. Use the direct visibilityid of the parent visibility or the identifier. If the visibility should be created on the top level the value has to be 0. Plugins creating a privacysetting will automaticly be added to the parent "plugins". Important: If u add a visibility without as a parent and as a category it wont be displayed until it has children that are displayed.
int$categorySets the type of the visibilitysetting. Currently there are only 2 types available: 0 - The setting is only a header without any options 1 (Default) - Normal setting
string$userUserid of the user that should be added the visibility. Default: The current logged on user
int$defaultint representation of the visibility that should be set. Use with caution since the API provides the easy change of the visibility int representation
int$pluginidConnects the created visibility with a plugin. Important: If addPrivacySetting is called in a file of a plugin there is no need to set the pluginid manually, because the API will normally find it
Returns
int the created visibilityid

◆ addPrivacySettingForAll()

static addPrivacySettingForAll (   $name,
  $identifier = "",
  $parent_identifier = 0,
  $category = 1,
  $default = null,
  $pluginid = null 
)
static

Adds a privacysetting for all users. If a parent is given, the function will only add a privacySetting for those users that have an existing parent

Parameters
string$nameThe setting's name, that will be displayed in the user's settingtab (Important: Don't mix the name up with the identifier)
string$identifierthe identifier is used to simplify the usage of the visibilityAPI. An identifier maps a string to a visibilityid (under the usage of a userid) therefore all identifier set for one user MUST be unique.
int | string$parent_identifierDetermines the parent of the visibility to add. Use the direct visibilityid of the parent visibility or the identifier. If the visibility should be created on the top level the value has to be 0. Plugins creating a privacysetting will automaticly be added to the parent "plugins". Important: If u add a visibility without a parent and without beeing a toplevelpoint itself it will NEVER be displayed.
int$categorySets the type of the visibilitysetting. Currently there are only 2 types available: 0 - The setting is only a header without any options 1 (Default) - Normal setting
int$defaultint representation of the visibility that should be set. Use with caution since the API provides the easy change of the visibility int representation
int$pluginidConnects the created visibility with a plugin. Important: If addPrivacySetting is called in a file of a plugin there is no need to set the pluginid manually, because the API will normally find it

◆ allowExtendedSettings()

static allowExtendedSettings ( \User  $user = null)
static

Returns whether the user should be allowed to configure the extended settings.

Parameters
User | null$userUser object (defaults to current user)
Returns
bool

◆ createDefaultCategories()

static createDefaultCategories (   $user = null)
static

Creates all nessesary categories for standard usage

Parameters
int$userUserid to define what user should create the categories default: current logged on user;

◆ exists()

static exists (   $id,
  $user = null 
)
static

Checks if a specific visibilityID or an identifier & userid combination exists

Parameters
type$idid or identifier
type$useruser id
Returns
type true if the id exists. false if not

◆ get_default_homepage_visibility()

static get_default_homepage_visibility (   $user_id = null)
static

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.

◆ getColCount()

static getColCount ( )
static

Helpfunction to calculate how many columns the settingstable needs

Returns
int Number of columns

◆ getHTMLArgs()

static getHTMLArgs (   $userid = null)
static

Helpfunction to get the data for the settingstable

Returns
array tree of settingelements

◆ getPrivacyIdByIdentifier()

static getPrivacyIdByIdentifier (   $ident,
  $user = null 
)
static

Returns the visibilityID by an identifier and a user

Parameters
string$identThe identifier for the visibilityid
string$userThe userid. Default: Current logged on user
Returns
int The visibilityID

◆ getSettingsArgs()

static getSettingsArgs (   $userid)
static

Builds up the htmlArgs for display in Settings

Parameters
string$useridthe userid
Returns
array tree of htmlArgs

◆ getStateDescription()

static getStateDescription (   $visibilityid,
  $owner = null 
)
static

Returns the description for a specific state set on a visibilityID

Parameters
int$visibilityidthe visibility id
Returns
string Description of the state or false if visibilityid was not found

◆ getVisibilities()

static getVisibilities ( )
static

Helpfunction to get all names for the settingstable

Returns
array all visibility names

◆ isFieldHideableForUser()

static isFieldHideableForUser ( string  $field,
User  $user = null 
)
static

Returns whether the given field is hideable by configuration for the given user permission.

Parameters
string$fieldField that should be hidden
User | null$userUser object (defaults to current user)
Returns
bool

◆ removeAllPrivacySettingForIdentifier()

static removeAllPrivacySettingForIdentifier (   $ident)
static

Deletes ALL privacySettings for a Identifier (for ALL users!)

Parameters
string$identThe Identifier to be removed

◆ removePlugin()

static removePlugin (   $id)
static

Removes all PrivacySetting of the given pluginid

Parameters
int$idthe pluginid

◆ removePrivacySetting()

static removePrivacySetting (   $id,
  $user = null 
)
static

Removes a privacysetting via ID or Identifier and user

Parameters
int | string$idID or Identifier
string$userUserid. Default: Current logged on user
Returns
int state The state the deleted visibility had

◆ removeUserPrivacySettings()

static removeUserPrivacySettings (   $user_id)
static

Removes all PrivacySettings from a user

Parameters
string$user_idthe given userid

◆ renamePrivacySetting()

static renamePrivacySetting (   $id,
  $new_name,
  $user = null 
)
static

Renames a PrivacySetting

Parameters
int | string$idVisibilityID or Identifier to be renamed
string$new_namethe new name
string$userUserid. Default: Current logged on user

◆ setAllSettingsForUser()

static setAllSettingsForUser (   $state,
  $user = null 
)
static

Sets all visibilites of a user to a specific state. This function should ONLY be called from the settingspage or some administration page NOT from a plugin

Parameters
type$stateThe int representation of the state everything should be set to
type$userThe user. Default: current logged on user;

◆ updatePrivacySetting()

static updatePrivacySetting (   $name,
  $id = "",
  $parent = null,
  $category = 1,
  $user = null,
  $default = null,
  $pluginid = null 
)
static

Updates a privacySetting. Important: The whole privacySetting gets deleted and recreated. Therefore a new visibilityID is created. If you use the privacyID you will have to update it as well.

Parameters
string$nameThe setting's name, that will be displayed in the user's settingtab (Important: Don't mix the name up with the identifier)
string$identifierthe identifier is used to simplify the usage of the visibilityAPI. An identifier maps a string to a visibilityid (under the usage of a userid) therefore all identifier set for one user MUST be unique.
int | string$parentDetermines the parent of the visibility to add. Use the direct visibilityid of the parent visibility or the identifier. If the visibility should be created on the top level the value has to be 0. Plugins creating a privacysetting will automaticly be added to the parent "plugins". Important: If u add a visibility without a parent and without beeing a toplevelpoint itself it will NEVER be displayed.
int$categorySets the type of the visibilitysetting. Currently there are only 2 types available: 0 - The setting is only a header without any options 1 (Default) - Normal setting
string$userUserid of the user that should be added the visibility. Default: The current logged on user
int$defaultint representation of the visibility that should be set. Use with caution since the API provides the easy change of the visibility int representation
int$pluginidConnects the created visibility with a plugin. Important: If addPrivacySetting is called in a file of a plugin there is no need to set the pluginid manually, because the API will normally find it
Returns
int the created visibilityid

◆ updatePrivacySettingWithTest()

static updatePrivacySettingWithTest (   $test,
  $name,
  $id,
  $parent = null,
  $category = 1,
  $user = null,
  $default = null,
  $pluginid = null 
)
static

Updates a privacySetting. Important: The whole privacySetting gets deleted and recreated if the teststring is not empty. Therefore a new visibilityID is created. If you use the privacyID you will have to update it as well.

Parameters
string$testA teststring to determine if the privacySetting is only deleted or if it is deleted and recreated. Use this with a request- string for example.
string$nameThe setting's name, that will be displayed in the user's settingtab (Important: Don't mix the name up with the identifier)
string$identifierthe identifier is used to simplify the usage of the visibilityAPI. An identifier maps a string to a visibilityid (under the usage of a userid) therefore all identifier set for one user MUST be unique.
int | string$parentDetermines the parent of the visibility to add. Use the direct visibilityid of the parent visibility or the identifier. If the visibility should be created on the top level the value has to be 0. Plugins creating a privacysetting will automaticly be added to the parent "plugins". Important: If u add a visibility without a parent and without beeing a toplevelpoint itself it will NEVER be displayed.
int$categorySets the type of the visibilitysetting. Currently there are only 2 types available: 0 - The setting is only a header without any options 1 (Default) - Normal setting
string$userUserid of the user that should be added the visibility. Default: The current logged on user
int$defaultint representation of the visibility that should be set. Use with caution since the API provides the easy change of the visibility int representation
int$pluginidConnects the created visibility with a plugin. Important: If addPrivacySetting is called in a file of a plugin there is no need to set the pluginid manually, because the API will normally find it
Returns
int the created visibilityid

◆ updateUserFromRequest()

static updateUserFromRequest (   $data,
  $userid = null 
)
static

Takes the updaterequestdata and stores it into the database

Parameters
array$dataData produced by the settingspage
string$useridthe userid. Default: current logged on user

◆ verify()

static verify (   $visibilityid,
  $ownerid,
  $userid = null 
)
static

Basic visibilitycheck to find out if a given user (or the current logged on user) is allowed to view the object that is defined by a visibilityid

Parameters
int | string$visibilityidThe visibility to check can be defined by the direct id (int) or the predefined identifier (string)
int$useridThe user for whom we check the visibility. If no user is given, the system will take the current logged on user
Returns
boolean true if user is allowed to view content according to the current visibilitysetting otherwise false;

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