-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.class.php
171 lines (150 loc) · 4.38 KB
/
index.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<?php
/**
* [Nulled by DarkGoth - NCP TEAM] - 2015
*/
defined('PHPFOX') or exit('NO DICE!');
/**
*
*
* @copyright [PHPFOX_COPYRIGHT]
* @author Raymond Benc
* @package Phpfox_Component
* @version $Id: index.class.php 3640 2011-12-02 06:20:26Z Raymond_Benc $
*/
class Ad_Component_Controller_Admincp_Index extends Phpfox_Component
{
/**
* Controller
*/
public function process()
{
(($sPlugin = Phpfox_Plugin::get('ad.component_controller_admincp_process__start')) ? eval($sPlugin) : false);
$iPage = $this->request()->getInt('page');
if (($iId = $this->request()->getInt('approve')))
{
if (Phpfox::getService('ad.process')->approve($iId))
{
$this->url()->send('admincp.ad', null, Phpfox::getPhrase('ad.ad_successfully_approved'));
}
}
if (($iId = $this->request()->getInt('deny')))
{
if (Phpfox::getService('ad.process')->deny($iId))
{
$this->url()->send('admincp.ad', null, Phpfox::getPhrase('ad.ad_successfully_denied'));
}
}
if (($iId = $this->request()->getInt('delete')))
{
if (Phpfox::getService('ad.process')->delete($iId))
{
$this->url()->send('admincp.ad', null, Phpfox::getPhrase('ad.ad_successfully_deleted'));
}
}
if (($aVals = $this->request()->getArray('val')))
{
if (Phpfox::getService('ad.process')->updateActivity($aVals))
{
$this->url()->send('admincp.ad', null, Phpfox::getPhrase('ad.ad_s_successfully_updated'));
}
}
$aPages = array(5, 10, 15, 20);
$aDisplays = array();
foreach ($aPages as $iPageCnt)
{
$aDisplays[$iPageCnt] = Phpfox::getPhrase('core.per_page', array('total' => $iPageCnt));
}
$aSorts = array(
'ad_id' => Phpfox::getPhrase('ad.recently_added')
);
$aFilters = array(
'status' => array(
'type' => 'select',
'options' => array(
'1' => Phpfox::getPhrase('ad.pending_approval'),
'2' => Phpfox::getPhrase('ad.pending_payment'),
'4' => Phpfox::getPhrase('ad.denied')
),
'add_any' => true
),
'display' => array(
'type' => 'select',
'options' => $aDisplays,
'default' => '10'
),
'sort' => array(
'type' => 'select',
'options' => $aSorts,
'default' => 'ad_id'
),
'sort_by' => array(
'type' => 'select',
'options' => array(
'DESC' => Phpfox::getPhrase('core.descending'),
'ASC' => Phpfox::getPhrase('core.ascending')
),
'default' => 'DESC'
)
);
$oSearch = Phpfox_Search::instance()->set(array(
'type' => 'campaigns',
'filters' => $aFilters,
'search' => 'search'
)
);
$sStatus = $oSearch->get('status');
$sView = $this->request()->get('view');
$iLocation = $this->request()->getInt('location');
if ($sStatus == '1')
{
$oSearch->setCondition('is_custom = 2');
}
elseif ($sStatus == '2')
{
$oSearch->setCondition('is_custom = 1');
}
elseif ($sStatus == '4')
{
$oSearch->setCondition('is_custom = 4');
}
else
{
switch ($sView)
{
case 'pending':
$oSearch->setCondition('is_custom = 2');
break;
default:
// $oSearch->setCondition('is_custom IN(0,2,3)');
break;
}
}
if ($iLocation > 0)
{
$oSearch->setCondition('AND location = ' . (int) $iLocation);
}
$iLimit = $oSearch->getDisplay();
list($iCnt, $aAds) = Ad_Service_Ad::instance()->get($oSearch->getConditions(), $oSearch->getSort(), $oSearch->getPage(), $iLimit);
Phpfox_Pager::instance()->set(array('page' => $iPage, 'size' => $iLimit, 'count' => $oSearch->getSearchTotal($iCnt)));
$this->template()->setTitle(Phpfox::getPhrase('ad.manage_ad_campaigns'))
->setBreadcrumb(Phpfox::getPhrase('ad.manage_ad_campaigns'), $this->url()->makeUrl('admincp.ad'))
->assign(array(
'aAds' => $aAds,
'iPendingCount' => (int) Ad_Service_Ad::instance()->getPendingCount(),
'sPendingLink' => Phpfox_Url::instance()->makeUrl('admincp.ad', array('view' => 'pending')),
'bIsSearch' => ($this->request()->get('search-id') ? true : false),
'sView' => $sView
)
);
(($sPlugin = Phpfox_Plugin::get('ad.component_controller_admincp_process__end')) ? eval($sPlugin) : false);
}
/**
* Garbage collector. Is executed after this class has completed
* its job and the template has also been displayed.
*/
public function clean()
{
(($sPlugin = Phpfox_Plugin::get('ad.component_controller_admincp_index_clean')) ? eval($sPlugin) : false);
}
}
?>