BxDolFilesModule::actionView PHP Method

actionView() public method

public actionView ( $sUri )
    function actionView($sUri)
    {
        $aIdent = array('fileUri' => $sUri);
        $aInfo = $this->_oDb->getFileInfo($aIdent);
        if (!empty($aInfo)) {
            if ($aInfo['AllowAlbumView'] == BX_DOL_PG_HIDDEN || !$this->isAllowedView($aInfo)) {
                $sKey = _t('_' . $this->_oConfig->getMainPrefix() . '_forbidden');
                $sCode = DesignBoxContent($sKey, MsgBox($sKey), 1);
            } else {
                $aInfo['medTitle'] = stripslashes($aInfo['medTitle']);
                $aInfo['medDesc'] = stripslashes($aInfo['medDesc']);
                $aInfo['NickName'] = getUsername($aInfo['medProfId']);
                //meta keywords and descriptions
                $this->_oTemplate->setPageDescription(substr(strip_tags($aInfo['medDesc']), 0, 255));
                $this->_oTemplate->addPageKeywords($aInfo['medTags']);
                // album data about prev and next files
                // calculation of un-approved files in album
                $sClassName = $this->_oConfig->getClassPrefix() . 'Search';
                bx_import('Search', $this->_aModule);
                $oSearch = new $sClassName();
                $oSearch->aCurrent['restriction']['albumId'] = array('value' => $aInfo['albumId'], 'field' => 'ID', 'operator' => '=', 'table' => 'sys_albums');
                $oSearch->aCurrent['restriction']['activeStatus']['operator'] = '<>';
                $aIds = '';
                $aExcludeList = $oSearch->getSearchData();
                if (!empty($aExcludeList)) {
                    foreach ($aExcludeList as $aValue) {
                        $aIds[] = $aValue['id'];
                    }
                }
                $aInfo['prevItem'] = $this->oAlbums->getClosestObj($aInfo['albumId'], $aInfo['medID'], 'prev', $aInfo['obj_order'], $aIds);
                $aInfo['nextItem'] = $this->oAlbums->getClosestObj($aInfo['albumId'], $aInfo['medID'], 'next', $aInfo['obj_order'], $aIds);
                $aInfo['favorited'] = $this->_oDb->checkFavoritesIn($aInfo['medID']);
                bx_import('PageView', $this->_aModule);
                $sClassName = $this->_oConfig->getClassPrefix() . 'PageView';
                $oPage = new $sClassName($this, $aInfo);
                $sCode = $this->_oTemplate->getJsInclude() . $oPage->getCode();
                $this->aPageTmpl['header'] = $sKey = $aInfo['medTitle'];
                $this->aPageTmpl['js_name'] = 'BxDolFiles.js';
                $this->aPageTmpl['css_name'] = 'explanation.css';
                if ($this->_iProfileId != $aInfo['medProfId']) {
                    $this->isAllowedView($aInfo, true);
                }
            }
        } else {
            $this->_oTemplate->displayPageNotFound();
        }
        $GLOBALS['oTopMenu']->setCustomSubHeader(_t('_sys_album_x_photo_x', $aInfo['albumCaption'], $sKey));
        $GLOBALS['oTopMenu']->setCustomSubHeaderUrl(BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'browse/album/' . $aInfo['albumUri'] . '/owner/' . $aInfo['NickName']);
        $GLOBALS['oTopMenu']->setCustomBreadcrumbs(array(_t('_' . $this->_oConfig->getMainPrefix()) => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'home/', $aInfo['albumCaption'] => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'browse/album/' . $aInfo['albumUri'] . '/owner/' . $aInfo['NickName'], $sKey => ''));
        $this->_oTemplate->addJsTranslation(array('_Are_you_sure'));
        $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $sCode));
    }