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


PHP Region::get方法代码示例

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


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

示例1: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     $fields->insertBefore(new Tab('MembershipDetails', 'Membership Details'), 'Main');
     //move first and ;astname
     $fields->addFieldToTab('Root.MembershipDetails', $fields->dataFieldByName('FirstName'));
     $fields->addFieldToTab('Root.MembershipDetails', $fields->dataFieldByName('Surname'));
     $fields->addFieldToTab('Root.MembershipDetails', $fields->dataFieldByName('Email'));
     $fields->addFieldToTab('Root.MembershipDetails', $region = DropdownField::create('RegionID', 'Region', Region::get()->map('ID', 'Title')));
     $region->setEmptyString(' ');
     $fields->addFieldToTab('Root.MembershipDetails', DropdownField::create('MembershipStatus', 'Membership Status', $this->owner->dbObject('MembershipStatus')->enumValues()));
     $fields->addFieldToTab('Root.MembershipDetails', $expiry = DateField::create('ExpiryDate'));
     $fields->addFieldToTab('Root.MembershipDetails', DropdownField::create('Discount', 'Discount', $this->owner->dbObject('Discount')->enumValues()));
     $fields->addFieldToTab('Root.MembershipDetails', $discountExpiry = DateField::create('DiscountExpiryDate'));
     $fields->addFieldToTab('Root.MembershipDetails', $joined = DateField::create('JoinedDate'));
     $fields->addFieldToTab('Root.MembershipDetails', TextareaField::create('NotesForMember'));
     if ($this->owner->MembershipStatus !== "Not applied") {
         $fields->addFieldToTab('Root.MembershipDetails', TextField::create('MemberNumber'));
     }
     $fields->addFieldToTab('Root.MembershipDetails', TextField::create('HomePhone'));
     $fields->addFieldToTab('Root.MembershipDetails', TextField::create('WorkPhone'));
     $fields->addFieldToTab('Root.MembershipDetails', TextField::create('MobilePhone'));
     $fields->addFieldToTab('Root.MembershipDetails', TextareaField::create('Address'));
     $fields->addFieldToTab('Root.MembershipDetails', TextField::create('Occupation'));
     $fields->addFieldToTab('Root.MembershipDetails', TextField::create('BirthDate'));
     $expiry->setConfig('showcalendar', true);
     $expiry->setConfig('showdropdown', true);
     $expiry->setConfig('dateformat', 'dd-MM-YYYY');
     $discountExpiry->setConfig('showcalendar', true);
     $discountExpiry->setConfig('showdropdown', true);
     $discountExpiry->setConfig('dateformat', 'dd-MM-YYYY');
     $joined->setConfig('showcalendar', true);
     $joined->setConfig('showdropdown', true);
     $joined->setConfig('dateformat', 'dd-MM-YYYY');
 }
开发者ID:adrexia,项目名称:nzlarps,代码行数:34,代码来源:MemberExtension.php

示例2: show

 public function show(SS_HTTPRequest $request)
 {
     $region = Region::get()->byID($request->param('ID'));
     if (!$region) {
         return $this->httpError(404, 'That region could not be found');
     }
     return array('Region' => $region, 'Title' => $region->Title);
 }
开发者ID:sachithranuwan,项目名称:one-ring-rentals,代码行数:8,代码来源:RegionsPage.php

示例3: getCMSFields

 public function getCMSFields()
 {
     $fields = FieldList::create(TabSet::create('Root'));
     $fields->addFieldsToTab('Root.Main', array(TextField::create('Title'), TextareaField::create('Description'), CurrencyField::create('PricePerNight', 'Price (per night)'), DropdownField::create('Bedrooms')->setSource(ArrayLib::valuekey(range(1, 10))), DropdownField::create('Bathrooms')->setSource(ArrayLib::valuekey(range(1, 10))), DropdownField::create('RegionID', 'Region')->setSource(Region::get()->map('ID', 'Title'))->setEmptyString('-- Select a region --'), CheckboxField::create('FeaturedOnHomepage', 'Feature on homepage')));
     $fields->addFieldToTab('Root.Photos', $upload = UploadField::create('PrimaryPhoto', 'Primary photo'));
     $upload->getValidator()->setAllowedExtensions(array('png', 'jpeg', 'jpg', 'gif'));
     $upload->setFolderName('property-photos');
     return $fields;
 }
开发者ID:sachithranuwan,项目名称:one-ring-rentals,代码行数:9,代码来源:Property.php

示例4: region

 public function region(SS_HTTPRequest $r)
 {
     $region = Region::get()->byID($r->param('ID'));
     if (!$region) {
         return $this->httpError(404, 'That region was not found');
     }
     $this->articleList = $this->articleList->filter(array('RegionID' => $region->ID));
     return array('SelectedRegion' => $region);
 }
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:9,代码来源:ArticleHolder.php

示例5: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Attachments', $photo = UploadField::create('Photo'));
     $fields->addFieldToTab('Root.Attachments', $brochure = UploadField::create('Brochure', 'Travel brochure, optional (PDF only)'));
     $photo->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpg', 'jpeg'));
     $photo->setFolderName('travel-photos');
     $brochure->getValidator()->setAllowedExtensions(array('pdf'));
     $brochure->setFolderName('travel-brochures');
     $fields->addFieldToTab('Root.Categories', CheckboxSetField::create('Categories', 'Selected categories', $this->Parent()->Categories()->map('ID', 'Title')));
     $fields->addFieldToTab('Root.Main', DropdownField::create('RegionID', 'Region', Region::get()->map('ID', 'Title'))->setEmptyString('-- None --'), 'Content');
     return $fields;
 }
开发者ID:silverstripeltd,项目名称:demo-project,代码行数:13,代码来源:ArticlePage.php

示例6: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldsToTab('Root.Main', DateField::create('Date', 'Date of article')->setConfig('showcalendar', true), 'Content');
     $fields->addFieldsToTab('Root.Main', TextareaField::create('Teaser'), 'Content');
     $fields->addFieldsToTab('Root.Main', TextField::create('Author', 'Author of article'), 'Content');
     $fields->addFieldsToTab('Root.Attachments', $photo = UploadField::create('Photo'));
     $fields->addFieldsToTab('Root.Attachments', $brochure = UploadField::create('Brochure', 'Travel brochure, optional (PDF only)'));
     $photo->setFolderName('travel-photos');
     $brochure->setFolderName('travel-brochures')->getValidator()->setAllowedExtensions(array('pdf'));
     $fields->addFieldsToTab('Root.Categories', CheckboxSetField::create('Categories', 'Selected categories', $this->Parent()->Categories()->map('ID', 'Title')));
     $fields->addFieldsToTab('Root.Main', DropdownField::create('RegionID', 'Region', Region::get()->map('ID', 'Title'))->setEmptyString('-- None --'), 'Content');
     return $fields;
 }
开发者ID:lili0allen,项目名称:ss_tutorial,代码行数:14,代码来源:ArticlePage.php

示例7: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     $details = $fields->dataFieldByName('Details');
     $event = $fields->dataFieldByName('EventPageID');
     $cID = Calendar::get_one('Calendar')->ID;
     $fields->push($calendar = HiddenField::create('CalendarID', 'Calendar'));
     $calendar->setValue($cID);
     $fields->insertAfter($event, 'TimeFrameType');
     $fields->insertAfter($region = DropdownField::create('RegionID', 'Region', Region::get()->map('ID', 'Title')), 'EventPageID');
     $region->setEmptyString(' ');
     $fields->removeByName('RelatedPage');
     $fields->addFieldToTab('Root.Details', TextareaField::create('Intro', 'Intro'));
     $fields->insertAfter($details, 'Intro');
     $fields->addFieldToTab('Root.Brand', ColorPaletteField::create("Colour", "Colour", $this->owner->getPalette()));
     $fields->insertAfter($splash = UploadField::create('SplashImage', 'Splash Image'), 'Colour');
     $fields->insertAfter($small = UploadField::create('SmallImage', 'Small Image'), 'SplashImage');
     $splash->setFolderName('Uploads/Splash-Images');
     $small->setFolderName('Uploads/Small-Images');
 }
开发者ID:adrexia,项目名称:nzlarps,代码行数:19,代码来源:EventExtension.php

示例8: searchableFields

 public function searchableFields()
 {
     return array('Title' => array('filter' => 'PartialMatchFilter', 'title' => 'Title', 'field' => 'TextField'), 'RegionID' => array('filter' => 'ExactMatchFilter', 'title' => 'Region', 'field' => DropdownField::create('RegionID')->setSource(Region::get()->map('ID', 'Title'))->setEmptyString('-- Any region --')), 'FeaturedOnHomepage' => array('filter' => 'ExactMatchFilter', 'title' => 'Only featured'));
 }
开发者ID:lili0allen,项目名称:ss_tutorial,代码行数:4,代码来源:Property.php

示例9: search

 public function search()
 {
     $output = '';
     if (!$this->isJson()) {
         return $this->httpError(500, 'Content Type not allowed');
     }
     try {
         $search_params = json_decode($this->request->getBody(), true);
         $query = new QueryObject(new Consultant());
         $query->addAlias(QueryAlias::create('Company'));
         $query->addAndCondition(QueryCriteria::equal("Active", true));
         $location = @explode(',', @$search_params['location_term']);
         $name = @$search_params['name_term'];
         $service = @$search_params['service_term'];
         $region = @$search_params['region_term'];
         if (!empty($name)) {
             $query->addAndCondition(QueryCompoundCriteria::compoundOr(array(QueryCriteria::like('CompanyService.Name', $name), QueryCriteria::like('CompanyService.Overview', $name), QueryCriteria::like('Company.Name', $name))));
         }
         if (!empty($service) || !empty($region)) {
             $query->addAlias(QueryAlias::create('ServicesOffered'));
             if (!empty($service)) {
                 $query->addAndCondition(QueryCriteria::like("ConsultantServiceOfferedType.Type", $service));
             }
             if (!empty($region)) {
                 $region_id = Region::get()->filter('Name', $region)->first()->ID;
                 $query->addAndCondition(QueryCriteria::id("Consultant_ServicesOffered.RegionID", $region_id));
             }
         }
         if (is_array($location) && !empty($location[0])) {
             $query->addAlias(QueryAlias::create('Offices'));
             $query->addAndCondition(QueryCriteria::like("Office.City", $location[0]));
         }
         $countries = array_flip(Geoip::getCountryDropDown());
         if (is_array($location) && count($location) == 2) {
             $country = trim($location[1]);
             if (!empty($country) && array_key_exists($country, $countries)) {
                 $query->addAndCondition(QueryCriteria::like("Office.Country", $countries[$country]));
             }
         } else {
             if (is_array($location) && count($location) == 3) {
                 $state = trim($location[1]);
                 $country = trim($location[2]);
                 if (!empty($country) && array_key_exists($country, $countries)) {
                     $query->addAndCondition(QueryCriteria::like("Office.Country", $countries[$country]));
                 }
                 if (!empty($state)) {
                     $query->addAndCondition(QueryCriteria::like("Office.State", $state));
                 }
             }
         }
         list($list, $size) = $this->consultants_repository->getAll($query, 0, 1000);
         foreach ($list as $public_cloud) {
             $output .= $public_cloud->renderWith('ConsultantsDirectoryPage_CloudBox', array('ConsultantLink' => $this->Link()));
         }
     } catch (Exception $ex) {
         return $this->httpError(500, 'Server Error');
     }
     return empty($output) ? $this->httpError(404, '') : $output;
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:59,代码来源:Consultants_Controller.php

示例10: work

 /**
  * Generates units from user work and pays his salary
  * 
  * @return mixed (boolean/array)
  */
 public function work()
 {
     /*
     http://wiki.e-sim.org/index.php/Productivity_formula
     * P = 10 * (4+E) * N * C * R * Q   
     P - Productivity
     E - Economy skill level
     N - Employee multiplier (Number of employees already worked that day in the company.)
     	if employeesWorked <=10 Then N = 1.0 + (10-employeesWorked) * 0.05
     	elseif employeesWorked <=20 Then N = 1.0 - (employeesWorked-10) * 0.03
     	elseif employeesWorked <=30 Then N = 0.7 - (employeesWorked-20) * 0.02
     	else N=0.5;
     C
     	1 If home country controls capital
     	0.75 If not
     R
     	for manufacture companies:
     		1.25 If region's country owns the appropriate high raw. (eg: Iron for Weapons)
     		1 If region's country do not own the appropriate high raw.
     	for raw companies:
     		1.0 in high regions
     		0.75 in medium region.
     Q
     	1.0 for manufacture companies
     	for raw companies
     		1.0 for Q1 companies
     		1.2 for Q2 companies
     		1.4 for Q3 companies
     		1.6 for Q4 companies
     		1.8 for Q5 companies
     * 
     */
     $job = new Job();
     $job = $job->getByUid($this->uid);
     if (!$job) {
         throw new Exception("you don't have a job");
     }
     $skills = new Skill();
     $skills->get($this->uid);
     $E = $skills->economic;
     $employeesWorked = 1;
     //ToDO PENDING
     if ($employeesWorked <= 10) {
         $N = 1.0 + (10 - $employeesWorked) * 0.05;
     } elseif ($employeesWorked <= 20) {
         $N = 1.0 - ($employeesWorked - 10) * 0.03;
     } elseif ($employeesWorked <= 30) {
         $N = 0.7 - ($employeesWorked - 20) * 0.02;
     } else {
         $N = 0.5;
     }
     $company = new Company();
     $company->get($job->company);
     $region = new Region();
     $companyRegion = $region->get($company->region);
     //does the region have the resource that company produces?
     // also determine product quality
     if ($company->productType == Company::PRODUCT_TYPE_RESOURCE) {
         $R = $companyRegion->resourceAmount / 10;
         $Q = 1;
     } else {
         $product = new Product();
         $product->get($company->product);
         if ($companyRegion->resourceType == $product->resource) {
             $R = 1.25;
         } else {
             $R = 1;
         }
         $Q = 0.8 + 0.2 * $company->quality;
     }
     $country = new Country();
     $country = $country->get($companyRegion->country);
     $capitalRegion = $region->get($country->capitalRegionId);
     //is country capital owned by original owners?
     if ($capitalRegion->country == $capitalRegion->countryConqueror) {
         $C = 1;
     } else {
         $C = 0.75;
     }
     if ($companyRegion->resourceAmount > 0) {
         $productivity = 10 * (4 + $E) * $N * $C * $R * $Q;
     } else {
         $productivity = 10 * (4 + $E) * $N * $C * $Q;
     }
     $user = new User($this->uid);
     $user->updateXP('WORK');
     $skills->economic += 0.125;
     $skills->save();
     $company->pendingUnits += $productivity;
     //calculate produced units
     if ($company->productType == Company::PRODUCT_TYPE_RESOURCE) {
         $createdUnits = floor($company->pendingUnits);
         $company->pendingUnits -= $createdUnits;
         $added = $company->addStock($createdUnits, Company::PRODUCT_TYPE_PRODUCT);
         if ($added) {
//.........这里部分代码省略.........
开发者ID:AugustoAngeletti,项目名称:erepublik,代码行数:101,代码来源:Job.php

示例11: PopularRegions

 public function PopularRegions()
 {
     return Region::get()->filter(array('PopularOnHomepage' => true))->limit(6);
 }
开发者ID:lili0allen,项目名称:ss_tutorial,代码行数:4,代码来源:HomePage.php

示例12: CurrentRegions

 /**
  * Get the {@link FeatureItem} objects attached to this page that are not Archived
  *
  * @return ArrayList
  */
 public function CurrentRegions()
 {
     return Region::get()->filter(array('Archived' => false, 'HideFromRegionLists' => false))->sort('Sort');
 }
开发者ID:adrexia,项目名称:nzlarps,代码行数:9,代码来源:AboutPage.php


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