1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* |
5
|
|
|
* Module: Class_Booking |
6
|
|
|
* Author: The SmartFactory <www.smartfactory.ca> |
7
|
|
|
* Licence: GNU |
8
|
|
|
* @param bool $showmenu |
9
|
|
|
* @param int $adsenseid |
10
|
|
|
* @param bool $clone |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
function editclass($showmenu = false, $adsenseid = 0, $clone = false) |
14
|
|
|
{ |
15
|
|
|
global $smartobjectAdsenseHandler; |
16
|
|
|
|
17
|
|
|
$adsenseObj = $smartobjectAdsenseHandler->get($adsenseid); |
18
|
|
|
|
19
|
|
|
if (!$clone && !$adsenseObj->isNew()) { |
20
|
|
|
if ($showmenu) { |
|
|
|
|
21
|
|
|
//smart_adminMenu(3, _AM_SOBJECT_ADSENSES . " > " . _AM_SOBJECT_EDITING); |
|
|
|
|
22
|
|
|
} |
23
|
|
|
smart_collapsableBar('adsenseedit', _AM_SOBJECT_ADSENSES_EDIT, _AM_SOBJECT_ADSENSES_EDIT_INFO); |
24
|
|
|
|
25
|
|
|
$sform = $adsenseObj->getForm(_AM_SOBJECT_ADSENSES_EDIT, 'addadsense'); |
26
|
|
|
$sform->display(); |
27
|
|
|
smart_close_collapsable('adsenseedit'); |
28
|
|
|
} else { |
29
|
|
|
$adsenseObj->setVar('adsenseid', 0); |
30
|
|
|
$adsenseObj->setVar('tag', ''); |
31
|
|
|
|
32
|
|
|
if ($showmenu) { |
|
|
|
|
33
|
|
|
//smart_adminMenu(3, _AM_SOBJECT_ADSENSES . " > " . _CO_SOBJECT_CREATINGNEW); |
|
|
|
|
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
smart_collapsableBar('adsensecreate', _AM_SOBJECT_ADSENSES_CREATE, _AM_SOBJECT_ADSENSES_CREATE_INFO); |
37
|
|
|
$sform = $adsenseObj->getForm(_AM_SOBJECT_ADSENSES_CREATE, 'addadsense', false, false, false, true); |
38
|
|
|
$sform->display(); |
39
|
|
|
smart_close_collapsable('adsensecreate'); |
40
|
|
|
} |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
include_once __DIR__ . '/admin_header.php'; |
44
|
|
|
include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
45
|
|
|
include_once SMARTOBJECT_ROOT_PATH . 'class/adsense.php'; |
46
|
|
|
$smartobjectAdsenseHandler = xoops_getModuleHandler('adsense'); |
47
|
|
|
smart_loadLanguageFile('smartobject', 'adsense'); |
48
|
|
|
$indexAdmin = new ModuleAdmin(); |
49
|
|
|
|
50
|
|
|
$op = ''; |
51
|
|
|
|
52
|
|
|
if (isset($_GET['op'])) { |
53
|
|
|
$op = $_GET['op']; |
54
|
|
|
} |
55
|
|
|
if (isset($_POST['op'])) { |
56
|
|
|
$op = $_POST['op']; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
switch ($op) { |
60
|
|
View Code Duplication |
case 'mod': |
|
|
|
|
61
|
|
|
|
62
|
|
|
$adsenseid = isset($_GET['adsenseid']) ? (int)$_GET['adsenseid'] : 0; |
63
|
|
|
|
64
|
|
|
smart_xoops_cp_header(); |
65
|
|
|
echo $indexAdmin->addNavigation(basename(__FILE__)); |
66
|
|
|
|
67
|
|
|
editclass(true, $adsenseid); |
68
|
|
|
break; |
69
|
|
|
|
70
|
|
View Code Duplication |
case 'clone': |
|
|
|
|
71
|
|
|
|
72
|
|
|
$adsenseid = isset($_GET['adsenseid']) ? (int)$_GET['adsenseid'] : 0; |
73
|
|
|
|
74
|
|
|
smart_xoops_cp_header(); |
75
|
|
|
echo $indexAdmin->addNavigation(basename(__FILE__)); |
76
|
|
|
|
77
|
|
|
editclass(true, $adsenseid, true); |
78
|
|
|
break; |
79
|
|
|
|
80
|
|
|
case 'addadsense': |
81
|
|
|
if (@include_once SMARTOBJECT_ROOT_PATH . 'include/captcha/captcha.php') { |
82
|
|
|
$xoopsCaptcha = XoopsCaptcha::getInstance(); |
83
|
|
|
if (!$xoopsCaptcha->verify()) { |
84
|
|
|
redirect_header('javascript:history.go(-1);', 3, $xoopsCaptcha->getMessage()); |
85
|
|
|
exit; |
86
|
|
|
} |
87
|
|
|
} |
88
|
|
|
include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
89
|
|
|
$controller = new SmartObjectController($smartobjectAdsenseHandler); |
90
|
|
|
$controller->storeFromDefaultForm(_AM_SOBJECT_ADSENSES_CREATED, _AM_SOBJECT_ADSENSES_MODIFIED); |
91
|
|
|
break; |
92
|
|
|
|
93
|
|
|
case 'del': |
94
|
|
|
|
95
|
|
|
include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
96
|
|
|
$controller = new SmartObjectController($smartobjectAdsenseHandler); |
97
|
|
|
$controller->handleObjectDeletion(); |
98
|
|
|
|
99
|
|
|
break; |
100
|
|
|
|
101
|
|
|
default: |
102
|
|
|
|
103
|
|
|
smart_xoops_cp_header(); |
104
|
|
|
echo $indexAdmin->addNavigation(basename(__FILE__)); |
105
|
|
|
|
106
|
|
|
//smart_adminMenu(3, _AM_SOBJECT_ADSENSES); |
|
|
|
|
107
|
|
|
|
108
|
|
|
smart_collapsableBar('createdadsenses', _AM_SOBJECT_ADSENSES, _AM_SOBJECT_ADSENSES_DSC); |
109
|
|
|
|
110
|
|
|
include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
111
|
|
|
$objectTable = new SmartObjectTable($smartobjectAdsenseHandler); |
112
|
|
|
$objectTable->addColumn(new SmartObjectColumn('description', 'left')); |
113
|
|
|
$objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_ADSENSE_TAG, 'center', 200, 'getXoopsCode')); |
|
|
|
|
114
|
|
|
|
115
|
|
|
// $objectTable->addCustomAction('getCreateItemLink'); |
|
|
|
|
116
|
|
|
// $objectTable->addCustomAction('getCreateAttributLink'); |
|
|
|
|
117
|
|
|
|
118
|
|
|
$objectTable->addIntroButton('addadsense', 'adsense.php?op=mod', _AM_SOBJECT_ADSENSES_CREATE); |
119
|
|
|
/* |
|
|
|
|
120
|
|
|
$criteria_upcoming = new CriteriaCompo(); |
121
|
|
|
$criteria_upcoming->add(new Criteria('start_date', time(), '>')); |
122
|
|
|
$objectTable->addFilter(_AM_SOBJECT_FILTER_UPCOMING, array( |
123
|
|
|
'key' => 'start_date', |
124
|
|
|
'criteria' => $criteria_upcoming |
125
|
|
|
)); |
126
|
|
|
|
127
|
|
|
$criteria_last7days = new CriteriaCompo(); |
128
|
|
|
$criteria_last7days->add(new Criteria('start_date', time() - 30 *(60 * 60 * 24), '>')); |
129
|
|
|
$criteria_last7days->add(new Criteria('start_date', time(), '<')); |
130
|
|
|
$objectTable->addFilter(_AM_SOBJECT_FILTER_LAST7DAYS, array( |
131
|
|
|
'key' => 'start_date', |
132
|
|
|
'criteria' => $criteria_last7days |
133
|
|
|
)); |
134
|
|
|
|
135
|
|
|
$criteria_last30days = new CriteriaCompo(); |
136
|
|
|
$criteria_last30days->add(new Criteria('start_date', time() - 30 *(60 * 60 * 24), '>')); |
137
|
|
|
$criteria_last30days->add(new Criteria('start_date', time(), '<')); |
138
|
|
|
$objectTable->addFilter(_AM_SOBJECT_FILTER_LAST30DAYS, array( |
139
|
|
|
'key' => 'start_date', |
140
|
|
|
'criteria' => $criteria_last30days |
141
|
|
|
)); |
142
|
|
|
*/ |
143
|
|
|
$objectTable->addQuickSearch(array('title', 'summary', 'description')); |
144
|
|
|
$objectTable->addCustomAction('getCloneLink'); |
145
|
|
|
|
146
|
|
|
$objectTable->render(); |
147
|
|
|
|
148
|
|
|
echo '<br>'; |
149
|
|
|
smart_close_collapsable('createdadsenses'); |
150
|
|
|
echo '<br>'; |
151
|
|
|
|
152
|
|
|
break; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
//smart_modFooter(); |
|
|
|
|
156
|
|
|
//xoops_cp_footer(); |
157
|
|
|
include_once __DIR__ . '/admin_footer.php'; |
158
|
|
|
|
This check looks for the bodies of
if
statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.These
if
bodies can be removed. If you have an empty if but statements in theelse
branch, consider inverting the condition.could be turned into
This is much more concise to read.