Cheetah
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
ChWsbPrivacy Class Reference
Inheritance diagram for ChWsbPrivacy:
ChAdsPrivacy ChBlogsPrivacy ChEventsPrivacy ChFilesPrivacy ChGroupsPrivacy ChPhotosPrivacy ChPollPrivacy ChSimpleMessengerPrivacy ChSitesPrivacy ChSoundsPrivacy ChStorePrivacyFile ChStorePrivacyProduct ChVideosPrivacy ChWallPrivacy ChWsbTextPrivacy

Public Member Functions

 __construct ($sTable='', $sFieldId='', $sFieldOwnerId='')
 
 getGroupChooser ($iOwnerId, $sModuleUri, $sActionName, $aDynamicGroups=array(), $sTitle="")
 
 check ($sAction, $iObjectId, $iViewerId=0)
 
 getFieldAction ($sAction)
 
 isDynamicGroupMember ($mixedGroupId, $iObjectOwnerId, $iViewerId, $iObjectId)
 

Static Public Member Functions

static isPrivacyPage ()
 

Public Attributes

 $_oDb
 

Detailed Description

Privacy settings for any content.

Integration of the content with privacy engine allows site member to organize the access to his content.

Related classes: ChWsbPrivacyQuery - database queries. ChWsbPrivacySearch - organize members search using necessary criteria. ChWsbPrivacyView - super class for all representations. ChBasePrivacyView - base template representation. ChTemplPrivacyView - custom template representation.

Example of usage:

  1. Register your privacy actions in sys_privacy_actions database table.
  2. Add one privacy field(with INT type) in the table with your items for each action. For example, for action 'comment', the field name should be 'allow_comment_to'.
  3. Add group choosers for necessary actions in the form, which is used to add new items.

    $oPrivacy = new ChWsbPrivacy(); $oPrivacy->getGroupChooser($iItemOwnerId, $sModuleUri, $sModuleAction);

  4. Check privacy when any user tries to view an item.

    $oPrivacy = new ChWsbPrivacy($sTable, $sFieldId, $sFieldOwnerId); if($oPrivacy->check($sAction, $iObjectId, $iViewerId)) { //show necessary content }

    See also
    an example of integration in the default Cheetah's modules(feedback, events, sites, etc)

    Memberships/ACL: Doesn't depend on user's membership.

Alerts: no alerts available

Definition at line 59 of file ChWsbPrivacy.php.

Constructor & Destructor Documentation

◆ __construct()

ChWsbPrivacy::__construct (   $sTable = '',
  $sFieldId = '',
  $sFieldOwnerId = '' 
)

constructor

Reimplemented in ChVideosPrivacy, ChSoundsPrivacy, ChPhotosPrivacy, and ChFilesPrivacy.

Definition at line 66 of file ChWsbPrivacy.php.

Member Function Documentation

◆ check()

ChWsbPrivacy::check (   $sAction,
  $iObjectId,
  $iViewerId = 0 
)

Check whether the viewer can make requested action.

Parameters
string$sActionaction name from 'sys_priacy_actions' table.
integer$iObjectIdobject ID the action to be performed with.
integer$iViewerIdviewer ID.
Returns
boolean result of operation.

Reimplemented in ChSimpleMessengerPrivacy.

Definition at line 127 of file ChWsbPrivacy.php.

◆ getFieldAction()

ChWsbPrivacy::getFieldAction (   $sAction)

Get database field name for action.

Parameters
string$sActionaction name.
Returns
string with field name.

Reimplemented in ChVideosPrivacy, ChSoundsPrivacy, ChSitesPrivacy, ChPhotosPrivacy, ChFilesPrivacy, ChBlogsPrivacy, and ChAdsPrivacy.

Definition at line 154 of file ChWsbPrivacy.php.

◆ getGroupChooser()

ChWsbPrivacy::getGroupChooser (   $iOwnerId,
  $sModuleUri,
  $sActionName,
  $aDynamicGroups = array(),
  $sTitle = "" 
)

Get Select element with available groups.

Parameters
integer$iOwnerIdobject's owner ID.
string$sModuleUrimodule's unique URI.
string$sActionNameaction name.
array$aDynamicGroupsan array of array('key' => group_id, 'value' => group_title).
string$sTitlethe title to be used for generated field.
Returns
an array with Select element description.

Definition at line 81 of file ChWsbPrivacy.php.

◆ isDynamicGroupMember()

ChWsbPrivacy::isDynamicGroupMember (   $mixedGroupId,
  $iObjectOwnerId,
  $iViewerId,
  $iObjectId 
)

Check whethere viewer is a member of dynamic group.

Parameters
mixed$mixedGroupIddynamic group ID.
integer$iObjectOwnerIdobject owner ID.
integer$iViewerIdviewer ID.
Returns
boolean result of operation.

Reimplemented in ChStorePrivacyProduct, ChStorePrivacyFile, ChGroupsPrivacy, and ChEventsPrivacy.

Definition at line 167 of file ChWsbPrivacy.php.

◆ isPrivacyPage()

static ChWsbPrivacy::isPrivacyPage ( )
static

Static Method. Check whether Privacy Group page/menu is available.

Definition at line 176 of file ChWsbPrivacy.php.

Member Data Documentation

◆ $_oDb

ChWsbPrivacy::$_oDb

Definition at line 61 of file ChWsbPrivacy.php.


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