Go to the documentation of this file.
22 if (
empty($sSystem) || !$this->_aSystem)
25 $this->_sJsObjName =
'oCmts' . ucfirst($sSystem) .
$iId;
27 'page_url' =>
'javascript:void(0);',
29 'count' => $this->_oQuery->getObjectCommentsCount($this->getId(), 0),
30 'per_page' => $this->getPerView(),
31 'sorting' => $this->_sOrder,
33 'per_page_interval' => 3,
34 'on_change_page' => $this->_sJsObjName .
'.changePage(this, {start}, {per_page})',
35 'on_change_per_page' => $this->_sJsObjName .
'.changePerPage(this)',
36 'on_change_sorting' => $this->_sJsObjName .
'.changeOrder(this)',
39 $this->_sStylePrefix = isset($this->_aSystem[
'root_style_prefix']) ? $this->_aSystem[
'root_style_prefix'] :
'cmt';
41 $GLOBALS[
'oSysTemplate']->addJsTranslation(
'_sys_txt_cmt_loading');
51 return $GLOBALS[
'oSysTemplate']->parseHtmlByName(
'cmts_main.html', array(
52 'html_id' => $this->_sSystem .
'-' . $this->
getId(),
55 'ch_if:show_paginate' => array(
56 'condition' => $sPaginate !==
"",
58 'content' => $sPaginate
61 'ch_if:show_post' => array(
78 if($iCmtsParentId == 0 &&
$iPerPage == -1)
81 $sRet =
'<ul class="cmts">';
85 $sRet .=
'<li class="cmt-no">' .
_t(
'_There are no comments yet') .
'</li>';
88 foreach ($aCmts
as $k => $r) {
92 if($r[
'cmt_rated'] == -1 || $r[
'cmt_rate'] < $this->_aSystem[
'viewing_threshold']) {
93 $sRet .=
'<li id="cmt' . $r[
'cmt_id'] .
'-hidden" class="cmt-replacement">';
94 $sRet .=
_t(
'_hidden_comment',
getNickName($r[
'cmt_author_id'])) .
' ' . ($r[
'cmt_replies'] > 0 ?
_t(
'_Show N replies', $r[
'cmt_replies']) .
'. ' :
'') .
'<a href="javascript:void(0)" onclick="javascript:' . $this->_sJsObjName .
'.showReplacement(' . $r[
'cmt_id'] .
')">' .
_t(
'_show_replacement') .
'</a>.';
99 $sClass =
' cmt-hidden';
102 $isOwnComment = $r[
'cmt_author_id'] == $this->
_getAuthorId();
104 $sClass .=
' cmt-mine';
106 $sRet .=
'<li id="cmt' . $r[
'cmt_id'] .
'" class="cmt' . $sClass .
'"><a id="' . $sAnchor .
'" name="' . $sAnchor .
'"></a>';
108 $sRet .=
'<div class="cmt-cont">';
111 $sRet .=
'<table class="cmt-balloon ch-def-round-corners-with-border">';
120 $sRet .=
'</div></li>';
140 $sRet = $sClass =
'';
141 if($r[
'cmt_rated'] == -1 || $r[
'cmt_rate'] < $this->_aSystem[
'viewing_threshold']) {
142 $sRet .=
'<li id="cmt' . $r[
'cmt_id'] .
'-hidden" class="cmt-replacement">';
143 $sRet .=
_t(
'_hidden_comment', $r[
'cmt_author_name']) .
' ' . ($r[
'cmt_replies'] > 0 ?
_t(
'_Show N replies', $r[
'cmt_replies']) .
'. ' :
'') .
'<a href="javascript:void(0)" onclick="javascript:' . $this->_sJsObjName .
'.showReplacement(' . $r[
'cmt_id'] .
')">' .
_t(
'_show_replacement') .
'</a>.';
148 $sClass =
' cmt-hidden';
151 $sRet .=
'<li id="cmt' . $r[
'cmt_id'] .
'" class="cmt cmt-mine cmt-just-posted' . $sClass .
'"><a id="' . $sAnchor .
'" name="' . $sAnchor .
'"></a>';
152 $sRet .=
'<div class="cmt-cont">';
158 $sRet .=
'<table class="cmt-balloon ch-def-round-corners-with-border">';
167 return $this->_oPaginate->getPaginate($iStart,
$iPerPage);
177 'cmt_replies' => $this->_oQuery->getObjectCommentsCount($this->getId(), 0),
181 $sRet =
'<div class="cmt-replies">';
182 if($aParams[
'cmt_replies'])
186 $sRet .=
'<div class="cmt-post-reply-to">';
191 $sRet .=
'<div class="clear_both"> </div>';
202 $GLOBALS[
'oSysTemplate']->addCss(array(
'cmts.css',
'cmts_phone.css'));
212 $GLOBALS[
'oSysTemplate']->addJs(
'ChWsbCmts.js');
213 $GLOBALS[
'oSysTemplate']->addJsTranslation(array(
230 'sObjName' => $this->_sJsObjName,
231 'sBaseUrl' => CH_WSB_URL_ROOT,
233 'sSystemTable' => $this->_aSystem[
'table_cmts'],
235 'iObjId' => $this->
getId(),
237 'sDefaultErrMsg' =>
_t(
'_Error occured'),
238 'sConfirmMsg' =>
_t(
'_Are_you_sure'),
239 'sAnimationEffect' => $this->_aSystem[
'animation_effect'],
240 'sAnimationSpeed' => $this->_aSystem[
'animation_speed'],
243 'iAutoHideRootPostForm' => $this->iAutoHideRootPostForm,
244 'iGlobAllowHtml' => $this->iGlobAllowHtml == 1 ? 1 : 0,
246 'oCmtElements' => $this->_aCmtElements
248 return $GLOBALS[
'oSysTemplate']->_wrapInTagJsCode(
"var " . $this->_sJsObjName .
" = new ChWsbCmts(" . json_encode($aParams) .
");");
256 if ($a[
'cmt_author_id'] && $a[
'cmt_author_name'])
257 $sAuthor =
'<a href="' .
getProfileLink($a[
'cmt_author_id']) .
'" class="cmt-author">' .
getNickName($a[
'cmt_author_id']) .
'</a>';
259 $sAuthor =
_t(
'_Anonymous');
261 $sRet =
'<tr class="cmt-head ch-def-font-small"><td class="' . $this->_sStylePrefix .
'-head-l"> </td><td class="' . $this->_sStylePrefix .
'-head-m">' . $sAuthor .
':</td><td class="' . $this->_sStylePrefix .
'-head-r"> </td></tr>';
269 <td class="' . $this->_sStylePrefix .
'-cont-l"> </td>
270 <td class="' . $this->_sStylePrefix .
'-cont-m">' .
271 ($this->_aSystem[
'is_mood'] ?
'<div class="cmt-mood">' .
_t($this->_aMoodText[$a[
'cmt_mood']]) .
'</div>' :
'') .
274 <td class="' . $this->_sStylePrefix .
'-cont-r"> </td>';
280 if ($a[
'cmt_rated'] || $a[
'cmt_rate'] < $this->_aSystem[
'viewing_threshold'])
281 $sClass =
' cmt-rate-disabled';
284 <div class="cmt-rate'.$sClass.
'">
285 <div class="cmt-points">'.
_t( (1 == $a[
'cmt_rate'] || -1 == $a[
'cmt_rate']) ?
'_N point' :
'_N points', $a[
'cmt_rate']).
'</div>
286 <div class="cmt-buttons"><a title="'.
_t(
'_Thumb Up').
'" href="javascript:void(0)" onclick="' . $this->_sJsObjName .
'.cmtRate(this);" id="cmt-pos-'.$a[
'cmt_id'].
'" class="cmt-pos"><i class="sys-icon plus-circle"></i></a><a title="'.
_t(
'_Thumb Down').
'" href="javascript:void(0)" onclick="' . $this->_sJsObjName .
'.cmtRate(this);" id="cmt-neg-'.$a[
'cmt_id'].
'" class="cmt-neg"><i class="sys-icon minus-circle"></i></a></div>
287 <div class="clear_both"> </div>
297 $sAgo = $a[
'cmt_ago'];
300 if(!
empty($sBaseUrl))
301 $sAgo =
'<a href="' . $sBaseUrl .
'#' . $this->
_getAnchor($a[
'cmt_id']) .
'">' . $sAgo .
'</a>';
303 $sRet =
'<tr id="cmt-jp-'.$a[
'cmt_id'].
'" class="cmt-foot ch-def-font-small"><td class="' . $this->_sStylePrefix .
'-cont-l"> </td><td class="' . $this->_sStylePrefix .
'-cont-m">';
304 $sRet .=
'<span class="cmt-posted-ago">' . $sAgo .
'</span>';
306 if($this->_aSystem[
'is_mood'])
307 $sRet .=
'<span class="sys-bullet"></span><span class="cmt-mood-text">' .
_t($this->_aMoodText[$a[
'cmt_mood']]) .
'</span>';
309 if($isRemoveAllowedPermanently)
310 $sRet .=
'<span class="sys-bullet"></span><a class="cmt-comment-manage-delete" title="' .
_t(
'_Delete') .
'" href="javascript:void(0)" onclick="' . $this->_sJsObjName .
'.cmtRemove(this, \'' . $a[
'cmt_id'] .
'\');
return false;
">'._t('_Delete').'</a>';
312 if((($isJustPosted && $n) || $isEditAllowedPermanently) && strpos($a['cmt_text'], 'video_comments') === false)
313 $sRet .= '<span class="sys-bullet
"></span><a class="cmt-
comment-manage-
edit" title="'._t('_Edit
').'" href="javascript:
void(0)
" onclick="' . $this->_sJsObjName . '.cmtEdit(
this, \
'' . $a[
'cmt_id'] .
'\');
return false;
">'._t('_Edit').'</a>';
315 if($a['cmt_replies'])
316 $sRet .= '<span class="sys-bullet
"></span>' . $this->_getRepliesBox($a);
318 if(!$isJustPosted && $this->isPostReplyAllowed())
319 $sRet .= '<span class="sys-bullet
"></span>' . $this->_getPostReplyBoxTo($a);
321 if ($isJustPosted && $n && !$isEditAllowedPermanently)
322 $sRet .= '<span class="sys-bullet
"></span>' . _t('_edit_available_for_N_seconds', $n);
324 $sRet .= '</td><td class="' . $this->_sStylePrefix . '-cont-r
"> </td></tr>';
327 function _getRepliesBox(&$a)
329 $bComments = isset($a['cmt_type']) && $a['cmt_type'] == 'comment';
330 $sClassPrefix = $bComments ? 'cmt-comments' : 'cmt-replies';
332 $sCmtReplies = '<span class="' . $sClassPrefix . '-count
">' . $a['cmt_replies'] . '</span>';
334 $sContentShow = _t(($bComments ? '_Show N comments' : '_Show N replies'), $sCmtReplies);
335 $sContentHide = _t(($bComments ? '_Hide N comments' : '_Hide N replies'), $sCmtReplies);
338 $sRet .= '<a class="' . $sClassPrefix . ' ' . $sClassPrefix . '-
show" href="javascript:
void(0)
" onclick="' . $this->_sJsObjName . '.toggleCmts(
this, \
'' . $a[
'cmt_id'] .
'\');
return false;
">' . $sContentShow . '</a>';
339 $sRet .= '<a class="' . $sClassPrefix . ' ' . $sClassPrefix . '-hide
" href="javascript:
void(0)
" onclick="' . $this->_sJsObjName . '.toggleCmts(
this, \
'' . $a[
'cmt_id'] .
'\');
return false;
">' . $sContentHide . '</a>';
343 function _getPostReplyBoxTo(&$a)
345 $sContent = _t(isset($a['cmt_type']) && $a['cmt_type'] == 'comment' ? '_Comment to this comment' : '_Reply to this comment');
346 return '<a class="cmt-reply-toggle
" href="javascript:
void(0)
" onclick="' . $this->_sJsObjName . '.toggleReply(
this, \
''.$a[
'cmt_id'].
'\');
return false;
">' . $sContent . '</a>';
348 function _getPostReplyBox($sType = 'comment', $iCmtParentId = 0)
350 if($sType == 'comment')
351 $sSwitcher = '<a class="cmt-
post-reply-text inactive
" href="javascript:
void(0)
" onclick="javascript:
' . $this->_sJsObjName . '.toggleType(
this)
"><i class="sys-icon pencil
"></i> ' . _t('_Add Your Comment') . '</a>' . (getSettingValue("video_comments
", "status
", "main
") == "enabled" ? '<a class="cmt-
post-reply-video
" href="javascript:
void(0)
" onclick="javascript:
' . $this->_sJsObjName . '.toggleType(
this)
"><i class="sys-icon film
"></i> ' . _t('_Record Your Comment') . '</a>' : '');
352 else if($sType == 'reply')
353 $sSwitcher = '<a class="cmt-
post-reply-text inactive
" href="javascript:
void(0)
" onclick="javascript:
' . $this->_sJsObjName . '.toggleType(
this)
"><i class="sys-icon pencil
"></i> ' . _t('_Reply as text') . '</a>' . (getSettingValue("video_comments
", "status
", "main
") == "enabled" ? '<a class="cmt-
post-reply-video
" href="javascript:
void(0)
" onclick="javascript:
' . $this->_sJsObjName . '.toggleType(
this)
"><i class="sys-icon film
"></i> ' . _t('_Reply as video') . '</a>' : '');
356 <div class="cmt-
post-reply
">
357 ' . $this->_getAuthorIcon(array('cmt_author_id' => $this->_getAuthorId())) . '
358 <table class="cmt-balloon ch-def-round-corners-
with-border
">
359 <tr class="cmt-head
">
360 <td class="cmt-head-l
"> </td>
361 <td class="cmt-head-m
">' . $sSwitcher . '<div class="clear_both
"></div></td>
362 <td class="cmt-head-r
"> </td>
364 <tr class="cmt-cont
">
365 <td class="cmt-cont-l
"> </td>
366 <td class="cmt-cont-m
">' . $this->_getFormBox('post', array('parent_id' => $iCmtParentId)) . '</td>
367 <td class="cmt-cont-r
"> </td>
369 <tr class="cmt-foot
">
370 <td class="cmt-foot-l
"> </td>
371 <td class="cmt-foot-m
"> </td>
372 <td class="cmt-foot-r
"> </td>
377 function _getFormBox($sType, $aCmt = array())
379 $iCmtId = !empty($aCmt['id']) ? (int)$aCmt['id'] : 0;
380 $iCmtParentId = !empty($aCmt['parent_id']) ? (int)$aCmt['parent_id'] : 0;
381 $sCmtText = !empty($aCmt['text']) ? $this->_prepareTextForEdit($aCmt['text']) : '';
383 $sTextareaId = $this->_sSystem . "_cmt_
" . $sType . "_textarea_
" . $this->_iId . "_
";
386 $sFunction = "submitComment(
this)
";
387 $sTextareaId .= $iCmtParentId;
391 $sFunction = "updateComment(
this,
'" . $iCmtId . "')
";
392 $sTextareaId .= $iCmtId;
396 if($this->_aSystem['is_mood'])
398 <div class="cmt-
post-reply-mood
">
399 <div class="cmt-
post-mood-ctl
"><input type="radio
" name="CmtMood
" value="1
" id="' . $this->_sSystem . '-mood-positive
" /></div>
400 <div class="cmt-
post-mood-lbl
"><label for="' . $this->_sSystem . '-mood-positive
">' . _t('_Comment Positive') . '</label></div>
401 <div class="cmt-
post-mood-ctl
"><input type="radio
" name="CmtMood
" value="-1
" id="' . $this->_sSystem . '-mood-negative
" /></div>
402 <div class="cmt-
post-mood-lbl
"><label for="' . $this->_sSystem . '-mood-negative
">' . _t('_Comment Negative') . '</label></div>
403 <div class="cmt-
post-mood-ctl
"><input type="radio
" name="CmtMood
" value="0
" id="' . $this->_sSystem . '-mood-neutral
" checked="checked
" /></div>
404 <div class="cmt-
post-mood-lbl
"><label for="' . $this->_sSystem . '-mood-neutral
">' . _t('_Comment Neutral') . '</label></div>
405 <div class="clear_both
"> </div>
409 <form name="cmt-
post-reply
" onsubmit="' . $this->_sJsObjName . '.
' . $sFunction . ';
return false;
">
410 <input type="hidden
" name="CmtParent
" value="' . $iCmtParentId . '" />
411 <input type="hidden
" name="CmtType
" value="text
" />
412 <div class="cmt-
post-reply-text
">
413 <textarea class="cmt-text-
' . $sType . ' ch-def-round-corners-
with-border
" id="' . $sTextareaId . '" name="CmtText
">' . $sCmtText . '</textarea>
415 <div class="cmt-
post-reply-video
">' . getApplicationContent('video_comments', 'recorder', array('user' => $this->_getAuthorId(), 'password' => $this->_getAuthorPassword(), 'extra' => implode('_', array($this->_sSystem . '-' . $this->getId(), $iCmtParentId))), true) . '</div>
416 <div class="cmt-
post-reply-
post"><button class="ch-btn ch-btn-small
" type="submit
">' . _t('_Submit Comment') . '</button></div>
420 if($this->iGlobAllowHtml == 1) {
421 ch_import('ChWsbEditor');
422 $oEditor = ChWsbEditor::getObjectInstance();
423 $sContent .= $oEditor ? $oEditor->attachEditor ('#' . $sTextareaId, CH_EDITOR_MINI, $this->bDynamic) : '';
428 function _getAuthorIcon ($a)
431 if (!$a['cmt_author_id'] || !getProfileInfo($a['cmt_author_id'])) {
432 if (!@include_once (CH_DIRECTORY_PATH_MODULES . 'cheetah/avatar/include.php'))
434 return '<div class="thumbnail_block thumbnail_block_icon
" style="float:none;
"><div class="thumbnail_image
"><img class="thumbnail_image_file ch-def-thumbnail ch-def-shadow ch-img-retina
" src="' . $oFunctions->getSexPic('', 'small
') . '" /></div></div>';
436 return $oFunctions->getMemberIcon($a['cmt_author_id']);
439 function _getBrowse()
441 return $GLOBALS['oSysTemplate']->parseHtmlByName('cmts_top_controls.html', array(
442 'js_object' => $this->_sJsObjName,
443 'sorting' => $this->_oPaginate->getSorting(array('asc' => '_oldest first', 'desc' => '_newest first')),
444 'expand_all' => _t('_expand all'),
445 'pages' => $this->_oPaginate->getPages()
_prepareTextForOutput($s)
getActions($iCmtId, $sType='reply')
post($sTable, $sId, $sAuthor, $sParent, $sMood, $sFileId)
ch_import($sClassName, $aModule=array())
if(!defined("WIDGET_STATUS_ENABLED")) define("WIDGET_STATUS_ENABLED" enabled
getPaginate($iStart=-1, $iPerPage=-1)
isPostReplyAllowed($isPerformAction=false)
getComments($iCmtsParentId=0, $sCmtOrder='asc', $iStart=0, $iPerPage=-1)
if the work is an executable linked with the with the complete machine readable work that uses the as object code and or source so that the user can modify the Library and then relink to produce a modified executable containing the modified rather than copying library functions into the if the user installs as long as the modified version is interface compatible with the version that the work was made with c Accompany the work with a written valid for at least three to give the same user the materials specified in for a charge no more than the cost of performing this distribution d If distribution of the work is made by offering access to copy from a designated offer equivalent access to copy the above specified materials from the same place e Verify that the user has already received a copy of these materials or that you have already sent this user a copy For an the required form of the work that uses the Library must include any data and utility programs needed for reproducing the executable from it as a special the materials to be distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system Such a contradiction means you cannot use both them and the Library together in an executable that you distribute You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities not covered by this and distribute such a combined provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise and provided that you do these two uncombined with any other library facilities This must be distributed under the terms of the Sections above b Give prominent notice with the combined library of the fact that part of it is a work based on the and explaining where to find the accompanying uncombined form of the same work You may not link or distribute the Library except as expressly provided under this License Any attempt otherwise to link or distribute the Library is void
__construct( $sSystem, $iId, $iInit=1)
_getActionsBox(&$a, $isJustPosted)
a choreographic work or entertainment in dumb show
getCommentsArray($iCmtParentId, $sCmtOrder, $iStart=0, $iCount=-1)
if(!defined("BOARD_TYPE_EDIT")) define("BOARD_TYPE_EDIT" edit
isRemoveAllowed($isPerformAction=false)
that in the case of a Adaptation or at a minimum such credit will if a credit for all contributing authors of the Adaptation or Collection then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors For the avoidance of You may only use the credit required by this Section for the purpose of attribution in the manner set out above by exercising Your rights under this You may not implicitly or explicitly assert or imply any connection with
_t($key, $arg0="", $arg1="", $arg2="")
_getPostReplyBox($sType='comment', $iCmtParentId=0)
getProfileLink( $iID, $sLinkAdd='')
getForm($sType, $iParentId)
getComment($iCmtId, $sType='new')
__construct( $sSystem, $iId, $iInit=1)
isEditAllowed($isPerformAction=false)
Attr AllowedRel this is empty