글 조회시 포인트 차감 또는 증감 할 수 있도록 기능 추가. 모듈 업데이트 필요. 중복 부과 안됨

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3501 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2008-01-08 07:35:51 +00:00
parent 860cb7e686
commit 480d7582f2
14 changed files with 76 additions and 12 deletions

View file

@ -361,6 +361,10 @@
// 로그 남기기
$output = executeQuery('document.insertDocumentReadedLog', $args);
// 조회수 업데이트가 되면 trigger 호출 (after)
$output = ModuleHandler::triggerCall('document.updateReadedCount', 'after', $oDocument);
if(!$output->toBool()) return $output;
// 세션 정보에 남김
return $_SESSION['readed_document'][$document_srl] = true;
}

View file

@ -44,6 +44,7 @@
$lang->point_upload_file = 'On Uploading';
$lang->point_delete_file = 'On Deleting Files';
$lang->point_download_file = 'On Downloading Files (Exclude images)';
$lang->point_read_document = 'On Reading';
$lang->cmd_point_config = 'Default Setting';

View file

@ -44,6 +44,7 @@
$lang->point_upload_file = 'Al subri archivos';
$lang->point_delete_file = 'Al borrar archivos';
$lang->point_download_file = 'Al descargar archivos (Excepto imágenes)';
$lang->point_read_document = '게시글 조회';
$lang->cmd_point_config = 'Configuración predefinida';

View file

@ -44,6 +44,7 @@
$lang->point_upload_file = 'アップロード';
$lang->point_delete_file = 'ファイル削除';
$lang->point_download_file = 'ダウンロード';
$lang->point_read_document = '게시글 조회';
$lang->cmd_point_config = 'デフォルト設定';

View file

@ -44,6 +44,7 @@
$lang->point_upload_file = '파일 업로드';
$lang->point_delete_file = '파일 삭제';
$lang->point_download_file = '파일 다운로드 (이미지 제외)';
$lang->point_read_document = '게시글 조회';
$lang->cmd_point_config = '기본 설정';

View file

@ -44,6 +44,7 @@
$lang->point_upload_file = 'При закачке файлов';
$lang->point_delete_file = 'При скачке файлов';
$lang->point_download_file = 'При скачке файлов (кроме изображений)';
$lang->point_read_document = '게시글 조회';
$lang->cmd_point_config = 'Настройки по умолчанию';

View file

@ -44,6 +44,7 @@
$lang->point_upload_file = '上传文件';
$lang->point_delete_file = '删除文件';
$lang->point_download_file = '下载文件 (图片除外)';
$lang->point_read_document = '게시글 조회';
$lang->cmd_point_config = '基本设置';

View file

@ -30,6 +30,7 @@
$config->signup_point = (int)$args->signup_point;
$config->login_point = (int)$args->login_point;
$config->insert_document = (int)$args->insert_document;
$config->read_document = (int)$args->read_document;
$config->insert_comment = (int)$args->insert_comment;
$config->upload_file = (int)$args->upload_file;
$config->download_file = (int)$args->download_file;
@ -71,7 +72,7 @@
$args = Context::getRequestVars();
foreach($args as $key => $val) {
preg_match("/^(insert_document|insert_comment|upload_file|download_file)_([0-9]+)$/", $key, $matches);
preg_match("/^(insert_document|insert_comment|upload_file|download_file|read_document)_([0-9]+)$/", $key, $matches);
if(!$matches[1]) continue;
$name = $matches[1];
$module_srl = $matches[2];
@ -103,6 +104,7 @@
$config->module_point[$module_srl]['insert_comment'] = (int)Context::get('insert_comment');
$config->module_point[$module_srl]['upload_file'] = (int)Context::get('upload_file');
$config->module_point[$module_srl]['download_file'] = (int)Context::get('download_file');
$config->module_point[$module_srl]['read_document'] = (int)Context::get('read_document');
$oModuleController = &getController('module');
$oModuleController->insertModuleConfig('point', $config);

View file

@ -72,6 +72,9 @@
$config->download_file = -5;
$config->download_file_act = 'procFileDownload';
// 조회
$config->read_document = 0;
// 설정 저장
$oModuleController->insertModuleConfig('point', $config);
@ -91,6 +94,7 @@
$oModuleController->insertTrigger('file.downloadFile', 'point', 'controller', 'triggerDownloadFile', 'after');
$oModuleController->insertTrigger('member.doLogin', 'point', 'controller', 'triggerAfterLogin', 'after');
$oModuleController->insertTrigger('module.dispAdditionSetup', 'point', 'view', 'triggerDispPointAdditionSetup', 'after');
$oModuleController->insertTrigger('document.updateReadedCount', 'point', 'controller', 'triggerUpdateReadedCount', 'after');
return new Object();
}
@ -115,6 +119,7 @@
if(!$oModuleModel->getTrigger('file.downloadFile', 'point', 'controller', 'triggerDownloadFile', 'after')) return true;
if(!$oModuleModel->getTrigger('member.doLogin', 'point', 'controller', 'triggerAfterLogin', 'after')) return true;
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'point', 'view', 'triggerDispPointAdditionSetup', 'after')) return true;
if(!$oModuleModel->getTrigger('document.updateReadedCount', 'point', 'controller', 'triggerUpdateReadedCount', 'after')) return true;
return false;
}
@ -152,6 +157,8 @@
$oModuleController->insertTrigger('member.doLogin', 'point', 'controller', 'triggerAfterLogin', 'after');
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'point', 'view', 'triggerDispPointAdditionSetup', 'after'))
$oModuleController->insertTrigger('module.dispAdditionSetup', 'point', 'view', 'triggerDispPointAdditionSetup', 'after');
if(!$oModuleModel->getTrigger('document.updateReadedCount', 'point', 'controller', 'triggerUpdateReadedCount', 'after'))
$oModuleController->insertTrigger('document.updateReadedCount', 'point', 'controller', 'triggerUpdateReadedCount', 'after');
return new Object(0, 'success_updated');
}

View file

@ -309,6 +309,36 @@
return new Object();
}
/**
* @brief 조회수 증가시 포인트 적용
**/
function triggerUpdateReadedCount(&$obj) {
// 로그인 상태일때만 실행
$logged_info = Context::get('logged_info');
if(!$logged_info->member_srl) return new Object();
// point 모듈 정보 가져옴
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('point');
$member_srl = $logged_info->member_srl;
$module_srl = $obj->get('module_srl');
// 대상 회원의 포인트를 구함
$oPointModel = &getModel('point');
$cur_point = $oPointModel->getPoint($member_srl, true);
// 포인트를 구해옴
$point = $config->module_point[$obj->get('module_srl')]['read_document'];
if(!isset($point)) $point = $config->read_document;
// 포인트 증감
$cur_point += $point;
$this->setPoint($member_srl,$cur_point);
return new Object();
}
/**
* @brief 포인트 설정
**/

View file

@ -41,6 +41,7 @@
$module_config['insert_comment'] = $config->insert_comment;
$module_config['upload_file'] = $config->upload_file;
$module_config['download_file'] = $config->download_file;
$module_config['read_document'] = $config->read_document;
}
$module_config['module_srl'] = $current_module_srl;

View file

@ -31,7 +31,7 @@
</td>
</tr>
<tr>
<th scope="col" rowspan="6">{$lang->is_default}</th>
<th scope="col" rowspan="7">{$lang->is_default}</th>
<td colspan="2">{$lang->point_signup}</th>
<td>
<input type="text" class="inputTypeText w80" value="{$config->signup_point}" name="signup_point" /> {$config->point_name}
@ -58,6 +58,10 @@
<td colspan="2">{$lang->point_download_file}</td>
<td><input type="text" name="download_file" value="{$config->download_file}" class="inputTypeText w80" /> {$config->point_name}</td>
</tr>
<tr>
<td colspan="2">{$lang->point_read_document}</td>
<td><input type="text" name="read_document" value="{$config->read_document}" class="inputTypeText w80" /> {$config->point_name}</td>
</tr>
<tr>
<th scope="col">{$lang->level_icon}</th>
<td colspan="3">

View file

@ -9,17 +9,19 @@
<th>{$lang->point_insert_comment}</th>
<th>{$lang->point_upload_file}</th>
<th>{$lang->point_download_file}</th>
<th>{$lang->point_read_document}</th>
</tr>
<!--@foreach($mid_list as $key => $val)-->
<!--@if(in_array($val->module,array('guestbook','board','blog')))-->
<tr>
<th colspan="4" scope="col">{$val->browser_title} ({$val->mid})</th>
<th colspan="5" scope="col">{$val->browser_title} ({$val->mid})</th>
</tr>
<tr>
<td><input type="text" name="insert_document_{$val->module_srl}" value="{$config->module_point[$val->module_srl]['insert_document']}" class="inputTypeText w80" /> {$config->point_name}</td>
<td><input type="text" name="insert_comment_{$val->module_srl}" value="{$config->module_point[$val->module_srl]['insert_comment']}" class="inputTypeText w80" /> {$config->point_name}</td>
<td><input type="text" name="upload_file_{$val->module_srl}" value="{$config->module_point[$val->module_srl]['upload_file']}" class="inputTypeText w80" /> {$config->point_name}</td>
<td><input type="text" name="download_file_{$val->module_srl}" value="{$config->module_point[$val->module_srl]['download_file']}" class="inputTypeText w80" /> {$config->point_name}</td>
<td><input type="text" name="insert_document_{$val->module_srl}" value="{$config->module_point[$val->module_srl]['insert_document']}" class="inputTypeText w40" /> {$config->point_name}</td>
<td><input type="text" name="insert_comment_{$val->module_srl}" value="{$config->module_point[$val->module_srl]['insert_comment']}" class="inputTypeText w40" /> {$config->point_name}</td>
<td><input type="text" name="upload_file_{$val->module_srl}" value="{$config->module_point[$val->module_srl]['upload_file']}" class="inputTypeText w40" /> {$config->point_name}</td>
<td><input type="text" name="download_file_{$val->module_srl}" value="{$config->module_point[$val->module_srl]['download_file']}" class="inputTypeText w40" /> {$config->point_name}</td>
<td><input type="text" name="read_document_{$val->module_srl}" value="{$config->module_point[$val->module_srl]['read_document']}" class="inputTypeText w40" /> {$config->point_name}</td>
</tr>
<!--@end-->
<!--@end-->

View file

@ -7,18 +7,26 @@
<caption>{$lang->point}</caption>
<tr>
<th>{$lang->point_insert_document}</th>
<th>{$lang->point_insert_comment}</th>
<th>{$lang->point_upload_file}</th>
<th>{$lang->point_download_file}</th>
<td><input type="text" name="insert_document" value="{$module_config['insert_document']}" class="inputTypeText w80" /> {$module_config['point_name']}</td>
</tr>
<tr>
<td><input type="text" name="insert_document" value="{$module_config['insert_document']}" class="inputTypeText w80" /> {$module_config['point_name']}</td>
<th>{$lang->point_insert_comment}</th>
<td><input type="text" name="insert_comment" value="{$module_config['insert_comment']}" class="inputTypeText w80" /> {$module_config['point_name']}</td>
</tr>
<tr>
<th>{$lang->point_upload_file}</th>
<td><input type="text" name="upload_file" value="{$module_config['upload_file']}" class="inputTypeText w80" /> {$module_config['point_name']}</td>
</tr>
<tr>
<th>{$lang->point_download_file}</th>
<td><input type="text" name="download_file" value="{$module_config['download_file']}" class="inputTypeText w80" /> {$module_config['point_name']}</td>
</tr>
<tr>
<th colspan="4" class="button"><span class="button"><input type="submit" value="{$lang->cmd_save}" /></span></th>
<th>{$lang->point_read_document}</th>
<td><input type="text" name="read_document" value="{$module_config['read_document']}" class="inputTypeText w80" /> {$module_config['point_name']}</td>
</tr>
<tr>
<th colspan="2" class="button"><span class="button"><input type="submit" value="{$lang->cmd_save}" /></span></th>
</tr>
</table>