BxDolFilesModule::actionAlbumsViewMy PHP Method

actionAlbumsViewMy() public method

public actionAlbumsViewMy ( $sParamValue = '', $sParamValue1 = '', $sParamValue2 = '', $sParamValue3 = '' )
    function actionAlbumsViewMy($sParamValue = '', $sParamValue1 = '', $sParamValue2 = '', $sParamValue3 = '')
    {
        $sAction = bx_get('action');
        if ($sAction !== false) {
            header('Content-Type: text/html; charset=UTF-8');
            if (!isLogged() && bx_get('oid') && bx_get('pwd')) {
                // in case of request from flash, cookies are not passed, and we have to set it explicitly
                $_COOKIE['memberID'] = bx_get('oid');
                $_COOKIE['memberPassword'] = bx_get('pwd');
                check_logged();
            }
            if (!isLogged()) {
                echo MsgBox(_t('_Access denied'));
                exit;
            }
            $sUpl = 'Uploader';
            bx_import($sUpl, $this->_aModule);
            $sClassName = $this->_oConfig->getClassPrefix() . $sUpl;
            $oUploader = new $sClassName();
            $this->processUpload($oUploader, $sAction);
            exit;
        }
        $bNotAllowView = $this->_iProfileId == 0 || !isLoggedActive();
        $aAlbumInfo = array();
        if (!$bNotAllowView && !empty($sParamValue1)) {
            $aAlbumInfo = $this->oAlbums->getAlbumInfo(array('fileUri' => $sParamValue1, 'owner' => $this->_iProfileId));
            if (!empty($aAlbumInfo)) {
                $bNotAllowView = $aAlbumInfo['AllowAlbumView'] == BX_DOL_PG_HIDDEN;
            }
        }
        if ($bNotAllowView) {
            $sKey = _t('_' . $this->_oConfig->getMainPrefix() . '_access_denied');
            $sCode = DesignBoxContent($sKey, MsgBox($sKey), 1);
            $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $sCode), '', '', false);
            return;
        }
        //album actions check
        if (is_array($_POST['entry'])) {
            foreach ($_POST['entry'] as $iValue) {
                $iValue = (int) $iValue;
                switch (true) {
                    case isset($_POST['action_delete']):
                        $iCount = $this->_deleteAlbumUnits($iValue);
                        if ($iCount == 0) {
                            $this->oAlbums->removeAlbum($iValue);
                        }
                        break;
                    case isset($_POST['action_move_to']):
                        $this->oAlbums->moveObject((int) $_POST['album_id'], (int) $_POST['new_album'], $iValue);
                        break;
                    case isset($_POST['action_delete_object']):
                        $this->_deleteFile($iValue);
                        break;
                }
            }
        }
        $sCode = '';
        switch ($sParamValue) {
            case 'main':
                bx_import('PageAlbumsOwner', $this->_aModule);
                $sClassName = $this->_oConfig->getClassPrefix() . 'PageAlbumsOwner';
                $oPage = new $sClassName($this, array('browse', 'owner', getUsername($this->_iProfileId)));
                $sCode .= $oPage->getCode();
                break;
            case 'main_objects':
                $sCode .= $this->getAlbumPageView($aAlbumInfo);
                break;
        }
        bx_import('PageAlbumsMy', $this->_aModule);
        $sClassName = $this->_oConfig->getClassPrefix() . 'PageAlbumsMy';
        $oPage = new $sClassName($this, $this->_iProfileId, array($sParamValue, $sParamValue1, $sParamValue2, $sParamValue3));
        $sClassPostfix = $oPage->getViewLevel() == 0 ? 'PageAlbumsOwner' : 'PageAlbumView';
        bx_import($sClassPostfix, $this->_aModule);
        $sClassName = $this->_oConfig->getClassPrefix() . $sClassPostfix;
        $oPageViewOwner = new $sClassName($this, array());
        $iPageWidth = $oPageViewOwner->getPageWidth();
        if ($iPageWidth != 0) {
            $oPage->forcePageWidth($iPageWidth);
        }
        $GLOBALS['oTopMenu']->setCurrentProfileID($this->_iProfileId);
        $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $oPage->getCode() . $sCode), '', '', false);
    }

Usage Example

Beispiel #1
0
 function actionAlbumsViewMy($sParamValue = '', $sParamValue1 = '', $sParamValue2 = '', $sParamValue3 = '')
 {
     $sAction = bx_get('action');
     if ($sAction !== false) {
         require_once 'BxSoundsUploader.php';
         $oUploader = new BxSoundsUploader();
         switch ($sAction) {
             case 'accept_upload':
                 echo $oUploader->serviceAcceptFile();
                 exit;
                 break;
             case 'accept_record':
                 echo $oUploader->serviceAcceptRecordFile();
                 exit;
                 break;
             case 'cancel_file':
                 echo $oUploader->serviceCancelFileInfo();
                 exit;
                 break;
             case 'accept_file_info':
                 echo $oUploader->serviceAcceptFileInfo();
                 exit;
                 break;
             case 'accept_multi_files':
                 echo $oUploader->servicePerformMultiMusicUpload();
                 exit;
                 break;
             default:
                 break;
         }
     } else {
         parent::actionAlbumsViewMy($sParamValue, $sParamValue1, $sParamValue2, $sParamValue3);
     }
 }