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
|
|
|
* Pedigree\Breadcrumb Class |
17
|
|
|
* |
18
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
19
|
|
|
* @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
20
|
|
|
* @author lucio <[email protected]> |
21
|
|
|
* @package Pedigree |
22
|
|
|
* @since 1.31 |
23
|
|
|
*/ |
24
|
|
|
|
25
|
|
|
use XoopsModules\Pedigree; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Class Picture |
29
|
|
|
*/ |
30
|
|
|
class Picture extends Pedigree\HtmlInputAbstract |
31
|
|
|
{ |
32
|
|
|
/** |
33
|
|
|
* @param Field $parentObject |
34
|
|
|
* @param Pedigree\Animal $animalObject |
35
|
|
|
*/ |
36
|
|
|
public function __construct($parentObject, $animalObject) |
37
|
|
|
{ |
38
|
|
|
$this->fieldnumber = $parentObject->getId(); |
|
|
|
|
39
|
|
|
$this->fieldname = $parentObject->fieldname; |
|
|
|
|
40
|
|
|
$this->value = $animalObject->{'user' . $this->fieldnumber}; |
|
|
|
|
41
|
|
|
$this->defaultvalue = $parentObject->defaultvalue; |
|
|
|
|
42
|
|
|
$this->lookuptable = $parentObject->hasLookup(); |
|
|
|
|
43
|
|
|
if ($this->lookuptable) { |
44
|
|
|
\xoops_error('No lookuptable may be specified for userfield ' . $this->fieldnumber); |
45
|
|
|
} |
46
|
|
|
if ($parentObject->inAdvanced()) { |
47
|
|
|
\xoops_error('userfield ' . $this->fieldnumber . ' cannot be shown in advanced info', \get_class($this)); |
48
|
|
|
} |
49
|
|
|
if ($parentObject->inPie()) { |
50
|
|
|
\xoops_error('A Pie-chart cannot be specified for userfield ' . $this->fieldnumber, \get_class($this)); |
51
|
|
|
} |
52
|
|
|
if ('1' == $parentObject->viewinlist) { |
|
|
|
|
53
|
|
|
\xoops_error('userfield ' . $this->fieldnumber . ' cannot be included in listview', \get_class($this)); |
54
|
|
|
} |
55
|
|
|
if ('1' == $parentObject->hassearch) { |
|
|
|
|
56
|
|
|
\xoops_error('Search cannot be defined for userfield ' . $this->fieldnumber, \get_class($this)); |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @return \XoopsFormFile |
62
|
|
|
*/ |
63
|
|
|
public function editField() |
64
|
|
|
{ |
65
|
|
|
$picturefield = new \XoopsFormFile($this->fieldname, 'user' . $this->fieldnumber, 1024000); |
66
|
|
|
$picturefield->setExtra("size ='50'"); |
67
|
|
|
|
68
|
|
|
return $picturefield; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @param string $name |
73
|
|
|
* |
74
|
|
|
* @return \XoopsFormFile |
75
|
|
|
*/ |
76
|
|
|
public function newField($name = '') |
77
|
|
|
{ |
78
|
|
|
$picturefield = new \XoopsFormFile($this->fieldname, $name . 'user' . $this->fieldnumber, 1024000); |
79
|
|
|
$picturefield->setExtra("size ='50'"); |
80
|
|
|
|
81
|
|
|
return $picturefield; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @return \XoopsFormLabel |
86
|
|
|
*/ |
87
|
|
|
public function viewField() |
88
|
|
|
{ |
89
|
|
|
$view = new \XoopsFormLabel($this->fieldname, '<img src="' . PEDIGREE_UPLOAD_URL . '/images/thumbnails/' . $this->value . '_400.jpeg">'); |
|
|
|
|
90
|
|
|
|
91
|
|
|
return $view; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @return string |
96
|
|
|
*/ |
97
|
|
|
public function showField() |
98
|
|
|
{ |
99
|
|
|
return '<img src="' . PEDIGREE_UPLOAD_URL . '/images/thumbnails/' . $this->value . '_150.jpeg">'; |
|
|
|
|
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @return string |
104
|
|
|
*/ |
105
|
|
|
public function showValue() |
106
|
|
|
{ |
107
|
|
|
return '<img src="' . PEDIGREE_UPLOAD_URL . '/images/thumbnails/' . $this->value . '_400.jpeg">'; |
|
|
|
|
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @return mixed|void |
112
|
|
|
*/ |
113
|
|
|
public function searchField() |
114
|
|
|
{ |
115
|
|
|
return null; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* @return mixed|void |
120
|
|
|
*/ |
121
|
|
|
public function getSearchString() |
122
|
|
|
{ |
123
|
|
|
return null; |
124
|
|
|
} |
125
|
|
|
} |
126
|
|
|
|