Passed
Push — master ( 8b5e26...f79285 )
by Michael
04:32
created

TrashForm   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 22
dl 0
loc 48
rs 10
c 1
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 39 2
1
<?php
2
3
namespace XoopsModules\Pedigree\Form;
4
5
/*
6
 You may not change or alter any portion of this comment or credits
7
 of supporting developers from this source code or any supporting source code
8
 which is considered copyrighted (c) material of the original comment or credit authors.
9
10
 This program is distributed in the hope that it will be useful,
11
 but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
*/
14
15
/**
16
 * Module: Pedigree
17
 *
18
 * @category        Module
19
 * @package         pedigree
20
 * @author          XOOPS Development Team <https://xoops.org>
21
 * @copyright       {@link https://xoops.org/ XOOPS Project}
22
 * @license         GPL 2.0 or later
23
 * @link            https://xoops.org/
24
 * @since           1.0.0
25
 */
26
27
use Xmf\Module\Helper\Permission;
28
use XoopsFormButton;
29
use XoopsFormHidden;
30
use XoopsFormLabel;
31
use XoopsFormText;
32
use XoopsFormTextArea;
33
use XoopsModules\Pedigree\{
34
    Helper
35
};
36
use XoopsThemeForm;
37
38
require_once \dirname(__DIR__, 2) . '/include/common.php';
39
40
$moduleDirName = \basename(\dirname(__DIR__, 2));
41
//$helper = Helper::getInstance();
42
$permHelper = new Permission();
43
44
\xoops_load('XoopsFormLoader');
45
46
/**
47
 * Class TrashForm
48
 */
49
class TrashForm extends XoopsThemeForm
50
{
51
    public $targetObject;
52
53
    /**
54
     * Constructor
55
     *
56
     * @param $target
57
     */
58
    public function __construct($target)
59
    {
60
        //  global $helper;
61
        $this->helper       = $target->helper;
0 ignored issues
show
Bug Best Practice introduced by
The property helper does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
62
        $this->targetObject = $target;
63
64
        $title = $this->targetObject->isNew() ? \sprintf(AM_PEDIGREE_TRASH_ADD) : \sprintf(AM_PEDIGREE_TRASH_EDIT);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\Form\AM_PEDIGREE_TRASH_ADD was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
Bug introduced by
The constant XoopsModules\Pedigree\Form\AM_PEDIGREE_TRASH_EDIT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
65
        parent::__construct($title, 'form', \xoops_getenv('SCRIPT_NAME'), 'post', true);
66
        $this->setExtra('enctype="multipart/form-data"');
67
68
        //include ID field, it's needed so the module knows if it is a new form or an edited form
69
70
        $hidden = new \XoopsFormHidden('id', $this->targetObject->getVar('id'));
71
        $this->addElement($hidden);
72
        unset($hidden);
73
74
        // Id
75
        $this->addElement(new \XoopsFormLabel(AM_PEDIGREE_TRASH_ID, $this->targetObject->getVar('id'), 'id'));
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\Form\AM_PEDIGREE_TRASH_ID was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
76
        // Pname
77
        $this->addElement(new \XoopsFormTextArea(AM_PEDIGREE_TRASH_PNAME, 'pname', $this->targetObject->getVar('pname'), 4, 47), false);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\Form\AM_PEDIGREE_TRASH_PNAME was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
78
        // Id_owner
79
        $this->addElement(new \XoopsFormText(AM_PEDIGREE_TRASH_ID_OWNER, 'id_owner', 50, 255, $this->targetObject->getVar('id_owner')), false);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\Fo...PEDIGREE_TRASH_ID_OWNER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
80
        // Id_breeder
81
        $this->addElement(new \XoopsFormText(AM_PEDIGREE_TRASH_ID_BREEDER, 'id_breeder', 50, 255, $this->targetObject->getVar('id_breeder')), false);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\Fo...DIGREE_TRASH_ID_BREEDER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
82
        // User
83
        $this->addElement(new \XoopsFormText(AM_PEDIGREE_TRASH_USER, 'user', 50, 255, $this->targetObject->getVar('user')), false);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\Form\AM_PEDIGREE_TRASH_USER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
84
        // Roft
85
        $this->addElement(new \XoopsFormText(AM_PEDIGREE_TRASH_ROFT, 'roft', 50, 255, $this->targetObject->getVar('roft')), false);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\Form\AM_PEDIGREE_TRASH_ROFT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
86
        // Mother
87
        $this->addElement(new \XoopsFormText(AM_PEDIGREE_TRASH_MOTHER, 'mother', 50, 255, $this->targetObject->getVar('mother')), false);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\Fo...M_PEDIGREE_TRASH_MOTHER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
88
        // Father
89
        $this->addElement(new \XoopsFormText(AM_PEDIGREE_TRASH_FATHER, 'father', 50, 255, $this->targetObject->getVar('father')), false);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\Fo...M_PEDIGREE_TRASH_FATHER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
90
        // Foto
91
        $this->addElement(new \XoopsFormText(AM_PEDIGREE_TRASH_FOTO, 'foto', 50, 255, $this->targetObject->getVar('foto')), false);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\Form\AM_PEDIGREE_TRASH_FOTO was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
92
        // Coi
93
        $this->addElement(new \XoopsFormText(AM_PEDIGREE_TRASH_COI, 'coi', 50, 255, $this->targetObject->getVar('coi')), false);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\Form\AM_PEDIGREE_TRASH_COI was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
94
95
        $this->addElement(new \XoopsFormHidden('op', 'save'));
96
        $this->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
97
    }
98
}
99