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

PedigreeTemp   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 76
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 76
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A Temp::__construct() 0 13 1
1
<?php namespace XoopsModules\Pedigree;
2
3
/*
4
 You may not change or alter any portion of this comment or credits
5
 of supporting developers from this source code or any supporting source code
6
 which is considered copyrighted (c) material of the original comment or credit authors.
7
8
 This program is distributed in the hope that it will be useful,
9
 but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
*/
12
/**
13
 * Pedigree module for XOOPS
14
 *
15
 * @copyright       XOOPS Project (https://xoops.org)
16
 * @license         GPL 2.0 or later
17
 * @package         pedigree
18
 * @since           2.5.x
19
 * @author          XOOPS Module Dev Team (https://xoops.org)
20
 */
21
22
use XoopsModules\Pedigree;
23
24
defined('XOOPS_ROOT_PATH') || die('Restricted access');
25
26
/**
27
 * Class Pedigree\Temp
28
 */
29
class Temp 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...
30
{
31
    //Constructor
32
    /**
33
     *
34
     */
35
    public function __construct()
36
    {
37
        parent::__construct();
38
        $this->initVar('id', XOBJ_DTYPE_INT, null, false, 11);
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...
39
        $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...
40
        $this->initVar('id_owner', XOBJ_DTYPE_INT, null, false, 11);
41
        $this->initVar('id_breeder', XOBJ_DTYPE_INT, null, false, 11);
42
        $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...
43
        $this->initVar('roft', XOBJ_DTYPE_TXTAREA, null, false);
44
        $this->initVar('mother', XOBJ_DTYPE_INT, null, false, 5);
45
        $this->initVar('father', XOBJ_DTYPE_INT, null, false, 5);
46
        $this->initVar('foto', XOBJ_DTYPE_TXTBOX, null, false, 255);
47
        $this->initVar('coi', XOBJ_DTYPE_TXTBOX, null, false, 10);
48
    }
49
50
    /**
51
     * @param bool $action
52
     *
53
     * @return \XoopsThemeForm
54
     */
55
    public function getForm($action = false)
56
    {
57
        global $xoopsDB, $xoopsModuleConfig;
58
59
        if (false === $action) {
60
            $action = $_SERVER['REQUEST_URI'];
61
        }
62
63
        $title = $this->isNew() ? sprintf(_AM_PEDIGREE_PEDIGREE_TEMP_ADD) : sprintf(_AM_PEDIGREE_PEDIGREE_TEMP_EDIT);
64
65
        require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
66
67
        $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...
68
        $form->setExtra('enctype="multipart/form-data"');
69
70
        $form->addElement(new \XoopsFormTextArea(_AM_PEDIGREE_PEDIGREE_TEMP_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...
71
        $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_TEMP_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...
72
        $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_TEMP_ID_BREEDER, 'id_breeder', 50, 255, $this->getVar('id_breeder')), false);
73
        $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_TEMP_USER, 'user', 50, 255, $this->getVar('user')), false);
74
        $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_TEMP_ROFT, 'roft', 50, 255, $this->getVar('roft')), false);
75
        $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_TEMP_MOTHER, 'mother', 50, 255, $this->getVar('mother')), false);
76
        $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_TEMP_FATHER, 'father', 50, 255, $this->getVar('father')), false);
77
        $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_TEMP_FOTO, 'foto', 50, 255, $this->getVar('foto')), false);
78
79
        //            $Handler = xoops_getModuleHandler("animal_", $xoopsModule->getVar("dirname"));
80
        $tempHandler = Pedigree\Helper::getInstance()->getHandler('Temp');
81
        $criteria    = new \CriteriaCompo();
0 ignored issues
show
Bug introduced by
The type CriteriaCompo 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...
82
        $criteria->setSort('id');
83
        $criteria->setOrder('ASC');
84
        $_arr   = $tempHandler->getAll();
85
        //@todo - the keys below aren't right for XoopsObjectTree. _id should be id, then need to determine which lineage (father/mother)
86
        //        and then use the appropriate key ('father', 'mother'). Can't really do a "combined" tree using XoopsObjectTree only.
87
        $mytree = new \XoopsObjectTree($_arr, '_id', '_pid');
0 ignored issues
show
Bug introduced by
The type XoopsObjectTree 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...
88
        $form->addElement(new \XoopsFormLabel(_AM_PEDIGREE_PEDIGREE_TEMP_COI, $mytree->makeSelBox('_pid', '_title', '--', $this->getVar('_pid'), false)));
0 ignored issues
show
Bug introduced by
The type XoopsFormLabel 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...
89
90
        $form->addElement(new \XoopsFormHidden('op', 'save_pedigree_temp'));
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...
91
92
        //Submit buttons
93
        $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...
94
        $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...
95
        $button_tray->addElement($submit_button);
96
97
        $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...
98
        $cancel_button->setExtra('onclick="history.go(-1)"');
99
        $button_tray->addElement($cancel_button);
100
101
        $form->addElement($button_tray);
102
103
        return $form;
104
    }
105
}
106