function getWallPost($aEvent, $sIcon = 'save', $aParams = array())
{
$sPrefix = $this->_oConfig->getMainPrefix();
$aObjectIds = strpos($aEvent['object_id'], ',') !== false ? explode(',', $aEvent['object_id']) : array($aEvent['object_id']);
rsort($aObjectIds);
$sClassName = $this->_oConfig->getClassPrefix() . 'Search';
bx_import('Search', $this->_aModule);
$oSearch = new $sClassName();
$sItemThumbnailType = isset($aParams['thumbnail_type']) ? $aParams['thumbnail_type'] : 'browse';
$iDeleted = 0;
$aItems = $aTmplItems = array();
foreach ($aObjectIds as $iId) {
$aItem = $oSearch->serviceGetItemArray($iId, $sItemThumbnailType);
if (empty($aItem)) {
$iDeleted++;
continue;
} else {
if ($aItem['status'] == 'approved' && $this->oAlbumPrivacy->check('album_view', $aItem['album_id'], $this->oModule->_iProfileId)) {
$aItems[] = $aItem;
}
}
$aItem2x = $oSearch->serviceGetItemArray($iId, $sItemThumbnailType . '2x');
$aTmplItems[] = array_merge($aItem, array('mod_prefix' => $sPrefix, 'cnt_item_width' => $aItem['width'], 'cnt_item_height' => $aItem['height'], 'cnt_item_icon' => $aItem['file'], 'cnt_item_icon_2x' => !empty($aItem2x['file']) ? $aItem2x['file'] : $aItem['file'], 'cnt_item_page' => $aItem['url'], 'cnt_item_title' => $aItem['title']));
}
if ($iDeleted == count($aObjectIds)) {
return array('perform_delete' => true);
}
$iOwner = 0;
if (!empty($aEvent['owner_id'])) {
$iOwner = (int) $aEvent['owner_id'];
}
$bItems = !empty($aItems) && is_array($aItems);
if ($iOwner == 0 && $bItems && !empty($aItems[0]['owner'])) {
$iOwner = (int) $aItems[0]['owner'];
}
if ($iOwner == 0 || !$bItems) {
return "";
}
$sCss = "";
if ($aEvent['js_mode']) {
$sCss = $this->_oTemplate->addCss(array('wall_post.css', 'wall_post_phone.css'), true);
} else {
$this->_oTemplate->addCss(array('wall_post.css', 'wall_post_phone.css'));
}
$iItems = count($aItems);
$sOwner = getNickName($iOwner);
//--- Grouped events
if ($iItems > 1) {
if ($iItems > 4) {
$aItems = array_slice($aItems, 0, 4);
$aTmplItems = array_slice($aTmplItems, 0, 4);
}
$aExtra = unserialize($aEvent['content']);
$sAlbumUri = $aExtra['album'];
$oAlbum = new BxDolAlbums($sPrefix);
$aAlbumInfo = $oAlbum->getAlbumInfo(array('fileUri' => $sAlbumUri, 'owner' => $iOwner));
$sTemplateName = isset($aParams['templates']['grouped']) ? $aParams['templates']['grouped'] : 'modules/boonex/wall/|timeline_post_files_grouped.html';
return array('title' => _t('_' . $sPrefix . '_wall_added_new_items_title', $sOwner, $iItems), 'description' => '', 'grouped' => array('group_id' => $aAlbumInfo['ID'], 'group_cmts_name' => $sPrefix . '_albums'), 'content' => $sCss . $this->_oTemplate->parseHtmlByName($sTemplateName, array('mod_prefix' => $sPrefix, 'mod_icon' => $sIcon, 'cpt_user_name' => $sOwner, 'cpt_added_new' => _t('_' . $sPrefix . '_wall_added_new_items', $iItems), 'cpt_album_url' => $oSearch->getCurrentUrl('album', $aAlbumInfo['ID'], $aAlbumInfo['Uri']) . '/owner/' . getUsername($iOwner), 'cpt_album_title' => $aAlbumInfo['Caption'], 'bx_repeat:items' => $aTmplItems, 'post_id' => $aEvent['id'])));
}
$aItem = $aItems[0];
$aTmplItem = $aTmplItems[0];
//--- Single public event
$sItemTxt = _t('_' . $sPrefix . '_wall_object');
$sTemplateName = isset($aParams['templates']['single']) ? $aParams['templates']['single'] : 'modules/boonex/wall/|timeline_post_files.html';
return array('title' => _t('_' . $sPrefix . '_wall_added_new_title', $sOwner, $sItemTxt), 'description' => $aItem['description'], 'grouped' => false, 'content' => $sCss . $this->_oTemplate->parseHtmlByName($sTemplateName, array_merge($aTmplItem, array('mod_prefix' => $sPrefix, 'mod_icon' => $sIcon, 'cpt_user_name' => $sOwner, 'cpt_added_new' => _t('_' . $sPrefix . '_wall_added_new'), 'cpt_item_url' => $aItem['url'], 'cpt_item' => $sItemTxt, 'post_id' => $aEvent['id']))));
}