mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
회원 이미지이름/마크이미지/서명과 포인트 레벨 아이콘 표시하는 애드온을 더 가볍게 수정
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3529 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
502b5a7a88
commit
0f9ec51d0a
12 changed files with 147 additions and 135 deletions
|
|
@ -12,6 +12,8 @@
|
|||
// before_display_content 가 아니면 return
|
||||
if($called_position != "before_display_content") return;
|
||||
|
||||
require_once('./addons/point_level_icon/point_level_icon.lib.php');
|
||||
|
||||
$oPointController = &getController('point');
|
||||
$output = preg_replace_callback('!<(div|span)([^\>]*)member_([0-9\-]+)([^\>]*)>(.*?)\<\/(div|span)\>!is', array($oPointController, 'transLevelIcon'), $output);
|
||||
$output = preg_replace_callback('!<(div|span)([^\>]*)member_([0-9\-]+)([^\>]*)>(.*?)\<\/(div|span)\>!is', 'pointLevelIconTrans', $output);
|
||||
?>
|
||||
|
|
|
|||
46
addons/point_level_icon/point_level_icon.lib.php
Normal file
46
addons/point_level_icon/point_level_icon.lib.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
/**
|
||||
* @brief 포인트 아이콘 변경을 위한 함수.
|
||||
**/
|
||||
function pointLevelIconTrans($matches) {
|
||||
$member_srl = $matches[3];
|
||||
if($member_srl<1) return $matches[0];
|
||||
|
||||
if(!isset($GLOBALS['_pointLevelIcon'][$member_srl])) {
|
||||
// 포인트 설정을 구해옴
|
||||
if(!$GLOBALS['_pointConfig']) {
|
||||
$oModuleModel = &getModel('module');
|
||||
$GLOBALS['_pointConfig'] = $oModuleModel->getModuleConfig('point');
|
||||
}
|
||||
$config = $GLOBALS['_pointConfig'];
|
||||
|
||||
// 포인트 모델을 구해 놓음
|
||||
if(!$GLOBALS['_pointModel']) $GLOBALS['_pointModel'] = getModel('point');
|
||||
$oPointModel = &$GLOBALS['_pointModel'];
|
||||
|
||||
// 포인트를 구함
|
||||
$point = $oPointModel->getPoint($member_srl);
|
||||
|
||||
// 레벨을 구함
|
||||
$level = $oPointModel->getLevel($point, $config->level_step);
|
||||
$text = $matches[5];
|
||||
|
||||
// 레벨 아이콘의 위치를 구함
|
||||
$level_icon = sprintf("./modules/point/icons/%s/%d.gif", $config->level_icon, $level);
|
||||
|
||||
// 최고 레벨이 아니면 다음 레벨로 가기 위한 per을 구함
|
||||
if($level < $config->max_level) {
|
||||
$next_point = $config->level_step[$level+1];
|
||||
if($next_point > 0) $per = (int)($point / $next_point*100);
|
||||
}
|
||||
|
||||
$title = sprintf("%s:%s%s %s, %s:%s/%s", Context::getLang('point'), $point, $config->point_name, $per?"(".$per."%)":"", Context::getLang('level'), $level, $config->max_level);
|
||||
|
||||
$text = sprintf('<span class="nowrap member_%s" style="cursor:pointer"><img src="%s" alt="%s" title="%s" style="vertical-align:middle;margin-right:3px"/>%s</span>', $member_srl, $level_icon, $title, $title, $text);
|
||||
|
||||
$GLOBALS['_pointLevelIcon'][$member_srl] = $text;
|
||||
}
|
||||
|
||||
return $GLOBALS['_pointLevelIcon'][$member_srl];
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue