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