1
|
|
|
<?php |
|
|
|
|
2
|
|
|
/* |
3
|
|
|
You may not change or alter any portion of this comment or credits |
4
|
|
|
of supporting developers from this source code or any supporting source code |
5
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
6
|
|
|
|
7
|
|
|
This program is distributed in the hope that it will be useful, |
8
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
9
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
10
|
|
|
*/ |
11
|
|
|
/** |
12
|
|
|
* PedigreeBreadcrumb Class |
13
|
|
|
* |
14
|
|
|
* @copyright {@link http://xoops.org/ XOOPS Project} |
15
|
|
|
* @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
16
|
|
|
* @author lucio <[email protected]> |
17
|
|
|
* @package Pedigree |
18
|
|
|
* @since 1.31 |
19
|
|
|
* |
20
|
|
|
*/ |
21
|
|
|
require_once __DIR__ . '/htmlinput.abstract.php'; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Class Picture |
25
|
|
|
*/ |
26
|
|
|
class PedigreePicture extends PedigreeHtmlInputAbstract |
|
|
|
|
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* @param Field $parentObject |
30
|
|
|
* @param PedigreeAnimal $animalObject |
31
|
|
|
*/ |
32
|
|
|
public function __construct($parentObject, $animalObject) |
33
|
|
|
{ |
34
|
|
|
$this->fieldnumber = $parentObject->getId(); |
|
|
|
|
35
|
|
|
$this->fieldname = $parentObject->fieldname; |
|
|
|
|
36
|
|
|
$this->value = $animalObject->{'user' . $this->fieldnumber}; |
|
|
|
|
37
|
|
|
$this->defaultvalue = $parentObject->defaultvalue; |
|
|
|
|
38
|
|
|
$this->lookuptable = $parentObject->hasLookup(); |
|
|
|
|
39
|
|
|
if ($this->lookuptable) { |
40
|
|
|
xoops_error('No lookuptable may be specified for userfield ' . $this->fieldnumber); |
41
|
|
|
} |
42
|
|
|
if ($parentObject->InAdvanced()) { |
43
|
|
|
xoops_error('userfield ' . $this->fieldnumber . ' cannot be shown in advanced info', get_class($this)); |
44
|
|
|
} |
45
|
|
|
if ($parentObject->inPie()) { |
46
|
|
|
xoops_error('A Pie-chart cannot be specified for userfield ' . $this->fieldnumber, get_class($this)); |
47
|
|
|
} |
48
|
|
View Code Duplication |
if ('1' == $parentObject->viewinlist) { |
|
|
|
|
49
|
|
|
xoops_error('userfield ' . $this->fieldnumber . ' cannot be included in listview', get_class($this)); |
50
|
|
|
} |
51
|
|
|
if ('1' == $parentObject->hassearch) { |
|
|
|
|
52
|
|
|
xoops_error('Search cannot be defined for userfield ' . $this->fieldnumber, get_class($this)); |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @return XoopsFormFile |
58
|
|
|
*/ |
59
|
|
|
public function editField() |
60
|
|
|
{ |
61
|
|
|
$picturefield = new XoopsFormFile($this->fieldname, 'user' . $this->fieldnumber, 1024000); |
62
|
|
|
$picturefield->setExtra("size ='50'"); |
63
|
|
|
|
64
|
|
|
return $picturefield; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @param string $name |
69
|
|
|
* |
70
|
|
|
* @return XoopsFormFile |
71
|
|
|
*/ |
72
|
|
View Code Duplication |
public function newField($name = '') |
|
|
|
|
73
|
|
|
{ |
74
|
|
|
$picturefield = new XoopsFormFile($this->fieldname, $name . 'user' . $this->fieldnumber, 1024000); |
75
|
|
|
$picturefield->setExtra("size ='50'"); |
76
|
|
|
|
77
|
|
|
return $picturefield; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @return XoopsFormLabel |
82
|
|
|
*/ |
83
|
|
|
public function viewField() |
84
|
|
|
{ |
85
|
|
|
$view = new XoopsFormLabel($this->fieldname, "<img src=\"assets/images/thumbnails/" . $this->value . "_400.jpeg\">"); |
86
|
|
|
|
87
|
|
|
return $view; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @return string |
92
|
|
|
*/ |
93
|
|
|
public function showField() |
94
|
|
|
{ |
95
|
|
|
return "<img src=\"assets/images/thumbnails/" . $this->value . "_150.jpeg\">"; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @return string |
100
|
|
|
*/ |
101
|
|
|
public function showValue() |
102
|
|
|
{ |
103
|
|
|
return "<img src=\"assets/images/thumbnails/" . $this->value . "_400.jpeg\">"; |
104
|
|
|
} |
105
|
|
|
} |
106
|
|
|
|
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.