BlueSpice MediaWiki master
 All Classes Namespaces Files Functions Variables Groups Pages
RatingItem Class Reference
Inheritance diagram for RatingItem:
Collaboration diagram for RatingItem:

Public Member Functions

 jsonSerialize ()
 
 checkValue ($mValue=false, $iContext=0)
 
 isAllowedValue ($mValue=false)
 
 userCan (User $oUser, $sAction= 'read', Title $oTitle=null)
 
 getTypeMessage ()
 
 vote (User $oUser, $mValue, User $oOwner=null, $iContext=0, Title $oTitle=null)
 
 deleteRatingItem ()
 
 getAnonRatings ($aRatings=false, $iContext=0)
 
 getRatings ($iContext=0)
 
 getRefType ()
 
 getSubType ()
 
 getRef ()
 
 getConfig ()
 
 countRatings ($iContext=0)
 
 getTotal ($iContext=0)
 
 getAverage ($iContext)
 
 hasUserRated (User $oUser, $return=false, $iContext=0)
 
 getRatedUserIDs ($iContext=0)
 
 getRatingsOfSpecificUser (User $oUser, $iContext=0)
 
 getValueFilteredRatings ($mValue=false, $iContext=0)
 
 getTagData ()
 
 getTag ()
 

Static Public Member Functions

static ensureBasicParams (stdClass $oData=null)
 
static newFromObject (stdClass $oData)
 

Protected Member Functions

 invalidateCache ()
 
 checkPermission ($sAction, User $oUser, Title $oTitle=null)
 
 loadRating ()
 
 insertRating (User $oOwner, $mValue, $iContext=0)
 
 updateRating (User $oOwner, $mValue, $iID, $iContext=0)
 
 deleteRating (User $oUser=null, $iContext=0)
 
 filterRating ($a=array())
 

Static Protected Member Functions

static factory ($sType, stdClass $oData)
 
static getInstanceFromCache (stdClass $oData)
 
static appendCache (RatingItem $oInstance)
 
static detachFromCache (RatingItem $oInstance)
 

Protected Attributes

 $oConfig = null
 
 $sRefType = ''
 
 $sSubType = ''
 
 $sRef = ''
 
 $aRatings = null
 

Static Protected Attributes

static $aRatingItems = array()
 

Member Function Documentation

static RatingItem::appendCache ( RatingItem  $oInstance)
staticprotected
Parameters
RatingItem$oInstance
Returns
RatingItem::checkValue (   $mValue = false,
  $iContext = 0 
)
Parameters
mixed$mValue
Returns
Status
RatingItem::countRatings (   $iContext = 0)

Total number of votes

Parameters
integer$iContext
Returns
integer
RatingItem::deleteRating ( User  $oUser = null,
  $iContext = 0 
)
protected

Archives this RatingItem - When User given: Archives rating of given user in this RatingItem

Parameters
User$oUser
integer$iContext
Returns
Boolean - true or false
RatingItem::deleteRatingItem ( )

Deletes the RatingItem and archives all user ratings

Returns
Status
static RatingItem::detachFromCache ( RatingItem  $oInstance)
staticprotected
Parameters
RatingItem$oInstance
Returns
static RatingItem::ensureBasicParams ( stdClass  $oData = null)
static
Parameters
stdClass$oData
Returns
Status
static RatingItem::factory (   $sType,
stdClass  $oData 
)
staticprotected
Parameters
string$sType
stdClass$oData
Returns
RatingItem::getAnonRatings (   $aRatings = false,
  $iContext = 0 
)

Make given ratings anon by removing userid and userip or request ratings with context and make the result anon.

Parameters
array$aRatings
integer$iContext
Returns
array
RatingItem::getAverage (   $iContext)

Average vote value. Note that this only works for integers!

Parameters
integer$iContext
Returns
float
RatingItem::getConfig ( )
Returns
RatingConfig
static RatingItem::getInstanceFromCache ( stdClass  $oData)
staticprotected

TODO: real object cache!

Parameters
stdClass$oData
Returns
RatingItem - or null
RatingItem::getRatings (   $iContext = 0)

Returns an array containing all ratings row arrays filtered by context.

Parameters
integer$iContext
Returns
array
RatingItem::getTotal (   $iContext = 0)

Total sum of all rating. Note that this only works for integers!

Parameters
integer$iContext
Returns
integer
RatingItem::getTypeMessage ( )
Returns
Message
RatingItem::hasUserRated ( User  $oUser,
  $return = false,
  $iContext = 0 
)

returns if the user has already rated

Parameters
User$oUser
boolean$return
Returns
boolean - true or false
RatingItem::isAllowedValue (   $mValue = false)
Parameters
mixed$mValue
Returns
Status
RatingItem::jsonSerialize ( )
RatingItem::loadRating ( )
protected

loads the ratings from the bs_rating table

Returns
boolean
static RatingItem::newFromObject ( stdClass  $oData)
static

RatingItem from a set of data

Parameters
stdClass$oData
Returns
RatingItem::userCan ( User  $oUser,
  $sAction = 'read',
Title  $oTitle = null 
)
Parameters
User$oUser
Returns
Status
RatingItem::vote ( User  $oUser,
  $mValue,
User  $oOwner = null,
  $iContext = 0,
Title  $oTitle = null 
)

CRUD votes from the rating item. Use $mValue = false to delete

Parameters
User$oUser- User, that initiated this action
mixed$mValue- use false to delete
User$oOwner- User, that the vote is related to
integer$iContext- context for multi value
Title$oTitle- for permission check!
Returns
Status

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