Places_Polyline Class
Static methods for the Polyline models.
Item Index
Methods
- addArea static
- byTime static
- byTime static
- defaults
- forPublishers static
- related static
- related. static
- stream static
- stream static
- streamName static
- streams static
- streams static
- subscribe static
- unsubscribe static
- userStream
Methods
addArea
-
$location
-
$title
-
[$floor]
-
[$column]
-
[$options=array()]
Adds a stream to represent an area within a location. Also may add streams to represent the floor and column.
Parameters:
-
$location
Streams_StreamThe location stream
-
$title
StringThe title of the area
-
[$floor]
String optionalThe number of the floor on which the area is located
-
[$column]
String optionalThe name of the column on which the area is located
-
[$options=array()]
Array optionalAny options to pass to Streams::create. Also can include:
-
[asUserId=null]
Array optionalOverride the first parameter to Streams::create
-
Returns:
An array of ($area, $floor, $column)
byTime
-
$publisherId
-
$relationType
-
$fromTime
-
$toTime
-
[$streamName="Streams/experience/main"]
-
[$options]
-
[$meters=null]
Get streams related to Places/nearby streams, which are found from the following parameters. Note that some of these streams may be slightly out of range and you may want to perform additional filtering using Places::distance(). The "latitude", "longitude" and "meters" options can be used to override those found in Places_Nearby::defaults(). If after this, any one of "latitude", "longitude" or "meters" is still not set, then the "Streams/experience/$experienceId" stream is used instead of Places_Nearby streams.
Parameters:
-
$publisherId
StringThe publisher of the category streams
-
$relationType
StringThe type of the relation
-
$fromTime
IntegerA unix timestamp, in either seconds or milliseconds
-
$toTime
IntegerA unix timestamp, in either seconds or milliseconds
-
[$streamName="Streams/experience/main"]
String optionalThe stream name of a community experience
-
[$options]
Array optionalOptions to pass to Places_Nearby::related(). Also can contain:
-
[latitude]
Double optionalThe latitude of the point to search around
-
[longitude]
Double optionalThe longitude of the point to search around
-
[meters]
Double optionalThe radius to search within
-
-
[$meters=null]
Double optionalOne of the values in Places/nearby/meters config array, used to find the right Places/nearby stream.
Returns:
Returns an array of Streams_RelatedTo objects
byTime
-
$publisherId
-
$relationType
-
$titles
-
$fromTime
-
$toTime
-
[$experienceId="main"]
-
[$options]
Get streams related to Places/interest streams, which are found from the following parameters. Note that some of these streams may be slightly out of range and you may want to perform additional filtering using Places::distance(). The "latitude", "longitude" and "meters" options can be used to override those found in Places_Nearby::defaults(). If after this, any one of "latitude", "longitude" or "meters" is still not set, then the "Streams/experience/$experienceId" stream is used instead of Places_Nearby streams.
Parameters:
-
$publisherId
StringThe publisher of the category streams
-
$relationType
StringThe type of the relation
-
$titles
String | Array | Db_RangeThe titles of the interests, which will be normalized
-
$fromTime
IntegerA unix timestamp, in either seconds or milliseconds
-
$toTime
IntegerA unix timestamp, in either seconds or milliseconds
-
[$experienceId="main"]
String optionalThe id of a community experience, the last part of its stream name
-
[$options]
Array optional-
[latitude]
Double optionalThe latitude of the point to search around
-
[longitude]
Double optionalThe longitude of the point to search around
-
[meters=null]
Double optionalOne of the values in Places/nearby/meters config array, used to find the right Places/nearby stream.
-
[asUserId]
String optionalOverride the default user id to fetch streams as. Not used for now, since this function always fetches the relations only.
-
Returns:
Returns an array of Streams_RelatedTo objects
defaults
-
$meters
Get the default latitude, longitude and meters to search around
Parameters:
-
$meters
DoubleCan override it to be one of the values in Places/nearby/meters config array
Returns:
An array containing $latitude, $longitude, $meters
forPublishers
-
$latitude
-
$longitude
-
[$metersArray=null]
-
[$experienceId='main']
Call this function to find the "nearby points" to publish to on a grid of quantized (latitude, longitude) pairs which are spaced at most $meters apart.
Parameters:
-
$latitude
DoubleThe latitude of the coordinates to search around
-
$longitude
DoubleThe longitude of the coordinates to search around
-
[$metersArray=null]
Array optionalTo override the default in "Places"/"nearby"/"meters" config. Useful for only notifying people within a certain radius.
-
[$experienceId='main']
String optionalThe id of the experience stream, the part that comes after "Streams/experience/"
Returns:
Returns an array of several ($streamName => $info) pairs where the $streamName is the name of the stream corresponding to the "nearby point" and $info includes the keys "latitude", "longitude", and "meters".
stream
-
$asUserId
-
$publisherId
-
$placeId
-
$throwIfBadValue
Get a Places/location stream published by a publisher for a given placeId. This is used to cache information from the Google Places API.
Parameters:
-
$asUserId
StringThe user to fetch as
-
$publisherId
StringThe user publishing the stream
-
$placeId
StringThe id of the place in Google Places
-
$throwIfBadValue
BooleanWhether to throw Q_Exception if the result contains a bad value
Returns:
stream
-
$publisherId
-
$latitude
-
$longitude
-
$meters
-
$streamName
-
[$experienceId='main']
-
[$options=array()]
Fetch (and create, if necessary) stream on which messages are posted relating to things happening a given number of $meters around the given location.
Parameters:
-
$publisherId
StringThe id of the publisher to publish this stream
-
$latitude
DoubleThe latitude of the coordinates to search around
-
$longitude
DoubleThe longitude of the coordinates to search around
-
$meters
DoubleThe radius, in meters, around this location. Should be one of the array values in the Places/nearby/meters config.
-
$streamName
StringThe name of the stream to create. Defaults to Places_Nearby::streamName($latitude, $longitude, $meters, $experienceId).
-
[$experienceId='main']
String optionalThe id of the experience stream, the part that comes after "Streams/experience/"
-
[$options=array()]
Array optionalOptions for Q_Text::get()
Returns:
Returns the stream object that was created or fetched.
streamName
-
$latitude
-
$longitude
-
$meters
-
[$experienceId='main']
Obtain the name of a "Places/nearby" stream corresponding to the given parameters
Parameters:
-
$latitude
DoubleThe latitude of the coordinates near which to relate
-
$longitude
DoubleThe longitude of the coordinates near which to relate
-
$meters
DoubleThe radius, in meters
-
[$experienceId='main']
String optionalOverride the id of the experience, the part of the stream name that's after "Streams/experience/"
Returns:
streams
-
$publisherId
-
$latitude
-
$longitude
-
$options
-
[$streamNames=null]
Fetch (and create, if necessary) "Places/nearby" streams corresponding ot the given parameters.
Parameters:
-
$publisherId
StringThe publisherId of the category streams
-
$latitude
DoubleThe latitude of the coordinates near which to relate
-
$longitude
DoubleThe longitude of the coordinates near which to relate
-
$options
ArrayThe options to pass to the Streams::relate and Streams::create functions. Also can contain the following options:
-
[forSubscribers]
Boolean optionalSet to true to return the streams that are relevant to subscribers instead of publishers, i.e. users who want to know when something relevant happens, rather than users who want to relate the streams they publish to categories.
-
[experienceId='main']
String optionalOverride the id of the experience, the part of the stream name that's after "Streams/experience/"
-
[meters]
Array | Double optionalOverride the default array of distances found in the config under Places/nearby/meters. If options.forSubscribers is true, however, this should be one of the entries from the array in Places/nearby/meters config.
-
[create]
Callable optionalIf set, this callback will be used to create streams when they don't already exist. It receives the $options array and should return a Streams_Stream object. If this option is set to null, new streams won't be created.
-
[transform="array_keys"]
Callable optionalCan be used to override the function which takes the output of Places_Nearby::forPublishers, and this $options array, and returns the array of ($originalStreamName => $newStreamName) pairs.
-
-
[$streamNames=null]
Array optionalOptional reference to fill with the stream names
Returns:
Returns the array of category streams
streams
-
$publisherId
-
$latitude
-
$longitude
-
$title
-
$options
-
[$experienceId="main"]
-
[$streamNames=null]
Fetch (and create, if necessary) category streams for things happening around the given location, during a particular hour.
Parameters:
-
$publisherId
StringThe publisherId of the category streams
-
$latitude
DoubleThe latitude of the coordinates near which to relate
-
$longitude
DoubleThe longitude of the coordinates near which to relate
-
$title
StringThe title of the interest, which will be normalized
-
$options
ArrayThe options to pass to the Streams::relate and Streams::create functions. Also can contain the following options:
-
[meters]
Array optionalOverride the default set of distances found in the config under Places/nearby/meters
-
[create]
Callable optionalIf set, this callback will be used to create streams when they don't already exist. It receives the $options array and should return a Streams_Stream object. If this option is set to null, new streams won't be created.
-
[transform="array_keys"]
Callable optionalCan be used to override the function which takes the output of Places_Nearby::forPublishers, and this $options array, and returns the array of ($originalStreamName => $newStreamName) pairs.
-
-
[$experienceId="main"]
String optionalThe id of a community experience, the last part of its stream name
-
[$streamNames=null]
Array optionalOptional reference to fill with the stream names
Returns:
Returns the array of category streams
subscribe
-
$publisherId
-
$latitude
-
$longitude
-
$meters
-
[$options=array()]
Call this function to subscribe to streams on which messages are posted related to things happening the given number of $meters around the given location.
Parameters:
-
$publisherId
StringThe id of the publisher publishing these streams.
-
$latitude
DoubleThe latitude of the coordinates to subscribe around
-
$longitude
DoubleThe longitude of the coordinates to subscribe around
-
$meters
DoubleThe radius, in meters, around this location. Should be one of the array values in the Places/nearby/meters config.
-
[$options=array()]
Array optionalThe options to pass to the streams() and subscribe() functions
Returns:
Returns an array of up to four arrays of ($publisherId, $streamName) of streams that were subscribed to.
unsubscribe
-
$publisherId
-
$latitude
-
$longitude
-
$meters
-
[$options=array()]
Call this function to unsubscribe from streams you previously subscribed to using Places_Nearby::subscribe.
Parameters:
-
$publisherId
StringThe id of the publisher publishing these streams.
-
$latitude
DoubleThe latitude of the coordinates to subscribe around
-
$longitude
DoubleThe longitude of the coordinates to subscribe around
-
$meters
DoubleThe radius, in meters, around this location. Should be one of the array values in the Places/nearby/meters config.
-
[$options=array()]
Array optionalThe options to pass to the streams() and unsubscribe() function
Returns:
Returns an array of up to four arrays of ($publisherId, $streamName) of streams that were subscribed to.
userStream
-
[$throwIfNotLoggedIn=false]
Get the logged-in user's location stream
Parameters:
-
[$throwIfNotLoggedIn=false]
Boolean optionalWhether to throw a Users_Exception_NotLoggedIn if no user is logged in.