Passed
Branch master (48d769)
by Michael
02:30
created

Tree   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 65
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
B getForm() 0 39 3
A __construct() 0 13 1
1
<?php namespace XoopsModules\Pedigree;
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/xoops/ The XOOPS Project}
15
 * @license         GPL 2.0 or later
16
 * @package         pedigree
17
 * @since           2.5.x
18
 * @author          XOOPS Module Dev Team (https://xoops.org)
19
 */
20
21
use XoopsModules\Pedigree;
22
23
defined('XOOPS_ROOT_PATH') || die('Restricted access');
24
25
/**
26
 * Class Pedigree\Tree
27
 */
28
class Tree extends \XoopsObject
0 ignored issues
show
Bug introduced by
The type XoopsObject was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
29
{
30
    //Constructor
31
    /**
32
     *
33
     */
34
    public function __construct()
35
    {
36
        parent::__construct();
37
        $this->initVar('id', XOBJ_DTYPE_INT, null, false, 7);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\XOBJ_DTYPE_INT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
38
        $this->initVar('naam', XOBJ_DTYPE_TXTAREA, null, false);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\XOBJ_DTYPE_TXTAREA was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
39
        $this->initVar('id_owner', XOBJ_DTYPE_INT, null, false, 5);
40
        $this->initVar('id_breeder', XOBJ_DTYPE_INT, null, false, 5);
41
        $this->initVar('user', XOBJ_DTYPE_TXTBOX, null, false, 25);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\XOBJ_DTYPE_TXTBOX was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
42
        $this->initVar('roft', XOBJ_DTYPE_ENUM, null, false);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\XOBJ_DTYPE_ENUM was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
43
        $this->initVar('mother', XOBJ_DTYPE_INT, null, false, 5);
44
        $this->initVar('father', XOBJ_DTYPE_INT, null, false, 5);
45
        $this->initVar('foto', XOBJ_DTYPE_TXTBOX, null, false, 255);
46
        $this->initVar('coi', XOBJ_DTYPE_TXTBOX, null, false, 10);
47
    }
48
49
    /**
50
     * @param bool $action
51
     *
52
     * @return \XoopsThemeForm
53
     */
54
    public function getForm($action = false)
55
    {
56
        global $xoopsModuleConfig;
57
58
        if (false === $action) {
59
            $action = $_SERVER['REQUEST_URI'];
60
        }
61
62
        $title = $this->isNew() ? sprintf(_AM_PEDIGREE_PEDIGREE_ADD) : sprintf(_AM_PEDIGREE_PEDIGREE_EDIT);
63
64
        require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\XOOPS_ROOT_PATH was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
65
66
        $form = new \XoopsThemeForm($title, 'form', $action, 'post', true);
0 ignored issues
show
Bug introduced by
The type XoopsThemeForm was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
67
        $form->setExtra('enctype="multipart/form-data"');
68
69
        $form->addElement(new \XoopsFormTextArea(_AM_PEDIGREE_PEDIGREE_NAAM, 'naam', $this->getVar('naam'), 4, 47), true);
0 ignored issues
show
Bug introduced by
The type XoopsFormTextArea was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
70
        $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_ID_OWNER, 'id_owner', 50, 255, $this->getVar('id_owner')), false);
0 ignored issues
show
Bug introduced by
The type XoopsFormText was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
71
        $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_ID_BREEDER, 'id_breeder', 50, 255, $this->getVar('id_breeder')), false);
72
        $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_USER, 'user', 50, 255, $this->getVar('user')), false);
73
        $form->addElement(new \XoopsFormTextArea(_AM_PEDIGREE_PEDIGREE_ROFT, 'roft', $this->getVar('roft'), 4, 47), false);
74
        $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_MOTHER, 'mother', 50, 255, $this->getVar('mother')), false);
75
        $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_FATHER, 'father', 50, 255, $this->getVar('father')), false);
76
        $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_FOTO, 'foto', 50, 255, $this->getVar('foto')), false);
77
        $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_COI, 'coi', 50, 255, $this->getVar('coi')), false);
78
79
        $form->addElement(new \XoopsFormHidden('op', 'save_pedigree'));
0 ignored issues
show
Bug introduced by
The type XoopsFormHidden was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
80
81
        //Submit buttons
82
        $button_tray   = new \XoopsFormElementTray('', '');
0 ignored issues
show
Bug introduced by
The type XoopsFormElementTray was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
83
        $submit_button = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
0 ignored issues
show
Bug introduced by
The type XoopsFormButton was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
Bug introduced by
The constant XoopsModules\Pedigree\_SUBMIT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
84
        $button_tray->addElement($submit_button);
85
86
        $cancel_button = new \XoopsFormButton('', '', _CANCEL, 'cancel');
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\_CANCEL was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
87
        $cancel_button->setExtra('onclick="history.go(-1)"');
88
        $button_tray->addElement($cancel_button);
89
90
        $form->addElement($button_tray);
91
92
        return $form;
93
    }
94
}
95