1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* extcal module. |
4
|
|
|
* |
5
|
|
|
* You may not change or alter any portion of this comment or credits |
6
|
|
|
* of supporting developers from this source code or any supporting source code |
7
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
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
|
|
|
* @copyright XOOPS Project (http://xoops.org) |
13
|
|
|
* @license http://www.fsf.org/copyleft/gpl.html GNU public license |
14
|
|
|
* |
15
|
|
|
* @since 2.2 |
16
|
|
|
* |
17
|
|
|
* @author JJDai <http://xoops.kiolo.com> |
18
|
|
|
**/ |
19
|
|
|
//---------------------------------------------------- |
20
|
|
View Code Duplication |
class Extcal_2_28 |
|
|
|
|
21
|
|
|
{ |
22
|
|
|
//---------------------------------------------------- |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @param XoopsModule $module |
26
|
|
|
* @param $options |
27
|
|
|
*/ |
28
|
|
|
public function __construct(XoopsModule $module, $options) |
|
|
|
|
29
|
|
|
{ |
30
|
|
|
global $xoopsDB; |
|
|
|
|
31
|
|
|
|
32
|
|
|
$this->addTable_etablissement(); |
33
|
|
|
$this->alterTable_event(); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
//---------------------------------------------------- |
37
|
|
|
public function alterTable_event() |
38
|
|
|
{ |
39
|
|
|
global $xoopsDB; |
|
|
|
|
40
|
|
|
|
41
|
|
|
$tbl = $xoopsDB->prefix('extcal_event'); |
42
|
|
|
|
43
|
|
|
$sql = <<<__sql__ |
44
|
|
|
ALTER TABLE `{$tbl}` |
45
|
|
|
add `event_organisateur` varchar(255) NOT NULL default '', |
46
|
|
|
add `event_picture1` varchar(255) NOT NULL, |
47
|
|
|
add `event_picture2` varchar(255) NOT NULL, |
48
|
|
|
add `event_price` varchar(255) NOT NULL default '', |
49
|
|
|
add `event_etablissement` int(5) NOT NULL DEFAULT '1'; |
50
|
|
|
__sql__; |
51
|
|
|
|
52
|
|
|
$xoopsDB->queryF($sql); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
//---------------------------------------------------- |
56
|
|
|
public function addTable_etablissement() |
57
|
|
|
{ |
58
|
|
|
global $xoopsDB; |
|
|
|
|
59
|
|
|
|
60
|
|
|
$tbl = $xoopsDB->prefix('extcal_etablissement'); |
61
|
|
|
|
62
|
|
|
$sql = <<<__sql__ |
63
|
|
|
CREATE TABLE `{$tbl}` ( |
64
|
|
|
`id` int(5) NOT NULL auto_increment, |
65
|
|
|
`nom` varchar(255) NOT NULL, |
66
|
|
|
`desc` text NOT NULL, |
67
|
|
|
`logo` varchar(255) NOT NULL, |
68
|
|
|
`categorie` varchar(255) NOT NULL, |
69
|
|
|
`adresse` varchar(255) NOT NULL, |
70
|
|
|
`adresse2` varchar(255) NOT NULL, |
71
|
|
|
`cp` varchar(10) NOT NULL, |
72
|
|
|
`ville` varchar(50) NOT NULL, |
73
|
|
|
`tel_fixe` varchar(20) NOT NULL, |
74
|
|
|
`tel_portable` varchar(20) NOT NULL, |
75
|
|
|
`mail` varchar(255) NOT NULL, |
76
|
|
|
`site` varchar(255) NOT NULL, |
77
|
|
|
`horaires` text NOT NULL, |
78
|
|
|
`divers` text NOT NULL, |
79
|
|
|
`tarifs` text NOT NULL, |
80
|
|
|
`map` text NOT NULL, |
81
|
|
|
|
82
|
|
|
PRIMARY KEY (`id`) |
83
|
|
|
) ENGINE = MYISAM ; |
84
|
|
|
__sql__; |
85
|
|
|
|
86
|
|
|
$xoopsDB->queryF($sql); |
87
|
|
|
//--------------------------------------------------- |
88
|
|
|
} |
89
|
|
|
//----------------------------------------------------------------- |
90
|
|
|
} // fin de la classe |
91
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.