Passed
Push — master ( f62223...75b16c )
by Michael
02:33
created

Location::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 20
rs 9.7
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php namespace XoopsModules\Extcal;
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
/**
14
 * @copyright    {@link https://xoops.org/ XOOPS Project}
15
 * @license      {@link http://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later}
16
 * @package      extcal
17
 * @since
18
 * @author       XOOPS Development Team,
19
 */
20
21
//Kraven 30
22
// defined('XOOPS_ROOT_PATH') || die('Restricted access');
23
24
require_once XOOPS_ROOT_PATH . '/kernel/object.php';
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Extcal\XOOPS_ROOT_PATH was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
25
26
//class Event extends \XoopsObject
27
//class extcal_location extends \XoopsObject
28
29
/**
30
 * Class Location.
31
 */
32
class Location 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...
33
{
34
    /**
35
     *
36
     */
37
    public function __construct()
38
    {
39
        //Toutes les attributs de la table
40
        $this->initVar('id', XOBJ_DTYPE_INT, null, false, 5);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Extcal\XOBJ_DTYPE_INT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
41
        $this->initVar('nom', XOBJ_DTYPE_TXTBOX, null, false);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Extcal\XOBJ_DTYPE_TXTBOX was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
42
        $this->initVar('description', XOBJ_DTYPE_TXTAREA, '', false);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Extcal\XOBJ_DTYPE_TXTAREA was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
43
        $this->initVar('logo', XOBJ_DTYPE_TXTBOX, null, false);
44
        $this->initVar('categorie', XOBJ_DTYPE_TXTBOX, null, false);
45
        $this->initVar('adresse', XOBJ_DTYPE_TXTBOX, null, false);
46
        $this->initVar('adresse2', XOBJ_DTYPE_TXTBOX, null, false);
47
        $this->initVar('cp', XOBJ_DTYPE_TXTBOX, null, false);
48
        $this->initVar('ville', XOBJ_DTYPE_TXTBOX, null, false);
49
        $this->initVar('tel_fixe', XOBJ_DTYPE_TXTBOX, null, false);
50
        $this->initVar('tel_portable', XOBJ_DTYPE_TXTBOX, null, false);
51
        $this->initVar('mail', XOBJ_DTYPE_TXTBOX, null, false);
52
        $this->initVar('site', XOBJ_DTYPE_TXTBOX, null, false);
53
        $this->initVar('horaires', XOBJ_DTYPE_TXTAREA, '', false);
54
        $this->initVar('divers', XOBJ_DTYPE_TXTBOX, null, false);
55
        $this->initVar('tarifs', XOBJ_DTYPE_TXTAREA, '', false);
56
        $this->initVar('map', XOBJ_DTYPE_URL, false);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Extcal\XOBJ_DTYPE_URL was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
57
    }
58
59
    /**
60
     * @param bool $action
61
     *
62
     * @return \XoopsThemeForm
63
     */
64
    public function getForm($action = false)
65
    {
66
        global $xoopsDB, $extcalConfig;
67
68
        if (false === $action) {
69
            $action = $_SERVER['REQUEST_URI'];
70
        }
71
72
        $title = $this->isNew() ? sprintf(_MD_EXTCAL_LOCATION_ADD) : sprintf(_MD_EXTCAL_LOCATION_EDIT);
73
74
        require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Extcal\XOOPS_ROOT_PATH was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
75
76
        $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...
77
        $form->setExtra('enctype="multipart/form-data"');
78
79
        $form->addElement(new \XoopsFormText(_MD_EXTCAL_LOCATION_NOM, 'nom', 50, 255, $this->getVar('nom')), true);
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...
80
        $form->addElement(new \XoopsFormDhtmlTextArea(_MD_EXTCAL_LOCATION_DESCRIPTION, 'description', $this->getVar('description'), 10), false);
0 ignored issues
show
Bug introduced by
The type XoopsFormDhtmlTextArea 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...
81
        $form->addElement(new \XoopsFormText(_MD_EXTCAL_LOCATION_CATEGORIE, 'categorie', 40, 255, $this->getVar('categorie')), false);
82
        $form->addElement(new \XoopsFormText(_MD_EXTCAL_LOCATION_ADRESSE, 'adresse', 50, 255, $this->getVar('adresse')), false);
83
        $form->addElement(new \XoopsFormText(_MD_EXTCAL_LOCATION_ADRESSE2, 'adresse2', 50, 255, $this->getVar('adresse2')), false);
84
        $form->addElement(new \XoopsFormText(_MD_EXTCAL_LOCATION_CP, 'cp', 10, 10, $this->getVar('cp')), false);
85
        $form->addElement(new \XoopsFormText(_MD_EXTCAL_LOCATION_VILLE, 'ville', 20, 255, $this->getVar('ville')), false);
86
        $form->addElement(new \XoopsFormText(_MD_EXTCAL_LOCATION_TEL_FIXE, 'tel_fixe', 20, 20, $this->getVar('tel_fixe')), false);
87
        $form->addElement(new \XoopsFormText(_MD_EXTCAL_LOCATION_TEL_PORTABLE, 'tel_portable', 20, 20, $this->getVar('tel_portable')), false);
88
        $form->addElement(new \XoopsFormText(_MD_EXTCAL_LOCATION_MAIL, 'mail', 50, 255, $this->getVar('mail')), false);
89
        $form->addElement(new \XoopsFormText(_MD_EXTCAL_LOCATION_SITE, 'site', 50, 255, $this->getVar('site')), false);
90
        $form->addElement(new \XoopsFormTextArea(_MD_EXTCAL_LOCATION_HORAIRES, 'horaires', $this->getVar('horaires'), 3, 40));
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...
91
        $form->addElement(new \XoopsFormTextArea(_MD_EXTCAL_LOCATION_DIVERS, 'divers', $this->getVar('divers'), 5, 40));
92
        //$form->addElement( new \XoopsFormTextArea(_MD_EXTCAL_LOCATION_TARIFS, 'tarifs', $this->getVar("tarifs"), 5, 40));
93
        $form->addElement(new \XoopsFormText(_MD_EXTCAL_LOCATION_TARIFS . ' ( ' . _MD_EXTCAL_DEVISE2 . ' )', 'tarifs', 20, 20, $this->getVar('tarifs')), false);
94
95
        //$form->addElement( new \XoopsFormTextArea(_MD_EXTCAL_LOCATION_MAP, 'map', $this->getVar("map"), 5, 40));
96
        $form->addElement(new \XoopsFormText(_MD_EXTCAL_LOCATION_MAP, 'map', 150, 255, $this->getVar('map')), false);
97
98
        //Logo
99
        $file_tray = new \XoopsFormElementTray(sprintf(_MD_EXTCAL_FORM_IMG, 2), '');
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...
100
        if ('' != $this->getVar('logo')) {
101
            $file_tray->addElement(new \XoopsFormLabel('', "<img src='" . XOOPS_URL . '/uploads/extcal/location/' . $this->getVar('logo') . "' name='image' id='image' alt=''><br><br>"));
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...
Bug introduced by
The constant XoopsModules\Extcal\XOOPS_URL was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
102
            $check_del_img = new \XoopsFormCheckBox('', 'delimg');
0 ignored issues
show
Bug introduced by
The type XoopsFormCheckBox 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...
103
            $check_del_img->addOption(1, _MD_EXTCAL_DEL_IMG);
104
            $file_tray->addElement($check_del_img);
105
            $file_img = new \XoopsFormFile(_MD_EXTCAL_IMG, 'attachedimage', 3145728);
0 ignored issues
show
Bug introduced by
The type XoopsFormFile 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...
106
            unset($check_del_img);
107
        } else {
108
            $file_img = new \XoopsFormFile('', 'attachedimage', 3145728);
109
        }
110
        $file_img->setExtra("size ='40'");
111
        $file_tray->addElement($file_img);
112
        $msg        = sprintf(_MD_EXTCAL_IMG_CONFIG, (int)(3145728 / 1000), 500, 500);
113
        $file_label = new \XoopsFormLabel('', '<br>' . $msg);
114
        $file_tray->addElement($file_label);
115
        $form->addElement($file_tray);
116
        $form->addElement(new \XoopsFormHidden('file', $this->getVar('logo')));
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...
117
        unset($file_img, $file_tray);
118
119
        $form->addElement(new \XoopsFormHidden('op', 'save_location'));
120
        $form->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Extcal\_SUBMIT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
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...
121
        $form->display();
122
123
        return $form;
124
    }
125
}
126