本文整理汇总了PHP中BxDolProfile::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP BxDolProfile::getInstance方法的具体用法?PHP BxDolProfile::getInstance怎么用?PHP BxDolProfile::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BxDolProfile
的用法示例。
在下文中一共展示了BxDolProfile::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: __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;
}
}
示例3: __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'])));
}
}
}
}
示例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: _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);
}
示例7: 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());
}
示例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: setLogged
/**
* Logged profile
*
* @param $iProfileId integer
* @param $sPassword string
* @param $sCallbackUrl
* @param $bRedirect boolean
* @return void
*/
function setLogged($iProfileId, $sCallbackUrl = '', $bRedirect = true)
{
$oProfile = BxDolProfile::getInstance($iProfileId);
bx_login($oProfile->getAccountId());
if ($bRedirect) {
$sCallbackUrl = $sCallbackUrl ? $sCallbackUrl : $this->_oConfig->sDefaultRedirectUrl;
header('Location: ' . $sCallbackUrl);
}
}
示例10: _getProfileObject
protected function _getProfileObject($iId)
{
bx_import('BxDolProfile');
$oProfile = BxDolProfile::getInstance($iId);
if (!$oProfile) {
bx_import('BxDolProfileUndefined');
$oProfile = BxDolProfileUndefined::getInstance();
}
return $oProfile;
}
示例11: _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;
}
示例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: __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']);
}
}
}
}
示例14: 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);
}
示例15: createAccountForm
public function createAccountForm()
{
// check access
if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = BxDolAccount::isAllowedCreate(0))) {
return MsgBox($sMsg);
}
// check and display form
$oForm = BxDolForm::getObjectInstance('sys_account', 'sys_account_create');
if (!$oForm) {
return MsgBox(_t('_sys_txt_error_occured'));
}
$oForm->initChecker();
if (!$oForm->isSubmittedAndValid()) {
$sCode = $oForm->getCode();
bx_alert('account', 'add_form', 0, 0, array('form_object' => &$oForm, 'form_code' => &$sCode));
return $sCode;
}
// insert data into database
$aValsToAdd = array('email_confirmed' => 0);
$iAccountId = $oForm->insert($aValsToAdd);
if (!$iAccountId) {
if (!$oForm->isValid()) {
return $oForm->getCode();
} else {
return MsgBox(_t('_sys_txt_error_account_creation'));
}
}
// alert
bx_alert('account', 'add', $iAccountId, 0);
// if email_confirmation procedure is enabled - send email confirmation letter
$oAccount = BxDolAccount::getInstance($iAccountId);
if (getParam('sys_email_confirmation') && $oAccount && !$oAccount->isConfirmed()) {
$oAccount->sendConfirmationEmail($iAccountId);
}
// add account and content association
bx_import('BxDolProfile');
$iProfileId = BxDolProfile::add(BX_PROFILE_ACTION_MANUAL, $iAccountId, $iAccountId, BX_PROFILE_STATUS_PENDING, 'system');
$oProfile = BxDolProfile::getInstance($iProfileId);
// approve profile if auto-approval is enabled and profile status is 'pending'
$sStatus = $oProfile->getStatus();
$isAutoApprove = $oForm->isSetPendingApproval() ? false : true;
if ($sStatus == BX_PROFILE_STATUS_PENDING && $isAutoApprove) {
$oProfile->approve(BX_PROFILE_ACTION_AUTO);
}
// perform action
BxDolAccount::isAllowedCreate($iProfileId, true);
// alert
bx_alert('account', 'added', $iAccountId);
// login to the created account automatically
bx_login($iAccountId);
$this->_iProfileId = bx_get_logged_profile_id();
// redirect
$this->_redirectAndExit(getParam('sys_redirect_after_account_added'), true, array('account_id' => $iAccountId, 'profile_id' => $iProfileId));
}