本文整理汇总了PHP中BxDolProfile::getInstanceByContentTypeAccount方法的典型用法代码示例。如果您正苦于以下问题:PHP BxDolProfile::getInstanceByContentTypeAccount方法的具体用法?PHP BxDolProfile::getInstanceByContentTypeAccount怎么用?PHP BxDolProfile::getInstanceByContentTypeAccount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BxDolProfile
的用法示例。
在下文中一共展示了BxDolProfile::getInstanceByContentTypeAccount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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']);
}
}
}
}
示例2: _checkAllowedConnect
protected function _checkAllowedConnect(&$aDataEntry, $isPerformAction, $sObjConnection, $isMutual, $isInvertResult, $isSwap = false)
{
if (!$this->_iProfileId) {
return _t('_sys_txt_access_denied');
}
$CNF =& $this->_oConfig->CNF;
$oProfileAuthor = BxDolProfile::getInstance($aDataEntry[$CNF['FIELD_AUTHOR']]);
$oProfile = $oProfileAuthor ? BxDolProfile::getInstanceByContentTypeAccount($aDataEntry[$CNF['FIELD_ID']], $this->_aModule['name'], $oProfileAuthor->getAccountId()) : false;
if (!$oProfile || $oProfile->id() == $this->_iProfileId) {
return _t('_sys_txt_access_denied');
}
bx_import('BxDolConnection');
$oConn = BxDolConnection::getObjectInstance($sObjConnection);
if ($isSwap) {
$isConnected = $oConn->isConnected($oProfile->id(), $this->_iProfileId, $isMutual);
} else {
$isConnected = $oConn->isConnected($this->_iProfileId, $oProfile->id(), $isMutual);
}
if ($isInvertResult) {
$isConnected = !$isConnected;
}
return $isConnected ? _t('_sys_txt_access_denied') : CHECK_ACTION_RESULT_ALLOWED;
}