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