|
@@ -40,32 +40,34 @@ class BxNtfsTemplate extends BxBaseModNotificationsTemplate
|
|
|
$sJsObject = $this->_oConfig->getJsObject('view');
|
|
$sJsObject = $this->_oConfig->getJsObject('view');
|
|
|
|
|
|
|
|
$aParamsDb = $aParams;
|
|
$aParamsDb = $aParams;
|
|
|
- $aParamsDb['per_page'] = $aParamsDb['per_page'] + 1;
|
|
|
|
|
|
|
+ $aParamsDb['per_page'] = 3 * $aParamsDb['per_page'];
|
|
|
|
|
|
|
|
$aEvents = $this->_oDb->getEvents($aParamsDb);
|
|
$aEvents = $this->_oDb->getEvents($aParamsDb);
|
|
|
if(empty($aEvents))
|
|
if(empty($aEvents))
|
|
|
return $this->getEmpty();
|
|
return $this->getEmpty();
|
|
|
|
|
|
|
|
- $oPaginate = new BxTemplPaginate(array(
|
|
|
|
|
- 'start' => $aParams['start'],
|
|
|
|
|
- 'per_page' => $aParams['per_page'],
|
|
|
|
|
- 'page_url' => $this->_oConfig->getViewUrl(),
|
|
|
|
|
- 'on_change_page' => $sJsObject . ".changePage(this, {start}, {per_page})"
|
|
|
|
|
- ));
|
|
|
|
|
- $oPaginate->setNumFromDataArray($aEvents);
|
|
|
|
|
-
|
|
|
|
|
- $sEvents = '';
|
|
|
|
|
|
|
+ $aTmplVarsEvents = array();
|
|
|
foreach($aEvents as $aEvent) {
|
|
foreach($aEvents as $aEvent) {
|
|
|
$sEvent = $this->getPost($aEvent, $aParams);
|
|
$sEvent = $this->getPost($aEvent, $aParams);
|
|
|
if(empty($sEvent))
|
|
if(empty($sEvent))
|
|
|
continue;
|
|
continue;
|
|
|
|
|
|
|
|
- $sEvents .= $sEvent;
|
|
|
|
|
|
|
+ $aTmplVarsEvents[] = array('event' => $sEvent);
|
|
|
|
|
+ if(count($aTmplVarsEvents) >= ($aParams['per_page'] + 1))
|
|
|
|
|
+ break;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ $oPaginate = new BxTemplPaginate(array(
|
|
|
|
|
+ 'start' => $aParams['start'],
|
|
|
|
|
+ 'per_page' => $aParams['per_page'],
|
|
|
|
|
+ 'page_url' => $this->_oConfig->getViewUrl(),
|
|
|
|
|
+ 'on_change_page' => $sJsObject . ".changePage(this, {start}, {per_page})"
|
|
|
|
|
+ ));
|
|
|
|
|
+ $oPaginate->setNumFromDataArray($aTmplVarsEvents);
|
|
|
|
|
+
|
|
|
return $this->parseHtmlByName('events.html', array(
|
|
return $this->parseHtmlByName('events.html', array(
|
|
|
'style_prefix' => $this->_oConfig->getPrefix('style'),
|
|
'style_prefix' => $this->_oConfig->getPrefix('style'),
|
|
|
- 'events' => $sEvents,
|
|
|
|
|
|
|
+ 'bx_repeat:events' => $aTmplVarsEvents,
|
|
|
'paginate' => $oPaginate->getSimplePaginate()
|
|
'paginate' => $oPaginate->getSimplePaginate()
|
|
|
));
|
|
));
|
|
|
}
|
|
}
|
|
@@ -74,25 +76,12 @@ class BxNtfsTemplate extends BxBaseModNotificationsTemplate
|
|
|
{
|
|
{
|
|
|
$oModule = $this->getModule();
|
|
$oModule = $this->getModule();
|
|
|
|
|
|
|
|
- if((int)$aEvent['processed'] == 0) {
|
|
|
|
|
- $aContent = $this->_getContent($aEvent);
|
|
|
|
|
- if(!empty($aContent) && is_array($aContent)) {
|
|
|
|
|
- $aSet = array();
|
|
|
|
|
-
|
|
|
|
|
- if(!empty($aContent['entry_author'])) {
|
|
|
|
|
- $aSet['object_owner_id'] = (int)$aContent['entry_author'];
|
|
|
|
|
- unset($aContent['entry_author']);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if((int)$aEvent['processed'] == 0)
|
|
|
|
|
+ $this->_processContent($aEvent);
|
|
|
|
|
|
|
|
- $aEvent['content'] = serialize($aContent);
|
|
|
|
|
- $aSet = array_merge($aSet, array(
|
|
|
|
|
- 'content' => $aEvent['content'],
|
|
|
|
|
- 'processed' => 1
|
|
|
|
|
- ));
|
|
|
|
|
-
|
|
|
|
|
- $this->_oDb->updateEvent($aSet, array('id' => $aEvent['id']));
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $oPrivacy = $oModule->_oConfig->getPrivacyObject($aEvent['type'] . '_' . $aEvent['action']);
|
|
|
|
|
+ if($oPrivacy !== false && !$oPrivacy->check($aEvent['id']))
|
|
|
|
|
+ return '';
|
|
|
|
|
|
|
|
list($sOwnerName, $sOwnerUrl, $sOwnerIcon) = $oModule->getUserInfo($aEvent['owner_id']);
|
|
list($sOwnerName, $sOwnerUrl, $sOwnerIcon) = $oModule->getUserInfo($aEvent['owner_id']);
|
|
|
$bAuthorIcon = !empty($sOwnerIcon);
|
|
$bAuthorIcon = !empty($sOwnerIcon);
|
|
@@ -136,6 +125,34 @@ class BxNtfsTemplate extends BxBaseModNotificationsTemplate
|
|
|
));
|
|
));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ protected function _processContent(&$aEvent)
|
|
|
|
|
+ {
|
|
|
|
|
+ $aContent = $this->_getContent($aEvent);
|
|
|
|
|
+ if(empty($aContent) || !is_array($aContent))
|
|
|
|
|
+ return;
|
|
|
|
|
+
|
|
|
|
|
+ $aSet = array();
|
|
|
|
|
+ if(!empty($aContent['entry_author'])) {
|
|
|
|
|
+ $aSet['object_owner_id'] = (int)$aContent['entry_author'];
|
|
|
|
|
+ unset($aContent['entry_author']);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(!empty($aContent['entry_privacy'])) {
|
|
|
|
|
+ $aSet['allow_view_event_to'] = $aContent['entry_privacy'];
|
|
|
|
|
+ $aEvent['allow_view_event_to'] = $aContent['entry_privacy'];
|
|
|
|
|
+ unset($aContent['entry_privacy']);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $aEvent['content'] = serialize($aContent);
|
|
|
|
|
+ $aSet = array_merge($aSet, array(
|
|
|
|
|
+ 'content' => $aEvent['content'],
|
|
|
|
|
+ 'processed' => 1
|
|
|
|
|
+ ));
|
|
|
|
|
+
|
|
|
|
|
+ $this->_oDb->updateEvent($aSet, array('id' => $aEvent['id']));
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
protected function _getContent(&$aEvent)
|
|
protected function _getContent(&$aEvent)
|
|
|
{
|
|
{
|
|
|
$sHandler = $aEvent['type'] . '_' . $aEvent['action'];
|
|
$sHandler = $aEvent['type'] . '_' . $aEvent['action'];
|
|
@@ -145,7 +162,6 @@ class BxNtfsTemplate extends BxBaseModNotificationsTemplate
|
|
|
$aHandler = $this->_oConfig->getHandlers($sHandler);
|
|
$aHandler = $this->_oConfig->getHandlers($sHandler);
|
|
|
if(!empty($aHandler['module_name']) && !empty($aHandler['module_class']) && !empty($aHandler['module_method']))
|
|
if(!empty($aHandler['module_name']) && !empty($aHandler['module_class']) && !empty($aHandler['module_method']))
|
|
|
return BxDolService::call($aHandler['module_name'], $aHandler['module_method'], array($aEvent), $aHandler['module_class']);
|
|
return BxDolService::call($aHandler['module_name'], $aHandler['module_method'], array($aEvent), $aHandler['module_class']);
|
|
|
-
|
|
|
|
|
|
|
|
|
|
$sMethod = 'display' . bx_gen_method_name($aHandler['alert_unit'] . '_' . $aHandler['alert_action']);
|
|
$sMethod = 'display' . bx_gen_method_name($aHandler['alert_unit'] . '_' . $aHandler['alert_action']);
|
|
|
if(!method_exists($this, $sMethod))
|
|
if(!method_exists($this, $sMethod))
|