本文整理汇总了PHP中BxDolProfile类的典型用法代码示例。如果您正苦于以下问题:PHP BxDolProfile类的具体用法?PHP BxDolProfile怎么用?PHP BxDolProfile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BxDolProfile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
* @param string $sType - system type
* @param string $sAction - system action
* @param int $iObjectId - object id
* @param int $iSenderId - sender (action's author) profile id, if it is false - then currectly logged in profile id is used
*/
public function __construct($sUnit, $sAction, $iObjectId, $iSender = false, $aExtras = array())
{
parent::__construct();
if (getParam('sys_db_cache_enable')) {
$oDb = BxDolDb::getInstance();
$oCache = $oDb->getDbCacheObject();
$sCacheKey = $oDb->genDbCacheKey('sys_alerts');
$aData = $oCache->getData($sCacheKey);
if (null === $aData) {
$aData = $this->getAlertsData();
$oCache->setData($sCacheKey, $aData);
}
} else {
$aData = $this->getAlertsData();
}
$this->_aAlerts = $aData['alerts'];
$this->_aHandlers = $aData['handlers'];
$this->sUnit = $sUnit;
$this->sAction = $sAction;
$this->iObject = (int) $iObjectId;
$this->aExtras = $aExtras;
if (false === $iSender) {
$oProfile = BxDolProfile::getInstance();
$this->iSender = $oProfile ? $oProfile->id() : 0;
} else {
$this->iSender = (int) $iSender;
}
}
示例2: __construct
public function __construct($aObject, $oTemplate = false)
{
parent::__construct($aObject, $oTemplate);
$CNF = $this->_oModule->_oConfig->CNF;
$iProfileId = bx_process_input(bx_get('profile_id'), BX_DATA_INT);
$iContentId = bx_process_input(bx_get('id'), BX_DATA_INT);
if ($iProfileId) {
$this->_oProfile = BxDolProfile::getInstance($iProfileId);
}
if (!$this->_oProfile && $iContentId) {
$this->_oProfile = BxDolProfile::getInstanceByContentAndType($iContentId, $this->MODULE);
}
if ($this->_oProfile) {
$this->_aProfileInfo = $this->_oProfile->getInfo();
$this->_aContentInfo = $this->_oModule->_oDb->getContentInfoById($this->_aProfileInfo['content_id']);
$this->addMarkers($this->_aProfileInfo);
$this->addMarkers(array('profile_id' => $this->_oProfile->id()));
if (isLogged()) {
$oConn = BxDolConnection::getObjectInstance('sys_profiles_friends');
if ($oConn->isConnectedNotMutual(bx_get_logged_profile_id(), $this->_oProfile->id())) {
$this->addMarkers(array('title_add_friend' => _t($CNF['T']['menu_item_title_befriend_sent']), 'title_remove_friend' => _t($CNF['T']['menu_item_title_unfriend_cancel_request'])));
} elseif ($oConn->isConnectedNotMutual($this->_oProfile->id(), bx_get_logged_profile_id())) {
$this->addMarkers(array('title_add_friend' => _t($CNF['T']['menu_item_title_befriend_confirm']), 'title_remove_friend' => _t($CNF['T']['menu_item_title_unfriend_reject_request'])));
} else {
$this->addMarkers(array('title_add_friend' => _t($CNF['T']['menu_item_title_befriend']), 'title_remove_friend' => _t($CNF['T']['menu_item_title_unfriend'])));
}
}
}
}
示例3: entryMediaView
function entryMediaView($iMediaId, $mixedContext = false)
{
$oModule = BxDolModule::getInstance($this->MODULE);
$CNF =& $oModule->_oConfig->CNF;
if (!($aMediaInfo = $oModule->_oDb->getMediaInfoById($iMediaId))) {
return '';
}
if (!($aAlbumInfo = $oModule->_oDb->getContentInfoById($aMediaInfo['content_id']))) {
return '';
}
$sUrlAlbum = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aAlbumInfo[$CNF['FIELD_ID']]);
$sText = $this->getMediaTitle($aMediaInfo);
$iProfileId = $aAlbumInfo[$CNF['FIELD_AUTHOR']];
$oProfile = BxDolProfile::getInstance($iProfileId);
if (!$oProfile) {
$oProfile = BxDolProfileUndefined::getInstance();
}
$aVars = array('title' => $sText, 'album' => _t('_bx_albums_txt_media_album_link', $sUrlAlbum, bx_process_output($aAlbumInfo[$CNF['FIELD_TITLE']]), $oProfile->getUrl(), $oProfile->getDisplayName()));
$aNextPrev = array('next' => $this->getNextPrevMedia($aMediaInfo, true, $mixedContext), 'prev' => $this->getNextPrevMedia($aMediaInfo, false, $mixedContext));
foreach ($aNextPrev as $k => $a) {
$aVars['bx_if:' . $k] = array('condition' => $a, 'content' => $a);
$aVars['bx_if:' . $k . '-na'] = array('condition' => !$a, 'content' => array());
}
$aVars = array_merge($aVars, $this->mediaVars($aMediaInfo, $CNF['OBJECT_IMAGES_TRANSCODER_BIG'], $CNF['OBJECT_VIDEOS_TRANSCODERS']['poster'], array('context' => $mixedContext)));
return $this->parseHtmlByName('media-view.html', $aVars);
}
示例4: __construct
public function __construct($aObject, $oTemplate = false)
{
parent::__construct($aObject, $oTemplate);
// get profile info
$iProfileId = bx_process_input(bx_get('profile_id'), BX_DATA_INT);
if ($iProfileId) {
$this->_oProfile = BxDolProfile::getInstance($iProfileId);
$this->_aProfileInfo = $this->_oProfile ? $this->_oProfile->getInfo() : false;
}
if (!$this->_aProfileInfo || !$this->_oProfile) {
return;
}
// select view profile submenu
$oMenuSubmenu = BxDolMenu::getObjectInstance('sys_site_submenu');
if ($oMenuSubmenu) {
$oMenuSubmenu->setObjectSubmenu('bx_persons_view_submenu', array('title' => $this->_oProfile->getDisplayName(), 'link' => $this->_oProfile->getUrl(), 'icon' => $this->_oProfile->getIcon()));
}
// add replaceable markers
$this->addMarkers($this->_aProfileInfo);
// every profile field can be used as marker
$this->addMarkers(array('profile_id' => $this->_oProfile->id()));
// profile id field is also suported
$this->addMarkers(array('display_name' => $this->_oProfile->getDisplayName()));
// profile display name is also suported
}
示例5: getProfilesByAccount
public function getProfilesByAccount($aContentInfo, $iMaxVisible = 2)
{
$oProfilesQuery = BxDolProfileQuery::getInstance();
$aProfiles = $oProfilesQuery->getProfilesByAccount($aContentInfo['id']);
$iProfiles = count($aProfiles);
$aTmplVars = array('class_cnt' => '', 'bx_repeat:profiles' => array(), 'bx_if:profiles_more' => array('condition' => $iProfiles > $iMaxVisible, 'content' => array('html_id' => $this->_oConfig->getHtmlIds('profile_more_popup') . $aContentInfo['id'], 'more' => _t('_bx_accnt_txt_more', $iProfiles - $iMaxVisible), 'more_attr' => bx_html_attribute(_t('_bx_accnt_txt_see_more')), 'popup' => '')));
$aTmplVarsPopup = array('class_cnt' => ' bx-def-padding', 'bx_repeat:profiles' => array(), 'bx_if:profiles_more' => array('condition' => false, 'content' => array()));
$i = 0;
foreach ($aProfiles as $iProfileId => $aProfile) {
$oProfile = BxDolProfile::getInstance($iProfileId);
if (!$oProfile) {
continue;
}
$sName = $oProfile->getDisplayName();
$aTmplVarsProfile = array('html_id' => $this->_oConfig->getHtmlIds('profile') . $aProfile['id'], 'id' => $oProfile->id(), 'url' => $oProfile->getUrl(), 'name' => $sName, 'name_attr' => bx_html_attribute($sName));
if ($i < $iMaxVisible) {
$aTmplVars['bx_repeat:profiles'][] = $aTmplVarsProfile;
}
if ($i >= $iMaxVisible) {
$aTmplVarsPopup['bx_repeat:profiles'][] = $aTmplVarsProfile;
}
++$i;
}
if ($aTmplVarsPopup['bx_repeat:profiles']) {
$aTmplVars['bx_if:profiles_more']['content']['popup'] = BxTemplFunctions::getInstance()->transBox('', $this->parseHtmlByName('profiles.html', $aTmplVarsPopup));
}
return $this->parseHtmlByName('profiles.html', $aTmplVars);
}
示例6: getUserInfo
public function getUserInfo($iUserId = 0)
{
$oProfile = BxDolProfile::getInstance($iUserId);
if (!$oProfile) {
$oProfile = BxDolProfileUndefined::getInstance();
}
return array($oProfile->getDisplayName(), $oProfile->getUrl(), $oProfile->getThumb(), $oProfile->getUnit());
}
示例7: _getCellProfileId
protected function _getCellProfileId($mixedValue, $sKey, $aField, $aRow)
{
$s = '<span class="bx-def-font-grayed">' . _t('_undefined') . '</span>';
if ($mixedValue && ($oProfile = BxDolProfile::getInstance((int) $mixedValue))) {
$s = '<a href="' . $oProfile->getUrl() . '">' . $oProfile->getDisplayName() . '</span>';
}
return parent::_getCellDefault($s, $sKey, $aField, $aRow);
}
示例8: serviceGetNotificationsPost
public function serviceGetNotificationsPost($aEvent)
{
$iProfile = (int) $aEvent['object_id'];
$oProfile = BxDolProfile::getInstance($iProfile);
if (!$oProfile) {
return array();
}
return array('entry_sample' => _t('_sys_profile_sample_single'), 'entry_url' => $oProfile->getUrl(), 'entry_caption' => $oProfile->getDisplayName(), 'entry_author' => $oProfile->id(), 'lang_key' => '_sys_profile_subscription_added');
}
示例9: _getProfileObject
protected function _getProfileObject($iId)
{
bx_import('BxDolProfile');
$oProfile = BxDolProfile::getInstance($iId);
if (!$oProfile) {
bx_import('BxDolProfileUndefined');
$oProfile = BxDolProfileUndefined::getInstance();
}
return $oProfile;
}
示例10: _getTemplateVars
protected function _getTemplateVars()
{
$aVars = parent::_getTemplateVars();
$aVars['bx_repeat:menu_items'] = array(true);
$aVars['profile_display_name'] = BxDolProfile::getInstance()->getDisplayName();
$aVars['url_switch_profile'] = BxDolPermalinks::getInstance()->permalink('page.php?i=account-profile-switcher');
$aVars['menu_account'] = BxDolMenu::getObjectInstance('sys_account')->getCode();
$aVars['menu_notifications'] = BxDolMenu::getObjectInstance('sys_account_notifications')->getCode();
return $aVars;
}
示例11: __construct
public function __construct($aObject, $oTemplate = false)
{
parent::__construct($aObject, $oTemplate);
$CNF =& $this->_oModule->_oConfig->CNF;
$aInformers = array();
// get profile info
$iProfileId = bx_process_input(bx_get('profile_id'), BX_DATA_INT);
$iContentId = bx_process_input(bx_get('id'), BX_DATA_INT);
if ($iProfileId) {
$this->_oProfile = BxDolProfile::getInstance($iProfileId);
}
if (!$this->_oProfile && $iContentId) {
$this->_oProfile = BxDolProfile::getInstanceByContentAndType($iContentId, $this->MODULE);
}
if ($this->_oProfile) {
$this->_aProfileInfo = $this->_oProfile->getInfo();
$this->_aContentInfo = $this->_oModule->_oDb->getContentInfoById($this->_aProfileInfo['content_id']);
}
if (!$this->_aContentInfo || !$this->_oProfile) {
return;
}
// select view profile submenu
$oMenuSubmenu = BxDolMenu::getObjectInstance('sys_site_submenu');
$oMenuSubmenu->setObjectSubmenu($CNF['OBJECT_MENU_SUBMENU_VIEW_ENTRY'], array('title' => $this->_oProfile->getDisplayName(), 'link' => $this->_oProfile->getUrl(), 'icon' => $CNF['ICON']));
// add replaceable markers
$this->addMarkers($this->_aProfileInfo);
// every content field can be used as marker
$this->addMarkers(array('profile_id' => $this->_oProfile->id()));
// profile id field
$this->addMarkers(array('display_name' => $this->_oProfile->getDisplayName()));
// profile display name
$this->addMarkers(array('profile_link' => $this->_oProfile->getUrl()));
// profile link
// display message if profile isn't active
if (bx_get_logged_profile_id() == $this->_oProfile->id() && !empty($CNF['INFORMERS']['status'])) {
$sStatus = $this->_aContentInfo['profile_status'];
if (isset($CNF['INFORMERS']['status']['map'][$sStatus])) {
$aInformers[] = array('name' => $CNF['INFORMERS']['status']['name'], 'msg' => _t($CNF['INFORMERS']['status']['map'][$sStatus]), 'type' => BX_INFORMER_ALERT);
}
}
// display message if it is possible to switch to this profile
$oProfile = $this->_aContentInfo ? BxDolProfile::getInstanceByContentTypeAccount($this->_aContentInfo['id'], $this->MODULE) : false;
if ($oProfile) {
$oProfile->checkSwitchToProfile($this->_oTemplate);
}
// add informers
if ($aInformers) {
$oInformer = BxDolInformer::getInstance($this->_oTemplate);
if ($oInformer) {
foreach ($aInformers as $a) {
$oInformer->add($a['name'], $this->_replaceMarkers($a['msg']), $a['type']);
}
}
}
}
示例12: __construct
function __construct($sMode = '', $aParams = array())
{
$this->aUnitViews = array('extended' => 'unit.html');
if (empty($aParams['unit_view'])) {
$aParams['unit_view'] = 'extended';
}
parent::__construct($sMode, $aParams);
$this->aCurrent = array('name' => 'bx_albums', 'module_name' => 'bx_albums', 'object_metatags' => 'bx_albums', 'title' => _t('_bx_albums_page_title_browse'), 'table' => 'bx_albums_albums', 'ownFields' => array('id', 'title', 'text', 'thumb', 'author', 'added'), 'searchFields' => array('title', 'text'), 'restriction' => array('author' => array('value' => '', 'field' => 'author', 'operator' => '='), 'status' => array('value' => 'active', 'field' => 'status', 'operator' => '=')), 'paginate' => array('perPage' => getParam('bx_albums_per_page_browse'), 'start' => 0), 'sorting' => 'last', 'rss' => array('title' => '', 'link' => '', 'image' => '', 'profile' => 0, 'fields' => array('Guid' => 'link', 'Link' => 'link', 'Title' => 'title', 'DateTimeUTS' => 'added', 'Desc' => 'text')), 'ident' => 'id');
$this->sFilterName = 'bx_albums_filter';
$this->oModule = $this->getMain();
$oProfileAuthor = null;
$CNF =& $this->oModule->_oConfig->CNF;
switch ($sMode) {
case 'author':
$oProfileAuthor = BxDolProfile::getInstance((int) $aParams['author']);
if (!$oProfileAuthor) {
$this->isError = true;
break;
}
$this->aCurrent['restriction']['author']['value'] = $oProfileAuthor->id();
$this->sBrowseUrl = 'page.php?i=' . $CNF['URI_AUTHOR_ENTRIES'] . '&profile_id={profile_id}';
$this->aCurrent['title'] = _t('_bx_albums_page_title_browse_by_author');
$this->aCurrent['rss']['link'] = 'modules/?r=albums/rss/' . $sMode . '/' . $oProfileAuthor->id();
break;
case 'public':
$this->sBrowseUrl = BxDolPermalinks::getInstance()->permalink($CNF['URL_HOME']);
$this->aCurrent['title'] = _t('_bx_albums_page_title_browse_recent');
$this->aCurrent['rss']['link'] = 'modules/?r=albums/rss/' . $sMode;
break;
case 'popular':
$this->sBrowseUrl = BxDolPermalinks::getInstance()->permalink($CNF['URL_POPULAR']);
$this->aCurrent['title'] = _t('_bx_albums_page_title_browse_popular');
$this->aCurrent['rss']['link'] = 'modules/?r=albums/rss/' . $sMode;
$this->aCurrent['sorting'] = 'popular';
break;
case 'updated':
$this->sBrowseUrl = BxDolPermalinks::getInstance()->permalink($CNF['URL_UPDATED']);
$this->aCurrent['title'] = _t('_bx_albums_page_title_browse_updated');
$this->aCurrent['rss']['link'] = 'modules/?r=albums/rss/' . $sMode;
$this->aCurrent['sorting'] = 'updated';
break;
case '':
// search results
$this->sBrowseUrl = BX_DOL_SEARCH_KEYWORD_PAGE;
$this->aCurrent['title'] = _t('_bx_albums');
$this->aCurrent['paginate']['perPage'] = 3;
unset($this->aCurrent['rss']);
break;
default:
$sMode = '';
$this->isError = true;
}
$this->processReplaceableMarkers($oProfileAuthor);
$this->addConditionsForPrivateContent($CNF, $oProfileAuthor);
}
示例13: serviceProfileStats
public function serviceProfileStats($iProfileId = 0)
{
if (!$iProfileId) {
$iProfileId = bx_get_logged_profile_id();
}
$oMenu = BxDolMenu::getObjectInstance('sys_profile_stats');
$oProfile = BxDolProfile::getInstance($iProfileId);
$aVars = array('profile_id' => $oProfile->id(), 'profile_url' => $oProfile->getUrl(), 'profile_edit_url' => $oProfile->getEditUrl(), 'profile_title' => $oProfile->getDisplayName(), 'profile_title_attr' => bx_html_attribute($oProfile->getDisplayName()), 'profile_ava_url' => $oProfile->getAvatar(), 'menu' => $oMenu->getCode());
$oTemplate = BxDolTemplate::getInstance();
return $oTemplate->parseHtmlByName('profile_stats.html', $aVars);
}
示例14: __construct
public function __construct($iAccoutId = 0)
{
parent::__construct();
$sKey = getParam('bx_antispam_akismet_api_key');
if ($sKey && ($oAccount = BxDolAccount::getInstance((int) $iAccoutId))) {
require_once BX_DIRECTORY_PATH_PLUGINS . 'akismet/Akismet.class.php';
$this->oAkismet = new Akismet(BX_DOL_URL_ROOT, $sKey);
$oProfile = BxDolProfile::getInstanceByAccount((int) $iAccoutId);
$this->oAkismet->setCommentAuthorEmail($oAccount->getEmail());
$this->oAkismet->setCommentAuthor($oProfile->getDisplayName());
$this->oAkismet->setCommentAuthorURL($oProfile->getUrl());
}
}
示例15: __construct
function __construct($sMode = '', $aParams = array())
{
$this->sCenterContentUnitSelector = '.bx-albums-unit-size';
$this->aUnitViews = array('gallery' => 'unit_media.html');
$this->sUnitTemplateLiveSearch = 'unit_media_live_search.html';
if (empty($aParams['unit_view'])) {
$aParams['unit_view'] = 'gallery';
}
parent::__construct($sMode, $aParams);
$this->aCurrent = array('name' => 'bx_albums_media', 'module_name' => 'bx_albums', 'object_metatags' => 'bx_albums_media', 'title' => _t('_bx_albums_media'), 'table' => 'bx_albums_files2albums', 'ownFields' => array('id', 'title', 'data', 'content_id', 'file_id', 'order', 'views'), 'searchFields' => array('title'), 'restriction_sql' => '', 'restriction' => array('author' => array('value' => '', 'field' => 'author', 'operator' => '='), 'album' => array('value' => '', 'field' => 'content_id', 'operator' => '=')), 'join' => array('albums' => array('type' => 'INNER', 'table' => 'bx_albums_albums', 'mainField' => 'content_id', 'onField' => 'id', 'joinFields' => array()), 'files' => array('type' => 'INNER', 'table' => 'bx_albums_files', 'table_alias' => 'f', 'mainField' => 'file_id', 'onField' => 'id', 'joinFields' => array('added'))), 'paginate' => array('perPage' => getParam('bx_albums_per_page_browse'), 'start' => 0), 'sorting' => 'last', 'rss' => array('title' => '', 'link' => '', 'image' => '', 'profile' => 0, 'fields' => array('Guid' => 'link', 'Link' => 'link', 'Title' => 'title', 'DateTimeUTS' => 'added', 'Desc' => 'title')), 'ident' => 'id');
$this->sFilterName = 'bx_albums_filter';
$this->oModule = $this->getMain();
$oProfileAuthor = isset($aParams['author']) ? BxDolProfile::getInstance((int) $aParams['author']) : null;
$CNF =& $this->oModule->_oConfig->CNF;
switch ($sMode) {
case 'album':
$this->aCurrent['restriction']['album']['value'] = (int) $aParams['album_id'];
$this->sBrowseUrl = BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . (int) $aParams['album_id']);
$this->aCurrent['title'] = _t('_bx_albums_page_title_browse_media_in_album');
$this->aCurrent['rss']['link'] = 'modules/?r=albums/rss_media/' . $sMode . '/' . (int) $aParams['album_id'];
$this->aCurrent['sorting'] = 'order';
$this->sOrderDirection = 'ASC';
break;
case 'recent':
$this->sBrowseUrl = BxDolPermalinks::getInstance()->permalink($CNF['URL_RECENT_MEDIA']);
$this->aCurrent['title'] = _t('_bx_albums_page_title_browse_recent_media');
$this->aCurrent['rss']['link'] = 'modules/?r=albums/rss_media/' . $sMode;
$this->aCurrent['sorting'] = 'last';
break;
case 'popular':
$this->sBrowseUrl = BxDolPermalinks::getInstance()->permalink($CNF['URL_POPULAR_MEDIA']);
$this->aCurrent['title'] = _t('_bx_albums_page_title_browse_popular_media');
$this->aCurrent['rss']['link'] = BxDolPermalinks::getInstance()->permalink('modules/?r=albums/rss_media/' . $sMode);
$this->aCurrent['sorting'] = 'popular';
break;
case '':
// search results
$this->sBrowseUrl = BX_DOL_SEARCH_KEYWORD_PAGE;
$this->aCurrent['paginate']['perPage'] = 3;
unset($this->aCurrent['rss']);
break;
default:
$sMode = '';
$this->isError = true;
}
$this->sBrowseUrl = $this->_replaceMarkers($this->sBrowseUrl);
$this->aCurrent['title'] = $this->_replaceMarkers($this->aCurrent['title']);
$this->addConditionsForPrivateContent($CNF, $oProfileAuthor);
}