Skip to content
Snippets Groups Projects
  • Carsten  Rose's avatar
    a81b1317
    Support.php: rewrote appendTypo3ParameterToArray() to use Typo3 Store instead... · a81b1317
    Carsten Rose authored
    Support.php: rewrote appendTypo3ParameterToArray() to use Typo3 Store instead of _GET Parameter. Moved randomAlphaNum() to Support.
    Link.php: rewrote handling of ToolTip. Renamed doHtmlUrl() to doAnchor().
    Utils.php: moved randomAlphaNum() to Support.
    Store.php: rewrote fillStoreClient() to be more compatible with phpUnit-test environment. Removed randomAlphaNum() - duplicate in Support.
    AnbstractBuildForm.php: rewrote deriveNewRecordUrlFromExistingSip() to use generic Support::appendTypo3ParameterToArray()
    Coding.md: Notes for debuggging.
    a81b1317
    History
    Support.php: rewrote appendTypo3ParameterToArray() to use Typo3 Store instead...
    Carsten Rose authored
    Support.php: rewrote appendTypo3ParameterToArray() to use Typo3 Store instead of _GET Parameter. Moved randomAlphaNum() to Support.
    Link.php: rewrote handling of ToolTip. Renamed doHtmlUrl() to doAnchor().
    Utils.php: moved randomAlphaNum() to Support.
    Store.php: rewrote fillStoreClient() to be more compatible with phpUnit-test environment. Removed randomAlphaNum() - duplicate in Support.
    AnbstractBuildForm.php: rewrote deriveNewRecordUrlFromExistingSip() to use generic Support::appendTypo3ParameterToArray()
    Coding.md: Notes for debuggging.

Notes / Best Practices for Coding

General

  • Class QuickFormQuery is the main entry point called by:
    • T3 Extension 'QFQ': called once per tt_content-record. 'bodytext' will be transferred to class QuickFormQuery.
      • The 'bodytext' contains:
        • Report definiton: 10.sql=SELECT ...
        • Form definition (explizit): form=Person
        • : do nothing
    • api/save.php: wrapper to receive AJAX post request and instantiate QuickFormQuery.
    • api/load.php: not implemented yet.
      • Wrapper to receive AJAX get requests.
      • delivers data for jqw grid
      • delivers data for typeahed fields
      • delivers data for select list
      • delivers data for depended (user select/unselect former elements) form elements

LOAD

  • When qfq starts,

    • (Form) Looking for a formname at:
      1. Typo3 Bodytext Element,
      2. For the 'SIP' ($_GET['s'])
      3. $_GET variables 'form' and 'r' (=recordId) - the parameter 'form' has to be allowed in 'Permit URL Parameter' of the specified form. This means: load the form to check, if it is allowed to load the form!?
      • If a formname is found, the search stops and the specified form will be processed.
    • (Report)
      • Process all .[<number.>].sql statements
  • Access code variables:

    • active/valid formname: [$this->store->setVar(SYSTEM_FORM, $formName, STORE_SYSTEM);]
    • SIP: [$this->store->getVar('form', STORE_SIP)]
    • All parameters from active SIP: [$this->store->getStore(STORE_SIP)]
    • Check Contstants.php for known Store members
  • In QuickFormQuery.php the whole Form will be copied to $this->formSpec and depending on further processing, the elements are available in $this->feNative and $this->feAction.

    • The Form specificaton (table form) will be evaluated direct after loading.
    • The FormElement specification will be evaluated later on in BuildForm*.php

SAVE

  • Via wrapper api/save.php
  • SID must be supplied via FORM POST
  • The SID supplies the and the
  • form.render: plain/table/bootstrap
    • Client will handle the response of save.php.
    • Optional redirection initiated by client.

DELETE

  • Via wrapper api/delete.php

  • The element who should dissappear after successfull deleting: class=record

  • Button:

    • class=record-delete
    • Button: data-sip={{SIP}}
  • Three possible variants with delete links:

    • Form: main record

    • HTML Code:

    • Form: subrecord, one delete button per record

    • Report: typially inside a table, but maybe different.

    • HTML Code:

Debug / Log / Errormessages

  • Before firing a SQL or doing processing of an FormElement, set some debugging / error variables:

    [src] $this->store->setVar(SYSTEM_SQL_RAW, STORE_SYSTEM)

  • Available fields:

    SYSTEM_SQL_RAW SYSTEM_SQL_FINAL SYSTEM_SQL_COUNT SYSTEM_SQL_PARAM_ARRAY SYSTEM_FORM = CLIENT_FORM; // ' / ' SYSTEM_FORM_ELEMENT = 'formElement'; // ' / ' SYSTEM_FORM_ELEMENT_COLUMN = 'formElementColumn'; // ''
  • Form.debugShowInfo: yes|no will display a tooltip near beside every formelement and show parse/evaluate as tooltip.

  • Check to display debug info:

    $this->store->getVar(SYSTEM_SHOW_DEBUG_INFO, STORE_SYSTEM) === 'yes'

Stores

  • Retrieve 'get' or 'post' variables by:

[src] $values = $this->store->getStore(STORE_CLIENT)

Primary Table

  • For the primary table all informations are available in STORE_TABLE_DEFAULT and STORE_TABLE_COLUMN_TYPES.
  • Get all columns of the primary table by

[src] array_keys($this->getStore(STORE_TABLE_COLUMN_TYPES))

  • Get the recent record in STORE_RECORD and the parent record (multiforms) in STORE_PARENT_RECORD.

Typo3

SIP

Page loaded: www.example.com?index.php&id=start&s=badcaffee1234&type=2&L=3, with $_SESSION['badcaffee1234'] => 'form=Person&r=1'

  • _SESSION[sip] => >> $_SESSION['badcaffee1234'] => 'form=Person&r=1'
  • _SESSION[urlparam] => >> $_SESSION['form=Person&r=1'] => 'badcaffee1234'

FormElement

Checkbox

<div class="checkbox">
    <label>
        <input type="checkbox">label 1
    </label>
</div>