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 : null|Repository
- $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).
- evaluateDefaultExpressions() : jResponseHtmlFragment|jResponseJson
- Evaluate QGIS default-value expressions with a given form feature context.
- 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
- setParentForeignKey() : mixed
- Set the foreign key value sent by the parent feature edition form.
- checkLinkedFeaturesEditable() : bool
- Check the features of a layer, updated to link or unlink them, are editable by the user.
- checkLinkEditionAccess() : bool
- Check the user can edit the data of a layer, to link or unlink features.
- 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.
- getRelationReferencingFields() : array<string|int, string>
- Get the fields of a layer referencing another layer in the project relations.
- 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
null|Repository
$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
evaluateDefaultExpressions()
Evaluate QGIS default-value expressions with a given form feature context.
public
evaluateDefaultExpressions() : jResponseHtmlFragment|jResponseJson
Tags
Return values
jResponseHtmlFragment|jResponseJsongetGroupVisibilities()
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'
setParentForeignKey()
Set the foreign key value sent by the parent feature edition form.
protected
setParentForeignKey(jFormsBase $form) : mixed
The value is given by the liz_parent_fk parameter, formatted as
"
The field name is checked against the relations of the project: only a field referencing the edited layer is accepted, so that this parameter cannot be used to set an arbitrary column.
Parameters
- $form : jFormsBase
-
The edition form
checkLinkedFeaturesEditable()
Check the features of a layer, updated to link or unlink them, are editable by the user.
private
checkLinkedFeaturesEditable(qgisVectorLayer $layer, array<string|int, mixed> $ids) : bool
The features must respect the filters by login and by polygon, as done for the other edition requests. The check is not done if no filter is configured for the layer, or if the user can override the filters. The error message is set if a feature is not editable.
Parameters
- $layer : qgisVectorLayer
-
the layer
- $ids : array<string|int, mixed>
-
the primary key values of the features
Return values
bool —true if all the features are editable
checkLinkEditionAccess()
Check the user can edit the data of a layer, to link or unlink features.
private
checkLinkEditionAccess(Project $lproj, Repository $lrep, string $layerId) : bool
The same checks as for the other edition requests are done: access to the repository, right to use the edition tools, layer editable by the user. The error message is set if the user cannot edit the layer.
Parameters
- $lproj : Project
-
the project
- $lrep : Repository
-
the repository
- $layerId : string
-
the id of the layer to edit
Return values
bool —true if the user can edit the layer
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
boolgetRelationReferencingFields()
Get the fields of a layer referencing another layer in the project relations.
private
getRelationReferencingFields(Project $lproj, string $referencingLayerId[, null|string $referencedLayerId = null ]) : array<string|int, string>
Parameters
- $lproj : Project
-
the project
- $referencingLayerId : string
-
the id of the referencing layer (child or pivot)
- $referencedLayerId : null|string = null
-
the id of the referenced layer (parent), null for any
Return values
array<string|int, string> —the referencing fields
getWfsFeature()
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