mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 19:21:40 +09:00
Add to comment voted notify feature.
This commit is contained in:
parent
42ba503bea
commit
a771266443
3 changed files with 64 additions and 1 deletions
|
|
@ -45,6 +45,8 @@ class ncenterlite extends ModuleObject
|
|||
array('document.updateVotedCount', 'ncenterlite', 'controller', 'triggerAfterVotedupdate', 'after'),
|
||||
array('moduleHandler.init', 'ncenterlite', 'controller', 'triggerAddMemberMenu', 'after'),
|
||||
array('document.moveDocumentToTrash', 'ncenterlite', 'controller', 'triggerAfterMoveToTrash', 'after'),
|
||||
array('comment.updateVotedCount', 'ncenterlite', 'controller', 'triggerAfterCommentVotedCount', 'after'),
|
||||
array('comment.updateVotedCountCancel', 'ncenterlite', 'controller', 'triggerAfterCommentVotedCancel', 'after'),
|
||||
);
|
||||
|
||||
private $delete_triggers = array(
|
||||
|
|
|
|||
|
|
@ -366,6 +366,56 @@ class ncenterliteController extends ncenterlite
|
|||
$output = $this->_insertNotify($args);
|
||||
}
|
||||
|
||||
function triggerAfterCommentVotedCount($obj)
|
||||
{
|
||||
$oCommentModel = new commentModel();
|
||||
$oComment = $oCommentModel->getComment($obj->comment_srl);
|
||||
|
||||
$content = $oComment->get('content');
|
||||
$document_srl = $oComment->get('document_srl');
|
||||
|
||||
$args = new stdClass();
|
||||
$args->config_type = 'vote';
|
||||
$args->member_srl = $obj->member_srl;
|
||||
$args->srl = $document_srl;
|
||||
$args->target_p_srl = $obj->comment_srl;
|
||||
$args->target_srl = $obj->comment_srl;
|
||||
$args->type = $this->_TYPE_COMMENT;
|
||||
$args->target_type = $this->_TYPE_VOTED;
|
||||
$args->target_summary = cut_str(trim(utf8_normalize_spaces(strip_tags($content))), 50);
|
||||
$args->regdate = date('YmdHis');
|
||||
$args->notify = $this->_getNotifyId($args);
|
||||
$args->target_url = getNotEncodedFullUrl('', 'document_srl', $document_srl, '_comment_srl', $obj->comment_srl) . '#comment_' . $obj->comment_srl;
|
||||
$output = $this->_insertNotify($args);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
function triggerAfterCommentVotedCancel($obj)
|
||||
{
|
||||
$oCommentModel = new commentModel();
|
||||
$oComment = $oCommentModel->getComment($obj->comment_srl);
|
||||
|
||||
$document_srl = $oComment->get('document_srl');
|
||||
|
||||
$args = new stdClass();
|
||||
$args->type = $this->_TYPE_COMMENT;
|
||||
$args->target_type = $this->_TYPE_VOTED;
|
||||
$args->target_srl = $obj->comment_srl;
|
||||
$args->srl = $document_srl;
|
||||
$output = executeQuery('ncenterlite.deleteNotifyByTargetType', $args);
|
||||
if($output->toBool())
|
||||
{
|
||||
$this->removeFlagFile($obj->member_srl);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
function triggerAfterDeleteComment(&$obj)
|
||||
{
|
||||
$oNcenterliteModel = getModel('ncenterlite');
|
||||
|
|
@ -394,7 +444,6 @@ class ncenterliteController extends ncenterlite
|
|||
{
|
||||
foreach($member_srls as $member_srl)
|
||||
{
|
||||
//Remove flag files
|
||||
$this->removeFlagFile($member_srl);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
12
modules/ncenterlite/queries/deleteNotifyByTargetType.xml
Normal file
12
modules/ncenterlite/queries/deleteNotifyByTargetType.xml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<query id="deleteNotifyByTargetType" action="delete">
|
||||
<tables>
|
||||
<table name="ncenterlite_notify" />
|
||||
</tables>
|
||||
|
||||
<conditions>
|
||||
<condition operation="equal" column="srl" var="srl" filter="number" notnull="notnull" />
|
||||
<condition operation="equal" column="target_srl" var="target_srl" filter="number" notnull="notnull" pipe="and" />
|
||||
<condition operation="equal" column="type" var="type" notnull="notnull" pipe="and" />
|
||||
<condition operation="equal" column="target_type" var="target_type" notnull="notnull" pipe="and" />
|
||||
</conditions>
|
||||
</query>
|
||||
Loading…
Add table
Add a link
Reference in a new issue