当前位置: 首页>>代码示例>>PHP>>正文


PHP Resources::GetInstance方法代码示例

本文整理汇总了PHP中Resources::GetInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Resources::GetInstance方法的具体用法?PHP Resources::GetInstance怎么用?PHP Resources::GetInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Resources的用法示例。


在下文中一共展示了Resources::GetInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __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);
 }
开发者ID:ViraSoftware,项目名称:booked,代码行数:60,代码来源:Page.php

示例2: PageLoad

 public function PageLoad()
 {
     $this->Set('DefaultTitle', Resources::GetInstance()->GetString('NoTitleLabel'));
     $this->presenter->SetSearchCriteria(ReservationViewRepository::ALL_USERS, ReservationUserLevel::ALL);
     $this->presenter->PageLoad();
     $this->Display('admin_upcoming_reservations.tpl');
 }
开发者ID:hugutux,项目名称:booked,代码行数:7,代码来源:UpcomingReservations.php

示例3: HandleInvitationAction

 /**
  * @param $invitationAction
  * @return string|null
  */
 private function HandleInvitationAction($invitationAction)
 {
     $referenceNumber = $this->page->GetInvitationReferenceNumber();
     $userId = $this->page->GetUserId();
     Log::Debug('Invitation action %s for user %s and reference number %s', $invitationAction, $userId, $referenceNumber);
     $series = $this->reservationRepository->LoadByReferenceNumber($referenceNumber);
     if ($invitationAction == InvitationAction::Accept) {
         $series->AcceptInvitation($userId);
         foreach ($series->AllResources() as $resource) {
             if (!$resource->HasMaxParticipants()) {
                 continue;
             }
             /** @var $instance Reservation */
             foreach ($series->Instances() as $instance) {
                 $numberOfParticipants = count($instance->Participants());
                 if ($numberOfParticipants > $resource->GetMaxParticipants()) {
                     return Resources::GetInstance()->GetString('MaxParticipantsError', array($resource->GetName(), $resource->GetMaxParticipants()));
                 }
             }
         }
     }
     if ($invitationAction == InvitationAction::Decline) {
         $series->DeclineInvitation($userId);
     }
     if ($invitationAction == InvitationAction::CancelInstance) {
         $series->CancelInstanceParticipation($userId);
     }
     if ($invitationAction == InvitationAction::CancelAll) {
         $series->CancelAllParticipation($userId);
     }
     $this->reservationRepository->Update($series);
     return null;
 }
开发者ID:hugutux,项目名称:booked,代码行数:37,代码来源:ParticipationPresenter.php

示例4: Validate

 public function Validate($category, $attributeValues, $entityId = null, $ignoreEmpty = false)
 {
     $isValid = true;
     $errors = array();
     $resources = Resources::GetInstance();
     $values = array();
     foreach ($attributeValues as $av) {
         $values[$av->AttributeId] = $av->Value;
     }
     $attributes = $this->attributeRepository->GetByCategory($category);
     foreach ($attributes as $attribute) {
         if ($attribute->UniquePerEntity() && $entityId != $attribute->EntityId()) {
             continue;
         }
         $value = trim($values[$attribute->Id()]);
         $label = $attribute->Label();
         if (empty($value) && $ignoreEmpty) {
             continue;
         }
         if (!$attribute->SatisfiesRequired($value)) {
             $isValid = false;
             $errors[] = $resources->GetString('CustomAttributeRequired', $label);
         }
         if (!$attribute->SatisfiesConstraint($value)) {
             $isValid = false;
             $errors[] = $resources->GetString('CustomAttributeInvalid', $label);
         }
     }
     return new AttributeServiceValidationResult($isValid, $errors);
 }
开发者ID:hugutux,项目名称:booked,代码行数:30,代码来源:AttributeService.php

示例5: CreateRecurRule

 /**
  * @param ReservationItemView|ReservationView $res
  * @return null|string
  */
 private function CreateRecurRule($res)
 {
     if (is_a($res, 'ReservationItemView')) {
         // don't populate the recurrance rule when a list of reservation is being exported
         return null;
     }
     ### !!!  THIS DOES NOT WORK BECAUSE EXCEPTIONS TO RECURRENCE RULES ARE NOT PROPERLY HANDLED !!!
     ### see bug report http://php.brickhost.com/forums/index.php?topic=11450.0
     if (empty($res->RepeatType) || $res->RepeatType == RepeatType::None) {
         return null;
     }
     $freqMapping = array(RepeatType::Daily => 'DAILY', RepeatType::Weekly => 'WEEKLY', RepeatType::Monthly => 'MONTHLY', RepeatType::Yearly => 'YEARLY');
     $freq = $freqMapping[$res->RepeatType];
     $interval = $res->RepeatInterval;
     $format = Resources::GetInstance()->GetDateFormat('ical');
     $end = $res->RepeatTerminationDate->SetTime($res->EndDate->GetTime())->Format($format);
     $rrule = sprintf('FREQ=%s;INTERVAL=%s;UNTIL=%s', $freq, $interval, $end);
     if ($res->RepeatType == RepeatType::Monthly) {
         if ($res->RepeatMonthlyType == RepeatMonthlyType::DayOfMonth) {
             $rrule .= ';BYMONTHDAY=' . $res->StartDate->Day();
         }
     }
     if (!empty($res->RepeatWeekdays)) {
         $dayMapping = array('SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA');
         $days = '';
         foreach ($res->RepeatWeekdays as $weekDay) {
             $days .= $dayMapping[$weekDay] . ',';
         }
         $days = substr($days, 0, -1);
         $rrule .= ';BYDAY=' . $days;
     }
     return $rrule;
 }
开发者ID:hugutux,项目名称:booked,代码行数:37,代码来源:iCalendarReservationView.php

示例6: Validate

 /**
  * @param ReservationSeries $reservationSeries
  * @return ReservationRuleResult
  */
 public function Validate($reservationSeries)
 {
     $userId = $reservationSeries->UserId();
     $resourceId = $reservationSeries->ResourceId();
     $isOk = !empty($userId) && !empty($resourceId);
     return new ReservationRuleResult($isOk, Resources::GetInstance()->GetString('InvalidReservationData'));
 }
开发者ID:Trideon,项目名称:gigolo,代码行数:11,代码来源:ReservationBasicInfoRule.php

示例7: Execute

 public function Execute(ISqlCommand $sqlCommand)
 {
     mysqli_set_charset($this->_db, Resources::GetInstance()->Charset);
     $mysqlCommand = new MySqlCommandAdapter($sqlCommand, $this->_db);
     Log::Sql('MySql Execute: ' . str_replace('%', '%%', $mysqlCommand->GetQuery()));
     $result = mysqli_query($this->_db, $mysqlCommand->GetQuery());
     $this->_handleError($result);
 }
开发者ID:hugutux,项目名称:booked,代码行数:8,代码来源:MySqlConnection.php

示例8: testLanguageIsLoadedCorrectlyWhenSet

 public function testLanguageIsLoadedCorrectlyWhenSet()
 {
     $langFile = 'en_us.php';
     $lang = 'en_us';
     $this->Resources = Resources::GetInstance();
     $this->Resources->SetLanguage($lang);
     $this->assertEquals($lang, $this->Resources->CurrentLanguage);
     $this->assertEquals($langFile, $this->Resources->LanguageFile);
 }
开发者ID:utn-frm-si,项目名称:booked,代码行数:9,代码来源:ResourcesTests.php

示例9: GetFullName

 protected function GetFullName(ReservationItemView $reservation)
 {
     $shouldHide = Configuration::Instance()->GetSectionKey(ConfigSection::PRIVACY, ConfigKeys::PRIVACY_HIDE_USER_DETAILS, new BooleanConverter());
     if ($shouldHide && (is_null($this->user) || $this->user->UserId != $reservation->UserId)) {
         return Resources::GetInstance()->GetString('Private');
     }
     $name = new FullName($reservation->FirstName, $reservation->LastName);
     return $name->__toString();
 }
开发者ID:hugutux,项目名称:booked,代码行数:9,代码来源:SlotLabelFactory.php

示例10: showSecurimage

 private function showSecurimage()
 {
     Log::Debug('CaptchaControl using Securimage');
     $url = CaptchaService::Create()->GetImageUrl();
     $label = Resources::GetInstance()->GetString('SecurityCode');
     $formName = FormKeys::CAPTCHA;
     echo "<img src='{$url}' alt='captcha' id='captchaImg'/>";
     echo "<br/><label class=\"reg\">{$label}<br/><input type=\"text\" class=\"input\" name=\"{$formName}\" size=\"20\" id=\"captchaValue\"/>";
 }
开发者ID:hugutux,项目名称:booked,代码行数:9,代码来源:CaptchaControl.php

示例11: ProcessPageLoad

 /**
  * @return void
  */
 public function ProcessPageLoad()
 {
     $this->Set('untitled', Resources::GetInstance()->GetString('NoTitleLabel'));
     $this->Set('RepeatEveryOptions', range(1, 20));
     $this->Set('RepeatOptions', array('none' => array('key' => 'Never', 'everyKey' => ''), 'daily' => array('key' => 'Daily', 'everyKey' => 'days'), 'weekly' => array('key' => 'Weekly', 'everyKey' => 'weeks'), 'monthly' => array('key' => 'Monthly', 'everyKey' => 'months'), 'yearly' => array('key' => 'Yearly', 'everyKey' => 'years')));
     $this->Set('DayNames', array(0 => 'DaySundayAbbr', 1 => 'DayMondayAbbr', 2 => 'DayTuesdayAbbr', 3 => 'DayWednesdayAbbr', 4 => 'DayThursdayAbbr', 5 => 'DayFridayAbbr', 6 => 'DaySaturdayAbbr'));
     $this->presenter->PageLoad();
     $this->Display('Reports/saved-reports.tpl');
 }
开发者ID:hugutux,项目名称:booked,代码行数:12,代码来源:SavedReportsPage.php

示例12: Validate

 public function Validate()
 {
     if ($this->file == null) {
         return;
     }
     $this->isValid = in_array($this->file->Extension(), $this->allowedTypes);
     if (!$this->IsValid()) {
         $this->AddMessage(Resources::GetInstance()->GetString('InvalidAttachmentExtension', array(implode(',', $this->allowedTypes))));
     }
 }
开发者ID:hugutux,项目名称:booked,代码行数:10,代码来源:FileTypeValidator.php

示例13: __construct

 public function __construct(IReport $report, $timezone)
 {
     $dateFormat = Resources::GetInstance()->GeneralDateTimeFormat();
     $orderedColumns = array(ColumnNames::ACCESSORY_NAME => new ReportStringColumn('Accessory', ChartColumnDefinition::Label(ColumnNames::ACCESSORY_ID, ChartGroup::Accessory)), ColumnNames::RESOURCE_NAME_ALIAS => new ReportStringColumn('Resource', ChartColumnDefinition::Label(ColumnNames::RESOURCE_ID, ChartGroup::Resource)), ColumnNames::QUANTITY => new ReportStringColumn('QuantityReserved', ChartColumnDefinition::Total()), ColumnNames::RESERVATION_START => new ReportDateColumn('BeginDate', $timezone, $dateFormat, ChartColumnDefinition::Date()), ColumnNames::RESERVATION_END => new ReportDateColumn('EndDate', $timezone, $dateFormat, ChartColumnDefinition::Null()), ColumnNames::RESERVATION_TITLE => new ReportStringColumn('Title', ChartColumnDefinition::Null()), ColumnNames::RESERVATION_DESCRIPTION => new ReportStringColumn('Description', ChartColumnDefinition::Null()), ColumnNames::REFERENCE_NUMBER => new ReportStringColumn('ReferenceNumber', ChartColumnDefinition::Null()), ColumnNames::OWNER_FULL_NAME_ALIAS => new ReportStringColumn('User', ChartColumnDefinition::Label(ColumnNames::OWNER_USER_ID)), ColumnNames::GROUP_NAME_ALIAS => new ReportStringColumn('Group', ChartColumnDefinition::Label(ColumnNames::GROUP_ID)), ColumnNames::SCHEDULE_NAME_ALIAS => new ReportStringColumn('Schedule', ChartColumnDefinition::Label(ColumnNames::SCHEDULE_ID)), ColumnNames::RESERVATION_CREATED => new ReportDateColumn('Created', $timezone, $dateFormat, ChartColumnDefinition::Null()), ColumnNames::RESERVATION_MODIFIED => new ReportDateColumn('LastModified', $timezone, $dateFormat, ChartColumnDefinition::Null()), ColumnNames::TOTAL => new ReportStringColumn('Total', ChartColumnDefinition::Total()), ColumnNames::TOTAL_TIME => new ReportTimeColumn('Total', ChartColumnDefinition::Total()));
     $reportColumns = $report->GetColumns();
     foreach ($orderedColumns as $key => $column) {
         if ($reportColumns->Exists($key)) {
             $this->columns[$key] = $column;
         }
     }
 }
开发者ID:hugutux,项目名称:booked,代码行数:11,代码来源:ReportDefinition.php

示例14: Validate

 /**
  * @param ReservationSeries $reservation
  * @return ReservationRuleResult
  */
 public function Validate($reservation)
 {
     $reservation->UserId();
     $permissionService = $this->permissionServiceFactory->GetPermissionService();
     $resourceIds = $reservation->AllResourceIds();
     foreach ($resourceIds as $resourceId) {
         if (!$permissionService->CanAccessResource(new ReservationResource($resourceId), $reservation->BookedBy())) {
             return new ReservationRuleResult(false, Resources::GetInstance()->GetString('NoResourcePermission'));
         }
     }
     return new ReservationRuleResult(true);
 }
开发者ID:hugutux,项目名称:booked,代码行数:16,代码来源:PermissionValidationRule.php

示例15: Validate

 public function Validate($reservationSeries)
 {
     foreach ($reservationSeries->AllResources() as $resource) {
         if (!$resource->GetAllowMultiday()) {
             $schedule = $this->scheduleRepository->LoadById($reservationSeries->ScheduleId());
             $tz = $schedule->GetTimezone();
             $isSameDay = $reservationSeries->CurrentInstance()->StartDate()->ToTimezone($tz)->DateEquals($reservationSeries->CurrentInstance()->EndDate()->ToTimezone($tz));
             return new ReservationRuleResult($isSameDay, Resources::GetInstance()->GetString('MultiDayRule', $resource->GetName()));
         }
     }
     return new ReservationRuleResult();
 }
开发者ID:ksdtech,项目名称:booked,代码行数:12,代码来源:ResourceCrossDayRule.php


注:本文中的Resources::GetInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。