UNA
BxDolCmts Class Reference
Inheritance diagram for BxDolCmts:
BxDolFactory iBxDolReplaceable iBxDolContentInfoService BxBaseCmts BxTemplCmts BxAlbumsCmtsMedia BxBaseModProfileCmts BxCnvCmts BxDolCmtsNotes BxDolCmtsReviews BxForumCmts BxMarketCmts BxTimelineCmts

Public Member Functions

 getNotificationId ()
 
 setTableNameFiles ($sTable)
 
 setTableNameFiles2Entries ($sTable)
 
 setId ($iId)
 
 addMarkers ($a)
 
 getQueryObject ()
 
 getCommentUniqId ($iCmtId, $iAuthorId=0)
 
 getCommentSimple ($iCmtId)
 
 getCommentRow ($iCmtId)
 
 isAdmin ($iCmtAuthorId)
 
 isReplyAllowed ($mixedCmt, $isPerformAction=false)
 
 actionPin ()
 
 registerTranscoders ()
 
 unregisterTranscoders ()
 

Static Public Member Functions

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

Static Public Attributes

static $sTableSystems = 'sys_objects_cmts'
 

Protected Member Functions

 __construct ($sSystem, $iId, $iInit=true, $oTemplate=false)
 
 _getAuthorId ()
 
 _replaceMarkers ($mixed)
 
 _getImageDo ()
 

Protected Attributes

 $_sTableImages = 'sys_cmts_images'
 

Detailed Description

Comments for any content

Related classes:

AJAX comments for any content. Self moderated - users rate all comments, and if comment is below viewing treshold it is hidden by default.

To add comments section to your module you need to add a record to 'sys_objects_cmts' table:

  • ID - autoincremented id for internal usage
  • ObjectName - your unique module name, with vendor prefix, lowercase and spaces are underscored
  • TableCmts - table name where comments are stored
  • Html - 0 - convert new lines to
    on saving, 1 - standard(default) visual editor, 2 - full visual editor, 3 - mini visual editor.
  • PerView - number of comments on a page
  • IsRatable - 0 or 1 allow to rate comments or not
  • ViewingThreshold - comment viewing treshost, if comment is below this number it is hidden by default
  • IsOn - is this comment object enabled
  • RootStylePrefix - toot comments style prefix, if you need root comments look different\
  • ObjectVote - Vote object name to process comments' votes. May be empty if Comment Vote is not needed.
  • TriggerTable - table to be updated upon each comment
  • TriggerFieldId - TriggerTable table field with unique record id of
  • TriggerFieldComments - TriggerTable table field with comments count, it will be updated automatically upon eaech comment
  • ClassName - your custom class name if you need to override default class, this class must have the same constructor arguments
  • ClassFile - file where your ClassName is stored.

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

Example of usage

After filling in the table you can show comments section in any place, using the following code:

$o = new BxTemplCmts('value of ObjectName field', $iYourEntryId);
if ($o->isEnabled())
echo $o->getCommentsBlock ();

Please note that you never need to use BxDolCmts class directly, use BxTemplCmts instead. Also if you override comments class with your own then make it child of BxTemplCmts class.

Memberships/ACL:

  • comments post
  • comments edit own
  • comments remove own
  • comments edit all

Alerts(hooks)

Alerts type/unit - every module has own type/unit, it equals to ObjectName.

The following alerts are rised

  • commentPost - comment was posted
    • $iObjectId - entry id
    • $iSenderId - author of comment
    • $aExtra['comment_id'] - just added comment id
  • commentRemoved - comments was removed
    • $iObjectId - entry id
    • $iSenderId - comment deleter id
    • $aExtra['comment_id'] - removed comment id
  • commentUpdated - comments was updated
    • $iObjectId - entry id
    • $iSenderId - comment deleter id
    • $aExtra['comment_id'] - updated comment id
  • commentRated - comments was rated
    • $iObjectId - entry id
    • $iSenderId - comment rater id
    • $aExtra['comment_id'] - rated comment id
    • $aExtra['rate'] - comment rate 1 or -1

Constructor & Destructor Documentation

◆ __construct()

BxDolCmts::__construct (   $sSystem,
  $iId,
  $iInit = true,
  $oTemplate = false 
)
protected

Constructor $sSystem - comments system name $iId - obect id to be commented

Member Function Documentation

◆ _getAuthorId()

BxDolCmts::_getAuthorId ( )
protected

Internal functions

◆ _getImageDo()

BxDolCmts::_getImageDo ( )
protected

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

◆ _replaceMarkers()

BxDolCmts::_replaceMarkers (   $mixed)
protected

Replace provided markers in a string

Parameters
$mixedstring or array to replace markers in
Returns
string where all occured markers are replaced

◆ actionPin()

BxDolCmts::actionPin ( )

Actions functions

◆ addMarkers()

BxDolCmts::addMarkers (   $a)

Add replace markers.

Parameters
$aarray of markers as key => value
Returns
true on success or false on error

Implements iBxDolReplaceable.

◆ getCommentRow()

BxDolCmts::getCommentRow (   $iCmtId)

Get comment's full info.

◆ getCommentSimple()

BxDolCmts::getCommentSimple (   $iCmtId)

Get comment's short info.

◆ getCommentUniqId()

BxDolCmts::getCommentUniqId (   $iCmtId,
  $iAuthorId = 0 
)

Get comment's unique id.

◆ getNotificationId()

BxDolCmts::getNotificationId ( )

Is used as:

  1. Live Update's session key.
  2. HTML ID for Live Update's 'New Content' button.
    Returns
    string with ID.

◆ getObjectInstance()

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

get comments object instanse

Parameters
$sSyscomments object name
$iIdassociated content id, where comments are postred in
$iInitperform initialization
Returns
null on error, or ready to use class instance

◆ getObjectInstanceByUniqId()

static BxDolCmts::getObjectInstanceByUniqId (   $iUniqId,
  $iInit = true,
  $oTemplate = false 
)
static

get comments object instanse

Parameters
$iUniqIdunique comment id
Returns
null on error, or ready to use class instance

◆ getQueryObject()

BxDolCmts::getQueryObject ( )

Database functions

◆ isAdmin()

BxDolCmts::isAdmin (   $iCmtAuthorId)

Permissions functions

◆ isReplyAllowed()

BxDolCmts::isReplyAllowed (   $mixedCmt,
  $isPerformAction = false 
)

Determines whether a 'reply' action allowed or not.

Parameters
integeror array $mixedCmt - ID or an array which describes the comment to be replied
boolean$isPerformAction
Returns
boolean

◆ registerTranscoders()

BxDolCmts::registerTranscoders ( )

Overwrite this method and register transcoder(s) if comments object uses custom transcoder(s), which differs from default one 'sys_cmts_images_preview'

◆ setId()

BxDolCmts::setId (   $iId)

set id to operate with votes

◆ setTableNameFiles()

BxDolCmts::setTableNameFiles (   $sTable)
Deprecated:
since version 10.0.0-B3 and can be removed in later versions.

◆ setTableNameFiles2Entries()

BxDolCmts::setTableNameFiles2Entries (   $sTable)
Deprecated:
since version 10.0.0-B3 and can be removed in later versions.

◆ unregisterTranscoders()

BxDolCmts::unregisterTranscoders ( )

Overwrite this method and unregister transcoder(s) if comments object uses custom transcoder(s), which differs from default one 'sys_cmts_images_preview'

Member Data Documentation

◆ $_sTableImages

BxDolCmts::$_sTableImages = 'sys_cmts_images'
protected

System tables which are used by default and can be overwritten in comment systems.

See also
BxDolCmts::getTableNameImages and BxDolCmts::getTableNameImages2Entries

◆ $sTableSystems

BxDolCmts::$sTableSystems = 'sys_objects_cmts'
static

System tables which are UNITED for all comment systems and cannot be overwritten.


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