本文整理汇总了PHP中Location::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Location::get方法的具体用法?PHP Location::get怎么用?PHP Location::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Location
的用法示例。
在下文中一共展示了Location::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate_data_for_day
private static function generate_data_for_day(SS_Datetime $date)
{
$data = array('timestamp' => time(), 'searchDate' => $date->Format("Y-m-d"), 'collections' => array('events' => array(), 'galleries' => array(), 'locations' => array()));
$galleryIDs = array();
$locationIDs = array();
// Get events
$where = sprintf("DATE(`StartDate`) = '%s'", $date->Format('Y-m-d'));
$events = Event::get()->where($where)->exclude(array("GalleryID" => 0, "Gallery.LocationID" => 0));
foreach ($events as $event) {
$galleryIDs[] = $event->GalleryID;
$data['collections']['events'][] = $event->forAPI();
}
// Get galleries
$galleries = Gallery::get()->byIDs(array_unique($galleryIDs));
foreach ($galleries as $gallery) {
$locationIDs[] = $gallery->LocationID;
$data['collections']['galleries'][] = $gallery->forAPI();
}
// Get locations
$locations = Location::get()->byIDs(array_unique($locationIDs));
foreach ($locations as $location) {
$data['collections']['locations'][] = $location->forAPI();
}
return $data;
}
示例2: allPagesToCache
public function allPagesToCache()
{
// Get each page type to define its sub-urls
$urls = array();
// memory intensive depending on number of pages
$pages = SiteTree::get()->where("ClassName != 'BlogEntry'");
//remove Blog pages from cache due to Form SecurityID issue
foreach ($pages as $page) {
array_push($urls, $page->Link());
if ($page->ClassName == 'ProjectPage') {
//add ajax pages for each projectpage
array_push($urls, $page->Link() . 'ajax');
}
}
//add tag pages
$tags = Tag::get()->filter(array('HasTagPage' => 1));
foreach ($tags as $tag) {
array_push($urls, '/tag/' . $tag->Slug);
}
//add location pages
$locations = Location::get();
foreach ($locations as $location) {
array_push($urls, '/location/' . $location->Slug);
}
return $urls;
}
示例3: isTFTP
public function isTFTP()
{
$Location = new Location($this->get('locationID'));
if ($Location && $Location->isValid()) {
return $Location->get('tftp');
}
}
示例4: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($shortUrl, Request $request)
{
$url = ShortUrl::where('short_url', 'LIKE', '%' . $shortUrl)->first();
$location = \Location::get();
if ($url !== null) {
ShortUrlClickInfo::create(['shorturl_id' => $url->id, 'country' => $location->countryName, 'ua' => $request->server->get("HTTP_USER_AGENT")]);
}
return redirect()->to($url->long_url);
}
示例5: testLocationDeletion
function testLocationDeletion()
{
$this->logInWithPermission('ADMIN');
$location = $this->objFromFixture('Location', 'silverstripe');
$locationID = $location->ID;
$this->logOut();
$this->logInWithPermission('Location_DELETE');
$this->assertTrue($location->canDelete());
$location->delete();
$locations = Location::get()->column('ID');
$this->assertFalse(in_array($locationID, $locations));
}
示例6: index
public function index($arguments)
{
$slug = $arguments->param('Slug');
$location = Location::get()->filter(array('Slug' => $slug))->First();
if ($location) {
$this->Lat = $location->Latitude;
$this->Lng = $location->Longitude;
$this->Location = $location->Title;
$this->Subtitle = $location->Subtitle;
$this->Key = $this->config()->key;
return $this->renderWith(array('LocationPage', 'Page'));
}
}
示例7: locationData
public function locationData()
{
// Get the locations from the database, exclude any that don't have LatLng's defined
$infoWindowList = Location::get()->exclude(array('lat' => null, 'lng' => null));
if ($infoWindowList) {
$InfoWindows = array();
foreach ($infoWindowList as $obj) {
$InfoWindows[] = array('lat' => $obj->lat, 'lng' => $obj->lng, 'info' => $obj->Name . "<br />" . $obj->InfoWindow);
}
$InfoWindows = Convert::array2json($InfoWindows);
// Return a JSON object for GoogleMapConfig.js to use
return $InfoWindows;
}
}
示例8: run
public function run($request)
{
Config::inst()->update('DataObject', 'validation_enabled', false);
$ct = 0;
$updateEmail = function ($location) use(&$ct) {
if (!$location->Email && $location->EmailAddress) {
$location->Email = $location->EmailAddress;
$location->write();
++$ct;
}
};
Location::get()->each($updateEmail);
Config::inst()->update('DataObject', 'validation_enabled', true);
echo '<p>' . $ct . ' Locations updated</p>';
}
示例9: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
// galleries field
$locations = function () {
return Location::get()->map('ID', 'Title');
};
$locationField = DropdownField::create('LocationID', 'Location', $locations());
$locationField->useAddNew('Location', $locations);
if ($this->LocationID) {
$locationField->setDescription($this->Location()->getDataAdminEditAnchorTag());
}
// add fields to tab
$fields->addFieldsToTab('Root.Main', array($locationField));
return $fields;
}
示例10: getLocations
public static function getLocations($filter = array(), $exclude = array())
{
$filter['ShowInLocator'] = true;
return Location::get()->exclude($exclude)->exclude('Lat', 0)->filter($filter);
}
示例11: count
?>
">Add a location</a></h3>
<?php
if (isset($_SESSION['formmessage'])) {
$formmessage = $_SESSION['formmessage'];
$formmessageclass = $_SESSION['formmessageclass'];
echo ' <p class="message ' . $formmessageclass . '">' . $formmessage . '</p>';
include "common/clearsessionmessage.php";
}
$locationcount = count($locations);
if ($locationcount > 0) {
echo ' <ol class="contentlist">';
foreach ($locations as $locationrow) {
$locationid = $locationrow['id'];
$locationname = $locationrow['name'];
$location = Location::get($locationid, $userid);
$entity = $location;
include "hbardata.php";
?>
<li><?php
echo $locationname;
?>
<ul class="list-inline contentlistactionlinks">
<li><a href="editlocation?id=<?php
echo $locationid;
?>
">Edit</a></li>
<?php
if ($menucount == 0 && $categorycount == 0 && $subcategorycount == 0 && $itemcount == 0 && $dealcount == 0 && $imagecount == 0) {
?>
<li>
示例12: getLocationDetails
public function getLocationDetails()
{
$locations = Location::get();
$result = View::make('reports.locationslist', ['locations' => $locations]);
return $result;
}
示例13: session_start
<?php
session_start();
include "header.php";
include "common/sessionuser.inc";
require_once "class/Restaurant.inc";
require_once "class/Location.inc";
require_once "class/Deal.inc";
if (REQMETHOD == 'GET') {
$locationid = $_GET['l'];
$location = Location::get($locationid);
$locationname = $location->getProperty('name');
$restaurantrow = $location->getRestaurant();
$restaurantid = $restaurantrow[0]['id'];
$restaurantname = $restaurantrow[0]['name'];
$deals = $location->getDeals();
}
?>
<body>
<?php
include "topnavbar.php";
include "dealhierarchy.php";
?>
<div class="container content">
<?php
include "breadcrumb.php";
?>
<h1>Deals</h1>
<h3><a href="adddeal?l=<?php
echo $locationid;
?>
示例14: getLocationDetails
public function getLocationDetails()
{
$locations = Location::get();
$result = View::make('reports.locationslist', ['locations' => $locations]);
return PDF::load($result, 'A4', 'portrait')->download();
}
示例15: add_post
public function add_post()
{
try {
$name = trim($_REQUEST['name']);
if ($this->getClass('LocationManager')->exists(trim($_REQUEST['name']))) {
throw new Exception('Location already Exists, please try again.');
}
if (!$name) {
throw new Exception('Please enter a name for this location.');
}
if (empty($_REQUEST['storagegroup'])) {
throw new Exception('Please select the storage group this location relates to.');
}
$Location = new Location(array('name' => trim($_REQUEST['name']), 'storageGroupID' => $_REQUEST['storagegroup'], 'storageNodeID' => $_REQUEST['storagenode'], 'tftp' => $_REQUEST['tftp']));
if ($_REQUEST['storagenode'] && $Location->get('storageGroupID') != $this->getClass('StorageNode', $_REQUEST['storagenode'])->get('storageGroupID')) {
$Location->set('storageGroupID', $this->getClass('StorageNode', $_REQUEST['storagenode'])->get('storageGroupID'));
}
if ($Location->save()) {
$this->FOGCore->setMessage('Location Added, editing!');
$this->FOGCore->redirect('?node=location&sub=edit&id=' . $Location->get('id'));
}
} catch (Exception $e) {
$this->FOGCore->setMessage($e->getMessage());
$this->FOGCore->redirect($this->formAction);
}
}