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
|
|
|
/** |
22
|
|
|
* Class Field |
23
|
|
|
*/ |
24
|
|
|
class PedigreeField |
|
|
|
|
25
|
|
|
{ |
26
|
|
|
protected $id; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @param $fieldnumber |
30
|
|
|
* @param $config |
31
|
|
|
*/ |
32
|
|
View Code Duplication |
public function __construct($fieldnumber, $config) |
|
|
|
|
33
|
|
|
{ |
34
|
|
|
//find key where Id = $fieldnumber; |
35
|
|
|
$configCount = count($config); |
36
|
|
|
for ($x = 0; $x < $configCount; ++$x) { |
37
|
|
|
//@todo - figure out if this is suppose to be an assignment or just a compare ('=' or '==') |
38
|
|
|
if ($config[$x]['Id'] = $fieldnumber) { |
39
|
|
|
foreach ($config[$x] as $key => $value) { |
40
|
|
|
$this->$key = $value; |
41
|
|
|
} |
42
|
|
|
} |
43
|
|
|
} |
44
|
|
|
$this->id = $fieldnumber; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @return bool |
49
|
|
|
*/ |
50
|
|
|
public function isActive() |
51
|
|
|
{ |
52
|
|
|
return ('1' == $this->getSetting('isactive')) ? true : false; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @return bool |
57
|
|
|
*/ |
58
|
|
|
public function inAdvanced() |
59
|
|
|
{ |
60
|
|
|
return ('1' == $this->getSetting('viewinadvanced')) ? true : false; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @return bool |
65
|
|
|
*/ |
66
|
|
|
public function isLocked() |
67
|
|
|
{ |
68
|
|
|
return ('1' == $this->getSetting('locked')) ? true : false; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @return bool |
73
|
|
|
*/ |
74
|
|
|
public function hasSearch() |
75
|
|
|
{ |
76
|
|
|
return ('1' == $this->getSetting('hassearch')) ? true : false; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @return bool |
81
|
|
|
*/ |
82
|
|
|
public function addLitter() |
83
|
|
|
{ |
84
|
|
|
return ('1' == $this->getSetting('litter')) ? true : false; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @return bool |
89
|
|
|
*/ |
90
|
|
|
public function generalLitter() |
91
|
|
|
{ |
92
|
|
|
return ('1' == $this->getSetting('generallitter')) ? true : false; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @return bool |
97
|
|
|
*/ |
98
|
|
|
public function hasLookup() |
99
|
|
|
{ |
100
|
|
|
return ('1' == $this->getSetting('lookuptable')) ? true : false; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @return string |
105
|
|
|
*/ |
106
|
|
|
public function getSearchString() |
107
|
|
|
{ |
108
|
|
|
return '&o=naam&p'; |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* @return bool |
113
|
|
|
*/ |
114
|
|
|
public function inPie() |
115
|
|
|
{ |
116
|
|
|
return ('1' == $this->getSetting('viewinpie')) ? true : false; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* @return bool |
121
|
|
|
*/ |
122
|
|
|
public function inPedigree() |
123
|
|
|
{ |
124
|
|
|
return ('1' == $this->getSetting('viewinpedigree')) ? true : false; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* @return bool |
129
|
|
|
*/ |
130
|
|
|
public function inList() |
131
|
|
|
{ |
132
|
|
|
return ('1' == $this->getSetting('viewinlist')) ? true : false; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
public function getId() |
|
|
|
|
136
|
|
|
{ |
137
|
|
|
return $this->id; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* @param $setting |
142
|
|
|
* |
143
|
|
|
* @return mixed |
144
|
|
|
*/ |
145
|
|
|
public function getSetting($setting) |
146
|
|
|
{ |
147
|
|
|
return $this->{$setting}; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* @param $fieldnumber |
152
|
|
|
* |
153
|
|
|
* @return array |
154
|
|
|
*/ |
155
|
|
View Code Duplication |
public function lookupField($fieldnumber) |
|
|
|
|
156
|
|
|
{ |
157
|
|
|
$ret = array(); |
158
|
|
|
global $xoopsDB; |
|
|
|
|
159
|
|
|
$SQL = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix("pedigree_lookup{$fieldnumber}") . " ORDER BY 'order'"; |
160
|
|
|
$result = $GLOBALS['xoopsDB']->query($SQL); |
161
|
|
|
while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
162
|
|
|
$ret[] = array('id' => $row['Id'], 'value' => $row['value']); |
163
|
|
|
} |
164
|
|
|
//array_multisort($ret,SORT_ASC); |
|
|
|
|
165
|
|
|
return $ret; |
166
|
|
|
} |
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* @return XoopsFormLabel |
170
|
|
|
*/ |
171
|
|
|
public function viewField() |
172
|
|
|
{ |
173
|
|
|
$view = new XoopsFormLabel($this->fieldname, $this->value); |
|
|
|
|
174
|
|
|
|
175
|
|
|
return $view; |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* @return string |
180
|
|
|
*/ |
181
|
|
|
public function showField() |
182
|
|
|
{ |
183
|
|
|
return $this->fieldname . ' : ' . $this->value; |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* @return mixed|string |
188
|
|
|
*/ |
189
|
|
|
public function showValue() |
190
|
|
|
{ |
191
|
|
|
global $myts; |
|
|
|
|
192
|
|
|
|
193
|
|
|
return $myts->displayTarea($this->value); |
194
|
|
|
//return $this->value; |
|
|
|
|
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
/** |
198
|
|
|
* @return string |
199
|
|
|
*/ |
200
|
|
|
public function searchField() |
201
|
|
|
{ |
202
|
|
|
return '<input type="text" name="query" size="20">'; |
203
|
|
|
} |
204
|
|
|
} |
205
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.