1
|
|
|
<?php |
2
|
|
|
/* Copyright (C) NAVER <http://www.navercorp.com> */ |
3
|
|
|
/** |
4
|
|
|
* @class pointAdminView |
5
|
|
|
* @author NAVER ([email protected]) |
6
|
|
|
* @brief The admin view class of the point module |
7
|
|
|
*/ |
8
|
|
|
class pointAdminView extends point |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* @brief Initialization |
12
|
|
|
*/ |
13
|
|
View Code Duplication |
function init() |
|
|
|
|
14
|
|
|
{ |
15
|
|
|
// Get teh configuration information |
16
|
|
|
$oModuleModel = getModel('module'); |
17
|
|
|
$config = $oModuleModel->getModuleConfig('point'); |
18
|
|
|
// Set the configuration variable |
19
|
|
|
Context::set('config', $config); |
20
|
|
|
|
21
|
|
|
//Security |
22
|
|
|
$security = new Security(); |
23
|
|
|
$security->encodeHTML('config.point_name','config.level_icon'); |
24
|
|
|
$security->encodeHTML('module_info..'); |
25
|
|
|
|
26
|
|
|
// Set the template path |
27
|
|
|
$this->setTemplatePath($this->module_path.'tpl'); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @brief Default configurations |
32
|
|
|
*/ |
33
|
|
|
function dispPointAdminConfig() |
34
|
|
|
{ |
35
|
|
|
// Get the list of level icons |
36
|
|
|
$level_icon_list = FileHandler::readDir("./modules/point/icons"); |
37
|
|
|
Context::set('level_icon_list', $level_icon_list); |
38
|
|
|
// Get the list of groups |
39
|
|
|
$oMemberModel = getModel('member'); |
40
|
|
|
$group_list = $oMemberModel->getGroups(); |
41
|
|
|
$selected_group_list = array(); |
42
|
|
|
if(count($group_list)) |
43
|
|
|
{ |
44
|
|
|
foreach($group_list as $key => $val) |
45
|
|
|
{ |
46
|
|
|
$selected_group_list[$key] = $val; |
47
|
|
|
} |
48
|
|
|
} |
49
|
|
|
Context::set('group_list', $selected_group_list); |
50
|
|
|
//Security |
51
|
|
|
$security = new Security(); |
52
|
|
|
$security->encodeHTML('group_list..title','group_list..description'); |
53
|
|
|
|
54
|
|
|
// Set the template |
55
|
|
|
$this->setTemplateFile('config'); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @brief Set per-module scores |
60
|
|
|
*/ |
61
|
|
|
function dispPointAdminModuleConfig() |
62
|
|
|
{ |
63
|
|
|
// Get a list of mid |
64
|
|
|
$oModuleModel = getModel('module'); |
65
|
|
|
$columnList = array('module_srl', 'mid', 'browser_title', 'module'); |
66
|
|
|
$mid_list = $oModuleModel->getMidList(null, $columnList); |
67
|
|
|
|
68
|
|
|
foreach($mid_list as $mid => $item) |
69
|
|
|
{ |
70
|
|
|
if($item->module === 'page') |
71
|
|
|
{ |
72
|
|
|
unset($mid_list[$mid]); |
73
|
|
|
} |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
Context::set('mid_list', $mid_list); |
77
|
|
|
Context::set('module_config', $oModuleModel->getModulePartConfigs('point')); |
78
|
|
|
|
79
|
|
|
//Security |
80
|
|
|
$security = new Security(); |
81
|
|
|
$security->encodeHTML('mid_list..browser_title','mid_list..mid'); |
82
|
|
|
|
83
|
|
|
// Set the template |
84
|
|
|
$this->setTemplateFile('module_config'); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @brief Configure the functional act |
89
|
|
|
*/ |
90
|
|
|
function dispPointAdminActConfig() |
91
|
|
|
{ |
92
|
|
|
// Set the template |
93
|
|
|
$this->setTemplateFile('action_config'); |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @brief Get a list of member points |
98
|
|
|
*/ |
99
|
|
|
function dispPointAdminPointList() |
100
|
|
|
{ |
101
|
|
|
$oPointModel = getModel('point'); |
102
|
|
|
|
103
|
|
|
$args = new stdClass(); |
104
|
|
|
$args->list_count = 20; |
105
|
|
|
$args->page = Context::get('page'); |
106
|
|
|
|
107
|
|
|
$oMemberModel = getModel('member'); |
108
|
|
|
$memberConfig = $oMemberModel->getMemberConfig(); |
109
|
|
|
|
110
|
|
|
Context::set('identifier', $memberConfig->identifier); |
111
|
|
|
|
112
|
|
|
$columnList = array('member.member_srl', 'member.user_id', 'member.email_address', 'member.nick_name', 'point.point'); |
113
|
|
|
$output = $oPointModel->getMemberList($args, $columnList); |
114
|
|
|
// context::set for writing into a template |
115
|
|
|
Context::set('total_count', $output->total_count); |
116
|
|
|
Context::set('total_page', $output->total_page); |
117
|
|
|
Context::set('page', $output->page); |
118
|
|
|
Context::set('member_list', $output->data); |
119
|
|
|
Context::set('page_navigation', $output->page_navigation); |
120
|
|
|
// Create a member model object |
121
|
|
|
$oMemberModel = getModel('member'); |
122
|
|
|
// Get a list of groups |
123
|
|
|
$this->group_list = $oMemberModel->getGroups(); |
|
|
|
|
124
|
|
|
Context::set('group_list', $this->group_list); |
125
|
|
|
//Security |
126
|
|
|
$security = new Security(); |
127
|
|
|
$security->encodeHTML('group_list..title','group_list..description'); |
128
|
|
|
$security->encodeHTML('member_list..'); |
129
|
|
|
$security->encodeHTML('search_target', 'search_keyword'); |
130
|
|
|
|
131
|
|
|
// Set the template |
132
|
|
|
$this->setTemplateFile('member_list'); |
133
|
|
|
} |
134
|
|
|
} |
135
|
|
|
/* End of file point.admin.view.php */ |
136
|
|
|
/* Location: ./modules/point/point.admin.view.php */ |
137
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.