UNA
BxDolScore Class Reference
Inheritance diagram for BxDolScore:
BxDolObject BxDolFactory iBxDolReplaceable BxBaseScore BxTemplScore BxDolCmtsScore BxMarketScore BxBaseCmtsScore BxTemplCmtsScore

Public Member Functions

 getStatCounterUp ()
 
 actionVoteUp ()
 
 isAllowedVote ($isPerformAction=false)
 
- Public Member Functions inherited from BxDolObject
 getConditions ($sMainTable, $sMainField)
 
 getQueryObject ()
 
 checkAction ($sAction, $isPerformAction=false)
 
 onObjectDelete ($iObjectId=0)
 

Static Public Member Functions

static getObjectInstance ($sSys, $iId, $iInit=true, $oTemplate=false)
 

Protected Member Functions

 _isAllowedVoteByObject ($aObject)
 
 _getImageDo ($sType)
 
- Protected Member Functions inherited from BxDolObject
 _getAuthorId ()
 
 _trigger ()
 
 _triggerValue ($iValue)
 
 _replaceMarkers ($mixed)
 

Detailed Description

Score for any content

Related classes:

AJAX vote for any content. Stars and Plus based representations are supported.

To add vote section to your feature you need to add a record to 'sys_objects_vote' table:

  • ID - autoincremented id for internal usage
  • Name - your unique module name, with vendor prefix, lowercase and spaces are underscored
  • TableMain - table name where summary votigs are stored
  • TableTrack - table name where each vote is stored
  • PostTimeout - number of seconds to not allow duplicate vote
  • MinValue - min vote value, 1 by default
  • MaxValue - max vote value, 5 by default
  • IsUndo - is Undo enabled for Plus based votes
  • IsOn - is this vote object enabled
  • TriggerTable - table to be updated upon each vote
  • TriggerFieldId - TriggerTable table field with unique record id, primary key
  • TriggerFieldRate - TriggerTable table field with average rate
  • TriggerFieldRateCount - TriggerTable table field with votes count
  • ClassName - your custom class name, if you overrride default class
  • ClassFile - your custom class path

You can refer to BoonEx modules for sample record in this table.

Example of usage

To get Star based vote you need to have different values for MinValue and MaxValue (for example 1 and 5) and IsUndo should be equal to 0. To get Plus(Like) based vote you need to have equal values for MinValue and MaxValue (for example 1) and IsUndo should be equal to 1. After filling the other paramenters in the table you can show vote in any place, using the following code:

$o = BxDolScore::getObjectInstance('system object name', $iYourEntryId);
if (!$o->isEnabled()) return '';
echo $o->getElementBlock();

Memberships/ACL:

  • vote

Alerts(hooks)

Alerts type/unit - every module has own type/unit, it equals to ObjectName. The following alerts are rised:

  • rate - comment was posted
    • $iObjectId - entry id
    • $iSenderId - rater user id
    • $aExtra['rate'] - rate

Member Function Documentation

◆ _getImageDo()

BxDolScore::_getImageDo (   $sType)
protected

Note. By default image based controls aren't used. Therefore it can be overwritten in custom template.

◆ _isAllowedVoteByObject()

BxDolScore::_isAllowedVoteByObject (   $aObject)
protected

Internal functions

◆ actionVoteUp()

BxDolScore::actionVoteUp ( )

Actions functions

◆ getObjectInstance()

static BxDolScore::getObjectInstance (   $sSys,
  $iId,
  $iInit = true,
  $oTemplate = false 
)
static

get votes object instanse

Parameters
$sSysvote object name
$iIdassociated content id, where vote is available
$iInitperform initialization
Returns
null on error, or ready to use class instance

◆ getStatCounterUp()

BxDolScore::getStatCounterUp ( )

Interface functions for outer usage

◆ isAllowedVote()

BxDolScore::isAllowedVote (   $isPerformAction = false)

Permissions functions


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