1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace XoopsModules\Wgevents; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* **************************************************************************** |
7
|
|
|
* - A Project by Developers TEAM For Xoops - ( https://xoops.org ) |
8
|
|
|
* **************************************************************************** |
9
|
|
|
* WGEVENTS - MODULE FOR XOOPS |
10
|
|
|
* Copyright (c) 2007 - 2012 |
11
|
|
|
* Goffy ( wedega.com ) |
12
|
|
|
* |
13
|
|
|
* You may not change or alter any portion of this comment or credits |
14
|
|
|
* of supporting developers from this source code or any supporting |
15
|
|
|
* source code which is considered copyrighted (c) material of the |
16
|
|
|
* original comment or credit authors. |
17
|
|
|
* |
18
|
|
|
* This program is distributed in the hope that it will be useful, |
19
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
20
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21
|
|
|
* GNU General Public License for more details. |
22
|
|
|
* --------------------------------------------------------------------------- |
23
|
|
|
* @copyright Goffy ( wedega.com ) |
24
|
|
|
* @license GPL 2.0 |
25
|
|
|
* @package wgevents |
26
|
|
|
* @author Goffy ( [email protected] ) |
27
|
|
|
* |
28
|
|
|
* **************************************************************************** |
29
|
|
|
*/ |
30
|
|
|
|
31
|
|
|
require_once dirname(__DIR__) . '/include/common.php'; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Class Import |
35
|
|
|
*/ |
36
|
|
|
class ImportHandler |
37
|
|
|
{ |
38
|
|
|
|
39
|
|
|
//Constructor |
40
|
|
|
public function __construct() |
41
|
|
|
{ |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @param bool $action |
46
|
|
|
* |
47
|
|
|
* @return \XoopsThemeForm |
48
|
|
|
*/ |
49
|
|
|
public function getFormApcal($action = false) |
50
|
|
|
{ |
51
|
|
|
|
52
|
|
|
if (false === $action) { |
53
|
|
|
$action = $_SERVER['REQUEST_URI']; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
57
|
|
|
$form = new \XoopsThemeForm(\_AM_WGEVENTS_IMPORT_APCAL, 'import_form', $action, 'post', true); |
58
|
|
|
$form->setExtra('enctype="multipart/form-data"'); |
59
|
|
|
// Form label |
60
|
|
|
$info = '<ul> |
61
|
|
|
<li>' . \_AM_WGEVENTS_IMPORT_DELETE . '</li> |
62
|
|
|
<li>' . \_AM_WGEVENTS_IMPORT_NORECCUR . '</li> |
63
|
|
|
<li>' . \_AM_WGEVENTS_IMPORT_NOPERM . '</li> |
64
|
|
|
</ul>'; |
65
|
|
|
$form->addElement(new \XoopsFormLabel(\_AM_WGEVENTS_IMPORT_ATTENTION, $info)); |
66
|
|
|
// Form Radio Categories |
67
|
|
|
$form->addElement(new \XoopsFormRadioYN(\_AM_WGEVENTS_IMPORT_CATS, 'cats', 1, _YES, _NO)); |
68
|
|
|
// Form Date Select for period |
69
|
|
|
$form->addElement(new \XoopsFormTextDateSelect(\_AM_WGEVENTS_IMPORT_DATEFROM, 'datefrom', '', time())); |
|
|
|
|
70
|
|
|
$dateTo = date(strtotime(date('d-m-Y 23:59:59', strtotime('+1 year')))); |
71
|
|
|
$form->addElement(new \XoopsFormTextDateSelect(\_AM_WGEVENTS_IMPORT_DATETO, 'dateto', '', $dateTo)); |
|
|
|
|
72
|
|
|
// Form Radio delete source data |
73
|
|
|
$form->addElement(new \XoopsFormRadioYN(\_AM_WGEVENTS_IMPORT_DELETE_ORIGIN, 'del_source', 0, _YES, _NO)); |
74
|
|
|
// Buttons |
75
|
|
|
$form->addElement(new \XoopsFormHidden('op', 'apcal_exec')); |
76
|
|
|
$form->addElement(new \XoopsFormButtonTray('', \_AM_WGEVENTS_IMPORT_EXEC, 'submit', '', false)); |
77
|
|
|
|
78
|
|
|
return $form; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @param bool $action |
83
|
|
|
* |
84
|
|
|
* @return \XoopsThemeForm |
85
|
|
|
*/ |
86
|
|
|
public function getFormExtcal($action = false) |
87
|
|
|
{ |
88
|
|
|
|
89
|
|
|
if (false === $action) { |
90
|
|
|
$action = $_SERVER['REQUEST_URI']; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
94
|
|
|
$form = new \XoopsThemeForm(\_AM_WGEVENTS_IMPORT_EXTCAL, 'import_form', $action, 'post', true); |
95
|
|
|
$form->setExtra('enctype="multipart/form-data"'); |
96
|
|
|
// Form label |
97
|
|
|
$info = '<ul> |
98
|
|
|
<li>' . \_AM_WGEVENTS_IMPORT_DELETE . '</li> |
99
|
|
|
<li>' . \_AM_WGEVENTS_IMPORT_NORECCUR . '</li> |
100
|
|
|
<li>' . \_AM_WGEVENTS_IMPORT_NOPERM . '</li> |
101
|
|
|
</ul>'; |
102
|
|
|
$form->addElement(new \XoopsFormLabel(\_AM_WGEVENTS_IMPORT_ATTENTION, $info)); |
103
|
|
|
// Form Radio Categories |
104
|
|
|
$form->addElement(new \XoopsFormRadioYN(\_AM_WGEVENTS_IMPORT_CATS, 'cats', 1, _YES, _NO)); |
105
|
|
|
// Form Date Select for period |
106
|
|
|
$form->addElement(new \XoopsFormTextDateSelect(\_AM_WGEVENTS_IMPORT_DATEFROM, 'datefrom', '', time())); |
|
|
|
|
107
|
|
|
$dateTo = date(strtotime(date('d-m-Y 23:59:59', strtotime('+1 year')))); |
108
|
|
|
$form->addElement(new \XoopsFormTextDateSelect(\_AM_WGEVENTS_IMPORT_DATETO, 'dateto', '', $dateTo)); |
|
|
|
|
109
|
|
|
// Form Radio delete source data |
110
|
|
|
$form->addElement(new \XoopsFormRadioYN(\_AM_WGEVENTS_IMPORT_DELETE_ORIGIN, 'del_source', 0, _YES, _NO)); |
111
|
|
|
// Buttons |
112
|
|
|
$form->addElement(new \XoopsFormHidden('op', 'extcal_exec')); |
113
|
|
|
$form->addElement(new \XoopsFormButtonTray('', \_AM_WGEVENTS_IMPORT_EXEC, 'submit', '', false)); |
114
|
|
|
|
115
|
|
|
return $form; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
} |
119
|
|
|
|