mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-14 00:39:57 +09:00
로그인한 사용자의 포인트 현황을 출력하는 위젯 추가
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4138 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
f340619618
commit
f742b03f73
8 changed files with 137 additions and 2 deletions
11
widgets/point_status/conf/info.xml
Normal file
11
widgets/point_status/conf/info.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<widget version="0.1">
|
||||
<title xml:lang="ko">포인트 현황 출력 위젯</title>
|
||||
<author email_address="zero@zeroboard.com" link="http://www.zeroboard.com" date="2008. 4. 23">
|
||||
<name xml:lang="ko">제로</name>
|
||||
<description xml:lang="ko">
|
||||
로그인한 회원의 포인트 현황을 출력하는 위젯입니다.
|
||||
캐시는 0으로 해주셔야 합니다.
|
||||
</description>
|
||||
</author>
|
||||
</widget>
|
||||
62
widgets/point_status/point_status.class.php
Normal file
62
widgets/point_status/point_status.class.php
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
/**
|
||||
* @class point_status
|
||||
* @author zero (zero@nzeo.com)
|
||||
* @brief 포인트 현황 출력 위젯
|
||||
* @version 0.1
|
||||
**/
|
||||
|
||||
class point_status extends WidgetHandler {
|
||||
|
||||
/**
|
||||
* @brief 위젯의 실행 부분
|
||||
*
|
||||
* ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다
|
||||
* 결과를 만든후 print가 아니라 return 해주어야 한다
|
||||
**/
|
||||
function proc($args) {
|
||||
// 비로그인 사용자의 경우 결과를 출력하지 않음
|
||||
if(!Context::get('is_logged')) return;
|
||||
|
||||
// 로그인 정보를 구함
|
||||
$logged_info = Context::get('logged_info');
|
||||
$member_srl = $logged_info->member_srl;
|
||||
if(!$member_srl) return;
|
||||
|
||||
// 포인트 관련 설정을 구함
|
||||
$oModuleModel = &getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('point');
|
||||
|
||||
// 포인트 내역을 구함
|
||||
$oPointModel = &getModel('point');
|
||||
$widget_info->point = $oPointModel->getPoint($member_srl);
|
||||
$widget_info->level = $oPointModel->getLevel($widget_info->point, $config->level_step);
|
||||
$widget_info->level_icon = sprintf("./modules/point/icons/%s/%d.gif", $config->level_icon, $widget_info->level);
|
||||
|
||||
// 최고 레벨이 아니면 다음 레벨로 가기 위한 per을 구함
|
||||
if($widget_info->level < $config->max_level) {
|
||||
$next_point = $config->level_step[$widget_info->level+1];
|
||||
if($next_point > 0) $per = (int)($widget_info->point / $next_point*100);
|
||||
}
|
||||
$widget_info->per = $per;
|
||||
$widget_info->next_point = $next_point;
|
||||
|
||||
// 단위 설정
|
||||
$widget_info->point_unit = $config->point_name;
|
||||
|
||||
// widget_info를 context setting
|
||||
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 = 'status';
|
||||
|
||||
// 템플릿 컴파일
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
return $oTemplate->compile($tpl_path, $tpl_file);
|
||||
}
|
||||
}
|
||||
?>
|
||||
18
widgets/point_status/skins/default/skin.xml
Normal file
18
widgets/point_status/skins/default/skin.xml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<skin>
|
||||
<title xml:lang="ko">회원 포인트 현황 기본 스킨</title>
|
||||
<maker email_address="zero@zeroboard.com" link="http://www.zeroboard.com" date="2008. 4. 23">
|
||||
<name xml:lang="ko">제로</name>
|
||||
<description xml:lang="ko">
|
||||
포인트 현황 출력 위젯의 기본 스킨입니다.
|
||||
</description>
|
||||
</maker>
|
||||
<colorset>
|
||||
<color name="normal">
|
||||
<title xml:lang="ko">기본 컬러</title>
|
||||
<title xml:lang="jp">デフォルトカラー</title>
|
||||
<title xml:lang="zh-CN">默认颜色</title>
|
||||
<title xml:lang="en">Default color</title>
|
||||
</color>
|
||||
</colorset>
|
||||
</skin>
|
||||
11
widgets/point_status/skins/default/status.css
Normal file
11
widgets/point_status/skins/default/status.css
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
.point_status_white .level { font-size:7pt; font-family:tahoma; float:left; color:#333333; }
|
||||
.point_status_white .next { font-size:7pt; font-family:tahoma; float:right; color:#979797; }
|
||||
.point_status_white .bar_box { background-color:#D9DAF8; height:8px; border:1px solid #2E35D3; white-space:nowrap; overflow:hidden; margin:3px 0 3px 0;}
|
||||
.point_status_white .bar { height:8px; background-color:#6A70E5; border-right:1px solid #2E35D3; white-space:nowrap; overflow:hidden;}
|
||||
.point_status_white .point { font-family:tahoma; font-size:8pt; color:#333333; }
|
||||
|
||||
.point_status_black .level { font-size:7pt; font-family:tahoma; float:left; color:#BBBBBB; }
|
||||
.point_status_black .next { font-size:7pt; font-family:tahoma; float:right; color:#979797; }
|
||||
.point_status_black .bar_box { background-color:#D9DAF8; height:8px; border:1px solid #2E35D3; white-space:nowrap; overflow:hidden; margin:3px 0 3px 0;}
|
||||
.point_status_black .bar { height:8px; background-color:#6A70E5; border-right:1px solid #2E35D3; white-space:nowrap; overflow:hidden;}
|
||||
.point_status_black .point { font-family:tahoma; font-size:8pt; color:#BBBBBB; }
|
||||
27
widgets/point_status/skins/default/status.html
Normal file
27
widgets/point_status/skins/default/status.html
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<!--@if($colorset=="black")-->
|
||||
{@ $colorset="black"}
|
||||
<!--@else-->
|
||||
{@ $colorset="white"}
|
||||
<!--@end-->
|
||||
<!--%import("status.css")-->
|
||||
|
||||
<div class="point_status_{$colorset}">
|
||||
<div class="level">
|
||||
Lv.<strong>{$widget_info->level}</strong>
|
||||
</div>
|
||||
<div class="next">
|
||||
<strong>{$widget_info->per}%</strong>
|
||||
<span class="next_point">(-{$widget_info->next_point-$widget_info->point})</span>
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
|
||||
<div class="bar_box">
|
||||
<div style="width:{$widget_info->per}%;" class="bar"></div>
|
||||
</div>
|
||||
|
||||
<div class="point">
|
||||
{number_format($widget_info->point)}{$widget_info->point_unit}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue