Help.php
3.57 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
<?php
use Action\WebAction;
use Index\HelpModel;
//use LibModels\Web\Home\HelpData;
use WebPlugin\Helpers;
use WebPlugin\Paging;
/**
* 帮助中心
*/
class helpController extends WebAction
{
public static $fqaCateId = 37;
public function indexAction()
{
//头部导航
$channel = Helpers::getChannelNameByCookie();
$this->setWebNavHeader($channel);
$this->setTitle('帮助中心');
$cateId = $this->get('category_id', 81);
$problem = '';
if (isset($_POST['problem'])) {
$problem = trim($_POST['problem']);
}
else {
$problem = $this->get('problem', '');
}
$helpList = HelpModel::getHelpList($cateId);
$helpDetail = HelpModel::getHelpDetail($cateId);
$data = array(
'pathNav' => array(
array(
'href' => SITE_MAIN,
'name' => 'YOHO!有货首页'
),
array(
'name' => '帮助中心'
)
),
'helpNav' => $helpList,
'contentHtml' => $helpDetail,
'formAction' => '/help?category_id=' . self::$fqaCateId . '&problem=' . $problem,
'problem' => $problem
);
if ($cateId == self::$fqaCateId) {
$this->go(Helpers::url('/help/search', array('category_id' => self::$fqaCateId, 'problem' => $problem)));
}
else {
$this->_view->display('index', array('helpIndexPage' => false, 'help' => $data));
}
}
public function searchAction()
{
//头部导航
$channel = Helpers::getChannelNameByCookie();
$this->setWebNavHeader($channel);
$this->setTitle('帮助中心');
$cateId = self::$fqaCateId;
if (isset($_POST['problem'])) {
$problem = trim($_POST['problem']);
}
else {
$problem = $this->get('problem', '');
}
//分页
$page = $this->get('page', 1);
$limit = 10;
$paging = new Paging('yoho');
$helpList = HelpModel::getHelpList($cateId);
$question = HelpModel::getSearchDetail($cateId, $page, $limit, $problem);
$total = isset($question['pager']['total']) ? $question['pager']['total'] : 0;
$pageTotal = isset($question['pager']['pageTotal']) ? $question['pager']['pageTotal'] : 0;
$page = isset($question['pager']['page']) ? $question['pager']['page'] : 0;
unset($question['pager']);
$paging->setTotal($total)->setSize($limit)->setQuery(array('page' => $page, 'category_id' => $cateId, 'problem' => $problem));
//数据整合
$data = array(
'pathNav' => array(
array(
'href' => SITE_MAIN,
'name' => 'YOHO!有货首页'
),
array(
'name' => '帮助中心'
)
),
'helpNav' => $helpList,
'questions' => $question,
'pager' => array(
'count' => $total,
'curPage' => $page,
'totalPages' => $pageTotal,
'pagerHtml' => $paging->view(false)
),
'formAction' => '/help/search?category_id=' . $cateId . '&problem=' . $problem,
'problem' => $problem
);
$this->_view->display('search', array('helpSearchPage' => true, 'help' => $data));
}
}