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

OwnerForm   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 41 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 XoopsFormSelectUser;
32
use XoopsFormText;
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 OwnerForm
48
 */
49
class OwnerForm 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_OWNER_ADD) : \sprintf(AM_PEDIGREE_OWNER_EDIT);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\Form\AM_PEDIGREE_OWNER_EDIT 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_OWNER_ADD 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_OWNER_ID, $this->targetObject->getVar('id'), 'id'));
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\Form\AM_PEDIGREE_OWNER_ID was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
76
        // Firstname
77
        $this->addElement(new \XoopsFormText(AM_PEDIGREE_OWNER_FIRSTNAME, 'firstname', 50, 255, $this->targetObject->getVar('firstname')), false);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\Fo...EDIGREE_OWNER_FIRSTNAME was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
78
        // Lastname
79
        $this->addElement(new \XoopsFormText(AM_PEDIGREE_OWNER_LASTNAME, 'lastname', 50, 255, $this->targetObject->getVar('lastname')), false);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\Fo...PEDIGREE_OWNER_LASTNAME was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
80
        // Postcode
81
        $this->addElement(new \XoopsFormText(AM_PEDIGREE_OWNER_POSTCODE, 'postcode', 50, 255, $this->targetObject->getVar('postcode')), false);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\Fo...PEDIGREE_OWNER_POSTCODE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
82
        // City
83
        $this->addElement(new \XoopsFormText(AM_PEDIGREE_OWNER_CITY, 'city', 50, 255, $this->targetObject->getVar('city')), false);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\Form\AM_PEDIGREE_OWNER_CITY was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
84
        // Streetname
85
        $this->addElement(new \XoopsFormText(AM_PEDIGREE_OWNER_STREETNAME, 'streetname', 50, 255, $this->targetObject->getVar('streetname')), false);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\Fo...DIGREE_OWNER_STREETNAME was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
86
        // Housenumber
87
        $this->addElement(new \XoopsFormText(AM_PEDIGREE_OWNER_HOUSENUMBER, 'housenumber', 50, 255, $this->targetObject->getVar('housenumber')), false);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\Fo...IGREE_OWNER_HOUSENUMBER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
88
        // Phonenumber
89
        $this->addElement(new \XoopsFormText(AM_PEDIGREE_OWNER_PHONENUMBER, 'phonenumber', 50, 255, $this->targetObject->getVar('phonenumber')), false);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\Fo...IGREE_OWNER_PHONENUMBER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
90
        // Emailadres
91
        $this->addElement(new \XoopsFormText(AM_PEDIGREE_OWNER_EMAILADRES, 'emailadres', 50, 255, $this->targetObject->getVar('emailadres')), false);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\Fo...DIGREE_OWNER_EMAILADRES was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
92
        // Website
93
        $this->addElement(new \XoopsFormText(AM_PEDIGREE_OWNER_WEBSITE, 'website', 50, 255, $this->targetObject->getVar('website')), false);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\Fo..._PEDIGREE_OWNER_WEBSITE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
94
        // User
95
        $this->addElement(new \XoopsFormSelectUser(AM_PEDIGREE_OWNER_USER, 'user', false, $this->targetObject->getVar('user'), 1, false), false);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Pedigree\Form\AM_PEDIGREE_OWNER_USER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
96
97
        $this->addElement(new \XoopsFormHidden('op', 'save'));
98
        $this->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
99
    }
100
}
101