|
@@ -470,7 +470,7 @@ class BxTimelineDb extends BxBaseModNotificationsDb
|
|
|
return call_user_func_array(array($this, $aMethod['name']), $aMethod['params']);
|
|
return call_user_func_array(array($this, $aMethod['name']), $aMethod['params']);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public function getEvents($aParams, $bReturnCount = false)
|
|
|
|
|
|
|
+ public function getEvents($aParams)
|
|
|
{
|
|
{
|
|
|
list($sMethod, $sSelectClause, $mixedJoinClause, $mixedWhereClause, $sOrderClause, $sLimitClause) = $this->_getSqlPartsEvents($aParams);
|
|
list($sMethod, $sSelectClause, $mixedJoinClause, $mixedWhereClause, $sOrderClause, $sLimitClause) = $this->_getSqlPartsEvents($aParams);
|
|
|
|
|
|
|
@@ -511,13 +511,7 @@ class BxTimelineDb extends BxBaseModNotificationsDb
|
|
|
'limit' => $sLimitClause
|
|
'limit' => $sLimitClause
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
- $aEntries = $this->$sMethod(bx_replace_markers($sSqlMask, $aSqlMarkers));
|
|
|
|
|
-
|
|
|
|
|
- return !$bReturnCount ? $aEntries : array($aEntries, (int)$this->getOne(bx_replace_markers($sSqlMask, array_merge($aSqlMarkers, array(
|
|
|
|
|
- 'select' => 'COUNT(*)',
|
|
|
|
|
- 'order' => '',
|
|
|
|
|
- 'limit' => ''
|
|
|
|
|
- )))));
|
|
|
|
|
|
|
+ return $this->$sMethod(bx_replace_markers($sSqlMask, $aSqlMarkers));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$bJoinAsArray = !empty($mixedJoinClause) && is_array($mixedJoinClause);
|
|
$bJoinAsArray = !empty($mixedJoinClause) && is_array($mixedJoinClause);
|
|
@@ -528,7 +522,6 @@ class BxTimelineDb extends BxBaseModNotificationsDb
|
|
|
$sLimitSubclause = isset($aParams['per_page']) ? 'LIMIT 0, ' . ($aParams['start'] + $aParams['per_page']) : '';
|
|
$sLimitSubclause = isset($aParams['per_page']) ? 'LIMIT 0, ' . ($aParams['start'] + $aParams['per_page']) : '';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $iEntries = 0;
|
|
|
|
|
$aSqlParts = array();
|
|
$aSqlParts = array();
|
|
|
foreach($mixedWhereClause as $sKey => $sValue) {
|
|
foreach($mixedWhereClause as $sKey => $sValue) {
|
|
|
$aSqlMarkers = array(
|
|
$aSqlMarkers = array(
|
|
@@ -541,22 +534,12 @@ class BxTimelineDb extends BxBaseModNotificationsDb
|
|
|
$sSqlPart = bx_replace_markers($sSqlMask, $aSqlMarkers);
|
|
$sSqlPart = bx_replace_markers($sSqlMask, $aSqlMarkers);
|
|
|
|
|
|
|
|
$aSqlParts[] = !$bCount ? $sSqlPart : (int)$this->$sMethod($sSqlPart);
|
|
$aSqlParts[] = !$bCount ? $sSqlPart : (int)$this->$sMethod($sSqlPart);
|
|
|
- if(!$bReturnCount)
|
|
|
|
|
- continue;
|
|
|
|
|
-
|
|
|
|
|
- $iEntries += (int)$this->getOne(bx_replace_markers($sSqlMask, array_merge($aSqlMarkers, array(
|
|
|
|
|
- 'select' => 'COUNT(*)',
|
|
|
|
|
- 'order' => '',
|
|
|
|
|
- 'limit' => ''
|
|
|
|
|
- ))));
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $aEntries = $bCount ? array_sum($aSqlParts) : $this->$sMethod(bx_replace_markers('(' . implode(') UNION (', $aSqlParts) . ') {order} {limit}', array(
|
|
|
|
|
|
|
+ return $bCount ? array_sum($aSqlParts) : $this->$sMethod(bx_replace_markers('(' . implode(') UNION (', $aSqlParts) . ') {order} {limit}', array(
|
|
|
'order' => str_replace('`' . $this->_sTable . '`.', '', $sOrderClause),
|
|
'order' => str_replace('`' . $this->_sTable . '`.', '', $sOrderClause),
|
|
|
'limit' => str_replace('`' . $this->_sTable . '`.', '', $sLimitClause),
|
|
'limit' => str_replace('`' . $this->_sTable . '`.', '', $sLimitClause),
|
|
|
)));
|
|
)));
|
|
|
-
|
|
|
|
|
- return !$bReturnCount ? $aEntries : array($aEntries, $iEntries);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
protected function _getFilterAddon($iOwnerId, $sFilter)
|
|
protected function _getFilterAddon($iOwnerId, $sFilter)
|