本文整理汇总了PHP中MetaModel::DBHasAccess方法的典型用法代码示例。如果您正苦于以下问题:PHP MetaModel::DBHasAccess方法的具体用法?PHP MetaModel::DBHasAccess怎么用?PHP MetaModel::DBHasAccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MetaModel
的用法示例。
在下文中一共展示了MetaModel::DBHasAccess方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: output
//.........这里部分代码省略.........
// 2) clicking on it will erase it
$sText = Dict::S("UI:YourSearch");
$sOnClick = " onclick=\"this.value='';this.onclick=null;\"";
}
// Render the tabs in the page (if any)
$this->s_content = $this->m_oTabs->RenderIntoContent($this->s_content);
if ($this->GetOutputFormat() == 'html') {
$oAppContext = new ApplicationContext();
$sUserName = UserRights::GetUser();
$sIsAdmin = UserRights::IsAdministrator() ? '(Administrator)' : '';
if (UserRights::IsAdministrator()) {
$sLogonMessage = Dict::Format('UI:LoggedAsMessage+Admin', $sUserName);
} else {
$sLogonMessage = Dict::Format('UI:LoggedAsMessage', $sUserName);
}
$sLogOffMenu = "<span id=\"logOffBtn\"><ul><li><img src=\"../images/onOffBtn.png\"><ul>";
$sLogOffMenu .= "<li><span>{$sLogonMessage}</span></li>\n";
$aActions = array();
$oPrefs = new URLPopupMenuItem('UI:Preferences', Dict::S('UI:Preferences'), utils::GetAbsoluteUrlAppRoot() . "pages/preferences.php?" . $oAppContext->GetForLink());
$aActions[$oPrefs->GetUID()] = $oPrefs->GetMenuItem();
if (utils::CanLogOff()) {
$oLogOff = new URLPopupMenuItem('UI:LogOffMenu', Dict::S('UI:LogOffMenu'), utils::GetAbsoluteUrlAppRoot() . 'pages/logoff.php?operation=do_logoff');
$aActions[$oLogOff->GetUID()] = $oLogOff->GetMenuItem();
}
if (UserRights::CanChangePassword()) {
$oChangePwd = new URLPopupMenuItem('UI:ChangePwdMenu', Dict::S('UI:ChangePwdMenu'), utils::GetAbsoluteUrlAppRoot() . 'pages/UI.php?loginop=change_pwd');
$aActions[$oChangePwd->GetUID()] = $oChangePwd->GetMenuItem();
}
utils::GetPopupMenuItems($this, iPopupMenuExtension::MENU_USER_ACTIONS, null, $aActions);
$oAbout = new JSPopupMenuItem('UI:AboutBox', Dict::S('UI:AboutBox'), 'return ShowAboutBox();');
$aActions[$oAbout->GetUID()] = $oAbout->GetMenuItem();
$sLogOffMenu .= $this->RenderPopupMenuItems($aActions);
$sRestrictions = '';
if (!MetaModel::DBHasAccess(ACCESS_ADMIN_WRITE)) {
if (!MetaModel::DBHasAccess(ACCESS_ADMIN_WRITE)) {
$sRestrictions = Dict::S('UI:AccessRO-All');
}
} elseif (!MetaModel::DBHasAccess(ACCESS_USER_WRITE)) {
$sRestrictions = Dict::S('UI:AccessRO-Users');
}
$sApplicationBanner = '';
if (strlen($sRestrictions) > 0) {
$sAdminMessage = trim(MetaModel::GetConfig()->Get('access_message'));
$sApplicationBanner .= '<div id="admin-banner">';
$sApplicationBanner .= '<img src="../images/locked.png" style="vertical-align:middle;">';
$sApplicationBanner .= ' <b>' . $sRestrictions . '</b>';
if (strlen($sAdminMessage) > 0) {
$sApplicationBanner .= ' <b>' . $sAdminMessage . '</b>';
}
$sApplicationBanner .= '</div>';
}
if (strlen($this->m_sMessage)) {
$sApplicationBanner .= '<div id="admin-banner"><span style="padding:5px;">' . $this->m_sMessage . '<span></div>';
}
$sApplicationBanner .= $sBannerExtraHtml;
if (!empty($sNorthPane)) {
$sNorthPane = '<div id="bottom-pane" class="ui-layout-north">' . $sNorthPane . '</div>';
}
if (!empty($sSouthPane)) {
$sSouthPane = '<div id="bottom-pane" class="ui-layout-south">' . $sSouthPane . '</div>';
}
$sIconUrl = Utils::GetConfig()->Get('app_icon_url');
$sOnlineHelpUrl = MetaModel::GetConfig()->Get('online_help');
//$sLogOffMenu = "<span id=\"logOffBtn\" style=\"height:55px;padding:0;margin:0;\"><img src=\"../images/onOffBtn.png\"></span>";
$sDisplayIcon = utils::GetAbsoluteUrlAppRoot() . 'images/itop-logo.png';
if (file_exists(MODULESROOT . 'branding/main-logo.png')) {
示例2: output
public function output()
{
$sApplicationBanner = '';
if (!MetaModel::DBHasAccess(ACCESS_USER_WRITE)) {
$sReadOnly = Dict::S('UI:AccessRO-Users');
$sAdminMessage = trim(MetaModel::GetConfig()->Get('access_message'));
$sApplicationBanner .= '<div id="admin-banner">';
$sApplicationBanner .= '<img src="../images/locked.png" style="vertical-align:middle;">';
$sApplicationBanner .= ' <b>' . $sReadOnly . '</b>';
if (strlen($sAdminMessage) > 0) {
$sApplicationBanner .= ' : ' . $sAdminMessage . '';
}
$sApplicationBanner .= '</div>';
}
$sMenu = '';
if ($this->m_bEnableDisconnectButton) {
$this->AddMenuButton('logoff', 'Portal:Disconnect', utils::GetAbsoluteUrlAppRoot() . 'pages/logoff.php?operation=do_logoff');
// This menu is always present and is the last one
}
foreach ($this->m_aMenuButtons as $aMenuItem) {
$sMenu .= "<a class=\"button\" id=\"{$aMenuItem['id']}\" href=\"{$aMenuItem['hyperlink']}\"><span>" . Dict::S($aMenuItem['label']) . "</span></a>";
}
$this->s_content = '<div id="portal"><div id="welcome">' . $this->m_sWelcomeMsg . '</div><div id="banner"><div id="logo"></div><div id="menu">' . $sMenu . '</div></div>' . $sApplicationBanner . '<div id="content">' . $this->s_content . '</div></div>';
parent::output();
}
示例3: DisplayStatus
$oP->p("Background processes: " . $sDisplayProcesses);
}
if (utils::ReadParam('status_only', false, true)) {
// Display status and exit
DisplayStatus($oP);
exit(0);
}
require_once APPROOT . 'core/mutex.class.inc.php';
$oP->p("Starting: " . time() . ' (' . date('Y-m-d H:i:s') . ')');
try {
$oConfig = utils::GetConfig();
$oMutex = new iTopMutex('cron.' . $oConfig->GetDBName() . '_' . $oConfig->GetDBSubname());
if ($oMutex->TryLock()) {
// Note: testing this now in case some of the background processes forces the read-only mode for a while
// in that case it is better to exit with the check on reentrance (mutex)
if (!MetaModel::DBHasAccess(ACCESS_ADMIN_WRITE)) {
$oP->p("A database maintenance is ongoing (read-only mode even for admins).");
$oP->Output();
exit - 1;
}
CronExec($oP, $aProcesses, $bVerbose);
$oMutex->Unlock();
} else {
// Exit silently
$oP->p("Already running...");
}
} catch (Exception $e) {
$oP->p("ERROR: '" . $e->getMessage() . "'");
if ($bDebug) {
// Might contain verb parameters such a password...
$oP->p($e->getTraceAsString());