本文整理汇总了PHP中ServiceLocator::GetServer方法的典型用法代码示例。如果您正苦于以下问题:PHP ServiceLocator::GetServer方法的具体用法?PHP ServiceLocator::GetServer怎么用?PHP ServiceLocator::GetServer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ServiceLocator
的用法示例。
在下文中一共展示了ServiceLocator::GetServer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ProcessPageLoad
public function ProcessPageLoad()
{
$this->presenter->PageLoad();
$this->Set('priorities', range(1, 10));
$this->Set('timezone', ServiceLocator::GetServer()->GetUserSession()->Timezone);
$this->Display('Admin/manage_announcements.tpl');
}
示例2: PageLoad
public function PageLoad()
{
$this->Set('DefaultTitle', Resources::GetInstance()->GetString('NoTitleLabel'));
$this->presenter->SetSearchCriteria(ServiceLocator::GetServer()->GetUserSession()->UserId, ReservationUserLevel::ALL);
$this->presenter->PageLoad();
$this->Display('upcoming_reservations.tpl');
}
示例3: __construct
public function __construct($user = null)
{
$this->user = $user;
if ($this->user == null) {
$this->user = ServiceLocator::GetServer()->GetUserSession();
}
}
示例4: __construct
public function __construct()
{
parent::__construct();
$userRepository = new UserRepository();
$this->presenter = new ManageReservationsPresenter($this, new ScheduleAdminManageReservationsService(new ReservationViewRepository(), $userRepository, new ReservationAuthorization(PluginManager::Instance()->LoadAuthorization())), new ScheduleAdminScheduleRepository($userRepository, ServiceLocator::GetServer()->GetUserSession()), new ResourceAdminResourceRepository($userRepository, ServiceLocator::GetServer()->GetUserSession()), new AttributeService(new AttributeRepository()), new UserPreferenceRepository());
$this->SetPageId('manage-reservations-schedule-admin');
}
示例5: __construct
public function __construct()
{
parent::__construct();
$userRepository = new UserRepository();
$user = ServiceLocator::GetServer()->GetUserSession();
$this->_presenter = new ManageSchedulesPresenter($this, new ScheduleAdminManageScheduleService(new ScheduleAdminScheduleRepository($userRepository, $user), new ScheduleRepository(), new ResourceAdminResourceRepository($userRepository, $user)), new GroupRepository());
}
示例6: PageLoad
public function PageLoad()
{
ob_clean();
$this->presenter->PageLoad();
$config = Configuration::Instance();
$feed = new FeedWriter(ATOM);
$title = $config->GetKey(ConfigKeys::APP_TITLE);
$feed->setTitle("{$title} Reservations");
$url = $config->GetScriptUrl();
$feed->setLink($url);
$feed->setChannelElement('updated', date(DATE_ATOM, time()));
$feed->setChannelElement('author', array('name' => $title));
foreach ($this->reservations as $reservation) {
/** @var FeedItem $item */
$item = $feed->createNewItem();
$item->setTitle($reservation->Summary);
$item->setLink($reservation->ReservationUrl);
$item->setDate($reservation->DateCreated->Timestamp());
$item->setDescription($this->FormatReservationDescription($reservation, ServiceLocator::GetServer()->GetUserSession()));
// sprintf('<div><span>Start</span> %s</div>
// <div><span>End</span> %s</div>
// <div><span>Organizer</span> %s</div>
// <div><span>Description</span> %s</div>',
// $reservation->DateStart->ToString(),
// $reservation->DateEnd->ToString(),
// $reservation->Organizer,
// $reservation->Description));
$feed->addItem($item);
}
$feed->genarateFeed();
}
示例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);
$appTitle = Configuration::Instance()->GetKey(ConfigKeys::APP_TITLE);
$pageTile = $resources->GetString($titleKey);
$this->smarty->assign('Title', (empty($appTitle) ? 'Booked' : $appTitle) . (empty($pageTile) ? '' : ' - ' . $pageTile));
$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);
}
示例8: __construct
/**
* @param IReservationViewRepository $reservationViewRepository
* @param IReservationAuthorization $authorization
* @param IReservationHandler $reservationHandler
* @param IUpdateReservationPersistenceService $persistenceService
*/
public function __construct(IReservationViewRepository $reservationViewRepository, $authorization = null, $reservationHandler = null, $persistenceService = null)
{
$this->reservationViewRepository = $reservationViewRepository;
$this->reservationAuthorization = $authorization == null ? new ReservationAuthorization(PluginManager::Instance()->LoadAuthorization()) : $authorization;
$this->persistenceService = $persistenceService == null ? new UpdateReservationPersistenceService(new ReservationRepository()) : $persistenceService;
$this->reservationHandler = $reservationHandler == null ? ReservationHandler::Create(ReservationAction::Update, $this->persistenceService, ServiceLocator::GetServer()->GetUserSession()) : $reservationHandler;
}
示例9: Register
public function Register($username, $email, $firstName, $lastName, $password, $timezone, $language, $homepageId, $additionalFields = array(), $attributeValues = array(), $groups = null)
{
$encryptedPassword = $this->_passwordEncryption->EncryptPassword($password);
$attributes = new UserAttribute($additionalFields);
if ($this->CreatePending()) {
$user = User::CreatePending($firstName, $lastName, $email, $username, $language, $timezone, $encryptedPassword->EncryptedPassword(), $encryptedPassword->Salt(), $homepageId);
} else {
$user = User::Create($firstName, $lastName, $email, $username, $language, $timezone, $encryptedPassword->EncryptedPassword(), $encryptedPassword->Salt(), $homepageId);
}
$user->ChangeAttributes($attributes->Get(UserAttribute::Phone), $attributes->Get(UserAttribute::Organization), $attributes->Get(UserAttribute::Position));
$user->ChangeCustomAttributes($attributeValues);
if ($groups != null) {
$user->WithGroups($groups);
}
if (Configuration::Instance()->GetKey(ConfigKeys::REGISTRATION_AUTO_SUBSCRIBE_EMAIL, new BooleanConverter())) {
foreach (ReservationEvent::AllEvents() as $event) {
$user->ChangeEmailPreference($event, true);
}
}
$userId = $this->_userRepository->Add($user);
$this->AutoAssignPermissions($userId);
if (Configuration::Instance()->GetKey(ConfigKeys::REGISTRATION_NOTIFY, new BooleanConverter())) {
ServiceLocator::GetEmailService()->Send(new AccountCreationEmail($user, ServiceLocator::GetServer()->GetUserSession()));
}
return $user;
}
示例10: Handle
/**
* @param ReservationItemView $existingReservation
* @return bool
*/
public function Handle(ReservationItemView $existingReservation)
{
$reservation = $this->repository->LoadById($existingReservation->GetId());
$reservation->ApplyChangesTo(SeriesUpdateScope::ThisInstance);
$reservation->Delete(ServiceLocator::GetServer()->GetUserSession());
$this->repository->Delete($reservation);
return true;
}
示例11: Create
public static function Create()
{
if (ServiceLocator::GetServer()->GetQuerystring(QueryStringKeys::RESPONSE_TYPE) == 'json') {
return new ReservationDeleteJsonPage();
} else {
return new ReservationDeletePage();
}
}
示例12: __construct
public function __construct()
{
parent::__construct();
$this->_presenter->SetUserRepository(new GroupAdminUserRepository(new GroupRepository(), ServiceLocator::GetServer()->GetUserSession()));
$groupRepository = new GroupAdminGroupRepository(new UserRepository(), ServiceLocator::GetServer()->GetUserSession());
$this->_presenter->SetGroupRepository($groupRepository);
$this->_presenter->SetGroupViewRepository($groupRepository);
}
示例13: PageLoad
public function PageLoad()
{
$this->presenter->PageLoad(ServiceLocator::GetServer()->GetUserSession());
header("Content-Type: text/Calendar");
header("Content-Disposition: inline; filename=calendar.ics");
$display = new CalendarExportDisplay();
echo $display->Render($this->reservations);
}
示例14: __construct
public function __construct($titleKey = '', $pageDepth = 1)
{
parent::__construct($titleKey, $pageDepth);
$user = ServiceLocator::GetServer()->GetUserSession();
if (!$user->IsAdmin) {
$this->RedirectResume(sprintf("%s%s?%s=%s", $this->path, Pages::LOGIN, QueryStringKeys::REDIRECT, urlencode($this->server->GetUrl())));
die;
}
}
示例15: Initialize
public function Initialize()
{
$announcement = new AnnouncementsControl(new SmartyPage());
$upcomingReservations = new UpcomingReservations(new SmartyPage());
$this->_page->AddItem($announcement);
$this->_page->AddItem($upcomingReservations);
if (ServiceLocator::GetServer()->GetUserSession()->IsAdmin) {
$allUpcomingReservations = new AllUpcomingReservations(new SmartyPage());
$this->_page->AddItem($allUpcomingReservations);
}
}