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 TextArea extends HtmlInputAbstract |
26
|
|
|
{ |
27
|
|
|
// Define class variables |
28
|
|
|
private $fieldnumber; |
29
|
|
|
private $fieldname; |
30
|
|
|
private $value; |
31
|
|
|
private $defaultvalue; |
32
|
|
|
private $lookuptable; |
33
|
|
|
private $rows = 5; |
34
|
|
|
private $cols = 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(Field $parentObject, Animal $animalObject) |
44
|
|
|
{ |
45
|
|
|
$this->fieldnumber = $parentObject->getId(); |
46
|
|
|
$this->fieldname = $parentObject->fieldname; |
|
|
|
|
47
|
|
|
$this->value = $animalObject->{'user' . $this->fieldnumber}; |
48
|
|
|
$this->defaultvalue = $parentObject->defaultvalue; |
|
|
|
|
49
|
|
|
if ($parentObject->hasLookup()) { |
50
|
|
|
\xoops_error('No lookuptable may be specified for userfield ' . $this->fieldnumber, \get_class($this)); |
51
|
|
|
} |
52
|
|
|
if ($parentObject->inAdvanced()) { |
53
|
|
|
\xoops_error('userfield ' . $this->fieldnumber . ' cannot be shown in advanced info', \get_class($this)); |
54
|
|
|
} |
55
|
|
|
if ($parentObject->inPie()) { |
56
|
|
|
\xoops_error('A Pie-chart cannot be specified for userfield ' . $this->fieldnumber, \get_class($this)); |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @return \XoopsFormTextArea |
62
|
|
|
*/ |
63
|
|
|
public function editField() |
64
|
|
|
{ |
65
|
|
|
$textarea = new \XoopsFormTextArea('<b>' . $this->fieldname . '</b>', 'user' . $this->fieldnumber, $value = $this->value, $this->rows, $this->cols); |
66
|
|
|
|
67
|
|
|
return $textarea; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @param string $name |
72
|
|
|
* |
73
|
|
|
* @return \XoopsFormTextArea |
74
|
|
|
*/ |
75
|
|
|
public function newField($name = '') |
76
|
|
|
{ |
77
|
|
|
$textarea = new \XoopsFormTextArea('<b>' . $this->fieldname . '</b>', $name . 'user' . $this->fieldnumber, $value = $this->defaultvalue, $this->rows, $this->cols); |
78
|
|
|
|
79
|
|
|
return $textarea; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @return string |
84
|
|
|
*/ |
85
|
|
|
public function getSearchString() |
86
|
|
|
{ |
87
|
|
|
return '&o=pname&l=1'; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @return mixed|void |
92
|
|
|
*/ |
93
|
|
|
public function showValue() |
94
|
|
|
{ |
95
|
|
|
return null; |
96
|
|
|
} |
97
|
|
|
} |
98
|
|
|
|