本文整理汇总了PHP中Pages::UrlFromId方法的典型用法代码示例。如果您正苦于以下问题:PHP Pages::UrlFromId方法的具体用法?PHP Pages::UrlFromId怎么用?PHP Pages::UrlFromId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pages
的用法示例。
在下文中一共展示了Pages::UrlFromId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSuccessfulValidateCallsRedirectToNormalPageWhenNoRequestedPage
public function testSuccessfulValidateCallsRedirectToNormalPageWhenNoRequestedPage()
{
$userSession = new UserSession(1);
$userSession->HomepageId = 2;
$this->fakeServer->UserSession = $userSession;
$this->auth->_ValidateResult = true;
$this->presenter->Login();
$this->assertEquals(Pages::UrlFromId(2), $this->page->_LastRedirect);
}
示例2: testRedirectsToHomepageIfUserIsActive
public function testRedirectsToHomepageIfUserIsActive()
{
$this->user->SetStatus(AccountStatus::ACTIVE);
$this->user->ChangeDefaultHomePage(2);
$this->postRegistration->HandleSelfRegistration($this->user, $this->page, $this->context);
$this->assertTrue($this->fakeAuth->_LoginCalled);
$this->assertEquals($this->user->EmailAddress(), $this->fakeAuth->_LastLogin);
$this->assertFalse($this->fakeAuth->_LastLoginContext->GetData()->Persist);
$this->assertEquals(Pages::UrlFromId(2), $this->page->_RedirectDestination);
}
示例3: HandleSelfRegistration
public function HandleSelfRegistration(User $user, IRegistrationPage $page, ILoginContext $loginContext)
{
if ($user->StatusId() == AccountStatus::ACTIVE) {
Log::Debug('PostRegistration - Handling activate user %s', $user->EmailAddress());
$this->authentication->Login($user->EmailAddress(), $loginContext);
$page->Redirect(Pages::UrlFromId($user->Homepage()));
} else {
Log::Debug('PostRegistration - Handling pending user %s', $user->EmailAddress());
$this->activation->Notify($user);
$page->Redirect(Pages::ACTIVATION);
}
}
示例4: testActivatesAccount
public function testActivatesAccount()
{
$user = new FakeUser(12);
$activationSuccess = new ActivationResult(true, $user);
$this->accountActivation->_ActivationResult = $activationSuccess;
$activationCode = uniqid();
$this->page->expects($this->once())->method('GetActivationCode')->will($this->returnValue($activationCode));
$this->page->expects($this->once())->method('Redirect')->with($this->equalTo(Pages::UrlFromId($user->Homepage())));
$this->presenter->PageLoad();
$this->assertEquals($activationCode, $this->accountActivation->_LastActivationCode);
$this->assertTrue($this->auth->_LoginCalled);
$this->assertEquals($user->EmailAddress(), $this->auth->_LastLogin);
$this->assertEquals(new WebLoginContext(new LoginData(false, $user->Language())), $this->auth->_LastLoginContext);
}
示例5: PageLoad
public function PageLoad()
{
$activationCode = $this->page->GetActivationCode();
if (empty($activationCode)) {
$this->page->ShowSent();
} else {
$activationResult = $this->accountActivation->Activate($activationCode);
if ($activationResult->Activated()) {
$user = $activationResult->User();
$this->authentication->Login($user->EmailAddress(), new WebLoginContext(new LoginData(false, $user->Language())));
$this->page->Redirect(Pages::UrlFromId($user->Homepage()));
} else {
$this->page->ShowError();
}
}
}
示例6: _Redirect
private function _Redirect()
{
$redirect = $this->_page->GetResumeUrl();
if (!empty($redirect)) {
$this->_page->Redirect(html_entity_decode($redirect));
} else {
$defaultId = ServiceLocator::GetServer()->GetUserSession()->HomepageId;
$url = Pages::UrlFromId($defaultId);
$this->_page->Redirect(empty($url) ? Pages::UrlFromId(Pages::DEFAULT_HOMEPAGE_ID) : $url);
}
}
示例7: __construct
protected function __construct($titleKey = '', $pageDepth = 0)
{
$this->SetSecurityHeaders();
$this->path = str_repeat('../', $pageDepth);
$this->server = ServiceLocator::GetServer();
$resources = Resources::GetInstance();
ExceptionHandler::SetExceptionHandler(new WebExceptionHandler(array($this, 'RedirectToError')));
$this->smarty = new SmartyPage($resources, $this->path);
$userSession = ServiceLocator::GetServer()->GetUserSession();
$this->smarty->assign('Charset', $resources->Charset);
$this->smarty->assign('CurrentLanguage', $resources->CurrentLanguage);
$this->smarty->assign('HtmlLang', $resources->HtmlLang);
$this->smarty->assign('HtmlTextDirection', $resources->TextDirection);
$this->smarty->assign('Title', 'Booked - ' . $resources->GetString($titleKey));
$this->smarty->assign('CalendarJSFile', $resources->CalendarLanguageFile);
$this->smarty->assign('LoggedIn', $userSession->IsLoggedIn());
$this->smarty->assign('Version', Configuration::VERSION);
$this->smarty->assign('Path', $this->path);
$this->smarty->assign('ScriptUrl', Configuration::Instance()->GetScriptUrl());
$this->smarty->assign('UserName', !is_null($userSession) ? $userSession->FirstName : '');
$this->smarty->assign('DisplayWelcome', $this->DisplayWelcome());
$this->smarty->assign('UserId', $userSession->UserId);
$this->smarty->assign('CanViewAdmin', $userSession->IsAdmin);
$this->smarty->assign('CanViewGroupAdmin', $userSession->IsGroupAdmin);
$this->smarty->assign('CanViewResourceAdmin', $userSession->IsResourceAdmin);
$this->smarty->assign('CanViewScheduleAdmin', $userSession->IsScheduleAdmin);
$this->smarty->assign('CanViewResponsibilities', !$userSession->IsAdmin && ($userSession->IsGroupAdmin || $userSession->IsResourceAdmin || $userSession->IsScheduleAdmin));
$allowAllUsersToReports = Configuration::Instance()->GetSectionKey(ConfigSection::REPORTS, ConfigKeys::REPORTS_ALLOW_ALL, new BooleanConverter());
$this->smarty->assign('CanViewReports', $allowAllUsersToReports || $userSession->IsAdmin || $userSession->IsGroupAdmin || $userSession->IsResourceAdmin || $userSession->IsScheduleAdmin);
$timeout = Configuration::Instance()->GetKey(ConfigKeys::INACTIVITY_TIMEOUT);
if (!empty($timeout)) {
$this->smarty->assign('SessionTimeoutSeconds', max($timeout, 1) * 60);
}
$this->smarty->assign('ShouldLogout', $this->GetShouldAutoLogout());
$this->smarty->assign('CssExtensionFile', Configuration::Instance()->GetKey(ConfigKeys::CSS_EXTENSION_FILE));
$this->smarty->assign('UseLocalJquery', Configuration::Instance()->GetKey(ConfigKeys::USE_LOCAL_JQUERY, new BooleanConverter()));
$this->smarty->assign('EnableConfigurationPage', Configuration::Instance()->GetSectionKey(ConfigSection::PAGES, ConfigKeys::PAGES_ENABLE_CONFIGURATION, new BooleanConverter()));
$this->smarty->assign('ShowParticipation', !Configuration::Instance()->GetSectionKey(ConfigSection::RESERVATION, ConfigKeys::RESERVATION_PREVENT_PARTICIPATION, new BooleanConverter()));
$this->smarty->assign('LogoUrl', 'booked.png');
if (file_exists($this->path . 'img/custom-logo.png')) {
$this->smarty->assign('LogoUrl', 'custom-logo.png');
}
if (file_exists($this->path . 'img/custom-logo.gif')) {
$this->smarty->assign('LogoUrl', 'custom-logo.gif');
}
if (file_exists($this->path . 'img/custom-logo.jpg')) {
$this->smarty->assign('LogoUrl', 'custom-logo.jpg');
}
$this->smarty->assign('CssUrl', 'null-style.css');
if (file_exists($this->path . 'css/custom-style.css')) {
$this->smarty->assign('CssUrl', 'custom-style.css');
}
$logoUrl = Configuration::Instance()->GetKey(ConfigKeys::HOME_URL);
if (empty($logoUrl)) {
$logoUrl = $this->path . Pages::UrlFromId($userSession->HomepageId);
}
$this->smarty->assign('HomeUrl', $logoUrl);
}