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
|
|
|
use \XoopsModules\Pedigree; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Class SystemMessage |
16
|
|
|
* @deprecated |
17
|
|
|
*/ |
18
|
|
|
class SystemMessage |
|
|
|
|
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* @param $message |
22
|
|
|
*/ |
23
|
|
|
public function __construct($message) |
24
|
|
|
{ |
25
|
|
|
echo '<span style="color: #ff0000;"><h3>' . $message . '</h3></span>'; |
26
|
|
|
} |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Class Animal |
31
|
|
|
* @deprecated |
32
|
|
|
*/ |
33
|
|
|
class Animal |
|
|
|
|
34
|
|
|
{ |
35
|
|
|
/** |
36
|
|
|
* @param int $animalnumber * @internal param int $id animal ID |
37
|
|
|
*/ |
38
|
|
|
public function __construct($animalnumber = 0) |
39
|
|
|
{ |
40
|
|
|
global $xoopsDB; |
|
|
|
|
41
|
|
|
if (0 == $animalnumber) { |
42
|
|
|
$SQL = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_tree') . " WHERE id = '1'"; |
43
|
|
|
} else { |
44
|
|
|
$SQL = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_tree') . ' WHERE id = ' . $animalnumber; |
45
|
|
|
} |
46
|
|
|
$result = $GLOBALS['xoopsDB']->query($SQL); |
47
|
|
|
$row = $GLOBALS['xoopsDB']->fetchRow($result); |
48
|
|
|
$numfields = $GLOBALS['xoopsDB']->getFieldsNum($result); |
49
|
|
|
for ($i = 0; $i < $numfields; ++$i) { |
50
|
|
|
$key = mysqli_fetch_field_direct($result, $i)->name; |
51
|
|
|
$this->$key = $row[$i]; |
52
|
|
|
} |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @return array |
57
|
|
|
*/ |
58
|
|
|
public function getFieldsIds() |
59
|
|
|
{ |
60
|
|
|
global $xoopsDB; |
|
|
|
|
61
|
|
|
$SQL = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_fields') . ' ORDER BY `order`'; |
62
|
|
|
$fields = []; |
63
|
|
|
$result = $GLOBALS['xoopsDB']->query($SQL); |
64
|
|
|
$count = 0; |
65
|
|
|
while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
66
|
|
|
$fields[] = $row['id']; |
67
|
|
|
++$count; |
68
|
|
|
$configValues[] = $row; |
69
|
|
|
} |
70
|
|
|
$this->configValues = isset($configValues) ? $configValues : ''; |
|
|
|
|
71
|
|
|
|
72
|
|
|
//print_r ($this->configValues); die(); |
|
|
|
|
73
|
|
|
return $fields; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @return mixed |
78
|
|
|
*/ |
79
|
|
|
public function getConfig() |
80
|
|
|
{ |
81
|
|
|
return $this->configValues; |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Class Field |
87
|
|
|
*/ |
88
|
|
|
class Field |
|
|
|
|
89
|
|
|
{ |
90
|
|
|
protected $id; |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @param $fieldnumber |
94
|
|
|
* @param $config |
95
|
|
|
*/ |
96
|
|
|
public function __construct($fieldnumber, $config) |
97
|
|
|
{ |
98
|
|
|
//find key where ID = $fieldnumber; |
99
|
|
|
for ($x = 0, $xMax = count($config); $x < $xMax; ++$x) { |
100
|
|
|
if ($config[$x]['id'] = $fieldnumber) { |
101
|
|
|
foreach ($config[$x] as $key => $values) { |
102
|
|
|
$this->$key = $values; |
103
|
|
|
} |
104
|
|
|
} |
105
|
|
|
} |
106
|
|
|
$this->id = $fieldnumber; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @return bool |
111
|
|
|
*/ |
112
|
|
|
public function isActive() |
113
|
|
|
{ |
114
|
|
|
$active = $this->getSetting('isactive'); |
115
|
|
|
return '1' == $active; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* @return bool |
120
|
|
|
*/ |
121
|
|
|
public function inAdvanced() |
122
|
|
|
{ |
123
|
|
|
$active = $this->getSetting('viewinadvanced'); |
124
|
|
|
// return ('1' == $active) ? true : false; |
|
|
|
|
125
|
|
|
return '1' == $active; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @return bool |
130
|
|
|
*/ |
131
|
|
|
public function isLocked() |
132
|
|
|
{ |
133
|
|
|
$active = $this->getSetting('locked'); |
134
|
|
|
return '1' == $active; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* @return bool |
139
|
|
|
*/ |
140
|
|
|
public function hasSearch() |
141
|
|
|
{ |
142
|
|
|
$active = $this->getSetting('hassearch'); |
143
|
|
|
return '1' == $active; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* @return bool |
148
|
|
|
*/ |
149
|
|
|
public function addLitter() |
150
|
|
|
{ |
151
|
|
|
$active = $this->getSetting('litter'); |
152
|
|
|
return '1' == $active; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @return bool |
157
|
|
|
*/ |
158
|
|
|
public function generalLitter() |
159
|
|
|
{ |
160
|
|
|
$active = $this->getSetting('generallitter'); |
161
|
|
|
return '1' == $active; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* @return bool |
166
|
|
|
*/ |
167
|
|
|
public function hasLookup() |
168
|
|
|
{ |
169
|
|
|
$active = $this->getSetting('lookuptable'); |
170
|
|
|
return '1' == $active; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* @return string |
175
|
|
|
*/ |
176
|
|
|
public function getSearchString() |
177
|
|
|
{ |
178
|
|
|
return '&o=naam&p'; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* @return bool |
183
|
|
|
*/ |
184
|
|
|
public function inPie() |
185
|
|
|
{ |
186
|
|
|
$active = $this->getSetting('viewinpie'); |
187
|
|
|
return '1' == $active; |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
/** |
191
|
|
|
* @return bool |
192
|
|
|
*/ |
193
|
|
|
public function inPedigree() |
194
|
|
|
{ |
195
|
|
|
$active = $this->getSetting('viewinpedigree'); |
196
|
|
|
return '1' == $active; |
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
/** |
200
|
|
|
* @return bool |
201
|
|
|
*/ |
202
|
|
|
public function inList() |
203
|
|
|
{ |
204
|
|
|
$active = $this->getSetting('viewinlist'); |
205
|
|
|
return '1' == $active; |
206
|
|
|
} |
207
|
|
|
|
208
|
|
|
public function getId() |
209
|
|
|
{ |
210
|
|
|
return $this->id; |
211
|
|
|
} |
212
|
|
|
|
213
|
|
|
/** |
214
|
|
|
* @param $setting |
215
|
|
|
* |
216
|
|
|
* @return mixed |
217
|
|
|
*/ |
218
|
|
|
public function getSetting($setting) |
219
|
|
|
{ |
220
|
|
|
return $this->{$setting}; |
221
|
|
|
} |
222
|
|
|
|
223
|
|
|
/** |
224
|
|
|
* @param $fieldnumber |
225
|
|
|
* |
226
|
|
|
* @return array |
227
|
|
|
*/ |
228
|
|
|
public function lookupField($fieldnumber) |
229
|
|
|
{ |
230
|
|
|
$ret = []; |
231
|
|
|
global $xoopsDB; |
|
|
|
|
232
|
|
|
$SQL = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_lookup' . $fieldnumber) . " ORDER BY 'order'"; |
233
|
|
|
$result = $GLOBALS['xoopsDB']->query($SQL); |
234
|
|
|
while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
235
|
|
|
$ret[] = ['id' => $row['id'], 'value' => $row['value']]; |
236
|
|
|
} |
237
|
|
|
|
238
|
|
|
//array_multisort($ret,SORT_ASC); |
|
|
|
|
239
|
|
|
return $ret; |
240
|
|
|
} |
241
|
|
|
|
242
|
|
|
/** |
243
|
|
|
* @return XoopsFormLabel |
244
|
|
|
*/ |
245
|
|
|
public function viewField() |
246
|
|
|
{ |
247
|
|
|
$view = new \XoopsFormLabel($this->fieldname, $this->value); |
248
|
|
|
|
249
|
|
|
return $view; |
250
|
|
|
} |
251
|
|
|
|
252
|
|
|
/** |
253
|
|
|
* @return string |
254
|
|
|
*/ |
255
|
|
|
public function showField() |
256
|
|
|
{ |
257
|
|
|
return $this->fieldname . ' : ' . $this->value; |
258
|
|
|
} |
259
|
|
|
|
260
|
|
|
/** |
261
|
|
|
* @return mixed|string |
262
|
|
|
*/ |
263
|
|
|
public function showValue() |
264
|
|
|
{ |
265
|
|
|
global $myts; |
|
|
|
|
266
|
|
|
|
267
|
|
|
return $myts->displayTarea($this->value); |
268
|
|
|
//return $this->value; |
|
|
|
|
269
|
|
|
} |
270
|
|
|
|
271
|
|
|
/** |
272
|
|
|
* @return string |
273
|
|
|
*/ |
274
|
|
|
public function searchField() |
275
|
|
|
{ |
276
|
|
|
return '<input type="text" name="query" size="20">'; |
277
|
|
|
} |
278
|
|
|
} |
279
|
|
|
|
280
|
|
|
/** |
281
|
|
|
* Class RadioButton |
282
|
|
|
* @deprecated |
283
|
|
|
*/ |
284
|
|
|
class RadioButton extends Field |
|
|
|
|
285
|
|
|
{ |
286
|
|
|
/** |
287
|
|
|
* @param Pedigree\Field $parentObject |
288
|
|
|
* @param Pedigree\Animal $animalObject |
289
|
|
|
*/ |
290
|
|
|
public function __construct($parentObject, $animalObject) |
291
|
|
|
{ |
292
|
|
|
$this->fieldnumber = $parentObject->getId(); |
|
|
|
|
293
|
|
|
|
294
|
|
|
$this->fieldname = $parentObject->fieldname; |
|
|
|
|
295
|
|
|
$this->value = $animalObject->{'user' . $this->fieldnumber}; |
|
|
|
|
296
|
|
|
$this->defaultvalue = $parentObject->defaultvalue; |
|
|
|
|
297
|
|
|
$this->lookuptable = $parentObject->lookuptable; |
|
|
|
|
298
|
|
|
if ('0' == $this->lookuptable) { |
299
|
|
|
new SystemMessage('A lookuptable must be specified for userfield' . $this->fieldnumber); |
|
|
|
|
300
|
|
|
} |
301
|
|
|
} |
302
|
|
|
|
303
|
|
|
/** |
304
|
|
|
* @return XoopsFormRadio |
305
|
|
|
*/ |
306
|
|
|
public function editField() |
307
|
|
|
{ |
308
|
|
|
$radio = new \XoopsFormRadio('<b>' . $this->fieldname . '</b>', 'user' . $this->fieldnumber, $value = $this->value); |
309
|
|
|
$lookupcontents = $this->lookupField($this->fieldnumber); |
310
|
|
|
for ($i = 0, $iMax = count($lookupcontents); $i < $iMax; ++$i) { |
311
|
|
|
$radio->addOption($lookupcontents[$i]['id'], $name = ($lookupcontents[$i]['value'] . '<br>')); |
312
|
|
|
} |
313
|
|
|
|
314
|
|
|
return $radio; |
315
|
|
|
} |
316
|
|
|
|
317
|
|
|
/** |
318
|
|
|
* @param string $name |
319
|
|
|
* |
320
|
|
|
* @return XoopsFormRadio |
321
|
|
|
*/ |
322
|
|
|
public function newField($name = '') |
323
|
|
|
{ |
324
|
|
|
$radio = new \XoopsFormRadio('<b>' . $this->fieldname . '</b>', $name . 'user' . $this->fieldnumber, $value = $this->defaultvalue); |
325
|
|
|
$lookupcontents = $this->lookupField($this->fieldnumber); |
326
|
|
|
for ($i = 0, $iMax = count($lookupcontents); $i < $iMax; ++$i) { |
327
|
|
|
$radio->addOption($lookupcontents[$i]['id'], $name = ($lookupcontents[$i]['value'] . '<br>')); |
328
|
|
|
} |
329
|
|
|
|
330
|
|
|
return $radio; |
331
|
|
|
} |
332
|
|
|
|
333
|
|
|
/** |
334
|
|
|
* @return XoopsFormLabel |
335
|
|
|
*/ |
336
|
|
|
public function viewField() |
337
|
|
|
{ |
338
|
|
|
$choosenvalue = ''; |
339
|
|
|
$lookupcontents = $this->lookupField($this->fieldnumber); |
340
|
|
|
for ($i = 0, $iMax = count($lookupcontents); $i < $iMax; ++$i) { |
341
|
|
|
if ($lookupcontents[$i]['id'] == $this->value) { |
342
|
|
|
$choosenvalue = $lookupcontents[$i]['value']; |
343
|
|
|
} |
344
|
|
|
} |
345
|
|
|
$view = new \XoopsFormLabel($this->fieldname, $choosenvalue); |
346
|
|
|
|
347
|
|
|
return $view; |
348
|
|
|
} |
349
|
|
|
|
350
|
|
|
/** |
351
|
|
|
* @return string |
352
|
|
|
*/ |
353
|
|
|
public function showField() |
354
|
|
|
{ |
355
|
|
|
$choosenvalue = ''; |
356
|
|
|
$lookupcontents = $this->lookupField($this->fieldnumber); |
357
|
|
|
for ($i = 0, $iMax = count($lookupcontents); $i < $iMax; ++$i) { |
358
|
|
|
if ($lookupcontents[$i]['id'] == $this->value) { |
359
|
|
|
$choosenvalue = $lookupcontents[$i]['value']; |
360
|
|
|
} |
361
|
|
|
} |
362
|
|
|
|
363
|
|
|
return $this->fieldname . ' : ' . $choosenvalue; |
364
|
|
|
} |
365
|
|
|
|
366
|
|
|
/** |
367
|
|
|
* @return mixed |
368
|
|
|
*/ |
369
|
|
|
public function showValue() |
370
|
|
|
{ |
371
|
|
|
$choosenvalue = ''; |
372
|
|
|
$lookupcontents = $this->lookupField($this->fieldnumber); |
373
|
|
|
for ($i = 0, $iMax = count($lookupcontents); $i < $iMax; ++$i) { |
374
|
|
|
if ($lookupcontents[$i]['id'] == $this->value) { |
375
|
|
|
$choosenvalue = $lookupcontents[$i]['value']; |
376
|
|
|
} |
377
|
|
|
} |
378
|
|
|
|
379
|
|
|
return $choosenvalue; |
380
|
|
|
} |
381
|
|
|
|
382
|
|
|
/** |
383
|
|
|
* @return string |
384
|
|
|
*/ |
385
|
|
|
public function searchField() |
386
|
|
|
{ |
387
|
|
|
$select = '<select size="1" name="query" style="width: 140px;">'; |
388
|
|
|
$lookupcontents = $this->lookupField($this->fieldnumber); |
389
|
|
|
for ($i = 0, $iMax = count($lookupcontents); $i < $iMax; ++$i) { |
390
|
|
|
$select .= '<option value="' . $lookupcontents[$i]['id'] . '">' . $lookupcontents[$i]['value'] . '</option>'; |
391
|
|
|
} |
392
|
|
|
$select .= '</select>'; |
393
|
|
|
|
394
|
|
|
return $select; |
395
|
|
|
} |
396
|
|
|
} |
397
|
|
|
|
398
|
|
|
/** |
399
|
|
|
* Class SelectBox |
400
|
|
|
* @deprecated |
401
|
|
|
*/ |
402
|
|
|
class SelectBox extends Field |
|
|
|
|
403
|
|
|
{ |
404
|
|
|
/** |
405
|
|
|
* @param $parentObject |
406
|
|
|
* @param $animalObject |
407
|
|
|
*/ |
408
|
|
|
public function __construct($parentObject, $animalObject) |
409
|
|
|
{ |
410
|
|
|
$this->fieldnumber = $parentObject->getId(); |
|
|
|
|
411
|
|
|
$this->fieldname = $parentObject->fieldname; |
|
|
|
|
412
|
|
|
$this->value = $animalObject->{'user' . $this->fieldnumber}; |
|
|
|
|
413
|
|
|
$this->defaultvalue = $parentObject->defaultvalue; |
|
|
|
|
414
|
|
|
$this->lookuptable = $parentObject->lookuptable; |
|
|
|
|
415
|
|
|
if ('0' == $this->lookuptable) { |
416
|
|
|
new SystemMessage('A lookuptable must be specified for userfield' . $this->fieldnumber); |
|
|
|
|
417
|
|
|
} |
418
|
|
|
} |
419
|
|
|
|
420
|
|
|
/** |
421
|
|
|
* @return XoopsFormSelect |
422
|
|
|
*/ |
423
|
|
|
public function editField() |
424
|
|
|
{ |
425
|
|
|
$select = new \XoopsFormSelect('<b>' . $this->fieldname . '</b>', 'user' . $this->fieldnumber, $value = $this->value, $size = 1, $multiple = false); |
426
|
|
|
$lookupcontents = $this->lookupField($this->fieldnumber); |
427
|
|
|
for ($i = 0, $iMax = count($lookupcontents); $i < $iMax; ++$i) { |
428
|
|
|
$select->addOption($lookupcontents[$i]['id'], $name = ($lookupcontents[$i]['value'] . '<br>')); |
429
|
|
|
} |
430
|
|
|
|
431
|
|
|
return $select; |
432
|
|
|
} |
433
|
|
|
|
434
|
|
|
/** |
435
|
|
|
* @param string $name |
436
|
|
|
* |
437
|
|
|
* @return XoopsFormSelect |
438
|
|
|
*/ |
439
|
|
|
public function newField($name = '') |
440
|
|
|
{ |
441
|
|
|
$select = new \XoopsFormSelect('<b>' . $this->fieldname . '</b>', $name . 'user' . $this->fieldnumber, $value = $this->defaultvalue, $size = 1, $multiple = false); |
442
|
|
|
$lookupcontents = $this->lookupField($this->fieldnumber); |
443
|
|
|
for ($i = 0, $iMax = count($lookupcontents); $i < $iMax; ++$i) { |
444
|
|
|
$select->addOption($lookupcontents[$i]['id'], $name = ($lookupcontents[$i]['value'] . '<br>')); |
445
|
|
|
} |
446
|
|
|
|
447
|
|
|
return $select; |
448
|
|
|
} |
449
|
|
|
|
450
|
|
|
/** |
451
|
|
|
* @return XoopsFormLabel |
452
|
|
|
*/ |
453
|
|
|
public function viewField() |
454
|
|
|
{ |
455
|
|
|
$choosenvalue = ''; |
456
|
|
|
$lookupcontents = $this->lookupField($this->fieldnumber); |
457
|
|
|
for ($i = 0, $iMax = count($lookupcontents); $i < $iMax; ++$i) { |
458
|
|
|
if ($lookupcontents[$i]['id'] == $this->value) { |
459
|
|
|
$choosenvalue = $lookupcontents[$i]['value']; |
460
|
|
|
} |
461
|
|
|
} |
462
|
|
|
$view = new \XoopsFormLabel($this->fieldname, $choosenvalue); |
463
|
|
|
|
464
|
|
|
return $view; |
465
|
|
|
} |
466
|
|
|
|
467
|
|
|
/** |
468
|
|
|
* @return string |
469
|
|
|
*/ |
470
|
|
|
public function showField() |
471
|
|
|
{ |
472
|
|
|
$choosenvalue = ''; |
473
|
|
|
$lookupcontents = $this->lookupField($this->fieldnumber); |
474
|
|
|
for ($i = 0, $iMax = count($lookupcontents); $i < $iMax; ++$i) { |
475
|
|
|
if ($lookupcontents[$i]['id'] == $this->value) { |
476
|
|
|
$choosenvalue = $lookupcontents[$i]['value']; |
477
|
|
|
} |
478
|
|
|
} |
479
|
|
|
|
480
|
|
|
return $this->fieldname . ' : ' . $choosenvalue; |
481
|
|
|
} |
482
|
|
|
|
483
|
|
|
/** |
484
|
|
|
* @return mixed |
485
|
|
|
*/ |
486
|
|
|
public function showValue() |
487
|
|
|
{ |
488
|
|
|
$choosenvalue = ''; |
489
|
|
|
$lookupcontents = $this->lookupField($this->fieldnumber); |
490
|
|
|
for ($i = 0, $iMax = count($lookupcontents); $i < $iMax; ++$i) { |
491
|
|
|
if ($lookupcontents[$i]['id'] == $this->value) { |
492
|
|
|
$choosenvalue = $lookupcontents[$i]['value']; |
493
|
|
|
} |
494
|
|
|
} |
495
|
|
|
|
496
|
|
|
return $choosenvalue; |
497
|
|
|
} |
498
|
|
|
|
499
|
|
|
/** |
500
|
|
|
* @return string |
501
|
|
|
*/ |
502
|
|
|
public function searchField() |
503
|
|
|
{ |
504
|
|
|
$select = '<select size="1" name="query" style="width: 140px;">'; |
505
|
|
|
$lookupcontents = $this->lookupField($this->fieldnumber); |
506
|
|
|
for ($i = 0, $iMax = count($lookupcontents); $i < $iMax; ++$i) { |
507
|
|
|
$select .= '<option value="' . $lookupcontents[$i]['id'] . '">' . $lookupcontents[$i]['value'] . '</option>'; |
508
|
|
|
} |
509
|
|
|
$select .= '</select>'; |
510
|
|
|
|
511
|
|
|
return $select; |
512
|
|
|
} |
513
|
|
|
} |
514
|
|
|
|
515
|
|
|
/** |
516
|
|
|
* Class TextBox |
517
|
|
|
* @deprecated |
518
|
|
|
*/ |
519
|
|
|
class TextBox extends Field |
|
|
|
|
520
|
|
|
{ |
521
|
|
|
/** |
522
|
|
|
* @param $parentObject |
523
|
|
|
* @param $animalObject |
524
|
|
|
*/ |
525
|
|
|
public function __construct($parentObject, $animalObject) |
526
|
|
|
{ |
527
|
|
|
$this->fieldnumber = $parentObject->getId(); |
|
|
|
|
528
|
|
|
$this->fieldname = $parentObject->fieldname; |
|
|
|
|
529
|
|
|
$this->value = $animalObject->{'user' . $this->fieldnumber}; |
|
|
|
|
530
|
|
|
$this->defaultvalue = $parentObject->defaultvalue; |
|
|
|
|
531
|
|
|
$this->lookuptable = $parentObject->lookuptable; |
|
|
|
|
532
|
|
|
if ('1' == $this->lookuptable) { |
533
|
|
|
new SystemMessage('No lookuptable may be specified for userfield' . $this->fieldnumber); |
|
|
|
|
534
|
|
|
} |
535
|
|
|
if ('1' == $parentObject->viewinadvanced) { |
536
|
|
|
new SystemMessage('userfield' . $this->fieldnumber . ' cannot be shown in advanced info'); |
|
|
|
|
537
|
|
|
} |
538
|
|
|
if ('1' == $parentObject->viewinpie) { |
539
|
|
|
new SystemMessage('A Pie-chart cannot be specified for userfield' . $this->fieldnumber); |
|
|
|
|
540
|
|
|
} |
541
|
|
|
} |
542
|
|
|
|
543
|
|
|
/** |
544
|
|
|
* @return XoopsFormText |
545
|
|
|
*/ |
546
|
|
|
public function editField() |
547
|
|
|
{ |
548
|
|
|
$textbox = new \XoopsFormText('<b>' . $this->fieldname . '</b>', 'user' . $this->fieldnumber, $size = 50, $maxsize = 50, $value = $this->value); |
549
|
|
|
|
550
|
|
|
return $textbox; |
551
|
|
|
} |
552
|
|
|
|
553
|
|
|
/** |
554
|
|
|
* @param string $name |
555
|
|
|
* |
556
|
|
|
* @return XoopsFormText |
557
|
|
|
*/ |
558
|
|
|
public function newField($name = '') |
559
|
|
|
{ |
560
|
|
|
$textbox = new \XoopsFormText('<b>' . $this->fieldname . '</b>', $name . 'user' . $this->fieldnumber, $size = 50, $maxsize = 50, $value = $this->defaultvalue); |
561
|
|
|
|
562
|
|
|
return $textbox; |
563
|
|
|
} |
564
|
|
|
|
565
|
|
|
/** |
566
|
|
|
* @return string |
567
|
|
|
*/ |
568
|
|
|
public function getSearchString() |
569
|
|
|
{ |
570
|
|
|
return '&o=naam&l=1'; |
571
|
|
|
} |
572
|
|
|
} |
573
|
|
|
|
574
|
|
|
/** |
575
|
|
|
* Class TextArea |
576
|
|
|
* @deprecated |
577
|
|
|
*/ |
578
|
|
|
class TextArea extends Field |
|
|
|
|
579
|
|
|
{ |
580
|
|
|
/** |
581
|
|
|
* @param $parentObject |
582
|
|
|
* @param $animalObject |
583
|
|
|
*/ |
584
|
|
|
public function __construct($parentObject, $animalObject) |
585
|
|
|
{ |
586
|
|
|
$this->fieldnumber = $parentObject->getId(); |
|
|
|
|
587
|
|
|
$this->fieldname = $parentObject->fieldname; |
|
|
|
|
588
|
|
|
$this->value = $animalObject->{'user' . $this->fieldnumber}; |
|
|
|
|
589
|
|
|
$this->defaultvalue = $parentObject->defaultvalue; |
|
|
|
|
590
|
|
|
if ('1' == $parentObject->lookuptable) { |
591
|
|
|
new SystemMessage('No lookuptable may be specified for userfield' . $this->fieldnumber); |
|
|
|
|
592
|
|
|
} |
593
|
|
|
if ('1' == $parentObject->viewinadvanced) { |
594
|
|
|
new SystemMessage('userfield' . $this->fieldnumber . ' cannot be shown in advanced info'); |
|
|
|
|
595
|
|
|
} |
596
|
|
|
if ('1' == $parentObject->viewinpie) { |
597
|
|
|
new SystemMessage('A Pie-chart cannot be specified for userfield' . $this->fieldnumber); |
|
|
|
|
598
|
|
|
} |
599
|
|
|
} |
600
|
|
|
|
601
|
|
|
/** |
602
|
|
|
* @return XoopsFormTextArea |
603
|
|
|
*/ |
604
|
|
|
public function editField() |
605
|
|
|
{ |
606
|
|
|
$textarea = new \XoopsFormTextArea('<b>' . $this->fieldname . '</b>', 'user' . $this->fieldnumber, $value = $this->value, $rows = 5, $cols = 50); |
607
|
|
|
|
608
|
|
|
return $textarea; |
609
|
|
|
} |
610
|
|
|
|
611
|
|
|
/** |
612
|
|
|
* @param string $name |
613
|
|
|
* |
614
|
|
|
* @return XoopsFormTextArea |
615
|
|
|
*/ |
616
|
|
|
public function newField($name = '') |
617
|
|
|
{ |
618
|
|
|
$textarea = new \XoopsFormTextArea('<b>' . $this->fieldname . '</b>', $name . 'user' . $this->fieldnumber, $value = $this->defaultvalue, $rows = 5, $cols = 50); |
619
|
|
|
|
620
|
|
|
return $textarea; |
621
|
|
|
} |
622
|
|
|
|
623
|
|
|
/** |
624
|
|
|
* @return string |
625
|
|
|
*/ |
626
|
|
|
public function getSearchString() |
627
|
|
|
{ |
628
|
|
|
return '&o=naam&l=1'; |
629
|
|
|
} |
630
|
|
|
} |
631
|
|
|
|
632
|
|
|
/** |
633
|
|
|
* Class DataSelect |
634
|
|
|
* @deprecated |
635
|
|
|
*/ |
636
|
|
|
class DataSelect extends Field |
|
|
|
|
637
|
|
|
{ |
638
|
|
|
/** |
639
|
|
|
* @param $parentObject |
640
|
|
|
* @param $animalObject |
641
|
|
|
*/ |
642
|
|
|
public function __construct($parentObject, $animalObject) |
643
|
|
|
{ |
644
|
|
|
$this->fieldnumber = $parentObject->getId(); |
|
|
|
|
645
|
|
|
$this->fieldname = $parentObject->fieldname; |
|
|
|
|
646
|
|
|
$this->value = $animalObject->{'user' . $this->fieldnumber}; |
|
|
|
|
647
|
|
|
$this->defaultvalue = $parentObject->defaultvalue; |
|
|
|
|
648
|
|
|
if ('1' == $parentObject->lookuptable) { |
649
|
|
|
new SystemMessage('No lookuptable may be specified for userfield' . $this->fieldnumber); |
|
|
|
|
650
|
|
|
} |
651
|
|
|
if ('1' == $parentObject->viewinadvanced) { |
652
|
|
|
new SystemMessage('userfield' . $this->fieldnumber . ' cannot be shown in advanced info'); |
|
|
|
|
653
|
|
|
} |
654
|
|
|
if ('1' == $parentObject->viewinpie) { |
655
|
|
|
new SystemMessage('A Pie-chart cannot be specified for userfield' . $this->fieldnumber); |
|
|
|
|
656
|
|
|
} |
657
|
|
|
} |
658
|
|
|
|
659
|
|
|
/** |
660
|
|
|
* @return XoopsFormTextDateSelect |
661
|
|
|
*/ |
662
|
|
|
public function editField() |
663
|
|
|
{ |
664
|
|
|
//$textarea = new \XoopsFormFile("<b>".$this->fieldname."</b>", $this->fieldname, $maxfilesize = 2000); |
|
|
|
|
665
|
|
|
$textarea = new \XoopsFormTextDateSelect('<b>' . $this->fieldname . '</b>', 'user' . $this->fieldnumber, $size = 15, $this->value); |
666
|
|
|
|
667
|
|
|
return $textarea; |
668
|
|
|
} |
669
|
|
|
|
670
|
|
|
/** |
671
|
|
|
* @param string $name |
672
|
|
|
* |
673
|
|
|
* @return XoopsFormTextDateSelect |
674
|
|
|
*/ |
675
|
|
|
public function newField($name = '') |
676
|
|
|
{ |
677
|
|
|
$textarea = new \XoopsFormTextDateSelect('<b>' . $this->fieldname . '</b>', $name . 'user' . $this->fieldnumber, $size = 15, $this->defaultvalue); |
678
|
|
|
|
679
|
|
|
return $textarea; |
680
|
|
|
} |
681
|
|
|
|
682
|
|
|
/** |
683
|
|
|
* @return string |
684
|
|
|
*/ |
685
|
|
|
public function getSearchString() |
686
|
|
|
{ |
687
|
|
|
return '&o=naam&l=1'; |
688
|
|
|
} |
689
|
|
|
} |
690
|
|
|
|
691
|
|
|
/** |
692
|
|
|
* Class UrlField |
693
|
|
|
* @deprecated |
694
|
|
|
*/ |
695
|
|
|
class UrlField extends Field |
|
|
|
|
696
|
|
|
{ |
697
|
|
|
/** |
698
|
|
|
* @param $parentObject |
699
|
|
|
* @param $animalObject |
700
|
|
|
*/ |
701
|
|
|
public function __construct($parentObject, $animalObject) |
702
|
|
|
{ |
703
|
|
|
$this->fieldnumber = $parentObject->getId(); |
|
|
|
|
704
|
|
|
$this->fieldname = $parentObject->fieldname; |
|
|
|
|
705
|
|
|
$this->value = $animalObject->{'user' . $this->fieldnumber}; |
|
|
|
|
706
|
|
|
$this->defaultvalue = $parentObject->defaultvalue; |
|
|
|
|
707
|
|
|
$this->lookuptable = $parentObject->lookuptable; |
|
|
|
|
708
|
|
|
if ('1' == $this->lookuptable) { |
709
|
|
|
new SystemMessage('No lookuptable may be specified for userfield' . $this->fieldnumber); |
|
|
|
|
710
|
|
|
} |
711
|
|
|
if ('1' == $parentObject->viewinadvanced) { |
712
|
|
|
new SystemMessage('userfield' . $this->fieldnumber . ' cannot be shown in advanced info'); |
|
|
|
|
713
|
|
|
} |
714
|
|
|
if ('1' == $parentObject->viewinpie) { |
715
|
|
|
new SystemMessage('A Pie-chart cannot be specified for userfield' . $this->fieldnumber); |
|
|
|
|
716
|
|
|
} |
717
|
|
|
} |
718
|
|
|
|
719
|
|
|
/** |
720
|
|
|
* @return XoopsFormText |
721
|
|
|
*/ |
722
|
|
|
public function editField() |
723
|
|
|
{ |
724
|
|
|
$textbox = new \XoopsFormText('<b>' . $this->fieldname . '</b>', 'user' . $this->fieldnumber, $size = 50, $maxsize = 255, $value = $this->value); |
725
|
|
|
|
726
|
|
|
return $textbox; |
727
|
|
|
} |
728
|
|
|
|
729
|
|
|
/** |
730
|
|
|
* @param string $name |
731
|
|
|
* |
732
|
|
|
* @return XoopsFormText |
733
|
|
|
*/ |
734
|
|
|
public function newField($name = '') |
735
|
|
|
{ |
736
|
|
|
$textbox = new \XoopsFormText('<b>' . $this->fieldname . '</b>', $name . 'user' . $this->fieldnumber, $size = 50, $maxsize = 255, $value = $this->defaultvalue); |
737
|
|
|
|
738
|
|
|
return $textbox; |
739
|
|
|
} |
740
|
|
|
|
741
|
|
|
/** |
742
|
|
|
* @return XoopsFormLabel |
743
|
|
|
*/ |
744
|
|
|
public function viewField() |
745
|
|
|
{ |
746
|
|
|
$view = new \XoopsFormLabel($this->fieldname, '<a href="' . $this->value . '" target=\"_new\">' . $this->value . '</a>'); |
747
|
|
|
|
748
|
|
|
return $view; |
749
|
|
|
} |
750
|
|
|
|
751
|
|
|
/** |
752
|
|
|
* @return string |
753
|
|
|
*/ |
754
|
|
|
public function showField() |
755
|
|
|
{ |
756
|
|
|
return $this->fieldname . ' : <a href="' . $this->value . '" target="_new">' . $this->value . '</a>'; |
757
|
|
|
} |
758
|
|
|
|
759
|
|
|
/** |
760
|
|
|
* @return string |
761
|
|
|
*/ |
762
|
|
|
public function showValue() |
763
|
|
|
{ |
764
|
|
|
return '<a href="' . $this->value . '" target="_new">' . $this->value . '</a>'; |
765
|
|
|
} |
766
|
|
|
|
767
|
|
|
/** |
768
|
|
|
* @return string |
769
|
|
|
*/ |
770
|
|
|
public function getSearchString() |
771
|
|
|
{ |
772
|
|
|
return '&o=naam&l=1'; |
773
|
|
|
} |
774
|
|
|
} |
775
|
|
|
|
776
|
|
|
/** |
777
|
|
|
* Class Picture |
778
|
|
|
* @deprecated |
779
|
|
|
*/ |
780
|
|
|
class Picture extends Field |
|
|
|
|
781
|
|
|
{ |
782
|
|
|
/** |
783
|
|
|
* @param $parentObject |
784
|
|
|
* @param $animalObject |
785
|
|
|
*/ |
786
|
|
|
public function __construct($parentObject, $animalObject) |
787
|
|
|
{ |
788
|
|
|
$this->fieldnumber = $parentObject->getId(); |
|
|
|
|
789
|
|
|
$this->fieldname = $parentObject->fieldname; |
|
|
|
|
790
|
|
|
$this->value = $animalObject->{'user' . $this->fieldnumber}; |
|
|
|
|
791
|
|
|
$this->defaultvalue = $parentObject->defaultvalue; |
|
|
|
|
792
|
|
|
$this->lookuptable = $parentObject->lookuptable; |
|
|
|
|
793
|
|
|
if ('1' == $this->lookuptable) { |
794
|
|
|
new SystemMessage('No lookuptable may be specified for userfield' . $this->fieldnumber); |
|
|
|
|
795
|
|
|
} |
796
|
|
|
if ('1' == $parentObject->viewinadvanced) { |
797
|
|
|
new SystemMessage('userfield' . $this->fieldnumber . ' cannot be shown in advanced info'); |
|
|
|
|
798
|
|
|
} |
799
|
|
|
if ('1' == $parentObject->viewinpie) { |
800
|
|
|
new SystemMessage('A Pie-chart cannot be specified for userfield' . $this->fieldnumber); |
|
|
|
|
801
|
|
|
} |
802
|
|
|
if ('1' == $parentObject->viewinlist) { |
803
|
|
|
new SystemMessage('userfield' . $this->fieldnumber . ' cannot be included in listview'); |
|
|
|
|
804
|
|
|
} |
805
|
|
|
if ('1' == $parentObject->hassearch) { |
806
|
|
|
new SystemMessage('Search cannot be defined for userfield' . $this->fieldnumber); |
|
|
|
|
807
|
|
|
} |
808
|
|
|
} |
809
|
|
|
|
810
|
|
|
/** |
811
|
|
|
* @return XoopsFormFile |
812
|
|
|
*/ |
813
|
|
|
public function editField() |
814
|
|
|
{ |
815
|
|
|
$pictureField = new \XoopsFormFile($this->fieldname, 'user' . $this->fieldnumber, 1024000); |
816
|
|
|
$pictureField->setExtra("size ='50'"); |
817
|
|
|
|
818
|
|
|
return $pictureField; |
819
|
|
|
} |
820
|
|
|
|
821
|
|
|
/** |
822
|
|
|
* @param string $name |
823
|
|
|
* |
824
|
|
|
* @return XoopsFormFile |
825
|
|
|
*/ |
826
|
|
|
public function newField($name = '') |
827
|
|
|
{ |
828
|
|
|
$pictureField = new \XoopsFormFile($this->fieldname, $name . 'user' . $this->fieldnumber, 1024000); |
829
|
|
|
$pictureField->setExtra("size ='50'"); |
830
|
|
|
|
831
|
|
|
return $pictureField; |
832
|
|
|
} |
833
|
|
|
|
834
|
|
|
/** |
835
|
|
|
* @return XoopsFormLabel |
836
|
|
|
*/ |
837
|
|
|
public function viewField() |
838
|
|
|
{ |
839
|
|
|
$view = new \XoopsFormLabel($this->fieldname, '<img src="' . PEDIGREE_UPLOAD_URL . '/images/thumbnails/' . $this->value . '_400.jpeg">'); |
|
|
|
|
840
|
|
|
|
841
|
|
|
return $view; |
842
|
|
|
} |
843
|
|
|
|
844
|
|
|
/** |
845
|
|
|
* @return string |
846
|
|
|
*/ |
847
|
|
|
public function showField() |
848
|
|
|
{ |
849
|
|
|
return '<img src="' . PEDIGREE_UPLOAD_URL . '/images/thumbnails/' . $this->value . '_150.jpeg">'; |
|
|
|
|
850
|
|
|
} |
851
|
|
|
|
852
|
|
|
/** |
853
|
|
|
* @return string |
854
|
|
|
*/ |
855
|
|
|
public function showValue() |
856
|
|
|
{ |
857
|
|
|
return '<img src="' . PEDIGREE_UPLOAD_URL . '/images/thumbnails/' . $this->value . '_400.jpeg">'; |
|
|
|
|
858
|
|
|
} |
859
|
|
|
} |
860
|
|
|
|
861
|
|
|
/** |
862
|
|
|
* Class SISContext |
863
|
|
|
* @deprecated |
864
|
|
|
*/ |
865
|
|
|
class SISContext |
|
|
|
|
866
|
|
|
{ |
867
|
|
|
private $contexts; |
868
|
|
|
private $depth; |
869
|
|
|
|
870
|
|
|
/** |
871
|
|
|
* SISContext constructor. |
872
|
|
|
*/ |
873
|
|
|
public function __construct() |
874
|
|
|
{ |
875
|
|
|
$this->contexts = []; |
876
|
|
|
$this->depth = 0; |
877
|
|
|
} |
878
|
|
|
|
879
|
|
|
/** |
880
|
|
|
* @param $url |
881
|
|
|
* @param $name |
882
|
|
|
*/ |
883
|
|
|
public function myGoto($url, $name) |
884
|
|
|
{ |
885
|
|
|
$keys = array_keys($this->contexts); |
886
|
|
|
for ($i = 0; $i < $this->depth; ++$i) { |
887
|
|
|
if ($keys[$i] == $name) { |
888
|
|
|
$this->contexts[$name] = $url; // the url might be slightly different |
889
|
|
|
$this->depth = $i + 1; |
890
|
|
|
|
891
|
|
|
for ($x = count($this->contexts); $x > $i + 1; $x--) { |
892
|
|
|
array_pop($this->contexts); |
893
|
|
|
} |
894
|
|
|
|
895
|
|
|
return; |
896
|
|
|
} |
897
|
|
|
} |
898
|
|
|
|
899
|
|
|
$this->contexts[$name] = $url; |
900
|
|
|
$this->depth++; |
901
|
|
|
} |
902
|
|
|
|
903
|
|
|
/** |
904
|
|
|
* @return array |
905
|
|
|
*/ |
906
|
|
|
public function getAllContexts() |
907
|
|
|
{ |
908
|
|
|
return $this->contexts; |
909
|
|
|
} |
910
|
|
|
|
911
|
|
|
/** |
912
|
|
|
* @return array |
913
|
|
|
*/ |
914
|
|
|
public function getAllContextNames() |
915
|
|
|
{ |
916
|
|
|
return array_keys($this->contexts); |
917
|
|
|
} |
918
|
|
|
} |
919
|
|
|
|
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.