Lizmap Web Client Master

qgisVectorLayer extends qgisMapLayer
in package

Give access to qgis mapLayer configuration.

Tags
author

3liz

copyright

2013-2019 3liz

see
http://3liz.com
license

Mozilla Public License : http://www.mozilla.org/MPL/

Table of Contents

Properties

$abstract  : mixed
layer abstract.
$aliases  : array<string, string>
$connection  : null|jDbConnection
$constraints  : array<string|int, string>
$datasource  : mixed
layer datasource.
$dbFieldList  : array<string|int, jDbFieldProperties>
$dbFieldsInfo  : mixed
$dbProfile  : string
$defaultValues  : array<string|int, string>
$dtParams  : null|object
$fields  : mixed
$id  : mixed
layer id in the QGIS project file.
$name  : mixed
layer name.
$proj4  : mixed
layer proj4.
$project  : Project|qgisProject
$provider  : mixed
layer provider.
$shortname  : mixed
layer short name.
$srid  : mixed
layer srid.
$title  : mixed
layer title.
$type  : mixed
layer type.
$webDavBaseUris  : mixed
$webDavFields  : mixed
$wfsFields  : mixed
$geometryDatatypeMap  : mixed

Methods

__construct()  : mixed
constructor.
canCurrentUserEdit()  : bool
checkFeatureAgainstPolygonFilter()  : bool
Check if the given edited feature intersects the filtering polygon for the current user.
deleteFeature()  : bool|int
editableFeatures()  : array<string|int, mixed>
Get the layer editable features.
getAbstract()  : mixed
getAliasFields()  : array<string, string>
list of aliases.
getConstraints()  : array<string|int, string>
Get the QGIS constraints of the given field.
getConstraintsList()  : array<string|int, string>
list of constraints.
getDatasource()  : mixed
getDatasourceConnection()  : jDbConnection
getDatasourceParameters()  : object
getDatasourceProfile()  : null|string
Give the jDb profile name for the database connection.
getDbFieldDefaultValues()  : mixed
getDbFieldDistinctValues()  : mixed
getDbFieldList()  : array<string|int, jDbFieldProperties>
getDbFieldsInfo()  : null|qgisLayerDbFieldsInfo
getDbFieldValues()  : mixed
getDefaultValue()  : null|string
Get the QGIS expression of the default value of the given field.
getDefaultValues()  : array<string|int, string>
List of default values for each fields.
getEditionCapabilities()  : null|object
getFields()  : mixed
getGeometryAsSql()  : mixed
getId()  : mixed
getName()  : mixed
getPolygonFilter()  : string
Returns the sql used to filter the layer data by polygon.
getPolygonFilterExpression()  : string
Returns the expression used to filter the layer data by polygon.
getPolygonFilterGeometry()  : string
Returns the geometry in eWKT of the authorized polygon for this layer and the current user.
getPrimaryKeyValues()  : mixed
getProj4()  : mixed
getProject()  : Project|qgisProject
getProvider()  : mixed
getRealEditionCapabilities()  : object
getShortName()  : mixed
getSrid()  : mixed
getTitle()  : mixed
getType()  : mixed
getWebDavFieldConfiguration()  : mixed
getWfsFields()  : mixed
getWfsTypeName()  : string
Get the WFS typename for this layer.
getXmlLayer()  : null|SimpleXMLElement
insertFeature()  : array<string|int, mixed>
insertRelations()  : array<string|int, mixed>
Link features between 2 tables by creating the needed lines in a third pivot table, for a many-to-many relation (n-m).
isEditable()  : mixed
isFeatureEditable()  : bool
Get the layer editable features.
linkChildren()  : array<string|int, mixed>
Link features between 2 tables: one parent layer and one child layer.
unlinkChild()  : mixed
updateFeature()  : array<string|int, mixed>
getPkWhereClause()  : mixed
requestPolygonFilter()  : array<string|int, mixed>
Get the polygon filter expression and the polygon geometry eWKT representation as returned by Lizmap plugin for QGIS Server for the layer, depending on the authenticated (or not) user and groups.

Properties

$aliases

protected array<string, string> $aliases = array()

list of aliases name for each fields

$constraints

protected array<string|int, string> $constraints = array()

list of constraints for each fields (type of contraints and if it is notNull, unique and/or expression contraint)

$defaultValues

protected array<string|int, string> $defaultValues = array()

list of default value (as QGIS expressions) for each fields

$geometryDatatypeMap

private mixed $geometryDatatypeMap = array('point', 'linestring', 'polygon', 'multipoint', 'multilinestring', 'multipolygon', 'geometrycollection', 'geometry', 'geography')

Methods

checkFeatureAgainstPolygonFilter()

Check if the given edited feature intersects the filtering polygon for the current user.

public checkFeatureAgainstPolygonFilter(array<string|int, mixed> $values) : bool

If there is no filter by polygon, this method returns true.

Parameters
$values : array<string|int, mixed>

values computed from the form

Tags
throws
Exception
Return values
bool

false when there is a filter by polygon and the geometry is outside the polygon(s)

deleteFeature()

public deleteFeature(object $feature, null|array<string|int, mixed> $loginFilteredLayers[, null|jDbConnection $connection = null ]) : bool|int
Parameters
$feature : object
$loginFilteredLayers : null|array<string|int, mixed>

array with these keys:

  • where: SQL WHERE statement
  • type: 'groups' or 'login'
  • attribute: filter attribute from the layer
$connection : null|jDbConnection = null

DBConnection, if not null then the parameter conneciton is used, default value null

Tags
throws
Exception
see
jDbConnection::exec()

Launch a SQL Query (update, delete..) which doesn't return rows.

Return values
bool|int

the number of affected rows. False if the query has failed.

editableFeatures()

Get the layer editable features.

public editableFeatures() : array<string|int, mixed>

Used client-side (JS) to fetch the features which are editable by the authenticated user when there is a filter by login (or by polygon). This allows to deactivate the editing icon for the non-editable features inside the popup and attribute table.

Return values
array<string|int, mixed>

Data containing the status (restricted|unrestricted) and the features if restricted

getAliasFields()

list of aliases.

public getAliasFields() : array<string, string>
Return values
array<string, string>

getConstraints()

Get the QGIS constraints of the given field.

public getConstraints(string $fieldName) : array<string|int, string>
Parameters
$fieldName : string
Return values
array<string|int, string>

the constraints of the field

getConstraintsList()

list of constraints.

public getConstraintsList() : array<string|int, string>
Return values
array<string|int, string>

getDatasourceConnection()

public getDatasourceConnection() : jDbConnection
Tags
throws
jException
Return values
jDbConnection

getDatasourceProfile()

Give the jDb profile name for the database connection.

public getDatasourceProfile([int $timeout = 30 ][, bool $setSearchPathFromLayer = true ]) : null|string

This method is public so it can be used by custom modules. Sometimes getDatasourceConnection() is not useful, as we could need the profile to give to jDao or other components that need a profile, not a connection

Parameters
$timeout : int = 30

default timeout for the connection

$setSearchPathFromLayer : bool = true

If true, the layer schema is used to set the search_path. Default to True to keep the same behavior as did the previous version of this method.

Tags
throws
jException
Return values
null|string

null if there is an issue or no connection parameters

getDbFieldDistinctValues()

public getDbFieldDistinctValues(mixed $field) : mixed
Parameters
$field : mixed

getDbFieldList()

public getDbFieldList() : array<string|int, jDbFieldProperties>
Return values
array<string|int, jDbFieldProperties>

getDbFieldValues()

public getDbFieldValues(mixed $feature) : mixed
Parameters
$feature : mixed

getDefaultValue()

Get the QGIS expression of the default value of the given field.

public getDefaultValue(string $fieldName) : null|string
Parameters
$fieldName : string
Return values
null|string

null if there is no default value

getDefaultValues()

List of default values for each fields.

public getDefaultValues() : array<string|int, string>

Values are QGIS expressions or may be null when no default value is given

Return values
array<string|int, string>

getEditionCapabilities()

public getEditionCapabilities() : null|object

return the edition layer object to be compatible with external modules. It will returns the capabilities object in the future. Use getRealEditionCapabilities() for the moment.

Tags
see
getRealEditionCapabilities()
Return values
null|object

the edition layer object

getGeometryAsSql()

public getGeometryAsSql(mixed $value) : mixed
Parameters
$value : mixed

getPolygonFilter()

Returns the sql used to filter the layer data by polygon.

public getPolygonFilter([bool $editing_context = false ][, int $ttl = 60 ]) : string

It is requested from Lizmap plugin and used only when querying the data directly from PostgreSQL via a SQL query. The filter is added in the WHERE clause.

Parameters
$editing_context : bool = false

If we are in a editing context or no. Default false

$ttl : int = 60

Cache TTL in seconds. Default 60. Use -1 to deactivate the cache.

Return values
string

the expression to filter the layer by polygon

getPolygonFilterExpression()

Returns the expression used to filter the layer data by polygon.

public getPolygonFilterExpression([bool $editing_context = false ][, int $ttl = 60 ]) : string

It is requested from Lizmap plugin and used only if a filter by polygon is active.

Parameters
$editing_context : bool = false

If we are in a editing context or no. Default false

$ttl : int = 60

Cache TTL in seconds. Default 60. Use -1 to deactivate the cache.

Return values
string

the geometry of the polygons in eWKT format

getPolygonFilterGeometry()

Returns the geometry in eWKT of the authorized polygon for this layer and the current user.

public getPolygonFilterGeometry([bool $editing_context = false ][, int $ttl = 60 ]) : string

It is requested from Lizmap plugin and used only if a filter by polygon is active.

Parameters
$editing_context : bool = false

If we are in a editing context or no. Default false

$ttl : int = 60

Cache TTL in seconds. Default 60. Use -1 to deactivate the cache.

Return values
string

the geometry of the polygons in eWKT format

getPrimaryKeyValues()

public getPrimaryKeyValues(mixed $feature) : mixed
Parameters
$feature : mixed

getRealEditionCapabilities()

public getRealEditionCapabilities() : object
Return values
object

the capabilities object

getWfsTypeName()

Get the WFS typename for this layer.

public getWfsTypeName() : string

We need to get either the shortname or the layer name and replace all spaces by underscore

Return values
string

The WFS typename of the layer

getXmlLayer()

public getXmlLayer() : null|SimpleXMLElement
Return values
null|SimpleXMLElement

insertFeature()

public insertFeature(array<string|int, mixed> $values) : array<string|int, mixed>
Parameters
$values : array<string|int, mixed>
Tags
throws
Exception
Return values
array<string|int, mixed>

list of primary keys with their values

insertRelations()

Link features between 2 tables by creating the needed lines in a third pivot table, for a many-to-many relation (n-m).

public insertRelations(string $foreign_key_column_a, array<string|int, mixed> $parent_a_ids, string $foreign_key_column_b, array<string|int, mixed> $parent_b_ids) : array<string|int, mixed>

It runs one ore many SQL queries concerning the pivot layer table to insert the needed line(s): INSERT INTO pivot_table ("foreign_key_column_a" , "foreign_key_column_b") SELECT parent_a_id_value, parent_b_id_value WHERE NOT EXISTS ( SELECT "foreign_key_column_a" , "foreign_key_column_b" FROM pivot_table WHERE "foreign_key_column_a" = parent_a_id_value AND "foreign_key_column_b" = parent_b_id_value );

Parameters
$foreign_key_column_a : string

name of the foreign key column referencing the parent A in the pivot table

$parent_a_ids : array<string|int, mixed>

values of the ids of the selected features of the parent table A

$foreign_key_column_b : string

name of the foreign key column referencing the parent B in the pivot table

$parent_b_ids : array<string|int, mixed>

values of the ids of the selected features of the parent table B

Return values
array<string|int, mixed>

Results of the SQL INSERT queries

isFeatureEditable()

Get the layer editable features.

public isFeatureEditable(mixed $feature) : bool

Used client-side (JS) to fetch the features which are editable by the authenticated user when there is a filter by login (or by polygon). This allows to deactivate the editing icon for the non-editable features inside the popup and attribute table.

Parameters
$feature : mixed
Return values
bool

Data containing the status (restricted|unrestricted) and the features if restricted

linkChildren()

Link features between 2 tables: one parent layer and one child layer.

public linkChildren(string $foreign_key_column, int $parent_id_value, string $child_pkey_column, array<string|int, mixed> $child_ids) : array<string|int, mixed>

It runs a SQL query concerning the child layer table: UPDATE child_table SET foreign_key_column = parent_id_value WHERE child_pkey_column = child_id;

Parameters
$foreign_key_column : string

name of the foreign key column in the child layer we need in the update SET

$parent_id_value : int

id value of the parent layer feature (only one ID allowed) used in the SET

$child_pkey_column : string

name of the primary key column in the child layer, used in the WHERE clause

$child_ids : array<string|int, mixed>

Primary key values of the child features to be linked. More than one allowed

Return values
array<string|int, mixed>

Results of the SQL UPDATE queries

unlinkChild()

public unlinkChild(mixed $fkey, mixed $pkey, mixed $pval) : mixed
Parameters
$fkey : mixed
$pkey : mixed
$pval : mixed

updateFeature()

public updateFeature(object $feature, array<string|int, mixed> $values, null|array<string|int, mixed> $loginFilteredLayers) : array<string|int, mixed>
Parameters
$feature : object
$values : array<string|int, mixed>
$loginFilteredLayers : null|array<string|int, mixed>

array with these keys:

  • where: SQL WHERE statement
  • type: 'groups' or 'login'
  • attribute: filter attribute from the layer
Tags
throws
Exception
Return values
array<string|int, mixed>

list of primary keys with their values

requestPolygonFilter()

Get the polygon filter expression and the polygon geometry eWKT representation as returned by Lizmap plugin for QGIS Server for the layer, depending on the authenticated (or not) user and groups.

protected requestPolygonFilter([bool $editing_context = false ][, int $ttl = 60 ][, bool $get_expression = false ][, bool $use_cache = true ]) : array<string|int, mixed>

The filter expression will be used to filter the layer data by polygon. The geometry eWKT representation to check that the edited features intersects the polygon.

This is used only when querying the data directly from PostgreSQL via a SQL query (for WFS or in the editing related classes). For example, the filter is added in the WHERE clause when needed.

Parameters
$editing_context : bool = false

If we are in a editing context or no. Default false

$ttl : int = 60

Cache TTL in seconds. Default 60. Use -1 to deactivate the cache.

$get_expression : bool = false

If we need the expression and not the SQL

$use_cache : bool = true

If we need to not use cache

Return values
array<string|int, mixed>

associative array containing the keys 'expression' and 'polygon'


        
On this page

Search results