Activity.class.php
4.29 KB
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<?php
class Controller_Admin_Activity extends Controller_Admin_Base
{
public function indexAction()
{
$this->_view['activityInfos'] = Facade_Activity::getActivityInfo();
}
public function createAction()
{
$id = intval($this->_request->id);
$info = array(
'id' => 0,
'content'=> '',
'title'=> '',
'client_content'=>'',
);
if($id)
{
$info = Facade_Activity::getActivityInfoById($id);
}
$this->_view['isMobile'] = false;
if(strpos($info['title'], '客户端') !== false)
{
$this->_view['isMobile'] = true;
}
$this->_view['info'] = $info;
}
public function doAction()
{
$id = intval($this->_request->id);
$data = $_POST;
if($id)
{
//更新
Facade_Activity::setActivityInfoById($id, trim($data['title']), $data['content'], $data['client_content']);
return $this->returnJson(true, 200, array('url' => url('activity/index')));
}
else
{
//新建
Facade_Activity::setActivityInfo($data['title'], trim($data['content']), $data['client_content']);
return $this->returnJson(true, 200, array('url' => url('activity/index')));
}
}
public function delAction()
{
$id = $this->_request->query('id');
$status = Facade_Activity::delActivityInfo($id);
if($status)
{
return $this->returnJson(true, 200);
}
else
{
return $this->returnJson(false, 403);
}
}
/**
* 现场活动计划
*/
public function planAction()
{
$this->_view['key'] = Lib_Images::genKey('fragmentimg');
$parent_id = $this->_request->query('parent_id', 0);
$topicInfo = array('title'=> '', 'id' => '0');
$plans = array();
if(!empty($parent_id))
{
$plans = Facade_Activity::getActivityPlanByParentId($parent_id);
$topicInfo = Facade_Activity::getActivityTopicId($parent_id);
}
$this->_view['plans'] = $plans;
$this->_view['topicInfo'] = $topicInfo;
}
/**
* 设置现场活动计划
*/
public function setactivityplanAction()
{
$title = $this->_request->query('title', '');
$content = $this->_request->query('content', '');
$pic = $this->_request->query('pic', '');
$start_time = $this->_request->query('start_time', '');
$end_time = $this->_request->query('end_time', '');
$place = $this->_request->query('place', '');
$id = $this->_request->query('id', '');
$parent_id = $this->_request->query('parent_id', 0);
if(!empty($id))
{
$status = Facade_Activity::setActivityPlanById($id, $parent_id, $title, $content, $pic, $place, $start_time, $end_time);
}
else
{
$status = Facade_Activity::setActivityPlan($parent_id, $title, $content, $pic, $place, $start_time, $end_time);
}
if($status)
{
return $this->returnJson(true, 200);
}
else
{
return $this->returnJson(false, 403);
}
}
/**
* 删除现场活动计划
*/
public function delactivityplanAction()
{
$id = $this->_request->query('id');
$status = Facade_Activity::delActivityPlan($id);
if($status)
{
return $this->returnJson(true, 200);
}
else
{
return $this->returnJson(false, 403);
}
}
/**
* 现场活动主题
*/
public function plantopicAction()
{
$limit = 15;
$total = Facade_Activity::getActivityTopicTotal();
$pagination = new Lib_Helper_Pagination($total, $limit);
$this->_view['topics'] = Facade_Activity::getActivityTopicList($pagination->getOffset(), $limit);
$this->_view['pagination'] = $pagination->getPagination();
}
/**
* 设置现场主题
*/
public function setactivitytopicAction()
{
$title = $this->_request->query('title', '');
$place = $this->_request->query('place', '');
$id = $this->_request->query('id', '');
$start_time = $this->_request->query('start_time', '');
$end_time = $this->_request->query('end_time', '');
if(!empty($id))
{
$status = Facade_Activity::setActivityTopicById($id, $title, $place, $start_time, $end_time);
}
else
{
$status = Facade_Activity::setActivityTopic($title, $place, $start_time, $end_time);
}
if($status)
{
return $this->returnJson(true, 200);
}
else
{
return $this->returnJson(false, 403);
}
}
/**
* 删除现场活动主题
*/
public function delactivitytopicAction()
{
$id = $this->_request->query('id');
$status = Facade_Activity::delActivityTopic($id);
if($status)
{
return $this->returnJson(true, 200);
}
else
{
return $this->returnJson(false, 403);
}
}
}