Completed
Push — master ( af939e...465698 )
by Michael
13s
created

PedigreeDateSelect::getSearchString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 27 and the first side effect is on line 22.

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.

Loading history...
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
 * Pedigree module for XOOPS
13
 *
14
 * @copyright   {@link http://sourceforge.net/projects/thmod/ The TXMod XOOPS Project}
15
 * @copyright   {@link http://sourceforge.net/projects/xoops/ The XOOPS Project}
16
 * @license     GPL 2.0 or later
17
 * @package     pedigree
18
 * @subpackage  class
19
 * @author      XOOPS Mod Development Team
20
 */
21
22
require_once __DIR__ . '/htmlinput.abstract.php';
23
24
/**
25
 * Class PedigreeDateSelectBox
26
 */
27
class PedigreeDateSelect extends PedigreeHtmlInputAbstract
0 ignored issues
show
Bug introduced by
There is at least one abstract method in this class. Maybe declare it as abstract, or implement the remaining methods: searchField, showField, showValue, viewField
Loading history...
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
28
{
29
    // Define class variables
30
    private $fieldnumber;
31
    private $fieldname;
32
    private $value;
33
    private $defaultvalue;
34
    private $lookuptable;
0 ignored issues
show
Unused Code introduced by
The property $lookuptable is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
35
    private $errs;
0 ignored issues
show
Unused Code introduced by
The property $errs is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
36
37
    /**
38
     * Constructor
39
     *
40
     * @param PedigreeFields $parentObject
41
     * @param $animalObject
42
     */
43 View Code Duplication
    public function __construct($parentObject, $animalObject)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
44
    {
45
        //@todo move language strings to language file
46
        $this->fieldnumber  = $parentObject->getId();
47
        $this->fieldname    = $parentObject->fieldname;
48
        $this->value        = $animalObject->{'user' . $this->fieldnumber};
49
        $this->defaultvalue = $parentObject->defaultvalue;
50
        if ($parentObject->hasLookup()) {
51
            xoops_error('No lookuptable may be specified for userfield ' . $this->fieldnumber, get_class($this));
52
        }
53
        if ($parentObject->inAdvanced()) {
54
            xoops_error('userfield ' . $this->fieldnumber . ' cannot be shown in advanced info', get_class($this));
55
        }
56
        if ($parentObject->inPie()) {
57
            xoops_error('A Pie-chart cannot be specified for userfield ' . $this->fieldnumber, get_class($this));
58
        }
59
    }
60
61
    /**
62
     * @return XoopsFormTextDateSelect
63
     */
64
    public function editField()
65
    {
66
        $textarea = new XoopsFormTextDateSelect('<b>' . $this->fieldname . '</b>', 'user' . $this->fieldnumber, $size = 15, $this->value);
67
68
        return $textarea;
69
    }
70
71
    /**
72
     * @param string $name
73
     *
74
     * @return XoopsFormTextDateSelect
75
     */
76
    public function newField($name = '')
77
    {
78
        $textarea = new XoopsFormTextDateSelect('<b>' . $this->fieldname . '</b>', $name . 'user' . $this->fieldnumber, $size = 15, $this->defaultvalue);
79
80
        return $textarea;
81
    }
82
83
    /**
84
     * @return string
85
     */
86
    public function getSearchString()
87
    {
88
        return '&amp;o=naam&amp;l=1';
89
    }
90
}
91