mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
세션 정보에 해당 세션이 위치하는 mid값을 기입하도록 하였고 현재 접속자 출력 위젯에서 mid값을 반영할 수 있도록 변경
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4292 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
befe944a1e
commit
d5126c2925
10 changed files with 63 additions and 20 deletions
|
|
@ -7,6 +7,7 @@
|
|||
</columns>
|
||||
<conditions>
|
||||
<condition operation="more" column="last_update" var="last_update" notnull="notnull" />
|
||||
<condition operation="equal" column="cur_mid" var="mid" pipe="and" />
|
||||
</conditions>
|
||||
<navigation>
|
||||
<list_count var="list_count" default="20" />
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
<query id="getLoggedMembers" action="select">
|
||||
<tables>
|
||||
<table name="session" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="member_srl" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="more" column="last_update" var="last_update" notnull="notnull" />
|
||||
</conditions>
|
||||
<groups>
|
||||
<group column="member_srl" />
|
||||
</groups>
|
||||
</query>
|
||||
|
|
@ -9,5 +9,6 @@
|
|||
<column name="val" var="val" />
|
||||
<column name="ipaddress" default="ipaddress()" />
|
||||
<column name="last_update" default="curdate()" />
|
||||
<column name="cur_mid" var="cur_mid" />
|
||||
</columns>
|
||||
</query>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
<column name="val" var="val" notnull="notnull" />
|
||||
<column name="ipaddress" default="ipaddress()" />
|
||||
<column name="last_update" default="curdate()" />
|
||||
<column name="cur_mid" var="cur_mid" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="session_key" var="session_key" notnull="notnull" />
|
||||
|
|
|
|||
|
|
@ -5,4 +5,5 @@
|
|||
<column name="val" type="bigtext" />
|
||||
<column name="ipaddress" type="varchar" size="128" notnull="notnull" />
|
||||
<column name="last_update" type="date" index="idx_session_update" />
|
||||
<column name="cur_mid" type="varchar" size="128" index="idx_session_cur_mid" />
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -25,6 +25,9 @@
|
|||
$oModuleController = &getController('module');
|
||||
$oModuleController->insertActionForward('session', 'view', 'dispSessionAdminIndex');
|
||||
|
||||
$oDB = &DB::getInstance();
|
||||
$oDB->addIndex("session","idx_session_update_mid", array("last_update","cur_mid"));
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
|
|
@ -39,6 +42,10 @@
|
|||
|
||||
if(!$oDB->isTableExists('session')) return true;
|
||||
|
||||
if(!$oDB->isColumnExists("session","cur_mid")) return true;
|
||||
|
||||
if(!$oDB->isIndexExists("session","idx_session_update_mid")) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -54,6 +61,14 @@
|
|||
|
||||
if(!$oModuleModel->getActionForward('dispSessionAdminIndex'))
|
||||
$oModuleController->insertActionForward('session', 'view', 'dispSessionAdminIndex');
|
||||
|
||||
if(!$oDB->isColumnExists("session","cur_mid")) {
|
||||
$oDB->addColumn('session',"cur_mid","varchar",128);
|
||||
}
|
||||
|
||||
if(!$oDB->isIndexExists("session","idx_session_update_mid"))
|
||||
$oDB->addIndex("session","idx_session_update_mid", array("last_update","cur_mid"));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -34,6 +34,11 @@
|
|||
|
||||
$args->expired = date("YmdHis", time()+$this->lifetime);
|
||||
$args->val = $val;
|
||||
$args->cur_mid = Context::get('mid');
|
||||
if(!$args->cur_mid) {
|
||||
$module_info = Context::get('current_module_info');
|
||||
$args->cur_mid = $module_info->mid;
|
||||
}
|
||||
|
||||
if(Context::get('is_logged')) {
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
|
|
|||
|
|
@ -27,6 +27,14 @@
|
|||
if(!$output->toBool()) {
|
||||
$oDB = &DB::getInstance();
|
||||
if(!$oDB->isTableExists('session')) $oDB->createTableByXmlFile($this->module_path.'schemas/session.xml');
|
||||
if(!$oDB->isColumnExists("session","cur_mid")) $oDB->addColumn('session',"cur_mid","varchar",128);
|
||||
$output = executeQuery('session.getSession', $args);
|
||||
}
|
||||
|
||||
// 세션 정보에서 cur_mid값이 없을 경우 테이블 생성 체크
|
||||
if(!isset($output->data->cur_mid)) {
|
||||
$oDB = &DB::getInstance();
|
||||
if(!$oDB->isColumnExists("session","cur_mid")) $oDB->addColumn('session',"cur_mid","varchar",128);
|
||||
}
|
||||
|
||||
return $output->data->val;
|
||||
|
|
@ -34,11 +42,17 @@
|
|||
|
||||
/**
|
||||
* @brief 현재 접속중인 사용자의 목록을 구함
|
||||
* period_time 인자의 값을 n으로 하여 최근 n분 이내에 세션을 갱신한 대상을 추출함
|
||||
* 여러개의 인자값을 필요로 해서 object를 인자로 받음
|
||||
* limit_count : 대상 수
|
||||
* page : 페이지 번호
|
||||
* period_time : 인자의 값을 n으로 하여 최근 n분 이내에 세션을 갱신한 대상을 추출함
|
||||
* mid : 특정 mid에 속한 사용자
|
||||
**/
|
||||
function getLoggedMembers($limit_count = 20, $page = 1, $period_time = 3) {
|
||||
$args->last_update = date("YmdHis", time() - $period_time*60);
|
||||
$args->page = $page;
|
||||
function getLoggedMembers($args) {
|
||||
if(!$args->limit_count) $args->limit_count = 20;
|
||||
if(!$args->page) $args->page = 1;
|
||||
if(!$args->period_time) $args->period_time = 3;
|
||||
$args->last_update = date("YmdHis", time() - $args->period_time*60);
|
||||
|
||||
$output = executeQueryArray('session.getLoggedMembers', $args);
|
||||
if(!$output->toBool() || !$output->data) return $output;
|
||||
|
|
|
|||
|
|
@ -13,5 +13,18 @@
|
|||
<type>text</type>
|
||||
<description xml:lang="ko">출력될 목록의 수를 정하실 수 있습니다. (기본 5개)</description>
|
||||
</var>
|
||||
<var id="use_mid">
|
||||
<name xml:lang="ko">대상 지정</name>
|
||||
<type>select</type>
|
||||
<description xml:lang="ko">대상을 전체로 하면 홈페이지 접속자 모두가 출력되고 Mid 구분으로 하게 되면 접속한 Mid에 같이 접속한 회원만 출력이 됩니다.</description>
|
||||
<options>
|
||||
<name xml:lang="ko">전체</name>
|
||||
<value>total</value>
|
||||
</options>
|
||||
<options>
|
||||
<name xml:lang="ko">Mid 구분</name>
|
||||
<value>mid</value>
|
||||
</options>
|
||||
</var>
|
||||
</extra_vars>
|
||||
</widget>
|
||||
|
|
|
|||
|
|
@ -16,13 +16,19 @@
|
|||
**/
|
||||
function proc($args) {
|
||||
|
||||
// 위젯 자체적으로 설정한 변수들을 체크
|
||||
$list_count = (int)$args->list_count;
|
||||
if(!$list_count) $list_count = 5;
|
||||
|
||||
$use_mid = $args->use_mid;
|
||||
if($use_mid == 'mid') $mid = Context::get('mid');
|
||||
else $mid = null;
|
||||
|
||||
$obj->list_count = $list_count;
|
||||
$obj->mid = $mid;
|
||||
|
||||
// session model 객체 생성
|
||||
$oSessionModel = &getModel('session');
|
||||
$output = $oSessionModel->getLoggedMembers($list_count);
|
||||
$output = $oSessionModel->getLoggedMembers($obj);
|
||||
$widget_info->member_list = $output->data;
|
||||
Context::set('widget_info', $widget_info);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue