function _getMediaAlbumsArray($sType, $iIdProfile, $iIdProfileViewer, $isShowEmptyAlbums = false) { switch ($sType) { case 'photo': $sModuleName = 'photos'; $sType = 'bx_photos'; $sMemAction = 'BX_PHOTOS_VIEW'; break; case 'video': $sModuleName = 'videos'; $sType = 'bx_videos'; $sMemAction = 'BX_VIDEOS_VIEW'; break; case 'music': $sModuleName = 'sounds'; $sType = 'bx_sounds'; $sMemAction = 'BX_SOUNDS_VIEW'; break; default: return array(); } if (!BxDolXMLRPCMedia::_isMembershipEnabledFor($iIdProfileViewer, $sMemAction)) { return array(); } bx_import('BxDolMemberInfo'); $oMemberInfo = BxDolMemberInfo::getObjectInstance(getParam('sys_member_info_thumb')); $isSetAvatarFromDefaultAlbumOnly = $oMemberInfo->isSetAvatarFromDefaultAlbumOnly(); bx_import('BxDolAlbums'); $o = new BxDolAlbums($sType, (int) $iIdProfile); $aList = $o->getAlbumList(array('owner' => (int) $iIdProfile, 'show_empty' => $isShowEmptyAlbums), 1, 1000); $aRet = array(); foreach ($aList as $r) { if (!BxDolService::call($sModuleName, 'get_album_privacy', array((int) $r['ID'], $iIdProfileViewer), 'Search')) { continue; } if ($isSetAvatarFromDefaultAlbumOnly) { bx_import('BxDolAlbums'); $isDefaulAlbum = $r['Uri'] == BxDolAlbums::getAbumUri(getParam($sType . '_profile_album_name'), $iIdProfile) ? 1 : 0; } else { $isDefaulAlbum = 1; } $aRet[] = array('Id' => $r['ID'], 'Title' => $r['Caption'], 'Num' => $r['ObjCount'], 'DefaultAlbum' => $isDefaulAlbum); } return $aRet; }
function _getMediaAlbumsArray($sType, $iIdProfile, $iIdProfileViewer, $isShowEmptyAlbums = false) { switch ($sType) { case 'photo': $sModuleName = 'photos'; $sType = 'bx_photos'; $sMemAction = 'BX_PHOTOS_VIEW'; break; case 'video': $sModuleName = 'videos'; $sType = 'bx_videos'; $sMemAction = 'BX_VIDEOS_VIEW'; break; case 'music': $sModuleName = 'sounds'; $sType = 'bx_sounds'; $sMemAction = 'BX_SOUNDS_VIEW'; break; default: return array(); } if (!BxDolXMLRPCMedia::_isMembershipEnabledFor($iIdProfileViewer, $sMemAction)) { return array(); } bx_import('BxDolAlbums'); $o = new BxDolAlbums($sType, (int) $iIdProfile); $aList = $o->getAlbumList(array('owner' => (int) $iIdProfile, 'show_empty' => $isShowEmptyAlbums)); $aRet = array(); foreach ($aList as $r) { if ($iIdProfile != $iIdProfileViewer && !BxDolService::call($sModuleName, 'get_album_privacy', array((int) $r['ID'], $iIdProfileViewer), 'Search')) { continue; } $aRet[] = array('Id' => $r['ID'], 'Title' => $r['Caption'], 'Num' => $r['ObjCount']); } return $aRet; }
function _GenSendFileInfoForm($iFileID, $aDefaultValues = array(), $aPossibleImage = array(), $aPossibleDuration = array()) { header("Content-type: text/html; charset=utf-8"); $this->addJsTranslation(array('_bx_' . $this->sUploadTypeLC . 's_val_title_err', '_bx_' . $this->sUploadTypeLC . 's_val_descr_err')); $oCategories = new BxDolCategories(); $oCategories->getTagObjectConfig(); $aFormCategories['categories'] = $oCategories->getGroupChooser('bx_' . $this->sUploadTypeLC . 's', $this->_iOwnerId, true); $aFormCategories['categories']['required'] = false; $sKey = 'album'; $aAlbums = array(); if ($this->_aExtras[$sKey] != '') { $aAlbums[BX_DOL_UPLOADER_EP_PREFIX . $sKey] = array('type' => 'hidden', 'name' => BX_DOL_UPLOADER_EP_PREFIX . $sKey, 'value' => stripslashes($this->_aExtras[$sKey])); } else { $oAlbum = new BxDolAlbums('bx_' . $this->sUploadTypeLC . 's'); $aAlbumList = $oAlbum->getAlbumList(array('owner' => $this->_iOwnerId)); if (count($aAlbumList) > 0) { foreach ($aAlbumList as $aValue) { $aList[$aValue['ID']] = stripslashes($aValue['Caption']); } } else { $sDefName = $oAlbum->getAlbumDefaultName(); $aList[$sDefName] = stripslashes($sDefName); } $aAlbums['album'] = array('type' => 'select_box', 'name' => BX_DOL_UPLOADER_EP_PREFIX . $sKey, 'caption' => _t('_sys_album'), 'values' => $aList); } $sCaptionVal = $this->sSendFileInfoFormCaption != '' ? $this->sSendFileInfoFormCaption : _t('_Info'); // processing of possible default values $aInputValues = array('title', 'tags', 'description', 'type', $this->sUploadTypeLC); foreach ($aInputValues as $sField) { $sEmpty = $sField == 'type' ? 'upload' : ''; $sTemp = isset($aDefaultValues[$sField]) ? strip_tags($aDefaultValues[$sField]) : $sEmpty; $aDefaultValues[$sField] = $sTemp; } $aForm = array('form_attrs' => array('id' => $this->sUploadTypeLC . '_file_info_form', 'method' => 'post', 'action' => $this->sWorkingFile, 'target' => 'upload_file_info_frame_' . $iFileID), 'inputs' => array('header2' => array('type' => 'block_header', 'caption' => $sCaptionVal, 'collapsable' => false), 'title' => array('type' => 'text', 'name' => 'title', 'caption' => _t('_Title'), 'required' => true, 'value' => $aDefaultValues['title']), 'tags' => array('type' => 'text', 'name' => 'tags', 'caption' => _t('_Tags'), 'info' => _t('_Tags_desc'), 'value' => $aDefaultValues['tags']), 'description' => array('type' => 'textarea', 'name' => 'description', 'caption' => _t('_Description'), 'value' => $aDefaultValues['description']), 'media_id' => array('type' => 'hidden', 'name' => 'file_id', 'value' => $iFileID), 'hidden_action' => array('type' => 'hidden', 'name' => 'action', 'value' => 'accept_file_info'), $this->sUploadTypeLC => array('type' => 'hidden', 'name' => $this->sUploadTypeLC, 'value' => $aDefaultValues[$this->sUploadTypeLC]), 'type' => array('type' => 'hidden', 'name' => 'type', 'value' => $aDefaultValues['type']))); //--- Process Extras ---// foreach ($this->_aExtras as $sKey => $mixedValue) { $aForm['inputs'][BX_DOL_UPLOADER_EP_PREFIX . $sKey] = array('type' => 'hidden', 'name' => BX_DOL_UPLOADER_EP_PREFIX . $sKey, 'value' => $mixedValue); } // merging categories $aForm['inputs'] = $this->getUploadFormArray($aForm['inputs'], array($aFormCategories, $aAlbums)); if (is_array($aPossibleImage) && count($aPossibleImage) > 0) { $aForm['inputs'] = array_merge($aForm['inputs'], $aPossibleImage); } if (is_array($aPossibleDuration) && count($aPossibleDuration) > 0) { $aForm['inputs'] = array_merge($aForm['inputs'], $aPossibleDuration); } $aForm['inputs'][] = array('type' => 'input_set', 'colspan' => true, 0 => array('type' => 'submit', 'name' => 'upload', 'value' => _t('_Submit'), 'colspan' => true, 'attrs' => array('onclick' => "return parent." . $this->_sJsPostObject . ".doValidateFileInfo(this, '" . $iFileID . "');")), 1 => array('type' => 'button', 'name' => 'delete', 'value' => _t('_bx_' . $this->sUploadTypeLC . 's_admin_delete'), 'colspan' => true, 'attrs' => array('onclick' => "return parent." . $this->_sJsPostObject . ".cancelSendFileInfo('" . $iFileID . "', '" . $this->sWorkingFile . "'); "))); $oForm = new BxTemplFormView($aForm); $sForm = $this->parseHtmlByName('uploader_regular_info.html', array('id' => $iFileID, 'form' => $oForm->getCode())); $sForm = str_replace(array("'", "\r", "\n"), array("\\'"), $sForm); return "<script src='" . BX_DOL_URL_ROOT . "inc/js/jquery.webForms.js' type='text/javascript' language='javascript'></script><script type='text/javascript'>parent." . $this->_sJsPostObject . ".genSendFileInfoForm('" . $iFileID . "', '" . $sForm . "'); parent." . $this->_sJsPostObject . "._loading(false);</script>"; }
function getAlbumList($iPage = 1, $iPerPage = 10, $aCond = array()) { $oSet = new BxDolAlbums($this->aCurrent['name']); foreach ($this->aCurrent['restriction'] as $sKey => $aParam) { if (!empty($aParam['value'])) { $aData[$sKey] = $aParam['value']; } } $aData = array_merge($aData, $aCond); $iAlbumCount = $oSet->getAlbumCount($aData); $this->aCurrent['paginate']['totalAlbumNum'] = $iAlbumCount; if ($iAlbumCount > 0) { $sCode = $this->addCustomParts(); $aList = $oSet->getAlbumList($aData, (int) $iPage, (int) $iPerPage); $bCheckPrivacy = isset($aData['allow_view']) ? false : true; foreach ($aList as $aData) { $sCode .= $this->displayAlbumUnit($aData, $bCheckPrivacy); } } else { $sCode = MsgBox(_t('_Empty')); } $sCode .= $this->addAlbumJsCss($this->bDynamic); return $this->oTemplate->parseHtmlByName('album_units.html', array('content' => $sCode)); }
function getAlbumList($iPage = 1, $iPerPage = 10, $aCond = array()) { $oSet = new BxDolAlbums($this->aCurrent['name']); foreach ($this->aCurrent['restriction'] as $sKey => $aParam) { $aData[$sKey] = $aParam['value']; } $aData = array_merge($aData, $aCond); $iAlbumCount = $oSet->getAlbumCount($aData); if ($iAlbumCount > 0) { $this->aCurrent['paginate']['totalAlbumNum'] = $iAlbumCount; $sCode = $this->addCustomParts(); $aList = $oSet->getAlbumList($aData, (int) $iPage, (int) $iPerPage); foreach ($aList as $iKey => $aData) { $sCode .= $this->displayAlbumUnit($aData); } } else { $sCode = MsgBox(_t('_Empty')); } return $sCode; }