1
|
|
|
<?php namespace XoopsModules\Pedigree; |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
You may not change or alter any portion of this comment or credits |
5
|
|
|
of supporting developers from this source code or any supporting source code |
6
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
7
|
|
|
|
8
|
|
|
This program is distributed in the hope that it will be useful, |
9
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
10
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
11
|
|
|
*/ |
12
|
|
|
/** |
13
|
|
|
* Pedigree\Breadcrumb Class |
14
|
|
|
* |
15
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
16
|
|
|
* @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
17
|
|
|
* @author lucio <[email protected]> |
18
|
|
|
* @package Pedigree |
19
|
|
|
* @since 1.31 |
20
|
|
|
* |
21
|
|
|
*/ |
22
|
|
|
use XoopsModules\Pedigree; |
23
|
|
|
|
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Class Picture |
27
|
|
|
*/ |
28
|
|
|
class Picture extends Pedigree\HtmlInputAbstract |
29
|
|
|
{ |
30
|
|
|
/** |
31
|
|
|
* @param Field $parentObject |
32
|
|
|
* @param Pedigree\Animal $animalObject |
33
|
|
|
*/ |
34
|
|
|
public function __construct($parentObject, $animalObject) |
35
|
|
|
{ |
36
|
|
|
$this->fieldnumber = $parentObject->getId(); |
|
|
|
|
37
|
|
|
$this->fieldname = $parentObject->fieldname; |
|
|
|
|
38
|
|
|
$this->value = $animalObject->{'user' . $this->fieldnumber}; |
|
|
|
|
39
|
|
|
$this->defaultvalue = $parentObject->defaultvalue; |
|
|
|
|
40
|
|
|
$this->lookuptable = $parentObject->hasLookup(); |
|
|
|
|
41
|
|
|
if ($this->lookuptable) { |
42
|
|
|
xoops_error('No lookuptable may be specified for userfield ' . $this->fieldnumber); |
|
|
|
|
43
|
|
|
} |
44
|
|
|
if ($parentObject->inAdvanced()) { |
45
|
|
|
xoops_error('userfield ' . $this->fieldnumber . ' cannot be shown in advanced info', get_class($this)); |
46
|
|
|
} |
47
|
|
|
if ($parentObject->inPie()) { |
48
|
|
|
xoops_error('A Pie-chart cannot be specified for userfield ' . $this->fieldnumber, get_class($this)); |
49
|
|
|
} |
50
|
|
|
if ('1' == $parentObject->viewinlist) { |
|
|
|
|
51
|
|
|
xoops_error('userfield ' . $this->fieldnumber . ' cannot be included in listview', get_class($this)); |
52
|
|
|
} |
53
|
|
|
if ('1' == $parentObject->hassearch) { |
|
|
|
|
54
|
|
|
xoops_error('Search cannot be defined for userfield ' . $this->fieldnumber, get_class($this)); |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @return \XoopsFormFile |
60
|
|
|
*/ |
61
|
|
|
public function editField() |
62
|
|
|
{ |
63
|
|
|
$picturefield = new \XoopsFormFile($this->fieldname, 'user' . $this->fieldnumber, 1024000); |
|
|
|
|
64
|
|
|
$picturefield->setExtra("size ='50'"); |
65
|
|
|
|
66
|
|
|
return $picturefield; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @param string $name |
71
|
|
|
* |
72
|
|
|
* @return \XoopsFormFile |
73
|
|
|
*/ |
74
|
|
|
public function newField($name = '') |
75
|
|
|
{ |
76
|
|
|
$picturefield = new \XoopsFormFile($this->fieldname, $name . 'user' . $this->fieldnumber, 1024000); |
77
|
|
|
$picturefield->setExtra("size ='50'"); |
78
|
|
|
|
79
|
|
|
return $picturefield; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @return \XoopsFormLabel |
84
|
|
|
*/ |
85
|
|
|
public function viewField() |
86
|
|
|
{ |
87
|
|
|
$view = new \XoopsFormLabel($this->fieldname, '<img src="' . PEDIGREE_UPLOAD_URL . '/images/thumbnails/' . $this->value . '_400.jpeg">'); |
|
|
|
|
88
|
|
|
|
89
|
|
|
return $view; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @return string |
94
|
|
|
*/ |
95
|
|
|
public function showField() |
96
|
|
|
{ |
97
|
|
|
return '<img src="' . PEDIGREE_UPLOAD_URL . '/images/thumbnails/' . $this->value . '_150.jpeg">'; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @return string |
102
|
|
|
*/ |
103
|
|
|
public function showValue() |
104
|
|
|
{ |
105
|
|
|
return '<img src="' . PEDIGREE_UPLOAD_URL . '/images/thumbnails/' . $this->value . '_400.jpeg">'; |
106
|
|
|
} |
107
|
|
|
} |
108
|
|
|
|