editionCtrl
extends jController
in package
Table of Contents
Properties
- $errorMessage : string
- $errorType : string
- $featureData : null|object
- $featureId : int|string
- $featureIdParam : string
- $geometryColumn : string
- $layer : qgisVectorLayer
- $layerId : string
- $layerName : string
- $layerXml : SimpleXMLElement
- $loginFilteredOverride : bool
- $primaryKeys : array<string|int, string>
- $proj4 : mixed
- $project : null|Project
- $repository : lizmapRepository
- $srid : mixed
Methods
- closeFeature() : jResponseHtmlFragment
- Form close : destroy it and display a message.
- createFeature() : jResponseHtmlFragment|jResponseRedirect
- Create a feature form based on the edition layer.
- deleteFeature() : jResponseHtmlFragment
- Delete Feature (output as html fragment).
- editableFeatures() : jResponseJson
- Editable features.
- editFeature() : jResponseHtmlFragment|jResponseRedirect
- Display the edition form (output as html fragment).
- getGroupVisibilities() : mixed
- web service for XHR request when group visibilities depending on the value of form controls.
- linkFeatures() : jResponseHtmlFragment
- Link features between 2 tables : - Either [1->n] relation, ie a parent layer and a child layer. In this case, passed $features2 layer id = $pivot.
- modifyFeature() : jResponseHtmlFragment|jResponseRedirect
- Modify a feature.
- saveFeature() : jResponseHtmlFragment|jResponseRedirect
- Save the edition form (output as html fragment).
- saveNewFeature() : jResponseJson
- Save a new feature, without redirecting to an HTML response.
- unlinkChild() : jResponseHtmlFragment
- Unlink child feature from their parent ( 1:n ) relation by setting the foreign key to NULL.
- getLayerEditionParameter() : null|qgisLayerDbFieldsInfo, 'primaryKeys': string[], 'geometryColumn': string, 'srid': mixed, 'proj4': mixed}
- Get layer parameters and returns layers info for edition.
- getPivotFeatures() : mixed
- Get Features via WFS from pivots connected to the current layer feature on editing.
- serviceAnswer() : jResponseHtmlFragment
- Send an answer.
- setErrorMessage() : mixed
- featureIsEditable() : bool
- Check if the WFS feature is editable by the authenticated user We check the filter by login & the filter by polygon.
- getEditionParameters() : bool
- Get parameters and set classes for the project and repository given.
- getWfsFeature() : mixed
- Get the WFS feature for the editing object and return featureData object.
- initializeForm() : mixed
- linkAddedFeature() : mixed
- Utilities used for link features related via an n to m relationship after an new "m" feature is created.
Properties
$errorMessage
private
string
$errorMessage
= ''
error message during responses processing
$errorType
private
string
$errorType
= 'default'
error type during responses processing
$featureData
private
null|object
$featureData
feature data as a PHP object from GeoJSON via json_decode
$featureId
private
int|string
$featureId
an integer or an array of integers
$featureIdParam
private
string
$featureIdParam
featureId parameter from the request, an integer or a string with coma separated integers
$geometryColumn
private
string
$geometryColumn
= ''
Geometry column for form
$layer
private
qgisVectorLayer
$layer
= ''
Layer data
$layerId
private
string
$layerId
= ''
layer id in the QGIS project file
$layerName
private
string
$layerName
= ''
layer name (
$layerXml
private
SimpleXMLElement
$layerXml
= ''
Layer data as simpleXml object
$loginFilteredOverride
private
bool
$loginFilteredOverride
= \false
Filter override flag
$primaryKeys
private
array<string|int, string>
$primaryKeys
= array()
Primary key for getWfsFeature
$proj4
private
mixed
$proj4
= ''
$project
private
null|Project
$project
$repository
private
lizmapRepository
$repository
$srid
private
mixed
$srid
= ''
Methods
closeFeature()
Form close : destroy it and display a message.
public
closeFeature() : jResponseHtmlFragment
This function does not use the serviceAnswer method which depends on jMessage and cannot be used to return a more complex HTML fragment with hidden data.
Tags
Return values
jResponseHtmlFragment —confirmation message that the form has been saved
createFeature()
Create a feature form based on the edition layer.
public
createFeature() : jResponseHtmlFragment|jResponseRedirect
Tags
Return values
jResponseHtmlFragment|jResponseRedirect —redirect to the display action
deleteFeature()
Delete Feature (output as html fragment).
public
deleteFeature() : jResponseHtmlFragment
If the Feature is linked with any pivot table (n to m relation) then the records on pivots are deleted too.
Tags
Return values
jResponseHtmlFragmenteditableFeatures()
Editable features.
public
editableFeatures() : jResponseJson
Get the layer editable features. Used client-side to fetch the features which are editable by the authenticated user when there is a filter by login (and/or by polygon). This allows to deactivate the editing icon for the other non-editable features inside the popup and attribute table.
Tags
Return values
jResponseJsoneditFeature()
Display the edition form (output as html fragment).
public
editFeature() : jResponseHtmlFragment|jResponseRedirect
Return values
jResponseHtmlFragment|jResponseRedirect —HTML code containing the form
getGroupVisibilities()
web service for XHR request when group visibilities depending on the value of form controls.
public
getGroupVisibilities() : mixed
linkFeatures()
Link features between 2 tables : - Either [1->n] relation, ie a parent layer and a child layer. In this case, passed $features2 layer id = $pivot.
public
linkFeatures() : jResponseHtmlFragment
In this case, we set the parent id in the child table foreign key column
- Or [n<->m] relation ie 2 tables with a pivot table between them In this case we add a new line in the pivot table referencing both parent layers.
Tags
Return values
jResponseHtmlFragmentmodifyFeature()
Modify a feature.
public
modifyFeature() : jResponseHtmlFragment|jResponseRedirect
Tags
Return values
jResponseHtmlFragment|jResponseRedirect —redirect to the display action
saveFeature()
Save the edition form (output as html fragment).
public
saveFeature() : jResponseHtmlFragment|jResponseRedirect
Tags
Return values
jResponseHtmlFragment|jResponseRedirect —redirect to the validation action
saveNewFeature()
Save a new feature, without redirecting to an HTML response.
public
saveNewFeature() : jResponseJson
Tags
Return values
jResponseJsonunlinkChild()
Unlink child feature from their parent ( 1:n ) relation by setting the foreign key to NULL.
public
unlinkChild() : jResponseHtmlFragment
Tags
Return values
jResponseHtmlFragmentgetLayerEditionParameter()
Get layer parameters and returns layers info for edition.
protected
getLayerEditionParameter(null|Project $proj, null|string $lid, null|string|array<string|int, string> $fIdParams[, bool $setMessage = true ]) : null|qgisLayerDbFieldsInfo, 'primaryKeys': string[], 'geometryColumn': string, 'srid': mixed, 'proj4': mixed}
Parameters
- $proj : null|Project
-
the project
- $lid : null|string
-
the layer id
- $fIdParams : null|string|array<string|int, string>
-
the feature ids
- $setMessage : bool = true
-
set/not set error message
Return values
null|qgisLayerDbFieldsInfo, 'primaryKeys': string[], 'geometryColumn': string, 'srid': mixed, 'proj4': mixed}getPivotFeatures()
Get Features via WFS from pivots connected to the current layer feature on editing.
protected
getPivotFeatures() : mixed
Return values
mixed —$pivotFeature The array containing the features
serviceAnswer()
Send an answer.
protected
serviceAnswer() : jResponseHtmlFragment
Return values
jResponseHtmlFragment —HTML fragment
setErrorMessage()
protected
setErrorMessage(mixed $message[, mixed $type = 'default' ]) : mixed
Parameters
- $message : mixed
- $type : mixed = 'default'
featureIsEditable()
Check if the WFS feature is editable by the authenticated user We check the filter by login & the filter by polygon.
private
featureIsEditable() : bool
Return values
boolgetEditionParameters()
Get parameters and set classes for the project and repository given.
private
getEditionParameters([bool $save = false ]) : bool
Parameters
- $save : bool = false
-
If true, we have to save the form. So take liz_repository and others instead of repository from request parameters.
Return values
boolgetWfsFeature()
Get the WFS feature for the editing object and return featureData object.
private
getWfsFeature(null|qgisVectorLayer $layer, mixed $featureId, null|mixed $keys[, string $exp_filter = null ]) : mixed
This method will always return an object if the feature exists in the layer even if there are some filters by login or by polygon ! /!\ This is not the responsibility of this method to know if the user has the right to edit !
Parameters
- $layer : null|qgisVectorLayer
-
the qgis vector layer
- $featureId : mixed
-
the value to search
- $keys : null|mixed
-
primary keys or attribute filter
- $exp_filter : string = null
-
filter for attributes
initializeForm()
private
initializeForm(jFormsBase $form[, mixed $forCreation = true ]) : mixed
Parameters
- $form : jFormsBase
- $forCreation : mixed = true
linkAddedFeature()
Utilities used for link features related via an n to m relationship after an new "m" feature is created.
private
linkAddedFeature(string $linkedLayers, array<string|int, mixed> $featureIds) : mixed
Parameters
- $linkedLayers : string
-
information on feaures to link provided as "pivot-id:n-layer-id:n-layer-value"
- $featureIds : array<string|int, mixed>
-
the primary keys of the new "m" feature