Form.php 1.33 KB
Newer Older
1
2
3
4
5
6
7
8
<?php
/**
 * Created by PhpStorm.
 * User: ep
 * Date: 12/23/15
 * Time: 6:33 PM
 */

Carsten  Rose's avatar
Carsten Rose committed
9

10
11
namespace qfq;

Carsten  Rose's avatar
Carsten Rose committed
12
13
14
require_once(__DIR__ . '/../qfq/Store.php');
require_once(__DIR__ . '/../qfq/Constants.php');

15

16
17
class Form {
    protected $config = null;
Carsten  Rose's avatar
Carsten Rose committed
18
    protected $store = null;
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//    protected $formElements = null;
//    protected $userLog = null;

    /*
     *
     */
    public function __construct() {

        /*
         * TODO:
         *  Preparation: setup logging, database access, record locking
         *  fill stores
         *  Check permission_create / permission_update
         *  Multi: iterate over all records, Single: activate record
         *      Check mode: Load | Save
         *      doActions 'Before'
         *      Do all FormElements
         *      doActions 'After'
         */
Carsten  Rose's avatar
Carsten Rose committed
38
39
40
41
42
43
44
45
46
47
48
49

        $this->store = Store::getInstance();
    }

    /*
     *
     */

    public function process() {
        $this->loadFormDefinition();

        return "Hello World from class Form";
50
51
    }

Carsten  Rose's avatar
Carsten Rose committed
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
    /*
     *
     */

    private function loadFormDefinition() {
        $formName = $this->getFormName();
        echo "--$formName--";
    }

    private function getFormName() {
//       by bodytext
//       by session
//       by GET['formular']

        $formName = $this->store->getVar(CLIENT_FORM, STORE_CLIENT);
        return $formName;

69
70
    }
}