Cheetah
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
ChWsbCmts Class Reference
Inheritance diagram for ChWsbCmts:
ChBaseCmtsView ChTemplCmtsView ChAdsCmts ChBlogsCmts ChEventsCmts ChGroupsCmts ChPollCmts ChSitesCmts ChStoreCmts ChWallCmts ChWsbCmtsProfile ChWsbFilesCmts ChWsbFilesCmtsAlbums ChWsbTextCmts

Public Member Functions

 __construct ( $sSystem, $iId, $iInit=1)
 
 init ($iId)
 
 checkAction ($iAction, $isPerformAction=false)
 
 checkActionErrorMsg ($iAction)
 
 getId ()
 
 isEnabled ()
 
 getSystemName ()
 
 getOrder ()
 
 setId ($iId)
 
 getBaseUrl ()
 
 isValidSystem ($sSystem)
 
 isTagsAllowed ()
 
 isNl2br ()
 
 isRatable ()
 
 getAllowedEditTime ()
 
 getPerView ()
 
 getSystemId ()
 
 maintenance ()
 
 getCommentsArray ($iCmtParentId, $sCmtOrder, $iStart=0, $iCount=-1)
 
 getCommentRow ($iCmtId)
 
 onObjectDelete ($iObjectId=0)
 
 onAuthorDelete ($iAuthorId)
 
 getCommentsTableName ()
 
 getObjectCommentsCount ($iObjectId=0)
 
 isRateAllowed ($isPerformAction=false)
 
 msgErrRateAllowed ()
 
 isPostReplyAllowed ($isPerformAction=false)
 
 msgErrPostReplyAllowed ()
 
 isEditAllowed ($isPerformAction=false)
 
 msgErrEditAllowed ()
 
 isRemoveAllowed ($isPerformAction=false)
 
 msgErrRemoveAllowed ()
 
 isEditAllowedAll ()
 
 isRemoveAllowedAll ()
 
 actionPaginateGet ()
 
 actionFormGet ()
 
 actionCmtsGet ()
 
 actionCmtGet ()
 
 actionCmtPost ()
 
 actionCmtRemove ()
 
 actionCmtEdit ()
 
 actionCmtEditSubmit ()
 
 actionCmtRate ()
 
 _getAuthorId ()
 
 _getAuthorPassword ()
 
 _getAuthorIp ()
 
 _prepareTextForEdit ($s)
 
 _prepareTextForSave ($s)
 
 _prepareTextForOutput ($s)
 
 _triggerComment ()
 
 _isSpam ($s)
 
 _getAnchor ($iId)
 

Static Public Member Functions

static getObjectInstance ($sSys, $iId, $iInit=true)
 
static & getSystems ()
 

Public Attributes

 $_iId = 0
 
 $iGlobAllowHtml
 
 $iAutoHideRootPostForm = 0
 
 $bDynamic = false
 
 $_sSystem = 'profile'
 
 $_aSystem = array ()
 
 $_aCmtElements = array ()
 
 $_oQuery = null
 
 $_sOrder = 'desc'
 
 $_aMoodText
 

Detailed Description

Comments for any content

Related classes: ChWsbCmtsQuery - comments database queries ChBaseCmtsView - comments base representation ChTemplCmtsView - custom template representation

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 TableTrack - table name where comments ratings are stored AllowTags - 0 or 1 allow HTML tags in comments or not Nl2br - convert new lines to
on saving SecToEdit - number of second to allow author to delete or edit comment 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 AnimationEffect - animation effect for comments, slide or fade AnimationSpeed - animation speen in milliseconds IsOn - is this comment object enabled IsMood - allow user to select comment as negative, positive or neutral RootStylePrefix - toot comments style prefix, if you need root comments look different 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 Cheetah 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:

ch_import ('ChTemplCmtsView'); $o = new ChTemplCmtsView ('value of ObjectName field', $iYourEntryId); if ($o->isEnabled()) echo $o->getCommentsFirst ();

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

Memberships/ACL: comments post - ACTION_ID_COMMENTS_POST comments vote - ACTION_ID_COMMENTS_VOTE comments edit own - ACTION_ID_COMMENTS_EDIT_OWN comments remove own - ACTION_ID_COMMENTS_REMOVE_OWN

Alerts: 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

Definition at line 98 of file ChWsbCmts.php.

Constructor & Destructor Documentation

◆ __construct()

ChWsbCmts::__construct (   $sSystem,
  $iId,
  $iInit = 1 
)

Member Function Documentation

◆ _getAnchor()

ChWsbCmts::_getAnchor (   $iId)

Definition at line 691 of file ChWsbCmts.php.

◆ _getAuthorId()

ChWsbCmts::_getAuthorId ( )

private functions

Definition at line 632 of file ChWsbCmts.php.

◆ _getAuthorIp()

ChWsbCmts::_getAuthorIp ( )

Definition at line 642 of file ChWsbCmts.php.

◆ _getAuthorPassword()

ChWsbCmts::_getAuthorPassword ( )

Definition at line 637 of file ChWsbCmts.php.

◆ _isSpam()

ChWsbCmts::_isSpam (   $s)

Definition at line 686 of file ChWsbCmts.php.

◆ _prepareTextForEdit()

ChWsbCmts::_prepareTextForEdit (   $s)

Definition at line 647 of file ChWsbCmts.php.

◆ _prepareTextForOutput()

ChWsbCmts::_prepareTextForOutput (   $s)

Definition at line 670 of file ChWsbCmts.php.

◆ _prepareTextForSave()

ChWsbCmts::_prepareTextForSave (   $s)

Definition at line 654 of file ChWsbCmts.php.

◆ _triggerComment()

ChWsbCmts::_triggerComment ( )

Definition at line 675 of file ChWsbCmts.php.

◆ actionCmtEdit()

ChWsbCmts::actionCmtEdit ( )

Definition at line 539 of file ChWsbCmts.php.

◆ actionCmtEditSubmit()

ChWsbCmts::actionCmtEditSubmit ( )

Definition at line 556 of file ChWsbCmts.php.

◆ actionCmtGet()

ChWsbCmts::actionCmtGet ( )

Definition at line 450 of file ChWsbCmts.php.

◆ actionCmtPost()

ChWsbCmts::actionCmtPost ( )

Reimplemented in ChWallCmts.

Definition at line 459 of file ChWsbCmts.php.

◆ actionCmtRate()

ChWsbCmts::actionCmtRate ( )

Definition at line 599 of file ChWsbCmts.php.

◆ actionCmtRemove()

ChWsbCmts::actionCmtRemove ( )

Definition at line 499 of file ChWsbCmts.php.

◆ actionCmtsGet()

ChWsbCmts::actionCmtsGet ( )

Definition at line 437 of file ChWsbCmts.php.

◆ actionFormGet()

ChWsbCmts::actionFormGet ( )

Definition at line 426 of file ChWsbCmts.php.

◆ actionPaginateGet()

ChWsbCmts::actionPaginateGet ( )

actions functions

Definition at line 415 of file ChWsbCmts.php.

◆ checkAction()

ChWsbCmts::checkAction (   $iAction,
  $isPerformAction = false 
)

check if user can post/edit or delete own comments

Definition at line 214 of file ChWsbCmts.php.

◆ checkActionErrorMsg()

ChWsbCmts::checkActionErrorMsg (   $iAction)

Definition at line 221 of file ChWsbCmts.php.

◆ getAllowedEditTime()

ChWsbCmts::getAllowedEditTime ( )

Definition at line 282 of file ChWsbCmts.php.

◆ getBaseUrl()

ChWsbCmts::getBaseUrl ( )

◆ getCommentRow()

ChWsbCmts::getCommentRow (   $iCmtId)

Definition at line 321 of file ChWsbCmts.php.

◆ getCommentsArray()

ChWsbCmts::getCommentsArray (   $iCmtParentId,
  $sCmtOrder,
  $iStart = 0,
  $iCount = -1 
)

comments functions

Definition at line 316 of file ChWsbCmts.php.

◆ getCommentsTableName()

ChWsbCmts::getCommentsTableName ( )

Definition at line 342 of file ChWsbCmts.php.

◆ getId()

ChWsbCmts::getId ( )

Definition at line 228 of file ChWsbCmts.php.

◆ getObjectCommentsCount()

ChWsbCmts::getObjectCommentsCount (   $iObjectId = 0)

Definition at line 347 of file ChWsbCmts.php.

◆ getObjectInstance()

static ChWsbCmts::getObjectInstance (   $sSys,
  $iId,
  $iInit = true 
)
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

Definition at line 154 of file ChWsbCmts.php.

◆ getOrder()

ChWsbCmts::getOrder ( )

Definition at line 243 of file ChWsbCmts.php.

◆ getPerView()

ChWsbCmts::getPerView ( )

Definition at line 287 of file ChWsbCmts.php.

◆ getSystemId()

ChWsbCmts::getSystemId ( )

Definition at line 292 of file ChWsbCmts.php.

◆ getSystemName()

ChWsbCmts::getSystemName ( )

Definition at line 238 of file ChWsbCmts.php.

◆ getSystems()

static& ChWsbCmts::getSystems ( )
static

Definition at line 171 of file ChWsbCmts.php.

◆ init()

ChWsbCmts::init (   $iId)

Reimplemented in ChWallCmts.

Definition at line 202 of file ChWsbCmts.php.

◆ isEditAllowed()

ChWsbCmts::isEditAllowed (   $isPerformAction = false)

Definition at line 379 of file ChWsbCmts.php.

◆ isEditAllowedAll()

ChWsbCmts::isEditAllowedAll ( )

Reimplemented in ChStoreCmts, ChGroupsCmts, ChEventsCmts, and ChBlogsCmts.

Definition at line 401 of file ChWsbCmts.php.

◆ isEnabled()

ChWsbCmts::isEnabled ( )

Definition at line 233 of file ChWsbCmts.php.

◆ isNl2br()

ChWsbCmts::isNl2br ( )

Definition at line 272 of file ChWsbCmts.php.

◆ isPostReplyAllowed()

ChWsbCmts::isPostReplyAllowed (   $isPerformAction = false)

Reimplemented in ChStoreCmts, ChGroupsCmts, ChEventsCmts, ChBlogsCmts, and ChAdsCmts.

Definition at line 368 of file ChWsbCmts.php.

◆ isRatable()

ChWsbCmts::isRatable ( )

Definition at line 277 of file ChWsbCmts.php.

◆ isRateAllowed()

ChWsbCmts::isRateAllowed (   $isPerformAction = false)

permissions functions

Definition at line 357 of file ChWsbCmts.php.

◆ isRemoveAllowed()

ChWsbCmts::isRemoveAllowed (   $isPerformAction = false)

Definition at line 390 of file ChWsbCmts.php.

◆ isRemoveAllowedAll()

ChWsbCmts::isRemoveAllowedAll ( )

Reimplemented in ChStoreCmts, ChGroupsCmts, ChEventsCmts, ChBlogsCmts, and ChWsbCmtsProfile.

Definition at line 407 of file ChWsbCmts.php.

◆ isTagsAllowed()

ChWsbCmts::isTagsAllowed ( )

Definition at line 267 of file ChWsbCmts.php.

◆ isValidSystem()

ChWsbCmts::isValidSystem (   $sSystem)

Definition at line 262 of file ChWsbCmts.php.

◆ maintenance()

ChWsbCmts::maintenance ( )

it is called on cron every day or similar period to clean old comment votes

Definition at line 300 of file ChWsbCmts.php.

◆ msgErrEditAllowed()

ChWsbCmts::msgErrEditAllowed ( )

Definition at line 384 of file ChWsbCmts.php.

◆ msgErrPostReplyAllowed()

ChWsbCmts::msgErrPostReplyAllowed ( )

Definition at line 373 of file ChWsbCmts.php.

◆ msgErrRateAllowed()

ChWsbCmts::msgErrRateAllowed ( )

Definition at line 362 of file ChWsbCmts.php.

◆ msgErrRemoveAllowed()

ChWsbCmts::msgErrRemoveAllowed ( )

Definition at line 395 of file ChWsbCmts.php.

◆ onAuthorDelete()

ChWsbCmts::onAuthorDelete (   $iAuthorId)

Definition at line 333 of file ChWsbCmts.php.

◆ onObjectDelete()

ChWsbCmts::onObjectDelete (   $iObjectId = 0)

Definition at line 326 of file ChWsbCmts.php.

◆ setId()

ChWsbCmts::setId (   $iId)

set id to operate with votes

Definition at line 251 of file ChWsbCmts.php.

Member Data Documentation

◆ $_aCmtElements

ChWsbCmts::$_aCmtElements = array ()

Definition at line 107 of file ChWsbCmts.php.

◆ $_aMoodText

ChWsbCmts::$_aMoodText
Initial value:
= array(
'-1' => '_sys_txt_cmt_mood_negative',
'0' => '_sys_txt_cmt_mood_neutral',
'1' => '_sys_txt_cmt_mood_positive',
)

Definition at line 110 of file ChWsbCmts.php.

◆ $_aSystem

ChWsbCmts::$_aSystem = array ()

Definition at line 106 of file ChWsbCmts.php.

◆ $_iId

ChWsbCmts::$_iId = 0

Definition at line 100 of file ChWsbCmts.php.

◆ $_oQuery

ChWsbCmts::$_oQuery = null

Definition at line 108 of file ChWsbCmts.php.

◆ $_sOrder

ChWsbCmts::$_sOrder = 'desc'

Definition at line 109 of file ChWsbCmts.php.

◆ $_sSystem

ChWsbCmts::$_sSystem = 'profile'

Definition at line 105 of file ChWsbCmts.php.

◆ $bDynamic

ChWsbCmts::$bDynamic = false

Definition at line 103 of file ChWsbCmts.php.

◆ $iAutoHideRootPostForm

ChWsbCmts::$iAutoHideRootPostForm = 0

Definition at line 102 of file ChWsbCmts.php.

◆ $iGlobAllowHtml

ChWsbCmts::$iGlobAllowHtml

Definition at line 101 of file ChWsbCmts.php.


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