PriceForm   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 22 2
1
<?php declare(strict_types=1);
2
3
namespace XoopsModules\Adslight\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: Adslight
17
 *
18
 * @category        Module
19
 * @author          XOOPS Development Team <https://xoops.org>
20
 * @copyright       {@link https://xoops.org/ XOOPS Project}
21
 * @license         GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html)
22
 */
23
24
use Xmf\Request;
25
use XoopsModules\Adslight;
26
27
require_once \dirname(__DIR__, 2) . '/include/common.php';
28
29
$moduleDirName = \basename(\dirname(__DIR__, 2));
30
//$helper = Adslight\Helper::getInstance();
31
$permHelper = new \Xmf\Module\Helper\Permission();
32
33
\xoops_load('XoopsFormLoader');
34
35
/**
36
 * Class PriceForm
37
 */
38
class PriceForm extends \XoopsThemeForm
39
{
40
    public $targetObject;
41
    public $helper;
42
43
    /**
44
     * Constructor
45
     *
46
     * @param $target
47
     */
48
    public function __construct($target)
49
    {
50
        $this->helper       = $target->helper;
51
        $this->targetObject = $target;
52
53
        $title = $this->targetObject->isNew() ? \AM_ADSLIGHT_PRICE_ADD : \AM_ADSLIGHT_PRICE_EDIT;
54
        parent::__construct($title, 'form', \xoops_getenv('SCRIPT_NAME'), 'post', true);
55
        $this->setExtra('enctype="multipart/form-data"');
56
57
        //include ID field, it's needed so the module knows if it is a new form or an edited form
58
59
        $hidden = new \XoopsFormHidden('id_price', $this->targetObject->getVar('id_price'));
60
        $this->addElement($hidden);
61
        unset($hidden);
62
63
        // Id_price
64
        $this->addElement(new \XoopsFormLabel(\AM_ADSLIGHT_PRICE_ID_PRICE, $this->targetObject->getVar('id_price'), 'id_price'));
65
        // Nom_price
66
        $this->addElement(new \XoopsFormText(\AM_ADSLIGHT_PRICE_NOM_PRICE, 'nom_price', 50, 255, $this->targetObject->getVar('nom_price')), false);
67
68
        $this->addElement(new \XoopsFormHidden('op', 'save'));
69
        $this->addElement(new \XoopsFormButton('', 'submit', \_SUBMIT, 'submit'));
70
    }
71
}
72