#
# Form
#
# a) List of forms: {{form:S}}='', {{formIdHistory:S}}=''
# b) Edit Form: {{form:S}} - Open form {{form:S}} with record {{r:S}} - typically the FormEditor
# c) Use history of a given form: {{formIdHistory:S}}
#
# {{form:S}}
# {{formIdHistory:S0}} - usage history of form '{{formIdHistory:S}}'
form={{form:SE}}
10.sql = SELECT f.id, f.name, f.title, f.tableName, f.created, COUNT(fsl.id) AS submit_count, MIN(fsl.created) AS submit_first, MAX(fsl.created) AS submit_last, GROUP_CONCAT(DISTINCT fsl.pageId ORDER BY fsl.pageId) AS submit_pages
FROM Form AS f
LEFT JOIN FormSubmitLog AS fsl ON fsl.formId=f.id
WHERE '{{form:SE}}'='' AND {{formIdHistory:S0}}=0
GROUP BY f.id ORDER BY f.name
10.twig = {% if result|length > 0 %}
{{ ('p:'~store.typo3.pageAlias~'|s|N|U:form=Form') | qfqlink }} |
id |
Name |
Title |
Table |
Created |
Last Submit |
# Submits |
Submits from PID |
{% for row in result %}
{{ ('p:'~store.typo3.pageAlias~'|s|E|U:form=Form&r='~row.id) | qfqlink }} |
{{ row.id }} |
{{ row.name }} |
{{ row.title[:50] }} |
{{ row.tableName }} |
{{ row.created|date("Y-m-d") }} |
{{ row.submit_last ? date(row.submit_last).diff(date()).days : "-" }} days ago |
{% if row.submit_count == 0 %}
{% set mode = "|r:3" %}
{% else %}
{% set mode = "" %}
{% endif %}
{{ ('p:'~store.typo3.pageAlias~mode~'|U:formIdHistory='~row.id~'|s|b|t:'~row.submit_count~'') | qfqlink }}
|
{{ row.submit_pages }} |
{% endfor %}
{% endif %}
20.sql = SELECT f.name
, fsl.feUser
, fsl.recordId
, fsl.pageId
, fsl.created
FROM FormSubmitLog AS fsl
LEFT JOIN Form AS f
ON fsl.formId=f.id
WHERE fsl.formId={{formIdHistory:S0}}
ORDER BY fsl.created DESC
20.twig = {% if result|length > 0 %}
Submit History for {{ result.0.name }}
Back
Form | feUser | recordId | pageId | Submit |
{% for row in result %}
{% for col in row %}
{{ col }} |
{% endfor %}
{% else %}
{# this should never happen, as we do not provide a link if there is no history #}
| | | no history found | | | | | |
{% endfor %}
Back
{% endif %}