function _serviceGetWallPost($aEvent, &$aParams)
{
if (!($aProfile = getProfileInfo($aEvent['owner_id']))) {
return '';
}
$aObjectIds = strpos($aEvent['object_id'], ',') !== false ? explode(',', $aEvent['object_id']) : array($aEvent['object_id']);
rsort($aObjectIds);
$iDeleted = 0;
$aItems = array();
foreach ($aObjectIds as $iId) {
$aItem = $this->_oDb->getEntryByIdAndOwner($iId, $aEvent['owner_id'], 1);
if (empty($aItem)) {
$iDeleted++;
}
if ($aItem[$this->_oDb->_sFieldStatus] == 'approved' && $aParams['obj_privacy']->check($aParams['txt_privacy_view_event'], $iId, $this->_iProfileId)) {
$aItems[] = $aItem;
}
}
if ($iDeleted == count($aObjectIds)) {
return array('perform_delete' => true);
}
if (empty($aItems)) {
return '';
}
$sCss = '';
$sCssPrefix = str_replace('_', '-', $this->_sPrefix);
$sBaseUrl = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/';
if ($aEvent['js_mode']) {
$sCss = $this->_oTemplate->addCss(array('wall_post.css', 'unit.css', 'twig.css'), true);
} else {
$this->_oTemplate->addCss(array('wall_post.css', 'unit.css', 'twig.css'));
}
$iItems = count($aItems);
$iOwner = (int) $aEvent['owner_id'];
$sOwner = getNickName($iOwner);
bx_import('Voting', $this->_aModule);
$sClass = $this->_aModule['class_prefix'] . 'Voting';
$oVoting = new $sClass($this->_sPrefix, 0, 0);
//--- Grouped events
if ($iItems > 1) {
if ($iItems > 4) {
$aItems = array_slice($aItems, 0, 4);
}
$aTmplItems = array();
foreach ($aItems as $aItem) {
$aTmplItems[] = array('unit' => $this->_oTemplate->unit($aItem, 'unit', $oVoting, true));
}
$sTmplName = isset($aParams['templates']['grouped']) ? $aParams['templates']['grouped'] : 'modules/boonex/wall/|timeline_post_twig_grouped.html';
return array('title' => _t($aParams['txt_added_new_title_plural'], $sOwner, $iItems), 'description' => '', 'content' => $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array('mod_prefix' => $sCssPrefix, 'mod_icon' => $aParams['icon'], 'cpt_user_name' => $sOwner, 'cpt_added_new' => _t($aParams['txt_added_new_plural'], $iItems), 'bx_repeat:items' => $aTmplItems)));
}
//--- Single public event
$aItem = $aItems[0];
$sTextWallObject = _t($aParams['txt_object']);
$sTmplName = isset($aParams['templates']['single']) ? $aParams['templates']['single'] : 'modules/boonex/wall/|timeline_post_twig.html';
return array('title' => _t($aParams['txt_added_new_title_single'], $sOwner, $sTextWallObject), 'description' => $aItem[$this->_oDb->_sFieldDescription], 'content' => $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array('mod_prefix' => $sCssPrefix, 'mod_icon' => $aParams['icon'], 'cpt_user_name' => $sOwner, 'cpt_added_new' => _t($aParams['txt_added_new_single']), 'cpt_object' => $sTextWallObject, 'cpt_item_url' => $sBaseUrl . $aItem[$this->_oDb->_sFieldUri], 'content' => $this->_oTemplate->unit($aItem, 'unit', $oVoting, true))));
}