PHP 클래스 BxDolVoting, dolphin.pro

Related classes: BxDolVotingQuery - votings database queries BxBaseVotingView - votings base representation BxTemplVotingView - custom template representation AJAX votings for any content. Big and small votings stars are supported To add votings section to your site you need to add a record to 'sys_objects_vote' table: ID - autoincremented id for internal usage ObjectName - your unique module name, with vendor prefix, lowercase and spaces are underscored TableRating - table name where sumarry votigs are stored TableTrack - table name where each vote is stored RowPrefix - row prefix for TableRating MaxVotes - max vote number, 5 by default PostName - post variable name with rating IsDuplicate - number of seconds to not allow duplicate vote (for some bad reason it is define here) IsOn - is this vote object enabled ClassName - custom class name for HotOrNot @see BxDolRate ClassFile - custom class path for HotOrNot TriggerTable - table to be updated upon each vote TriggerFieldRate - TriggerTable table field with average rate TriggerFieldRateCount - TriggerTable table field with votes count TriggerFieldId - TriggerTable table field with unique record id, primary key OverrideClassName - your custom class name, if you overrride default class OverrideClassFile - your custom class path You can refer to BoonEx modules for sample record in this table. Example of usage: After filling in the table you can show big votings in any place, using the following code: bx_import('BxTemplVotingView'); $o = new BxTemplVotingView ('value of ObjectName field', $iYourEntryId); if (!$o->isEnabled()) return ''; echo $o->getBigVoting (1); // 1 - rate is allowed And small votings, using the following code: $o = new BxTemplVotingView ('value of ObjectName field', $iYourEntryId); if (!$o->isEnabled()) return ''; echo $o->getSmallVoting (0); // 0 - rate is not allowed, like readony votings In some cases votes are already in database and there is no need to execute additional query to get ratings, so you can use the following code: $o = new BxTemplVotingView ('value of ObjectName field', 0); foreach ($aRecords as $aData) echo $o->getJustVotingElement(0, $aData['ID'], $aData['voting_rate']); Please note that you never need to use BxDolVoting class directly, use BxTemplVotingView instead. Also if you override votings class with your own then make it child of BxTemplVotingView class. Memberships/ACL: vote - ACTION_ID_VOTE Alerts: 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
파일 보기 프로젝트 열기: boonex/dolphin.pro 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$_aSystem current rating system name
$_fRate number of votes
$_iCount item id to be rated
$_iId
$_oQuery current rating system array
$_sSystem average rate

공개 메소드들

메소드 설명
__construct ( $sSystem, $iId, $iInit = 1 ) Constructor
actionVote ( )
checkAction ( $bPerformAction = false )
deleteVotings ( $iId )
getId ( )
getMaxVote ( )
getObjectInstance ( $sSys, $iId, $iInit = true ) : null get voting object instanse
getSqlParts ( $sMailTable, $sMailField )
getSystemName ( )
getSystems ( )
getTopVotedItem ( $iDays, $sJoinTable = '', $sJoinField = '', $sWhere = '' )
getVoteCount ( )
getVoteRate ( )
getVotedItems ( $sIp )
init ( $iId )
initVotes ( )
isDublicateVote ( )
isEnabled ( )
isValidSystem ( $sSystem )
maintenance ( ) it is called on cron every day or similar period to clean old votes
makeVote ( $iVote )
setId ( $iId ) set id to operate with votes

보호된 메소드들

메소드 설명
_getVoteResult ( )
_triggerVote ( )

메소드 상세

__construct() 공개 메소드

Constructor
public __construct ( $sSystem, $iId, $iInit = 1 )

_getVoteResult() 보호된 메소드

protected _getVoteResult ( )

_triggerVote() 보호된 메소드

protected _triggerVote ( )

actionVote() 공개 메소드

public actionVote ( )

checkAction() 공개 메소드

public checkAction ( $bPerformAction = false )

deleteVotings() 공개 메소드

public deleteVotings ( $iId )

getId() 공개 메소드

public getId ( )

getMaxVote() 공개 메소드

public getMaxVote ( )

getObjectInstance() 정적인 공개 메소드

get voting object instanse
static public getObjectInstance ( $sSys, $iId, $iInit = true ) : null
$sSys voting object name
$iId associated content id
$iInit perform initialization
리턴 null on error, or ready to use class instance

getSqlParts() 공개 메소드

public getSqlParts ( $sMailTable, $sMailField )

getSystemName() 공개 메소드

public getSystemName ( )

getSystems() 공개 정적인 메소드

public static getSystems ( )

getTopVotedItem() 공개 메소드

public getTopVotedItem ( $iDays, $sJoinTable = '', $sJoinField = '', $sWhere = '' )

getVoteCount() 공개 메소드

public getVoteCount ( )

getVoteRate() 공개 메소드

public getVoteRate ( )

getVotedItems() 공개 메소드

public getVotedItems ( $sIp )

init() 공개 메소드

public init ( $iId )

initVotes() 공개 메소드

public initVotes ( )

isDublicateVote() 공개 메소드

public isDublicateVote ( )

isEnabled() 공개 메소드

public isEnabled ( )

isValidSystem() 공개 메소드

public isValidSystem ( $sSystem )

maintenance() 공개 메소드

it is called on cron every day or similar period to clean old votes
public maintenance ( )

makeVote() 공개 메소드

public makeVote ( $iVote )

setId() 공개 메소드

set id to operate with votes
public setId ( $iId )

프로퍼티 상세

$_aSystem 공개적으로 프로퍼티

current rating system name
public $_aSystem

$_fRate 공개적으로 프로퍼티

number of votes
public $_fRate

$_iCount 공개적으로 프로퍼티

item id to be rated
public $_iCount

$_iId 공개적으로 프로퍼티

public $_iId

$_oQuery 공개적으로 프로퍼티

current rating system array
public $_oQuery

$_sSystem 공개적으로 프로퍼티

average rate
public $_sSystem