팁제공자 : 늘푸른이
관리자페이지 외에 일반페이지에서도 회원리스트(회원목록)를 사용하실 분이 계실까하여 올려봅니다.
-준비-
modules/member/skins/default/member_list.html
modules/member/conf/module.xml
modules/member/member.controller.php
modules/member/member.view.php
4가지만 수정, 추가하시면 됩니다.
대부분 관리자에서 뽑아왔습니다.
아래 소스를 member_list.html 으로 만들어 관리자(tpl)가 아닌 일반(./skins/default)에 저장합니다.
<!-- 설명 -->
<!--#include("common_header.html")-->
<form action="./" method="get" class="adminSearch">
<input type="hidden" name="module" value="{$module}" />
<input type="hidden" name="act" value="{$act}" />
<fieldset>
<select name="selected_group_srl">
<option value="0">{$lang->group}</option>
<!--@foreach($group_list as $key => $val)-->
<option value="{$val->group_srl}" <group_srl)-->selected="selected">{$val->title}!--@if($selected_group_srl==$val->group_srl)-->selected="selected"<!--@end-->>{$val->title}</option>
<!--@end-->
</select>
<select name="search_target">
<option value="">{$lang->search_target}</option>
<search_target_list">!--@foreach($lang->search_target_list as $key => $val)-->
<option value="{$key}" <selected="selected">{$val}!--@if($search_target==$key)-->selected="selected"<!--@end-->>{$val}</option>
<!--@end-->
</select>
<input type="text" name="search_keyword" value="{htmlspecialchars($search_keyword)}" class="inputTypeText" />
<span class="button black strong"><input type="submit" value="{$lang->cmd_search}" /></span>
<a href="#" onclick="location.href='{getUrl(','module',$module,'act',$act)}';return false;" class="button"><span>{$lang->cmd_cancel}</span></a>
</fieldset>
</form>
<!-- 목록 -->
<form method="get" action="./" id="member_fo">
<table cellspacing="0" class="rowTable">
<caption>Total {number_format($total_count)}, Page {number_format($page)}/{number_format($total_page)}</caption>
<thead>
<tr>
<th scope="col"><div><a href="{getUrl('sort_index','','sort_order',$sort_index!='last_login'&&$sort_order=='desc'?'asc':'')}">{$lang->no}</a></div></th>
<th scope="col"><div><input type="checkbox" onclick="XE.checkboxToggleAll(); return false;"/></div></th>
<th scope="col" class="quarter_wide"><div>{$lang->user_id}</div></th>
<th scope="col" class="quarter_wide"><div>{$lang->user_name}</div></th>
<th scope="col" class="quarter_wide"><div>{$lang->nick_name}</div></th>
<th scope="col" class="quarter_wide"><div><a href="{getUrl('sort_index','','sort_order',$sort_index!='last_login'&&$sort_order=='desc'?'asc':'')}">{$lang->signup_date}</a></div></th>
<th scope="col"><div><a href="{getUrl('sort_index','last_login','sort_order',$sort_index=='last_login'&&$sort_order=='desc'?'asc':'')}">{$lang->last_login}</a></div></th>
<th scope="col" colspan="2"><div> </div></th>
</tr>
</thead>
<tbody>
<!--@foreach($member_list as $no => $val)-->
{@ $val->group_list = implode(', ', $val->group_list)}
<tr class="row{$cycle_idx}">
<td rowspan="2">{$no}</td>
<td rowspan="2"><input type="checkbox" name="cart" value="{$val->member_srl}"/></td>
<td><a href="{getUrl('act','dispMemberAdminInfo','member_srl',$val->member_srl)}">{htmlspecialchars($val->user_id)}</a></td>
<td>{htmlspecialchars($val->user_name)}</td>
<td><span class="member_{$val->member_srl}">{htmlspecialchars($val->nick_name)}</span></td>
<td>{zdate($val->regdate,"Y-m-d H:i:s")}</td>
<td>{zdate($val->last_login,"Y-m-d H:i:s")}</td>
<td class="nowrap">
<homepage)-->!--@if($val->homepage)--><a href="{$val->homepage}" class="homepage" onclick="window.open(this.href);return false;"><img src="./images/icon_homepage.gif" title="{$lang->homepage}" alt="{$lang->homepage}" /></a> <!--@end-->
<blog)-->!--@if($val->blog)--><a href="{$val->blog}" class="blog" onclick="window.open(this.href);return false;"><img src="./images/icon_blog.gif" title="{$lang->blog}" alt="{$lang->blog}" /></a> < ">!--@end-->
</td>
<td><is_admin">!--@if($val->is_admin != 'Y')--><a href="{getUrl('act','dispMemberAdminDeleteForm','member_srl', $val->member_srl)}" title="{$lang->cmd_delete}" class="buttonSet buttonDelete"><span>{$lang->cmd_delete}</span></a><!--@else--><imgsrc="./images/icon_management.gif" title="{$lang->is_admin}" alt="{$lang->is_admin}" /><!--@end--></td>
</tr>
<tr>
<td colspan="8"><p>{$val->group_list} </p></td>
</tr>
<!--@end-->
</tbody>
</table>
<!-- 버튼 -->
<div class="clear">
<div class="fl">
<a href="#" onclick="doManageMemberGroup(); return false;" class="button blue"><span>{$lang->cmd_member_group}</span></a>
<a href="#" onclick="doDeleteMembers(); return false;" class="button red"><span>{$lang->cmd_delete}</span></a>
</div>
<div class="fr">
<a href="{getUrl('act','dispMemberAdminInsert','member_srl','')}" class="button black strong"><span>{$lang->cmd_make}</span></a>
</div>
</div>
<!-- 페이지 네비게이션 -->
<div class="pagination a1">
<a href="{getUrl('page','','module_srl','')}" class="prevEnd">{$lang->first_page}</a>
<!--@while($page_no = $page_navigation->getNextPage())-->
<!--@if($page == $page_no)-->
<strong>{$page_no}</strong>
<!--@else-->
<a href="{getUrl('page',$page_no,'module_srl','')}">{$page_no}</a>
<!--@end-->
<!--@end-->
<a href="{getUrl('page',$page_navigation->last_page,'module_srl','')}" class="nextEnd">{$lang->last_page}</a>
</div>
</form>
<!--#include("./common_footer.html")-->
modules/member/conf/module.xml 를 열어서 <action name="dispMemberInfo" type="view" standalone="true" /> 위에
<action name="dispMemberList" type="view" standalone="true" index="true" />을 추가, 저장합니다.
modules/member/member.controller.php를 열어서 -1460줄-
// 사용자의 전용 메뉴 구성 (이 메뉴는 애드온등으로 변경될 수 있음)
$this->addMemberMenu( 'dispMemberInfo', 'cmd_view_member_info');
$this->addMemberMenu( 'dispMemberScrappedDocument', 'cmd_view_scrapped_document');
$this->addMemberMenu( 'dispMemberSavedDocument', 'cmd_view_saved_document');
$this->addMemberMenu( 'dispMemberOwnDocument', 'cmd_view_own_document');
위 소스를 찾아 아래 소스를 추가 저장합니다.
$this->addMemberMenu( 'dispMemberList', 'cmd_view_member_list');
modules/member/member.view.php를 열어서 -67줄-
/**
* @brief 회원 정보 출력
**/
function dispMemberInfo() {
$oMemberModel = &getModel('member');
$logged_info = Context::get('logged_info');
// 비회원일 경우 정보 열람 중지
if(!$logged_info->member_srl) return $this->stop('msg_not_permitted');
$member_srl = Context::get('member_srl');
if(!$member_srl && Context::get('is_logged')) {
$member_srl = $logged_info->member_srl;
} elseif(!$member_srl) {
return $this->dispMemberSignUpForm();
}
$site_module_info = Context::get('site_module_info');
$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, $site_module_info->site_srl);
unset($member_info->password);
unset($member_info->email_id);
unset($member_info->email_host);
unset($member_info->email_address);
if(!$member_info->member_srl) return $this->dispMemberSignUpForm();
Context::set('member_info', $member_info);
Context::set('extend_form_list', $oMemberModel->getCombineJoinForm($member_info));
if ($member_info->member_srl == $logged_info->member_srl)
Context::set('openids', $oMemberModel->getMemberOpenIDByMemberSrl($member_srl));
$this->setTemplateFile('member_info');
}
위 소스 밑에 아래의 소스를 추가 , 저장합니다.
/**
* @brief display member list
**/
function dispMemberList() {
$oMemberAdminModel = &getAdminModel('member');
$oMemberModel = &getModel('member');
$logged_info = Context::get('logged_info');
$output = $oMemberAdminModel->getMemberList();
// 비회원일 경우 정보 열람 중지
if(!$logged_info->member_srl) return $this->stop('msg_not_permitted');
$member_srl = Context::get('member_srl');
if(!$member_srl && Context::get('is_logged')) {
$member_srl = $logged_info->member_srl;
} elseif(!$member_srl) {
return $this->dispMemberSignUpForm();
}
$site_module_info = Context::get('site_module_info');
$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, $site_module_info->site_srl);
// retrieve list of groups for each member
if($output->data) {
foreach($output->data as $key => $member) {
$output->data[$key]->group_list = $oMemberModel->getMemberGroups($member->member_srl,0);
}
}
Context::set('member_info', $member_info);
Context::set('extend_form_list', $oMemberModel->getCombineJoinForm($member_info));
if ($member_info->member_srl == $logged_info->member_srl)
Context::set('openids', $oMemberModel->getMemberOpenIDByMemberSrl($member_srl));
Context::set('total_count', $output->total_count);
Context::set('total_page', $output->total_page);
Context::set('page', $output->page);
Context::set('member_list', $output->data);
Context::set('page_navigation', $output->page_navigation);
$this->setTemplateFile('member_list');
}
혹시나 오류가 있을지 모를 대비로
그동안 수정을 자주하신 분들은 백업 먼저 하시고
수정하시기 바랍니다.
첨부파일 올립니다.