Leonid, or anyone, can you please for me edit this function so, that a link "Add photo" and "Pagination Element" is there in all cases, if there are no photos, if there is one photo and if there are some photos..
---------------------------------------
function getPhotoBlock ($aParams = array()) {
$aShowParams = array('showRate' => 1, 'showPaginate' => 0, 'showViews' => 0, 'showDate' => 0, 'showLink' => 0, 'showFrom' => 0);
if (count($aParams) > 0) {
foreach( $aParams as $sKeyName => $sKeyValue ) {
switch ($sKeyName) {
case 'PID':
$this->aCurrent['restriction']['owner']['value'] = (int)$sKeyValue;
break;
case 'Category':
$this->aCurrent['restriction']['category']['value'] = strip_tags($sKeyValue);
break;
case 'Tag':
$this->aCurrent['restriction']['tag']['value'] = strip_tags($sKeyValue);
break;
case 'Limit':
$this->aCurrent['paginate']['perPage'] = (int)$sKeyValue;
break;
case 'DisplayPagination':
if ($sKeyValue == 1)
$aShowParams['showPaginate'] = 1;
break;
case 'DisplayViews':
if ($sKeyValue == 1)
$aShowParams['showViews'] = 1;
break;
case 'DisplayWhenAgo':
if ($sKeyValue == 1)
$aShowParams['showDate'] = 1;
break;
case 'DisplayLink':
if ($sKeyValue == 1)
$aShowParams['showLink'] = 1;
break;
case 'DisplayProfile':
if ($sKeyValue == 1)
$aShowParams['showFrom'] = 1;
break;
}
}
}
$this->aCurrent['paginate']['perPage'] = 20;
$aFilesList = $this->getSearchData();
$iCnt = $this->aCurrent['paginate']['totalNum'];
if ($iCnt) {
$aUnit = array();
$aUnits = array();
if (defined('BX_PROFILE_PAGE') || defined('BX_MEMBER_PAGE')) {
$iPhotoWidth = 294;
$sImgWidth = 'style="width:' . $iPhotoWidth . 'px;"';
}
else {
$iPhotoWidth = (int)$this->oModule->_oConfig->getGlParam('file_width');
$iPhotoWidth = ($iPhotoWidth > 1) ? $iPhotoWidth : 600;
$sImgWidth = '';
}
foreach ($aFilesList as $iKey => $aData) {
$sPicUrl = $this->getImgUrl($aData['Hash'], 'icon');
$aUnits[] = array(
'imageId' => $iKey + 1,
'picUrl' => $sPicUrl
);
$sPicLinkElements .= 'aPicLink['.($iKey + 1).'] = '.$aData['id'].';';
if ($iKey == 0) {
$aAdd = array('switchWidth' => ($iPhotoWidth + 2), 'imgWidth' => $sImgWidth);
$aUnit['switcherUnit'] = $this->getSwitcherUnit($aData, $aShowParams, $aAdd);
}
}
$aUnit['moduleUrl'] = BX_DOL_URL_ROOT . $this->oModule->_oConfig->getBaseUri();
$aUnit['bx_repeat:iconBlock'] = $aUnits;
$aUnit['count'] = $iCnt;
$aUnit['contWidth'] = $iCnt * 40;
$aUnit['picWidth'] = $iPhotoWidth;
$aUnit['picBoxWidth'] = $aUnit['switchWidth'] = $iPhotoWidth + 2;
$aUnit['switchWidthOut'] = $aUnit['switchWidth'] + 4;
if ($aUnit['contWidth'] > $aUnit['picWidth']) {
$bScroller = true;
$aUnit['containerWidth'] = $aUnit['picBoxWidth'] - 72;
}
else {
$bScroller = false;
$aUnit['containerWidth'] = $aUnit['contWidth'];
}
$aUnit['bx_if:scrollerBack'] = array(
'condition' => $bScroller,
'content' => array(1)
);
$aUnit['bx_if:scrollerNext'] = array(
'condition' => $bScroller,
'content' => array(1),
);
$aUnit['picLinkElements'] = $sPicLinkElements;
if ($aShowParams['showPaginate'] == 1) {
$aLinkAddon = $this->getLinkAddByPrams();
$oPaginate = new BxDolPaginate(array(
'page_url' => $aUnit['changeUrl'],
'count' => $iCnt,
'info' => false,
'per_page' => 1,
'page' => $this->aCurrent['paginate']['page'],
'per_page_changer' => false,
'page_reloader' => false,
'on_change_page' => 'getCurrentImage({page})',
));
$aUnit['paginate'] = $oPaginate->getPaginate();
}
else
$aUnit['paginate'] = '';
$this->oTemplate->addCss('search.css');
return $this->oTemplate->parseHtmlByName('photo_switcher.html', $aUnit);
}
elseif ($this->oModule->_iProfileId != 0 && $this->oModule->_iProfileId == (int)$this->aCurrent['restriction']['owner']['value']) {
ob_start();
?>
<div class="paginate">
<div class="view_all" style="background-image:url(__img_src__)">
<a href="__lnk_url__" title="__lnk_title__">__lnk_content__</a>
</div>
</div>
<?
$sCode = ob_get_clean();
$sLinkTitle = _t('_bx_photos_add');
$sNickName = getNickName($this->oModule->_iProfileId);
//K//$sCaption = uriFilter(_t('_bx_photos_profile_album_name', $sNickName));//K//
$sCaption = uriFilter(str_replace('{nickname}', $sNickName, $this->oModule->_oConfig->getGlParam('profile_album_name')));
$aUnit = array(
'img_src' => $this->oTemplate->getIconUrl('more.png'),
'lnk_url' => $this->oModule->_oConfig->getBaseUri() . 'albums/my/add_objects/' . $sCaption . '/owner/' . $sNickName,
'lnk_title' => $sLinkTitle,
'lnk_content' => $sLinkTitle
);
return MsgBox(_t('_Empty')) . $this->oTemplate->parseHtmlByContent($sCode, $aUnit);
}
return MsgBox(_t('_Empty'));
}
------------------------
thanks in advance