|
|
@@ -770,7 +770,10 @@ class BxBaseModGeneralModule extends BxDolModule
|
|
|
|
|
|
array('group' => $sModule . '_vote', 'type' => 'insert', 'alert_unit' => $sModule, 'alert_action' => 'doVote', 'module_name' => $sModule, 'module_method' => 'get_notifications_vote', 'module_class' => 'Module', 'module_event_privacy' => $sEventPrivacy),
|
|
|
array('group' => $sModule . '_vote', 'type' => 'delete', 'alert_unit' => $sModule, 'alert_action' => 'undoVote'),
|
|
|
-
|
|
|
+
|
|
|
+ array('group' => $sModule . '_reaction', 'type' => 'insert', 'alert_unit' => $sModule . '_reactions', 'alert_action' => 'doVote', 'module_name' => $sModule, 'module_method' => 'get_notifications_reaction', 'module_class' => 'Module', 'module_event_privacy' => $sEventPrivacy),
|
|
|
+ array('group' => $sModule . '_reaction', 'type' => 'delete', 'alert_unit' => $sModule . '_reactions', 'alert_action' => 'undoVote'),
|
|
|
+
|
|
|
array('group' => $sModule . '_score_up', 'type' => 'insert', 'alert_unit' => $sModule, 'alert_action' => 'doVoteUp', 'module_name' => $sModule, 'module_method' => 'get_notifications_score_up', 'module_class' => 'Module', 'module_event_privacy' => $sEventPrivacy),
|
|
|
|
|
|
array('group' => $sModule . '_score_down', 'type' => 'insert', 'alert_unit' => $sModule, 'alert_action' => 'doVoteDown', 'module_name' => $sModule, 'module_method' => 'get_notifications_score_down', 'module_class' => 'Module', 'module_event_privacy' => $sEventPrivacy),
|
|
|
@@ -780,6 +783,7 @@ class BxBaseModGeneralModule extends BxDolModule
|
|
|
array('group' => 'comment', 'unit' => $sModule, 'action' => 'commentPost', 'types' => array('personal', 'follow_member', 'follow_context')),
|
|
|
array('group' => 'reply', 'unit' => $sModule, 'action' => 'replyPost', 'types' => array('personal')),
|
|
|
array('group' => 'vote', 'unit' => $sModule, 'action' => 'doVote', 'types' => array('personal', 'follow_member', 'follow_context')),
|
|
|
+ array('group' => 'vote', 'unit' => $sModule . '_reactions', 'action' => 'doVote', 'types' => array('personal', 'follow_member', 'follow_context')),
|
|
|
array('group' => 'score_up', 'unit' => $sModule, 'action' => 'doVoteUp', 'types' => array('personal', 'follow_member', 'follow_context')),
|
|
|
array('group' => 'score_down', 'unit' => $sModule, 'action' => 'doVoteDown', 'types' => array('personal', 'follow_member', 'follow_context'))
|
|
|
),
|
|
|
@@ -797,6 +801,9 @@ class BxBaseModGeneralModule extends BxDolModule
|
|
|
array('unit' => $sModule, 'action' => 'doVote'),
|
|
|
array('unit' => $sModule, 'action' => 'undoVote'),
|
|
|
|
|
|
+ array('unit' => $sModule . '_reactions', 'action' => 'doVote'),
|
|
|
+ array('unit' => $sModule . '_reactions', 'action' => 'undoVote'),
|
|
|
+
|
|
|
array('unit' => $sModule, 'action' => 'doVoteUp'),
|
|
|
array('unit' => $sModule, 'action' => 'doVoteDown'),
|
|
|
)
|
|
|
@@ -907,6 +914,35 @@ class BxBaseModGeneralModule extends BxDolModule
|
|
|
* Entry post vote for Notifications module
|
|
|
*/
|
|
|
public function serviceGetNotificationsVote($aEvent)
|
|
|
+ {
|
|
|
+ $CNF = &$this->_oConfig->CNF;
|
|
|
+
|
|
|
+ $iContentId = (int)$aEvent['object_id'];
|
|
|
+ $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
|
|
|
+ if(empty($aContentInfo) || !is_array($aContentInfo))
|
|
|
+ return array();
|
|
|
+
|
|
|
+ $oVote = BxDolVote::getObjectInstance($CNF['OBJECT_VOTES'], $iContentId);
|
|
|
+ if(!$oVote || !$oVote->isEnabled())
|
|
|
+ return array();
|
|
|
+
|
|
|
+ $sEntryUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aContentInfo[$CNF['FIELD_ID']]);
|
|
|
+ $sEntryCaption = isset($aContentInfo[$CNF['FIELD_TITLE']]) ? $aContentInfo[$CNF['FIELD_TITLE']] : strmaxtextlen($aContentInfo[$CNF['FIELD_TEXT']], 20, '...');
|
|
|
+
|
|
|
+ return array(
|
|
|
+ 'entry_sample' => $CNF['T']['txt_sample_single'],
|
|
|
+ 'entry_url' => $sEntryUrl,
|
|
|
+ 'entry_caption' => $sEntryCaption,
|
|
|
+ 'entry_author' => $aContentInfo[$CNF['FIELD_AUTHOR']],
|
|
|
+ 'subentry_sample' => $CNF['T']['txt_sample_vote_single'],
|
|
|
+ 'lang_key' => '', //may be empty or not specified. In this case the default one from Notification module will be used.
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Entry post vote for Notifications module
|
|
|
+ */
|
|
|
+ public function serviceGetNotificationsReaction($aEvent)
|
|
|
{
|
|
|
$CNF = &$this->_oConfig->CNF;
|
|
|
|
|
|
@@ -915,21 +951,33 @@ class BxBaseModGeneralModule extends BxDolModule
|
|
|
if(empty($aContentInfo) || !is_array($aContentInfo))
|
|
|
return array();
|
|
|
|
|
|
- $oVote = BxDolVote::getObjectInstance($CNF['OBJECT_VOTES'], $iContentId);
|
|
|
- if(!$oVote || !$oVote->isEnabled())
|
|
|
+ $oReaction = BxDolVote::getObjectInstance($CNF['OBJECT_REACTIONS'], $iContentId);
|
|
|
+ if(!$oReaction || !$oReaction->isEnabled())
|
|
|
+ return array();
|
|
|
+
|
|
|
+ $aSubentry = $oReaction->getTrackBy(array('type' => 'id', 'id' => (int)$aEvent['subobject_id']));
|
|
|
+ if(empty($aSubentry) || !is_array($aSubentry))
|
|
|
return array();
|
|
|
|
|
|
+ $aSubentrySampleParams = array();
|
|
|
+ $aReaction = $oReaction->getReaction($aSubentry['reaction']);
|
|
|
+ if(!empty($aReaction['title']))
|
|
|
+ $aSubentrySampleParams[] = $aReaction['title'];
|
|
|
+ else
|
|
|
+ $aSubentrySampleParams[] = '_undefined';
|
|
|
+
|
|
|
$sEntryUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aContentInfo[$CNF['FIELD_ID']]);
|
|
|
$sEntryCaption = isset($aContentInfo[$CNF['FIELD_TITLE']]) ? $aContentInfo[$CNF['FIELD_TITLE']] : strmaxtextlen($aContentInfo[$CNF['FIELD_TEXT']], 20, '...');
|
|
|
|
|
|
- return array(
|
|
|
- 'entry_sample' => $CNF['T']['txt_sample_single'],
|
|
|
- 'entry_url' => $sEntryUrl,
|
|
|
- 'entry_caption' => $sEntryCaption,
|
|
|
- 'entry_author' => $aContentInfo[$CNF['FIELD_AUTHOR']],
|
|
|
- 'subentry_sample' => $CNF['T']['txt_sample_vote_single'],
|
|
|
- 'lang_key' => '', //may be empty or not specified. In this case the default one from Notification module will be used.
|
|
|
- );
|
|
|
+ return array(
|
|
|
+ 'entry_sample' => $CNF['T']['txt_sample_single'],
|
|
|
+ 'entry_url' => $sEntryUrl,
|
|
|
+ 'entry_caption' => $sEntryCaption,
|
|
|
+ 'entry_author' => $aContentInfo[$CNF['FIELD_AUTHOR']],
|
|
|
+ 'subentry_sample' => $CNF['T']['txt_sample_reaction_single'],
|
|
|
+ 'subentry_sample_params' => $aSubentrySampleParams,
|
|
|
+ 'lang_key' => '', //may be empty or not specified. In this case the default one from Notification module will be used.
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
/**
|