mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-27 23:29:57 +09:00
simulz님의 rank point 위젯 추가
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3075 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
a4075d9a86
commit
b5eac321ee
10 changed files with 325 additions and 0 deletions
43
widgets/rank_point/conf/info.xml
Normal file
43
widgets/rank_point/conf/info.xml
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<widget version="0.7">
|
||||
<title xml:lang="ko">포인트 랭킹 출력</title>
|
||||
<author email_address="k10206@naver.com" link="http://www.simulz.com" date="2007. 8. 29">
|
||||
<name xml:lang="ko">Simulz</name>
|
||||
<description xml:lang="ko">회원의 포인트 순위를 출력합니다.</description>
|
||||
</author>
|
||||
<extra_vars>
|
||||
<var id="title">
|
||||
<name xml:lang="ko">제목</name>
|
||||
<type>text</type>
|
||||
<description xml:lang="ko">위젯의 제목으로 출력됩니다.</description>
|
||||
</var>
|
||||
<var id="list_count">
|
||||
<name xml:lang="ko">목록수</name>
|
||||
<type>text</type>
|
||||
<description xml:lang="ko">출력될 목록의 수를 정하실 수 있습니다. (기본 5개)</description>
|
||||
</var>
|
||||
<var id="without_admin">
|
||||
<name xml:lang="ko">관리자</name>
|
||||
<type>select</type>
|
||||
<description xml:lang="ko">순위에 관리자를 포함합니다.</description>
|
||||
<options>
|
||||
<name xml:lang="ko">포함</name>
|
||||
<value>false</value>
|
||||
</options>
|
||||
<options>
|
||||
<name xml:lang="ko">미포함</name>
|
||||
<value>true</value>
|
||||
</options>
|
||||
</var>
|
||||
<var id="with_group">
|
||||
<name xml:lang="ko">그룹 포함</name>
|
||||
<type>text</type>
|
||||
<description xml:lang="ko">출력할 회원 그룹명을 입력하세요. 예)준회원,정회원</description>
|
||||
</var>
|
||||
<var id="without_group">
|
||||
<name xml:lang="ko">그룹 제외</name>
|
||||
<type>text</type>
|
||||
<description xml:lang="ko">제외할 회원 그룹명을 입력하세요. 예)관리그룹,정회원</description>
|
||||
</var>
|
||||
</extra_vars>
|
||||
</widget>
|
||||
20
widgets/rank_point/queries/getMemberList.xml
Normal file
20
widgets/rank_point/queries/getMemberList.xml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<query id="getMemberList" action="select">
|
||||
<tables>
|
||||
<table name="member" alias="member"/>
|
||||
<table name="point" alias="point"/>
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="member.*" />
|
||||
<column name="point.point" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="member.member_srl" var="point.member_srl" />
|
||||
<condition operation="equal" column="is_admin" var="is_admin" pipe="and" />
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="sort_index" default="point" order="desc" />
|
||||
<list_count var="list_count" default="20" />
|
||||
<page_count var="page_count" default="10" />
|
||||
<page var="page" default="1" />
|
||||
</navigation>
|
||||
</query>
|
||||
24
widgets/rank_point/queries/getMemberListWithinGroup.xml
Normal file
24
widgets/rank_point/queries/getMemberListWithinGroup.xml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<query id="getMemberListWithinGroup" action="select">
|
||||
<tables>
|
||||
<table name="member" alias="member"/>
|
||||
<table name="point" alias="point"/>
|
||||
<table name="member_group_member" alias="member_group"/>
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="member.*" />
|
||||
<column name="point.point" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="in" column="member_group.group_srl" var="selected_group_srl" />
|
||||
<condition operation="notequal" column="member_group.group_srl" var="selected_group_without_srl" pipe="and" />
|
||||
<condition operation="equal" column="member.member_srl" var="member_group.member_srl" pipe="and" notnull="notnull" />
|
||||
<condition operation="equal" column="member.member_srl" var="point.member_srl" pipe="and" />
|
||||
<condition operation="equal" column="member.is_admin" var="is_admin" pipe="and" />
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="sort_index" default="point" order="desc" />
|
||||
<list_count var="list_count" default="20" />
|
||||
<page_count var="page_count" default="10" />
|
||||
<page var="page" default="1" />
|
||||
</navigation>
|
||||
</query>
|
||||
149
widgets/rank_point/rank_point.class.php
Normal file
149
widgets/rank_point/rank_point.class.php
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
<?php
|
||||
/**
|
||||
* @class rank_point
|
||||
* @author Simulz.com (k10206@naver.com)
|
||||
* @brief 회원 포인트 랭킹
|
||||
**/
|
||||
|
||||
class rank_point extends WidgetHandler {
|
||||
|
||||
/**
|
||||
* @brief 포인트 정보 표시
|
||||
**/
|
||||
function point_info($member_srl) {
|
||||
$oModuleModel = &getModel('module');
|
||||
$this->config = $oModuleModel->getModuleConfig('point');
|
||||
|
||||
$point = $this->oPointModel->getPoint($member_srl);
|
||||
$level = $this->oPointModel->getLevel($point, $this->config->level_step);
|
||||
|
||||
$src = sprintf("modules/point/icons/%s/%d.gif", $this->config->level_icon, $level);
|
||||
$info = getimagesize($src);
|
||||
$this->icon_width = $info[0];
|
||||
$this->icon_height = $info[1];
|
||||
|
||||
if($level < $this->config->max_level) {
|
||||
$next_point = $this->config->level_step[$level+1];
|
||||
if($next_point > 0) {
|
||||
$per = (int)($point / $next_point*100);
|
||||
}
|
||||
}
|
||||
|
||||
$code = sprintf('title="%s:%s%s %s, %s:%s/%s" style="background:url(%s) no-repeat left;padding-left:%dpx; height:%dpx"', Context::getLang('point'), $point, $this->config->point_name, $per?"(".$per."%)":"", Context::getLang('level'), $level, $this->config->max_level, Context::getRequestUri().$src, $this->icon_width+2, $this->icon_height);
|
||||
return $code;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 위젯의 실행 부분
|
||||
*
|
||||
* ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다
|
||||
* 결과를 만든후 print가 아니라 return 해주어야 한다
|
||||
**/
|
||||
function proc($args) {
|
||||
// 위젯 자체적으로 설정한 변수들을 체크
|
||||
$title = $args->title;
|
||||
$list_count = (int)$args->list_count;
|
||||
if(!$list_count) $list_count = 5;
|
||||
$mid_list = explode(",",$args->mid_list);
|
||||
$subject_cut_size = $args->subject_cut_size;
|
||||
if(!$subject_cut_size) $subject_cut_size = 0;
|
||||
|
||||
//그룹 정보를 구해옴 (그룹 포함)
|
||||
$tmp_groups = explode(",",$args->with_group);
|
||||
$count = count($tmp_groups);
|
||||
for($i = 0; $i < $count; $i++) {
|
||||
$group_name = trim($tmp_groups[$i]);
|
||||
if(!$group_name) continue;
|
||||
$target_group[$i] = $group_name;
|
||||
}
|
||||
|
||||
//그룹 정보를 구해옴 (그룹 제외)
|
||||
$tmp_groups = explode(",",$args->without_group);
|
||||
$count = count($tmp_groups);
|
||||
for($i = 0; $i < $count; $i++) {
|
||||
$group_name = trim($tmp_groups[$i]);
|
||||
if(!$group_name) continue;
|
||||
$target_group_without[$i] = $group_name;
|
||||
}
|
||||
|
||||
$oMemberModel = &getModel('member');
|
||||
$this->oPointModel = &getModel('point');
|
||||
|
||||
$obj->list_count = $list_count;
|
||||
$obj->is_admin = $args->without_admin == "true" ? "N" : "";
|
||||
|
||||
if(count($target_group) || count($target_group_without)) {
|
||||
// 그룹 목록을 구해옴
|
||||
$group_list = $oMemberModel->getGroups();
|
||||
|
||||
if(count($target_group)) {
|
||||
foreach($group_list as $group_srl => $val) {
|
||||
if(!in_array($val->title, $target_group)) continue;
|
||||
$target_group_srl_list[] = $group_srl;
|
||||
}
|
||||
} else {
|
||||
foreach($group_list as $group_srl => $val) {
|
||||
if(!in_array($val->title, $target_group_without)) continue;
|
||||
$target_group_without_srl_list[] = $group_srl;
|
||||
}
|
||||
}
|
||||
|
||||
// 해당 그룹의 멤버를 구해옴
|
||||
if(count($target_group_srl_list) || count($target_group_without_srl_list)) {
|
||||
if(count($target_group_srl_list)) $obj->selected_group_srl = implode(',',$target_group_srl_list);
|
||||
else $obj->selected_group_without_srl = implode(',',$target_group_without_srl_list);
|
||||
$output = executeQuery('widgets.rank_point.getMemberListWithinGroup', $obj);
|
||||
}
|
||||
}
|
||||
else {
|
||||
//전체 포인트 목록을 구해옴
|
||||
$output = executeQuery("widgets.rank_point.getMemberList",$obj);
|
||||
}
|
||||
|
||||
// 오류가 생기면 그냥 무시
|
||||
if(!$output->toBool()) return;
|
||||
|
||||
// 결과가 있으면 각 문서 객체화를 시킴
|
||||
if(count($output->data)) {
|
||||
foreach($output->data as $key => $val) {
|
||||
$val->perlev = $this->point_info($val->member_srl);
|
||||
|
||||
$image_name = $oMemberModel->getImageName($val->member_srl);
|
||||
$image_mark = $oMemberModel->getImageMark($val->member_srl);
|
||||
if($image_name->width) {
|
||||
if($image_mark->height && $image_mark->height > $image_name->height) $top_margin = ($image_mark->height - $image_name->height)/2;
|
||||
else $top_margin = 0;
|
||||
$val->nick_name = sprintf('<img src="%s" border="0" alt="%s" title="%s" width="%s" height="%s" align="absmiddle" style="margin-top:%dpx;" />', Context::getRequestUri().$image_name->file, $image_name->file, $image_name->file, $image_name->width, $image_name->height, $top_margin);
|
||||
}
|
||||
if($image_mark->width) {
|
||||
$val->nick_name = sprintf('<img src="%s" border="0" alt="%s" title="%s" width="%s" height="%s" align="absmiddle" />', Context::getRequestUri().$image_mark->file, $image_mark->file, $image_mark->file, $image_mark->width, $image_mark->height).$val->nick_name;
|
||||
}
|
||||
|
||||
$point_list[$key] = $val;
|
||||
}
|
||||
} else {
|
||||
$point_list = array();
|
||||
}
|
||||
|
||||
$widget_info->title = $title;
|
||||
$widget_info->list_count = $list_count;
|
||||
$widget_info->point_list = $point_list;
|
||||
$widget_info->subject_cut_size = $subject_cut_size;
|
||||
|
||||
$widget_info->debug = $debug;
|
||||
Context::set('widget_info', $widget_info);
|
||||
|
||||
// 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정)
|
||||
$tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);
|
||||
Context::set('colorset', $args->colorset);
|
||||
|
||||
// 템플릿 파일을 지정
|
||||
$tpl_file = 'list';
|
||||
|
||||
// 템플릿 컴파일
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
$output = $oTemplate->compile($tpl_path, $tpl_file);
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
||||
21
widgets/rank_point/skins/sz_xe/css/default.css
Normal file
21
widgets/rank_point/skins/sz_xe/css/default.css
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
.sz_point { margin-right:10px; width:100%; position:relative;}
|
||||
.sz_point h2 { display:block; height:21px; padding:9px 0 0 9px; margin-bottom:12px; color:#000000; font-size:1em;}
|
||||
|
||||
.sz_point .left { cursor:pointer; height:20px; background:url(../images/default/bullet.gif) no-repeat left; padding-left:15px; overflow:hidden; }
|
||||
|
||||
.sz_point .center { text-align:right; padding-left:5px; }
|
||||
|
||||
.sz_point .sz_Box_000{border:solid 0;padding:0;}
|
||||
.sz_point .sz_Box_001{width:100%;border:solid 1px;border-color:#E7E7E7;padding:5px 5px 2px 5px;background-color:#F4F4F4;color:#696969;}
|
||||
.sz_point .sz_Box_002{width:100%;border:solid 1px;border-color:#DDEAA8;padding:5px 5px 2px 5px;background-color:#FBFDF1;color:#99B81A;}
|
||||
.sz_point .sz_Box_003{width:100%;border:solid 1px;border-color:#F9D5D5;padding:5px 5px 2px 5px;background-color:#FEF6F6;color:#D98383;}
|
||||
.sz_point .sz_Box_004{width:100%;border:solid 1px;border-color:#EFDAF4;padding:5px 5px 2px 5px;background-color:#FCF7FD;color:#AF69C0;}
|
||||
.sz_point .sz_Box_005{width:100%;border:solid 1px;border-color:#DCDFF6;padding:5px 5px 2px 5px;background-color:#F6F7FE;color:#7381EA;}
|
||||
.sz_point .sz_Box_006{width:100%;border:solid 1px;border-color:#DAEAEE;padding:5px 5px 2px 5px;background-color:#F0F6F8;color:#619DAC;}
|
||||
.sz_point .sz_Box_007{width:100%;border:solid 1px;border-color:#D5EDDD;padding:5px 5px 2px 5px;background-color:#EFF9F2;color:#6FB587;}
|
||||
.sz_point .sz_Box_008{width:100%;border:solid 1px;border-color:#FFEC15;padding:5px 5px 2px 5px;background-color:#FFFCDF;color:#FF9900;}
|
||||
.sz_point .sz_Box_009{width:100%;border:solid 1px;border-color:#9DD7E8;padding:5px 5px 2px 5px;background-color:#F8FDFF;color:#0A8DBD;}
|
||||
|
||||
.sz_point a {color: #3e81de; text-decoration:none;}
|
||||
.sz_point a:hover {color: #3e81de;}
|
||||
.sz_point a:visit {color: #3e81de;}
|
||||
BIN
widgets/rank_point/skins/sz_xe/images/default/bullet.gif
Normal file
BIN
widgets/rank_point/skins/sz_xe/images/default/bullet.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 282 B |
BIN
widgets/rank_point/skins/sz_xe/images/default/bulletD0.gif
Normal file
BIN
widgets/rank_point/skins/sz_xe/images/default/bulletD0.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 44 B |
BIN
widgets/rank_point/skins/sz_xe/images/default/lineNotice.gif
Normal file
BIN
widgets/rank_point/skins/sz_xe/images/default/lineNotice.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 139 B |
26
widgets/rank_point/skins/sz_xe/list.html
Normal file
26
widgets/rank_point/skins/sz_xe/list.html
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<!-- 설정된 컬러셋의 종류에 따라서 css파일을 import 합니다 -->
|
||||
|
||||
<!--%import("css/default.css")-->
|
||||
|
||||
<div class="sz_point">
|
||||
<div class="sz_{$colorset}">
|
||||
<!--@if($widget_info->title)-->
|
||||
<h2>{$widget_info->title} Top {$widget_info->list_count}</h2>
|
||||
<!--@end-->
|
||||
<table>
|
||||
{@ $no = 1}
|
||||
<!--@foreach($widget_info->point_list as $val)-->
|
||||
<tr class="member_{$val->member_srl}">
|
||||
<td class="left">{$no}위. <span class="nick_name" {$val->perlev}>{$val->nick_name}</span></td>
|
||||
<td class="center">{$val->point}점</td>
|
||||
<td class="right">
|
||||
<!--@if($logged_info->is_admin == "Y")-->
|
||||
<a href="{getUrl('module','admin','act','dispDocumentAdminList','search_target','member_srl','search_keyword',$val->member_srl)}" target="_blank">[작성글]</a>
|
||||
<!--@end-->
|
||||
</td>
|
||||
</tr>
|
||||
{@ $no++}
|
||||
<!--@end-->
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
42
widgets/rank_point/skins/sz_xe/skin.xml
Normal file
42
widgets/rank_point/skins/sz_xe/skin.xml
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<skin>
|
||||
<title xml:lang="ko">Simulz 포인트 랭킹 스킨</title>
|
||||
<maker email_address="k10206@naver.com" link="http://www.simulz.com" date="2007. 8. 29">
|
||||
<name xml:lang="ko">Simulz</name>
|
||||
<description xml:lang="ko">
|
||||
Simulz 포인트 랭킹 스킨입니다.
|
||||
</description>
|
||||
</maker>
|
||||
<colorset>
|
||||
<color name="Box_000">
|
||||
<title xml:lang="ko">기본</title>
|
||||
</color>
|
||||
<color name="Box_001">
|
||||
<title xml:lang="ko">회색</title>
|
||||
</color>
|
||||
<color name="Box_002">
|
||||
<title xml:lang="ko">연두</title>
|
||||
</color>
|
||||
<color name="Box_003">
|
||||
<title xml:lang="ko">분홍</title>
|
||||
</color>
|
||||
<color name="Box_004">
|
||||
<title xml:lang="ko">보라</title>
|
||||
</color>
|
||||
<color name="Box_005">
|
||||
<title xml:lang="ko">밝은 파랑</title>
|
||||
</color>
|
||||
<color name="Box_006">
|
||||
<title xml:lang="ko">청록</title>
|
||||
</color>
|
||||
<color name="Box_007">
|
||||
<title xml:lang="ko">초록</title>
|
||||
</color>
|
||||
<color name="Box_008">
|
||||
<title xml:lang="ko">노랑</title>
|
||||
</color>
|
||||
<color name="Box_009">
|
||||
<title xml:lang="ko">파랑</title>
|
||||
</color>
|
||||
</colorset>
|
||||
</skin>
|
||||
Loading…
Add table
Add a link
Reference in a new issue