조회수 설정 기능을 추가함 #103

This commit is contained in:
qw5414 2016-01-15 19:13:35 +09:00
parent 349ee07f60
commit e33bdb9b92
7 changed files with 69 additions and 44 deletions

View file

@ -485,7 +485,9 @@ class documentAdminController extends document
function procDocumentAdminInsertConfig()
{
// Get the basic information
$config = Context::gets('thumbnail_type');
$config = new stdClass();
$config->thumbnail_type = Context::get('thumbnail_type');
$config->updateCount = Context::get('updatecount');
// Insert by creating the module Controller object
$oModuleController = getController('module');
$output = $oModuleController->insertModuleConfig('document',$config);

View file

@ -900,26 +900,30 @@ class documentController extends document
// Pass if read count is increaded on the session information
if($_SESSION['readed_document'][$document_srl]) return false;
// Pass if the author's IP address is as same as visitor's.
if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'] && Context::getSessionStatus())
$oDocumentModel = getModel('document');
$config = $oDocumentModel->getDocumentConfig();
if($config->updatecount != 'yes')
{
$_SESSION['readed_document'][$document_srl] = true;
return false;
// Pass if the author's IP address is as same as visitor's.
if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'] && Context::getSessionStatus())
{
$_SESSION['readed_document'][$document_srl] = true;
return false;
}
// Pass ater registering sesscion if the author is a member and has same information as the currently logged-in user.
if($member_srl && $logged_info->member_srl == $member_srl)
{
$_SESSION['readed_document'][$document_srl] = true;
return false;
}
}
// Pass ater registering sesscion if the author is a member and has same information as the currently logged-in user.
if($member_srl && $logged_info->member_srl == $member_srl)
{
$_SESSION['readed_document'][$document_srl] = true;
return false;
}
$oDB = DB::getInstance();
$oDB->begin();
// Update read counts
$args = new stdClass;
$args->document_srl = $document_srl;
$output = executeQuery('document.updateReadedCount', $args);
executeQuery('document.updateReadedCount', $args);
// Call a trigger when the read count is updated (after)
$trigger_output = ModuleHandler::triggerCall('document.updateReadedCount', 'after', $oDocument);

View file

@ -23,6 +23,17 @@
<value xml:lang="tr"><![CDATA[Küçük Resim Türü]]></value>
<value xml:lang="vi"><![CDATA[Định dạng hình nhỏ]]></value>
</item>
<item name="read_update_count">
<value xml:lang="ko"><![CDATA[조회수 설정]]></value>
<value xml:lang="en"></value>
<value xml:lang="jp"></value>
<value xml:lang="zh-CN"></value>
<value xml:lang="zh-TW"></value>
<value xml:lang="fr"></value>
<value xml:lang="ru"></value>
<value xml:lang="tr"></value>
<value xml:lang="vi"></value>
</item>
<item name="thumbnail_crop">
<value xml:lang="ko"><![CDATA[잘라내기 (정해진 크기에 꽉 찬 모습의 썸네일을 만듭니다.)]]></value>
<value xml:lang="en"><![CDATA[Crop (to a specific size)]]></value>

View file

@ -3,9 +3,7 @@ xe.lang.msg_empty_search_target = '{$lang->msg_empty_search_target}';
xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
</script>
<load target="js/document_admin.js" />
<div class="x_page-header">
<h1>{$lang->document} <a class="x_icon-question-sign" href="./common/manual/admin/#UMAN_content_document" target="_blank">{$lang->help}</a></h1>
</div>
<include target="header.html" />
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/document/tpl/declared_list/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>

View file

@ -1,21 +1,26 @@
<!--#include("header.html")-->
<include target="header.html" />
<form action="./" method="post">
<form action="./" method="post" class="x_form-horizontal" method="post">
<input type="hidden" name="module" value="document" />
<input type="hidden" name="act" value="procDocumentAdminInsertConfig" />
<table class="x_table x_table-striped x_table-hover">
<tr>
<th scope="col">{$lang->thumbnail_type}</th>
</tr>
<tr>
<td>
<input type="radio" name="thumbnail_type" value="crop" <!--@if($config->thumbnail_type != 'ratio')-->checked="checked"<!--@end-->/> {$lang->thumbnail_crop} <br />
<input type="radio" name="thumbnail_type" value="ratio" <!--@if($config->thumbnail_type == 'ratio')-->checked="checked"<!--@end-->/> {$lang->thumbnail_ratio}
</td>
</tr>
</table>
<div class="btnArea">
<input class="btn" type="submit" value="{$lang->cmd_registration}" />
<input class="btn" type="button" value="{$lang->cmd_delete_all_thumbnail}" onclick="doDeleteAllThumbnail()"/>
<input type="hidden" name="xe_validator_id" value="modules/member/tpl/1" />
<div class="x_control-group">
<div class="x_control-label">{$lang->thumbnail_type}</div>
<div class="x_controls">
<label class="x_inline" for="thumbnail_type_crop"><input type="radio" name="thumbnail_type" id="thumbnail_type_crop" value="Y" checked="checked"|cond="$config->thumbnail_type == 'crop'" /> {$lang->thumbnail_crop}</label>
<label class="x_inline" for="thumbnail_type_ratio"><input type="radio" name="thumbnail_type" id="thumbnail_type_ratio" value="N" checked="checked"|cond="$config->thumbnail_type == 'ratio'" /> {$lang->thumbnail_ratio}</label>
</div>
</div>
</form>
<div class="x_control-group">
<div class="x_control-label">{$lang->read_update_count}</div>
<div class="x_controls">
<label class="x_inline" for="updatecount_yes"><input type="radio" name="updatecount" id="updatecount_yes" value="Y" checked="checked"|cond="$config->updatecount == 'yes'" /> {$lang->cmd_yes}</label>
<label class="x_inline" for="updatecount_no"><input type="radio" name="updatecount" id="updatecount_no" value="N" checked="checked"|cond="$config->updatecount != 'yes'" /> {$lang->cmd_no}</label>
</div>
</div>
<div class="btnArea x_clearfix">
<span class="x_pull-right" style="margin-left:10px;"><input class="btn" type="button" value="{$lang->cmd_delete_all_thumbnail}" onclick="doDeleteAllThumbnail()"/></span>
<span class="x_pull-right"><input class="x_btn x_btn-primary" type="submit" value="{$lang->cmd_save}" /></span>
</div>
</form>

View file

@ -3,9 +3,7 @@ xe.lang.msg_empty_search_target = '{$lang->msg_empty_search_target}';
xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
</script>
<load target="js/document_admin.js" />
<div class="x_page-header">
<h1>{$lang->document} <a class="x_icon-question-sign" href="./common/manual/admin/#UMAN_content_document" target="_blank">{$lang->help}</a></h1>
</div>
<include target="header.html" />
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/document/tpl/document_list/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>

View file

@ -1,9 +1,16 @@
<load target="js/document_admin.js" />
<h1>{$lang->document} {$lang->cmd_management}</h1>
<p>
<a href="{getUrl('act','dispDocumentAdminList')}" class="active"|cond="$act=='dispDocumentAdminList'">{$lang->document_list}</a>
<i>|</i>
<a href="{getUrl('act','dispDocumentAdminConfig')}" class="active"|cond="$act=='dispDocumentAdminConfig'">{$lang->cmd_module_config}</a>
<i>|</i>
<a href="{getUrl('act','dispDocumentAdminDeclared')}" class="active"|cond="$act=='dispDocumentAdminDeclared'">{$lang->cmd_declared_list}</a>
</p>
<div class="x_page-header">
<h1>{$lang->document} <a class="x_icon-question-sign" href="./common/manual/admin/#UMAN_content_document" target="_blank">{$lang->help}</a></h1>
</div>
<ul class="x_nav x_nav-tabs">
<li class="x_active"|cond="$act == 'dispDocumentAdminList'">
<a href="{getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList')}">{$lang->document_list}</a>
</li>
<li class="x_active"|cond="$act == 'dispDocumentAdminConfig'">
<a href="{getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminConfig')}">{$lang->cmd_module_config}</a>
</li>
<li class="x_active"|cond="$act == 'dispDocumentAdminDeclared'">
<a href="{getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminDeclared')}">{$lang->cmd_declared_list}</a>
</li>
</ul>