XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
member.admin.model.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
8 class memberAdminModel extends member
9 {
14  var $member_info = NULL;
15 
20  var $member_groups = NULL;
21 
26  var $join_form_list = NULL;
27 
32  function init()
33  {
34  }
35 
41  function getMemberList()
42  {
43  // Search option
44  $args = new stdClass();
45  $args->is_admin = Context::get('is_admin')=='Y'?'Y':'';
46  $args->is_denied = Context::get('is_denied')=='Y'?'Y':'';
47  $args->selected_group_srl = Context::get('selected_group_srl');
48 
49  $filter = Context::get('filter_type');
50  switch($filter)
51  {
52  case 'super_admin' : $args->is_admin = 'Y';break;
53  case 'site_admin' : $args->member_srls = $this->getSiteAdminMemberSrls();break;
54  case 'enable' : $args->is_denied = 'N';break;
55  case 'disable' : $args->is_denied = 'Y';break;
56  }
57 
58  $search_target = trim(Context::get('search_target'));
59  $search_keyword = trim(Context::get('search_keyword'));
60 
61  if($search_target && $search_keyword)
62  {
63  switch($search_target)
64  {
65  case 'user_id' :
66  if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
67  $args->s_user_id = $search_keyword;
68  break;
69  case 'user_name' :
70  if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
71  $args->s_user_name = $search_keyword;
72  break;
73  case 'nick_name' :
74  if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
75  $args->s_nick_name = $search_keyword;
76  $args->html_nick_name = htmlspecialchars($search_keyword, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
77  break;
78  case 'email_address' :
79  if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
80  $args->s_email_address = $search_keyword;
81  break;
82  case 'regdate' :
83  $args->s_regdate = preg_replace("/[^0-9]/","",$search_keyword);
84  break;
85  case 'regdate_more' :
86  $args->s_regdate_more = substr(preg_replace("/[^0-9]/","",$search_keyword) . '00000000000000',0,14);
87  break;
88  case 'regdate_less' :
89  $args->s_regdate_less = substr(preg_replace("/[^0-9]/","",$search_keyword) . '00000000000000',0,14);
90  break;
91  case 'last_login' :
92  $args->s_last_login = preg_replace("/[^0-9]/","",$search_keyword);
93  //$args->s_last_login = $search_keyword;
94  break;
95  case 'last_login_more' :
96  $args->s_last_login_more = substr(preg_replace("/[^0-9]/","",$search_keyword) . '00000000000000',0,14);
97  break;
98  case 'last_login_less' :
99  $args->s_last_login_less = substr(preg_replace("/[^0-9]/","",$search_keyword) . '00000000000000',0,14);
100  break;
101  case 'birthday' :
102  $args->s_birthday = preg_replace("/[^0-9]/","",$search_keyword);
103  break;
104  case 'extra_vars' :
105  $args->s_extra_vars = $search_keyword;
106  break;
107  }
108  }
109 
110  // Change the query id if selected_group_srl exists (for table join)
111  $sort_order = Context::get('sort_order');
112  $sort_index = Context::get('sort_index');
113  if(!$sort_index)
114  {
115  $sort_index = "list_order";
116  }
117 
118  if(!$sort_order)
119  {
120  $sort_order = 'asc';
121  }
122 
123  if($sort_order != 'asc')
124  {
125  $sort_order = 'desc';
126  }
127 
128  if($args->selected_group_srl)
129  {
130  $query_id = 'member.getMemberListWithinGroup';
131  $args->sort_index = "member.".$sort_index;
132  }
133  else
134  {
135  $query_id = 'member.getMemberList';
136  $args->sort_index = $sort_index;
137  }
138 
139  $args->sort_order = $sort_order;
140  Context::set('sort_order', $sort_order);
141  // Other variables
142  $args->page = Context::get('page');
143  $args->list_count = 40;
144  $args->page_count = 10;
145  $output = executeQuery($query_id, $args);
146 
147  return $output;
148  }
149 
158  function getSiteMemberList($site_srl, $page = 1)
159  {
160  $args->site_srl = $site_srl;
161  $args->page = $page;
162  $args->list_count = 40;
163  $args->page_count = 10;
164  $query_id = 'member.getSiteMemberList';
165  $output = executeQueryArray($query_id, $args);
166  return $output;
167  }
168 
175  {
176  $output = executeQueryArray('member.getSiteAdminMemberSrls');
177  if(!$output->toBool() || !$output->data) return array();
178 
179  $member_srls = array();
180  foreach($output->data as $member_info)
181  {
182  $member_srls[] = $member_info->member_srl;
183  }
184 
185  return $member_srls;
186  }
187 
194  {
195  $skin = Context::get('skin');
196  if(!$skin) $tpl = "";
197  else
198  {
199  $oModuleModel = getModel('module');
200  $skin_info = $oModuleModel->loadSkinInfo($this->module_path, $skin);
201  Context::set('skin_info', $skin_info);
202 
203  $oModuleModel = getModel('module');
204  $config = $oModuleModel->getModuleConfig('member');
205  if(!$config->colorset) $config->colorset = "white";
206  Context::set('config', $config);
207 
208  $oTemplate = &TemplateHandler::getInstance();
209  $tpl = $oTemplate->compile($this->module_path.'tpl', 'new_colorset_list');
210  }
211 
212  $this->add('tpl', $tpl);
213  }
214 
215 
223  public function getMemberCountByDate($date = '')
224  {
225  $args = new stdClass();
226  if($date) $args->regDate = date('Ymd', strtotime($date));
227 
228  $output = executeQuery('member.getMemberCountByDate', $args);
229  if(!$output->toBool()) return 0;
230 
231  return $output->data->count;
232  }
233 
241  function getMemberGroupMemberCountByDate($date = '')
242  {
243  if($date) $args->regDate = date('Ymd', strtotime($date));
244 
245  $output = executeQuery('member.getMemberGroupMemberCountByDate', $args);
246  if(!$output->toBool()) return 0;
247 
248  return count($output->data);
249  }
250 
257  {
258  $member_join_form_srl = Context::get('member_join_form_srl');
259 
260  $args = new stdClass();
261  $args->member_join_form_srl = $member_join_form_srl;
262  $output = executeQuery('member.getJoinForm', $args);
263 
264  if($output->toBool() && $output->data)
265  {
266  $formInfo = $output->data;
267  $default_value = $formInfo->default_value;
268  if($default_value)
269  {
270  $default_value = unserialize($default_value);
271  Context::set('default_value', $default_value);
272  }
273  Context::set('formInfo', $output->data);
274  }
275 
276  $oMemberModel = getModel('member');
277  $config = $oMemberModel->getMemberConfig();
278  foreach($config->signupForm as $item)
279  {
280  $list[] = $item->name;
281  }
282 
283  $id_list = implode(',',$list);
284  Context::set('id_list',$id_list);
285 
286  $oTemplate = &TemplateHandler::getInstance();
287  $tpl = $oTemplate->compile($this->module_path.'tpl', 'insert_join_form');
288 
289  $this->add('tpl', str_replace("\n"," ",$tpl));
290  }
291 
298  {
299  $db_info = Context::getDBInfo();
300  $admin_ip_list = $db_info->admin_ip_list;
301  if(!$admin_ip_list) return true;
302  if(!is_array($admin_ip_list)) $admin_ip_list = explode(',',$admin_ip_list);
303  if(!count($admin_ip_list) || IpFilter::filter($admin_ip_list)) return true;
304  else return false;
305  }
306 }
307 /* End of file member.admin.model.php */
308 /* Location: ./modules/member/member.admin.model.php */
$oModuleModel
Definition: ko.install.php:236
$output
Definition: ko.install.php:193
add($key, $val)
set($key, $val, $set_to_get_vars=0)
getSiteMemberList($site_srl, $page=1)
filter($ip_list, $ip=NULL)
getMemberGroupMemberCountByDate($date= '')
$args
Definition: ko.install.php:185
getModel($module_name)
Definition: func.inc.php:145
getMemberCountByDate($date= '')
executeQueryArray($query_id, $args=NULL, $arg_columns=NULL)
Definition: func.inc.php:219
executeQuery($query_id, $args=NULL, $arg_columns=NULL)
Definition: func.inc.php:203