Activity.class.php
2.98 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
<?php
/**
* 活动页面
*/
class Controller_Activity extends Controller_Abstract
{
/**
* 活动介绍
*/
public function indexAction()
{
$this->_view['activityInfos'] = Facade_Activity::getActivityInfo();
}
/**
* 现场活动
*/
public function planAction()
{
$topics = Facade_Activity::getActivityTopic();
$currentday = $this->_request->query('currentday', '');
$currentday = is_numeric($currentday) ? $currentday : 0;
$list = array();
$planList = array();
$topicIds = array();
//导航
$navList = array();
$today = strtotime(date('Y-m-d', time()));
$firstCurrentday = 0;
foreach($topics as $topic)
{
$startTime = strtotime(date('Y-m-d', $topic['start_time']));
$list[$startTime][] = $topic;
$year = date('Y', $topic['start_time']);
if(!isset($navList[$year]))
{
$navList[$year] = array();
}
$enable = 0;
//导航
if(!in_array($startTime, array_keys($navList[$year])))
{
$enable = $today >= $startTime ? 1 : 0;
if($enable && empty($firstCurrentday))
{
$firstCurrentday = $startTime;
}
$navList[$year][$startTime] = array('timestamp' => $startTime,'enable' => $enable);
}
//第一次,没有时间
if(empty($currentday))
{
$currentday = $firstCurrentday;
}
if($startTime == $currentday)
{
$topicIds[] = $topic['id'];
}
}
foreach($topicIds as $topicId)
{
$planList[$topicId] = Facade_Activity::getActivityPlanByParentId($topicId);
}
krsort($list);
krsort($navList);
$this->_view['plans'] = $planList;
$this->_view['topics'] = $list[$currentday];
$this->_view['navs'] = $navList;
$this->_view['currentday'] = $currentday;
}
/**
* 活动介绍客户端的html5
*/
public function introduceAction()
{
$this->_view['activityInfos'] = Facade_Activity::getActivityInfo();
$this->_view['title'] = trim($this->_request->query('title', ''));
$this->_viewname = 'introducemobile';
}
/**
* 移动端问答
*/
public function qaAction()
{
$this->_viewname = 'qamobile';
}
/**
* 往期视频
*/
public function videoAction()
{
$tag = '视频';
$datetime = '2015-01-01 00:00:00';
$total = Facade_News::getTotalBeforeTime($tag, $datetime);
$page = new Lib_Helper_Pagination($total, 24);
$page->setOptions(array('afterAppend' => 'setLayout'));
list($offset, $limit) = $page->getLimit();
$list = Facade_News::getListBeforeTime($tag, $datetime, $offset, $limit);
$this->_view['video'] = $list;
$this->_view['pagination'] = $page->getPagination();
}
/**
* 赞助商
*/
public function partnerAction()
{
$partnerList = Facade_Partner::getPartner();
$partnerGroups = array();
foreach($partnerList as $partner)
{
foreach(Facade_Partner::$types as $key => $type)
{
if($partner['type'] == $key)
{
$partnerGroups[$type][] = $partner;
}
}
}
$this->_view['partnerGroups'] = $partnerGroups;
}
}