Cheetah
|
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 | |
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.
ChWsbCmts::__construct | ( | $sSystem, | |
$iId, | |||
$iInit = 1 |
|||
) |
Constructor $sSystem - comments system name $iId - obect id to be commented
Reimplemented in ChWallCmts, ChVideosCmtsAlbums, ChVideosCmts, ChSoundsCmtsAlbums, ChSoundsCmts, ChPhotosCmtsAlbums, ChPhotosCmts, ChNewsCmts, ChFilesCmtsAlbums, ChFilesCmts, ChFdbCmts, ChArlCmts, ChWsbTextCmts, ChWsbFilesCmtsAlbums, ChWsbFilesCmts, ChWsbCmtsProfile, ChTemplCmtsView, ChTemplCmtsView, ChTemplCmtsView, and ChBaseCmtsView.
Definition at line 121 of file ChWsbCmts.php.
ChWsbCmts::_getAnchor | ( | $iId | ) |
Definition at line 691 of file ChWsbCmts.php.
ChWsbCmts::_getAuthorId | ( | ) |
private functions
Definition at line 632 of file ChWsbCmts.php.
ChWsbCmts::_getAuthorIp | ( | ) |
Definition at line 642 of file ChWsbCmts.php.
ChWsbCmts::_getAuthorPassword | ( | ) |
Definition at line 637 of file ChWsbCmts.php.
ChWsbCmts::_isSpam | ( | $s | ) |
Definition at line 686 of file ChWsbCmts.php.
ChWsbCmts::_prepareTextForEdit | ( | $s | ) |
Definition at line 647 of file ChWsbCmts.php.
ChWsbCmts::_prepareTextForOutput | ( | $s | ) |
Definition at line 670 of file ChWsbCmts.php.
ChWsbCmts::_prepareTextForSave | ( | $s | ) |
Definition at line 654 of file ChWsbCmts.php.
ChWsbCmts::_triggerComment | ( | ) |
Definition at line 675 of file ChWsbCmts.php.
ChWsbCmts::actionCmtEdit | ( | ) |
Definition at line 539 of file ChWsbCmts.php.
ChWsbCmts::actionCmtEditSubmit | ( | ) |
Definition at line 556 of file ChWsbCmts.php.
ChWsbCmts::actionCmtGet | ( | ) |
Definition at line 450 of file ChWsbCmts.php.
ChWsbCmts::actionCmtPost | ( | ) |
Reimplemented in ChWallCmts.
Definition at line 459 of file ChWsbCmts.php.
ChWsbCmts::actionCmtRate | ( | ) |
Definition at line 599 of file ChWsbCmts.php.
ChWsbCmts::actionCmtRemove | ( | ) |
Definition at line 499 of file ChWsbCmts.php.
ChWsbCmts::actionCmtsGet | ( | ) |
Definition at line 437 of file ChWsbCmts.php.
ChWsbCmts::actionFormGet | ( | ) |
Definition at line 426 of file ChWsbCmts.php.
ChWsbCmts::actionPaginateGet | ( | ) |
actions functions
Definition at line 415 of file ChWsbCmts.php.
ChWsbCmts::checkAction | ( | $iAction, | |
$isPerformAction = false |
|||
) |
check if user can post/edit or delete own comments
Definition at line 214 of file ChWsbCmts.php.
ChWsbCmts::checkActionErrorMsg | ( | $iAction | ) |
Definition at line 221 of file ChWsbCmts.php.
ChWsbCmts::getAllowedEditTime | ( | ) |
Definition at line 282 of file ChWsbCmts.php.
ChWsbCmts::getBaseUrl | ( | ) |
Reimplemented in ChStoreCmts, ChSitesCmts, ChPollCmts, ChGroupsCmts, ChEventsCmts, ChBlogsCmts, ChAdsCmts, ChWsbTextCmts, ChWsbFilesCmtsAlbums, ChWsbFilesCmts, and ChWsbCmtsProfile.
Definition at line 257 of file ChWsbCmts.php.
ChWsbCmts::getCommentRow | ( | $iCmtId | ) |
Definition at line 321 of file ChWsbCmts.php.
ChWsbCmts::getCommentsArray | ( | $iCmtParentId, | |
$sCmtOrder, | |||
$iStart = 0 , |
|||
$iCount = -1 |
|||
) |
comments functions
Definition at line 316 of file ChWsbCmts.php.
ChWsbCmts::getCommentsTableName | ( | ) |
Definition at line 342 of file ChWsbCmts.php.
ChWsbCmts::getId | ( | ) |
Definition at line 228 of file ChWsbCmts.php.
ChWsbCmts::getObjectCommentsCount | ( | $iObjectId = 0 | ) |
Definition at line 347 of file ChWsbCmts.php.
|
static |
get comments object instanse
$sSys | comments object name |
$iId | associated content id, where comments are postred in |
$iInit | perform initialization |
Definition at line 154 of file ChWsbCmts.php.
ChWsbCmts::getOrder | ( | ) |
Definition at line 243 of file ChWsbCmts.php.
ChWsbCmts::getPerView | ( | ) |
Definition at line 287 of file ChWsbCmts.php.
ChWsbCmts::getSystemId | ( | ) |
Definition at line 292 of file ChWsbCmts.php.
ChWsbCmts::getSystemName | ( | ) |
Definition at line 238 of file ChWsbCmts.php.
|
static |
Definition at line 171 of file ChWsbCmts.php.
ChWsbCmts::init | ( | $iId | ) |
Reimplemented in ChWallCmts.
Definition at line 202 of file ChWsbCmts.php.
ChWsbCmts::isEditAllowed | ( | $isPerformAction = false | ) |
Definition at line 379 of file ChWsbCmts.php.
ChWsbCmts::isEditAllowedAll | ( | ) |
Reimplemented in ChStoreCmts, ChGroupsCmts, ChEventsCmts, and ChBlogsCmts.
Definition at line 401 of file ChWsbCmts.php.
ChWsbCmts::isEnabled | ( | ) |
Definition at line 233 of file ChWsbCmts.php.
ChWsbCmts::isNl2br | ( | ) |
Definition at line 272 of file ChWsbCmts.php.
ChWsbCmts::isPostReplyAllowed | ( | $isPerformAction = false | ) |
Reimplemented in ChStoreCmts, ChGroupsCmts, ChEventsCmts, ChBlogsCmts, and ChAdsCmts.
Definition at line 368 of file ChWsbCmts.php.
ChWsbCmts::isRatable | ( | ) |
Definition at line 277 of file ChWsbCmts.php.
ChWsbCmts::isRateAllowed | ( | $isPerformAction = false | ) |
permissions functions
Definition at line 357 of file ChWsbCmts.php.
ChWsbCmts::isRemoveAllowed | ( | $isPerformAction = false | ) |
Definition at line 390 of file ChWsbCmts.php.
ChWsbCmts::isRemoveAllowedAll | ( | ) |
Reimplemented in ChStoreCmts, ChGroupsCmts, ChEventsCmts, ChBlogsCmts, and ChWsbCmtsProfile.
Definition at line 407 of file ChWsbCmts.php.
ChWsbCmts::isTagsAllowed | ( | ) |
Definition at line 267 of file ChWsbCmts.php.
ChWsbCmts::isValidSystem | ( | $sSystem | ) |
Definition at line 262 of file ChWsbCmts.php.
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.
ChWsbCmts::msgErrEditAllowed | ( | ) |
Definition at line 384 of file ChWsbCmts.php.
ChWsbCmts::msgErrPostReplyAllowed | ( | ) |
Definition at line 373 of file ChWsbCmts.php.
ChWsbCmts::msgErrRateAllowed | ( | ) |
Definition at line 362 of file ChWsbCmts.php.
ChWsbCmts::msgErrRemoveAllowed | ( | ) |
Definition at line 395 of file ChWsbCmts.php.
ChWsbCmts::onAuthorDelete | ( | $iAuthorId | ) |
Definition at line 333 of file ChWsbCmts.php.
ChWsbCmts::onObjectDelete | ( | $iObjectId = 0 | ) |
Definition at line 326 of file ChWsbCmts.php.
ChWsbCmts::setId | ( | $iId | ) |
set id to operate with votes
Definition at line 251 of file ChWsbCmts.php.
ChWsbCmts::$_aCmtElements = array () |
Definition at line 107 of file ChWsbCmts.php.
ChWsbCmts::$_aMoodText |
Definition at line 110 of file ChWsbCmts.php.
ChWsbCmts::$_aSystem = array () |
Definition at line 106 of file ChWsbCmts.php.
ChWsbCmts::$_iId = 0 |
Definition at line 100 of file ChWsbCmts.php.
ChWsbCmts::$_oQuery = null |
Definition at line 108 of file ChWsbCmts.php.
ChWsbCmts::$_sOrder = 'desc' |
Definition at line 109 of file ChWsbCmts.php.
ChWsbCmts::$_sSystem = 'profile' |
Definition at line 105 of file ChWsbCmts.php.
ChWsbCmts::$bDynamic = false |
Definition at line 103 of file ChWsbCmts.php.
ChWsbCmts::$iAutoHideRootPostForm = 0 |
Definition at line 102 of file ChWsbCmts.php.
ChWsbCmts::$iGlobAllowHtml |
Definition at line 101 of file ChWsbCmts.php.