TextBox::showValue()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace XoopsModules\Pedigree;
4
5
/*
6
 * You may not change or alter any portion of this comment or credits
7
 * of supporting developers from this source code or any supporting source code
8
 * which is considered copyrighted (c) material of the original comment or credit authors.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
 */
14
15
/**
16
 * @package         XoopsModules\Pedigree
17
 * @copyright       {@link https://xoops.org/ XOOPS Project}
18
 * @license         {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later}
19
 * @author          XOOPS Module Dev Team
20
 */
21
22
/**
23
 * Class Pedigree\SelectBox
24
 */
25
class TextBox extends HtmlInputAbstract
26
{
27
    // Define class variables
28
    private $fieldnumber;
29
    private $fieldname;
30
    private $value;
31
    private $defaultvalue;
32
    private $lookuptable;
33
    private $size    = 50;
34
    private $maxsize = 50;
35
36
    /**
37
     * Constructor
38
     *
39
     * @param \XoopsModules\Pedigree\Field  $parentObject
40
     * @param \XoopsModules\Pedigree\Animal $animalObject
41
     * @todo move hard coded language strings to language file
42
     */
43
    public function __construct($parentObject, $animalObject)
44
    {
45
        $this->fieldnumber  = $parentObject->getId();
46
        $this->fieldname    = $parentObject->fieldname;
0 ignored issues
show
Bug introduced by
The property fieldname does not seem to exist on XoopsModules\Pedigree\Field.
Loading history...
47
        $this->value        = $animalObject->{'user' . $this->fieldnumber};
48
        $this->defaultvalue = $parentObject->defaultvalue;
0 ignored issues
show
Bug introduced by
The property defaultvalue does not seem to exist on XoopsModules\Pedigree\Field.
Loading history...
49
        $this->lookuptable  = $parentObject->lookuptable;
0 ignored issues
show
Bug introduced by
The property lookuptable does not seem to exist on XoopsModules\Pedigree\Field.
Loading history...
50
        if ('1' == $this->lookuptable) {
51
            \xoops_error('No lookuptable may be specified for userfield ' . $this->fieldnumber, \get_class($this));
52
        }
53
        if ('1' == $parentObject->viewinadvanced) {
0 ignored issues
show
Bug introduced by
The property viewinadvanced does not seem to exist on XoopsModules\Pedigree\Field.
Loading history...
54
            \xoops_error('userfield ' . $this->fieldnumber . ' cannot be shown in advanced info', \get_class($this));
55
        }
56
        if ('1' == $parentObject->viewinpie) {
0 ignored issues
show
Bug introduced by
The property viewinpie does not seem to exist on XoopsModules\Pedigree\Field.
Loading history...
57
            \xoops_error('A Pie-chart cannot be specified for userfield ' . $this->fieldnumber, \get_class($this));
58
        }
59
    }
60
61
    /**
62
     * @return \XoopsFormText
63
     */
64
    public function editField()
65
    {
66
        $textbox = new \XoopsFormText('<b>' . $this->fieldname . '</b>', 'user' . $this->fieldnumber, $this->size, $this->maxsize, $value = $this->value);
67
68
        return $textbox;
69
    }
70
71
    /**
72
     * @param string $name
73
     *
74
     * @return \XoopsFormText
75
     */
76
    public function newField($name = '')
77
    {
78
        $textbox = new \XoopsFormText('<b>' . $this->fieldname . '</b>', $name . 'user' . $this->fieldnumber, $this->size, $this->maxsize, $value = $this->defaultvalue);
79
80
        return $textbox;
81
    }
82
83
    /**
84
     * @return string
85
     */
86
    public function getSearchString()
87
    {
88
        return '&amp;o=pname&amp;l=1';
89
    }
90
91
    /**
92
     * @return mixed|void
93
     */
94
    public function showValue()
95
    {
96
        return null;
97
    }
98
}
99