BuildFormPlain.php 3.16 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
/**
 * Created by PhpStorm.
 * User: crose
 * Date: 1/25/16
 * Time: 9:46 PM
 */

namespace qfq;

use qfq;

require_once(__DIR__ . '/../qfq/Constants.php');
require_once(__DIR__ . '/../qfq/AbstractBuildForm.php');

Carsten  Rose's avatar
Carsten Rose committed
16
17
18
19
/**
 * Class BuildFormPlain
 * @package qfq
 */
20
21
class BuildFormPlain extends AbstractBuildForm {

Carsten  Rose's avatar
Carsten Rose committed
22
23
24
    /**
     *
     */
25
26
27
28
29
30
31
32
33
34
35
36
37
    public function fillWrap() {
        $this->wrap[WRAP_SETUP_TITLE][WRAP_SETUP_START] = '<h3>';
        $this->wrap[WRAP_SETUP_TITLE][WRAP_SETUP_END] = '</h3>';

        $this->wrap[WRAP_SETUP_ELEMENT][WRAP_SETUP_START] = '<p>';
        $this->wrap[WRAP_SETUP_ELEMENT][WRAP_SETUP_END] = '</p>';

        $this->wrap[WRAP_SETUP_LABEL][WRAP_SETUP_START] = '';
        $this->wrap[WRAP_SETUP_LABEL][WRAP_SETUP_END] = '';
        $this->wrap[WRAP_SETUP_INPUT][WRAP_SETUP_START] = '';
        $this->wrap[WRAP_SETUP_INPUT][WRAP_SETUP_END] = '';
        $this->wrap[WRAP_SETUP_NOTE][WRAP_SETUP_START] = '';
        $this->wrap[WRAP_SETUP_NOTE][WRAP_SETUP_END] = '';
38
39
40
41

        $this->wrap[WRAP_SETUP_IN_FIELDSET][WRAP_SETUP_START] = '<p>';
        $this->wrap[WRAP_SETUP_IN_FIELDSET][WRAP_SETUP_END] = '</p>';

42
43
    }

Carsten  Rose's avatar
Carsten Rose committed
44
45
46
    /**
     * @return string
     */
47
48
49
50
    public function getProcessFilter() {
        return FORM_ELEMENTS_NATIVE;
    }

Carsten  Rose's avatar
Carsten Rose committed
51
52
53
    /**
     * @return string
     */
54
    public function doSubrecords() {
Carsten  Rose's avatar
Carsten Rose committed
55
56
57
        $json = array();
        //TODO: $json is not returned - which is wrong. In this case, dynamic update won't work for subrecords
        return $this->elements($this->store->getVar(SIP_RECORD_ID, STORE_SIP), FORM_ELEMENTS_SUBRECORD, $json);
58
59
    }

Carsten  Rose's avatar
Carsten Rose committed
60
61
62
63
64
65
    /**
     * @param $htmlFormElementId
     * @param $formElement
     * @param $value
     * @return string
     */
66
    public function buildRowNative($formElement, $elementHtml) {
67
68
69
        $html = '';

        // Construct Marshaller Name
70
//        $buildElementFunctionName = 'build' . $this->buildElementFunctionName[$formElement['type']];
71

72
73
74

        if($formElement['nestedInFieldSet']==='no')
            $html .= $this->wrap[WRAP_SETUP_ELEMENT][WRAP_SETUP_START];
75
76
        $html .= $this->wrapItem(WRAP_SETUP_LABEL, $formElement['label']);
        $html .= $this->wrapItem(WRAP_SETUP_INPUT, $elementHtml);
77
        $html .= $this->wrapItem(WRAP_SETUP_NOTE, $formElement['note']);
78
79
        if($formElement['nestedInFieldSet']==='no')
            $html .= $this->wrap[WRAP_SETUP_ELEMENT][WRAP_SETUP_END];
80
81
82
83
84
85
86
87
88
89

        return $html;
    }

    /**
     * @return string
     */
    public function tail() {
        $html = '';

90
        $html .= $this->buildNewSip();
91
92
93
94

        $html .= $this->wrapItem(WRAP_SETUP_INPUT, '<input type="submit" value="Submit">');
        $html = $this->wrapItem(WRAP_SETUP_ELEMENT, $html);
        $html .= '</form>';
95
        $html .= '</div>'; // main <div class=...> around everything
96
97
98
99

        return $html;
    }

100
101
102
103
104
105
106
107
108
109
110
111

    public function buildRowPill($formElement, $elementHtml) {
        // TODO: Implement buildRowPill() method.
    }

    public function buildRowFieldset($formElement, $elementHtml) {
        // TODO: Implement buildRowFieldset() method.
    }

    public function buildRowSubrecord($formElement, $elementHtml) {
        // TODO: Implement buildRowSubrecord() method.
    }
112
}