BuildFormBootstrap.php 2.11 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
/**
 * Created by PhpStorm.
 * User: crose
 * Date: 1/25/16
 * Time: 10:00 PM
 */

namespace qfq;

use qfq;

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

class BuildFormBootstrap extends AbstractBuildForm {

    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] = '';
    }

    public function getProcessFilter() {
        return FORM_ELEMENTS_NATIVE_SUBRECORD;
    }

    public function doSubrecords() {
        return '';
    }

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

        $html .= $this->wrapItem(WRAP_SETUP_TITLE, $this->formSpec['title'], true);
        $html .= '<form action="?" method="post" target="_top" accept-charset="UTF-8">';

        return $html;
    }

    public function wrapElement($htmlFormElementId, $formElement, $value) {
        $html = '';

        // Construct Marshaller Name
        $buildElementFunctionName = 'build' . $this->buildElementFunctionName[$formElement['type']];
        $html .= $this->wrapItem(WRAP_SETUP_TITLE, $this->formSpec['title'], true);
        $html .= '<form action="?" method="post" target="_top" accept-charset="UTF-8">';


        return $html;
    }

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

        $sip = $this->store->getVar(CLIENT_SIP, STORE_CLIENT);
        $sipName = CLIENT_SIP;
        $html .= $this->buildHidden(array(), $sipName, $sip);

        // TODO: bootstrap. See BuildFormTable.tail()

        return $html;
    }

}