QgisForm
in package
implements
QgisFormControlsInterface
Table of Contents
Interfaces
Properties
- $appContext : AppContextInterface
- $attributeEditorForm : null|qgisAttributeEditorElement
- $dbFieldsInfo : null|qgisLayerDbFieldsInfo
- $featureId : string
- $form : jFormsBase
- $form_name : string
- $formControls : array<string|int, QgisFormControl>
- $formPlugins : array<string|int, string>
- $formWidgetsAttributes : array<string|int, array<string|int, mixed>>
- $layer : qgisVectorLayer
- $loginFilteredOverride : bool
Methods
- __construct() : mixed
- QgisForm constructor.
- check() : mixed
- convertDateTimeToFormat() : string
- Converts the datetime to the format specified in the qgis Project.
- convertQgisFormatToPHP() : string
- Converts the format of a date from QGIS syntax to PHP syntax.
- deleteFromDb() : bool|int
- Delete the feature from the database.
- evaluateExpression() : mixed
- evaluateExpressionText() : null|object
- Returns the text evaluated from $expression.
- evaluateWebDavUrlExpression() : mixed
- getAttributesEditorForm() : null|qgisAttributeEditorElement
- getDateTimeConversionTab() : mixed
- getFieldNames() : array<string|int, string>
- List of field name for a \jForms form.
- getFieldValue() : mixed
- getForm() : jFormsBase
- getFormControlName() : null|string
- Return the control name for the jForms form.
- getFormPlugins() : array<string|int, string>
- getFormWidgetsAttributes() : array<string|int, array<string|int, mixed>>
- getQgisControl() : null|QgisFormControl
- getQgisControls() : array<string|int, QgisFormControl>
- getStoragePathForControl() : null|array<string|int, string>
- Get the storage path of QGIS form control for a given form input.
- getStoragePathFromExpression() : string
- Get the storage path of QGIS form control for a given form input when this path must be calculated with an expression.
- getUploadedFiles() : array<string|int, string>
- Return path of all files uploaded with the form.
- resetFormData() : jFormsBase
- Reset the form controls data to Null.
- saveToDb() : array<string|int, mixed>|false|int
- Save the form to the database.
- setFormDataFromDefault() : jFormsBase
- Set the form controls data from the database default value.
- setFormDataFromFields() : jFormsBase
- Set the form controls data from the database value.
- updateFormByLogin() : jFormsBase
- Dynamically update form by modifying the filter by login control.
- changeLoginFilteredControl() : mixed
- disableControl() : mixed
- fillControlFromUniqueValues() : mixed
- Get the values for a "Unique Values" layer's field and fill the form control for a specific field.
- fillFormControl() : mixed
- filterDataByLogin() : null|array<string|int, mixed>
- Filter data by login if necessary as configured in the plugin for login filtered layers.
- generateFormName() : mixed
- generates a name for the form.
- getConstraints() : mixed
- getDefaultValue() : null|string
- Get the default value of a QGIS field, if this is a simple raw value.
- getFieldList() : mixed
- getParsedValue() : mixed
- PerformWfsRequest() : mixed
- processUploadedFile() : mixed
- Process the given form upload control data.
- processWebDavUploadFile() : string
- Upload, delete or keep webdav file.
- fillControlFromRelationReference() : mixed
- Get WFS data from a "Relation Reference" and fill the form control for a specific field.
- fillControlFromValueRelationLayer() : mixed
- Get WFS data from a "Value Relation" layer and fill the form control for a specific field.
Properties
$appContext
protected
AppContextInterface
$appContext
$attributeEditorForm
protected
null|qgisAttributeEditorElement
$attributeEditorForm
the qgis form element
$dbFieldsInfo
protected
null|qgisLayerDbFieldsInfo
$dbFieldsInfo
$featureId
protected
string
$featureId
$form
protected
jFormsBase
$form
$form_name
protected
string
$form_name
the form id into the HTML
$formControls
protected
array<string|int, QgisFormControl>
$formControls
= array()
$formPlugins
protected
array<string|int, string>
$formPlugins
= array()
$formWidgetsAttributes
protected
array<string|int, array<string|int, mixed>>
$formWidgetsAttributes
= array()
keys are control names, values are an associative array of values for jforms widgets
$layer
protected
qgisVectorLayer
$layer
$loginFilteredOverride
protected
bool
$loginFilteredOverride
= false
Methods
__construct()
QgisForm constructor.
public
__construct(qgisVectorLayer $layer, jFormsBase $form, string $featureId, bool $loginFilteredOverride, AppContextInterface $appContext) : mixed
Parameters
- $layer : qgisVectorLayer
- $form : jFormsBase
- $featureId : string
- $loginFilteredOverride : bool
- $appContext : AppContextInterface
Tags
check()
public
check([mixed $feature = null ]) : mixed
Parameters
- $feature : mixed = null
convertDateTimeToFormat()
Converts the datetime to the format specified in the qgis Project.
public
convertDateTimeToFormat(string $value, string $fieldFormat) : string
Parameters
- $value : string
-
The datetime to convert
- $fieldFormat : string
-
The format in which to convert the date
Return values
string —The date converted
convertQgisFormatToPHP()
Converts the format of a date from QGIS syntax to PHP syntax.
public
convertQgisFormatToPHP(string $fieldFormat) : string
Parameters
- $fieldFormat : string
-
The format to convert
Return values
string —The format converted
deleteFromDb()
Delete the feature from the database.
public
deleteFromDb(mixed $feature[, null|jDbConnection $cnx = null ]) : bool|int
Parameters
- $feature : mixed
- $cnx : null|jDbConnection = null
-
DBConnection, passed along QGISVectorLayer deleteFeature method
Tags
Return values
bool|int —the number of affected rows. False if the query has failed.
evaluateExpression()
public
evaluateExpression(mixed $expression[, mixed $form_feature = null ]) : mixed
Parameters
- $expression : mixed
- $form_feature : mixed = null
evaluateExpressionText()
Returns the text evaluated from $expression.
public
evaluateExpressionText(array<string|int, mixed> $expression[, null|array<string|int, mixed> $form_feature = null ]) : null|object
Parameters
- $expression : array<string|int, mixed>
-
The expression to evaluate
- $form_feature : null|array<string|int, mixed> = null
-
A feature to add to the evaluation context
Return values
null|objectevaluateWebDavUrlExpression()
public
evaluateWebDavUrlExpression(mixed $fieldRef, mixed $storageUrl[, mixed $fileName = null ]) : mixed
Parameters
- $fieldRef : mixed
- $storageUrl : mixed
- $fileName : mixed = null
getAttributesEditorForm()
public
getAttributesEditorForm() : null|qgisAttributeEditorElement
Return values
null|qgisAttributeEditorElementgetDateTimeConversionTab()
public
getDateTimeConversionTab() : mixed
getFieldNames()
List of field name for a \jForms form.
public
getFieldNames() : array<string|int, string>
Return values
array<string|int, string>getFieldValue()
public
getFieldValue(mixed $fieldName, mixed $form) : mixed
Parameters
- $fieldName : mixed
- $form : mixed
getForm()
public
getForm() : jFormsBase
Return values
jFormsBasegetFormControlName()
Return the control name for the jForms form.
public
getFormControlName(mixed $name) : null|string
Parameters
- $name : mixed
-
the name of the qgis control
Return values
null|string —null if the control does not exist
getFormPlugins()
public
getFormPlugins() : array<string|int, string>
Return values
array<string|int, string>getFormWidgetsAttributes()
public
getFormWidgetsAttributes() : array<string|int, array<string|int, mixed>>
Return values
array<string|int, array<string|int, mixed>> —keys are control names, values are an associative array of values for jforms widgets
getQgisControl()
public
getQgisControl(mixed $name) : null|QgisFormControl
Parameters
- $name : mixed
Return values
null|QgisFormControl —null if the control does not exists
getQgisControls()
public
getQgisControls() : array<string|int, QgisFormControl>
Return values
array<string|int, QgisFormControl>getStoragePathForControl()
Get the storage path of QGIS form control for a given form input.
public
getStoragePathForControl(null|QgisFormControl $ctrl[, array<string|int, mixed> $values = null ]) : null|array<string|int, string>
Parameters
- $ctrl : null|QgisFormControl
-
QGIS Form control
- $values : array<string|int, mixed> = null
-
Jelix form field values
Return values
null|array<string|int, string>getStoragePathFromExpression()
Get the storage path of QGIS form control for a given form input when this path must be calculated with an expression.
public
getStoragePathFromExpression(QgisFormControl $ctrl[, null|array<string|int, mixed> $values = null ]) : string
In this case we need to evaluate the expression
Parameters
- $ctrl : QgisFormControl
-
QGIS Form control
- $values : null|array<string|int, mixed> = null
-
Form fields values
Return values
stringgetUploadedFiles()
Return path of all files uploaded with the form.
public
getUploadedFiles(jFormsBase $form) : array<string|int, string>
Parameters
- $form : jFormsBase
Return values
array<string|int, string> —the list of path
resetFormData()
Reset the form controls data to Null.
public
resetFormData() : jFormsBase
Return values
jFormsBase —the Jelix jForm object
saveToDb()
Save the form to the database.
public
saveToDb([null|mixed $feature = null ][, array<string|int, mixed> $modifiedControls = array() ]) : array<string|int, mixed>|false|int
Parameters
- $feature : null|mixed = null
- $modifiedControls : array<string|int, mixed> = array()
Return values
array<string|int, mixed>|false|int —value of primary key or false if an error occurred
setFormDataFromDefault()
Set the form controls data from the database default value.
public
setFormDataFromDefault() : jFormsBase
Return values
jFormsBase —the Jelix jForm object
setFormDataFromFields()
Set the form controls data from the database value.
public
setFormDataFromFields(mixed $feature) : jFormsBase
Parameters
- $feature : mixed
Return values
jFormsBase —the Jelix jForm object
updateFormByLogin()
Dynamically update form by modifying the filter by login control.
public
updateFormByLogin() : jFormsBase
Return values
jFormsBase —modified form
changeLoginFilteredControl()
protected
changeLoginFilteredControl(mixed $attribute, mixed $data) : mixed
Parameters
- $attribute : mixed
- $data : mixed
disableControl()
protected
disableControl(mixed $formControl[, mixed $message = 'Control not well configured' ]) : mixed
Parameters
- $formControl : mixed
- $message : mixed = 'Control not well configured'
fillControlFromUniqueValues()
Get the values for a "Unique Values" layer's field and fill the form control for a specific field.
protected
fillControlFromUniqueValues(string $fieldName, QgisFormControl $formControl) : mixed
Parameters
- $fieldName : string
-
Name of QGIS field
- $formControl : QgisFormControl
-
QGIS Form control
fillFormControl()
protected
fillFormControl(QgisFormControl $formControl, string $fieldName, jFormsBase $form) : mixed
Parameters
- $formControl : QgisFormControl
- $fieldName : string
- $form : jFormsBase
filterDataByLogin()
Filter data by login if necessary as configured in the plugin for login filtered layers.
protected
filterDataByLogin(string $layername) : null|array<string|int, mixed>
Parameters
- $layername : string
Return values
null|array<string|int, mixed> —array with these keys:
- where: SQL WHERE statement
- type: 'groups' or 'login'
- attribute: filter attribute from the layer
generateFormName()
generates a name for the form.
protected
static generateFormName(mixed $sel) : mixed
Parameters
- $sel : mixed
getConstraints()
protected
getConstraints(mixed $fieldName) : mixed
Parameters
- $fieldName : mixed
getDefaultValue()
Get the default value of a QGIS field, if this is a simple raw value.
protected
getDefaultValue(string $fieldName) : null|string
Parameters
- $fieldName : string
Return values
null|string —return null if this is not a number or a string
getFieldList()
protected
getFieldList(mixed $geometryColumn, mixed $insertAction, mixed $modifiedControls) : mixed
Parameters
- $geometryColumn : mixed
- $insertAction : mixed
- $modifiedControls : mixed
getParsedValue()
protected
getParsedValue(mixed $ref, mixed $geometryColumn) : mixed
Parameters
- $ref : mixed
- $geometryColumn : mixed
PerformWfsRequest()
protected
PerformWfsRequest(mixed $wfsRequest, mixed $formControl, mixed $referencedField, mixed $previewField) : mixed
Parameters
- $wfsRequest : mixed
- $formControl : mixed
- $referencedField : mixed
- $previewField : mixed
processUploadedFile()
Process the given form upload control data.
protected
processUploadedFile(jFormsBase $form, string $ref, array<string|int, mixed> $values) : mixed
It compute the storage path based on the field definition It tries to store the file on disk
Parameters
- $form : jFormsBase
-
Editing form
- $ref : string
-
Control field name
- $values : array<string|int, mixed>
-
Form controls values (without the upload fields)
processWebDavUploadFile()
Upload, delete or keep webdav file.
protected
processWebDavUploadFile(jFormsBase $form, string $ref) : string
Parameters
- $form : jFormsBase
- $ref : string
Tags
Return values
stringfillControlFromRelationReference()
Get WFS data from a "Relation Reference" and fill the form control for a specific field.
private
fillControlFromRelationReference(string $fieldName, QgisFormControl $formControl) : mixed
Parameters
- $fieldName : string
-
Name of QGIS field
- $formControl : QgisFormControl
fillControlFromValueRelationLayer()
Get WFS data from a "Value Relation" layer and fill the form control for a specific field.
private
fillControlFromValueRelationLayer(string $fieldName, QgisFormControl $formControl) : mixed
Parameters
- $fieldName : string
-
Name of QGIS field
- $formControl : QgisFormControl