#410. trigger로 추천, 비추천에 따른 포인트 변동 기능 지원

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4194 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
haneul 2008-05-14 04:35:18 +00:00
parent 75ff83f052
commit 296c181762
14 changed files with 100 additions and 4 deletions

View file

@ -415,14 +415,22 @@
$args->voted_count = $oDocument->get('voted_count') + $point; $args->voted_count = $oDocument->get('voted_count') + $point;
$output = executeQuery('document.updateVotedCount', $args); $output = executeQuery('document.updateVotedCount', $args);
} }
if(!$output->toBool()) return $output;
// 로그 남기기 // 로그 남기기
$args->point = $point; $args->point = $point;
$output = executeQuery('document.insertDocumentVotedLog', $args); $output = executeQuery('document.insertDocumentVotedLog', $args);
if(!$output->toBool()) return $output;
// 세션 정보에 남김 // 세션 정보에 남김
$_SESSION['voted_document'][$document_srl] = true; $_SESSION['voted_document'][$document_srl] = true;
$obj->member_srl = $oDocument->get('member_srl');
$obj->module_srl = $oDocument->get('module_srl');
$obj->point = $point;
$output = ModuleHandler::triggerCall('document.updateVotedCount', 'after', $obj);
if(!$output->toBool()) return $output;
// 결과 리턴 // 결과 리턴
if($point > 0) if($point > 0)
return new Object(0, 'success_voted'); return new Object(0, 'success_voted');

View file

@ -48,6 +48,8 @@
$lang->point_delete_file = 'On Deleting Files'; $lang->point_delete_file = 'On Deleting Files';
$lang->point_download_file = 'On Downloading Files (Exclude images)'; $lang->point_download_file = 'On Downloading Files (Exclude images)';
$lang->point_read_document = 'On Reading'; $lang->point_read_document = 'On Reading';
$lang->point_voted = 'On Recommended';
$lang->point_blamed = 'On Blamed';
$lang->cmd_point_config = 'Default Setting'; $lang->cmd_point_config = 'Default Setting';

View file

@ -48,6 +48,8 @@
$lang->point_delete_file = 'Al borrar archivos'; $lang->point_delete_file = 'Al borrar archivos';
$lang->point_download_file = 'Al descargar archivos (Excepto imágenes)'; $lang->point_download_file = 'Al descargar archivos (Excepto imágenes)';
$lang->point_read_document = 'El Reading'; $lang->point_read_document = 'El Reading';
$lang->point_voted = '추천 받음';
$lang->point_blamed = '비추천 받음';
$lang->cmd_point_config = 'Configuración predefinida'; $lang->cmd_point_config = 'Configuración predefinida';

View file

@ -48,6 +48,8 @@
$lang->point_delete_file = 'ファイル削除'; $lang->point_delete_file = 'ファイル削除';
$lang->point_download_file = 'ダウンロード'; $lang->point_download_file = 'ダウンロード';
$lang->point_read_document = '書き込み照会'; $lang->point_read_document = '書き込み照会';
$lang->point_voted = '추천 받음';
$lang->point_blamed = '비추천 받음';
$lang->cmd_point_config = 'デフォルト設定'; $lang->cmd_point_config = 'デフォルト設定';

View file

@ -48,7 +48,8 @@
$lang->point_delete_file = '파일 삭제'; $lang->point_delete_file = '파일 삭제';
$lang->point_download_file = '파일 다운로드 (이미지 제외)'; $lang->point_download_file = '파일 다운로드 (이미지 제외)';
$lang->point_read_document = '게시글 조회'; $lang->point_read_document = '게시글 조회';
$lang->point_voted = '추천 받음';
$lang->point_blamed = '비추천 받음';
$lang->cmd_point_config = '기본 설정'; $lang->cmd_point_config = '기본 설정';
$lang->cmd_point_module_config = '모듈별 설정'; $lang->cmd_point_module_config = '모듈별 설정';

View file

@ -48,6 +48,8 @@
$lang->point_delete_file = 'При скачке файлов'; $lang->point_delete_file = 'При скачке файлов';
$lang->point_download_file = 'При скачке файлов (кроме изображений)'; $lang->point_download_file = 'При скачке файлов (кроме изображений)';
$lang->point_read_document = '게시글 조회'; $lang->point_read_document = '게시글 조회';
$lang->point_voted = '추천 받음';
$lang->point_blamed = '비추천 받음';
$lang->cmd_point_config = 'Настройки по умолчанию'; $lang->cmd_point_config = 'Настройки по умолчанию';

View file

@ -48,6 +48,8 @@
$lang->point_delete_file = '删除文件'; $lang->point_delete_file = '删除文件';
$lang->point_download_file = '下载文件 (图片除外)'; $lang->point_download_file = '下载文件 (图片除外)';
$lang->point_read_document = '查看主题'; $lang->point_read_document = '查看主题';
$lang->point_voted = '추천 받음';
$lang->point_blamed = '비추천 받음';
$lang->cmd_point_config = '基本设置'; $lang->cmd_point_config = '基本设置';

View file

@ -36,6 +36,8 @@
$config->insert_comment = (int)$args->insert_comment; $config->insert_comment = (int)$args->insert_comment;
$config->upload_file = (int)$args->upload_file; $config->upload_file = (int)$args->upload_file;
$config->download_file = (int)$args->download_file; $config->download_file = (int)$args->download_file;
$config->voted = (int)$args->voted;
$config->blamed = (int)$args->blamed;
// 최고 레벨 // 최고 레벨
$config->max_level = $args->max_level; $config->max_level = $args->max_level;
@ -89,7 +91,7 @@
$args = Context::getRequestVars(); $args = Context::getRequestVars();
foreach($args as $key => $val) { foreach($args as $key => $val) {
preg_match("/^(insert_document|insert_comment|upload_file|download_file|read_document)_([0-9]+)$/", $key, $matches); preg_match("/^(insert_document|insert_comment|upload_file|download_file|read_document|voted|blamed)_([0-9]+)$/", $key, $matches);
if(!$matches[1]) continue; if(!$matches[1]) continue;
$name = $matches[1]; $name = $matches[1];
$module_srl = $matches[2]; $module_srl = $matches[2];
@ -130,6 +132,8 @@
$config->module_point[$srl]['upload_file'] = (int)Context::get('upload_file'); $config->module_point[$srl]['upload_file'] = (int)Context::get('upload_file');
$config->module_point[$srl]['download_file'] = (int)Context::get('download_file'); $config->module_point[$srl]['download_file'] = (int)Context::get('download_file');
$config->module_point[$srl]['read_document'] = (int)Context::get('read_document'); $config->module_point[$srl]['read_document'] = (int)Context::get('read_document');
$config->module_point[$srl]['voted'] = (int)Context::get('voted');
$config->module_point[$srl]['blamed'] = (int)Context::get('blamed');
} }
$oModuleController = &getController('module'); $oModuleController = &getController('module');

View file

@ -75,6 +75,10 @@
// 조회 // 조회
$config->read_document = 0; $config->read_document = 0;
// 추천 / 비추천
$config->voted = 0;
$config->blamed = 0;
// 설정 저장 // 설정 저장
$oModuleController->insertModuleConfig('point', $config); $oModuleController->insertModuleConfig('point', $config);
@ -96,6 +100,9 @@
$oModuleController->insertTrigger('module.dispAdditionSetup', 'point', 'view', 'triggerDispPointAdditionSetup', 'after'); $oModuleController->insertTrigger('module.dispAdditionSetup', 'point', 'view', 'triggerDispPointAdditionSetup', 'after');
$oModuleController->insertTrigger('document.updateReadedCount', 'point', 'controller', 'triggerUpdateReadedCount', 'after'); $oModuleController->insertTrigger('document.updateReadedCount', 'point', 'controller', 'triggerUpdateReadedCount', 'after');
// 추천 / 비추천에 대한 트리거 추가 2008.05.13 haneul
$oModuleController->insertTrigger('document.updateVotedCount', 'point', 'controller', 'triggerUpdateVotedCount', 'after');
return new Object(); return new Object();
} }
@ -121,6 +128,9 @@
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'point', 'view', 'triggerDispPointAdditionSetup', '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; if(!$oModuleModel->getTrigger('document.updateReadedCount', 'point', 'controller', 'triggerUpdateReadedCount', 'after')) return true;
// 추천 / 비추천에 대한 트리거 추가 2008.05.13 haneul
if(!$oModuleModel->getTrigger('document.updateVotedCount', 'point', 'controller', 'triggerUpdateVotedCount', 'after')) return true;
return false; return false;
} }
@ -160,6 +170,10 @@
if(!$oModuleModel->getTrigger('document.updateReadedCount', 'point', 'controller', 'triggerUpdateReadedCount', 'after')) if(!$oModuleModel->getTrigger('document.updateReadedCount', 'point', 'controller', 'triggerUpdateReadedCount', 'after'))
$oModuleController->insertTrigger('document.updateReadedCount', 'point', 'controller', 'triggerUpdateReadedCount', 'after'); $oModuleController->insertTrigger('document.updateReadedCount', 'point', 'controller', 'triggerUpdateReadedCount', 'after');
// 추천 / 비추천에 대한 트리거 추가 2008.05.13 haneul
if(!$oModuleModel->getTrigger('document.updateVotedCount', 'point', 'controller', 'triggerUpdateVotedCount', 'after'))
$oModuleController->insertTrigger('document.updateVotedCount', 'point', 'controller', 'triggerUpdateVotedCount', 'after');
return new Object(0, 'success_updated'); return new Object(0, 'success_updated');
} }

View file

@ -351,6 +351,41 @@
return new Object(); return new Object();
} }
/**
* @brief 추천/비추천 포인트 적용
**/
function triggerUpdateVotedCount(&$obj) {
$module_srl = $obj->module_srl;
$member_srl = $obj->member_srl;
if(!$module_srl || !$member_srl) return new Object();
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('point');
$oPointModel = &getModel('point');
$cur_point = $oPointModel->getPoint($member_srl, true);
if( $obj->point > 0 )
{
$point = $config->module_point[$module_srl]['voted'];
if(!isset($point)) $point = $config->voted;
}
else
{
$point = $config->module_point[$module_srl]['blamed'];
if(!isset($point)) $point = $config->blamed;
}
if(!$point) return new Object();
// 포인트 증감
$cur_point += $point;
$this->setPoint($member_srl,$cur_point);
return new Object();
}
/** /**
* @brief 포인트 설정 * @brief 포인트 설정
**/ **/

View file

@ -42,6 +42,10 @@
$module_config['upload_file'] = $config->upload_file; $module_config['upload_file'] = $config->upload_file;
$module_config['download_file'] = $config->download_file; $module_config['download_file'] = $config->download_file;
$module_config['read_document'] = $config->read_document; $module_config['read_document'] = $config->read_document;
//2008.05.13 haneul
$module_config['voted'] = $config->voted;
$module_config['blamed'] = $config->blamed;
} }
$module_config['module_srl'] = $current_module_srl; $module_config['module_srl'] = $current_module_srl;

View file

@ -44,7 +44,7 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="col" rowspan="7">{$lang->is_default}</th> <th scope="col" rowspan="9">{$lang->is_default}</th>
<td colspan="2">{$lang->point_signup}</th> <td colspan="2">{$lang->point_signup}</th>
<td> <td>
<input type="text" class="inputTypeText w80" value="{$config->signup_point}" name="signup_point" /> {$config->point_name} <input type="text" class="inputTypeText w80" value="{$config->signup_point}" name="signup_point" /> {$config->point_name}
@ -75,6 +75,14 @@
<td colspan="2">{$lang->point_read_document}</td> <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> <td><input type="text" name="read_document" value="{$config->read_document}" class="inputTypeText w80" /> {$config->point_name}</td>
</tr> </tr>
<tr>
<td colspan="2">{$lang->point_voted}</td>
<td><input type="text" name="voted" value="{$config->voted}" class="inputTypeText w80" /> {$config->point_name}</td>
</tr>
<tr>
<td colspan="2">{$lang->point_blamed}</td>
<td><input type="text" name="blamed" value="{$config->blamed}" class="inputTypeText w80" /> {$config->point_name}</td>
</tr>
<tr> <tr>
<th scope="col">{$lang->level_icon}</th> <th scope="col">{$lang->level_icon}</th>
<td colspan="3"> <td colspan="3">

View file

@ -10,11 +10,13 @@
<th>{$lang->point_upload_file}</th> <th>{$lang->point_upload_file}</th>
<th>{$lang->point_download_file}</th> <th>{$lang->point_download_file}</th>
<th>{$lang->point_read_document}</th> <th>{$lang->point_read_document}</th>
<th>{$lang->point_voted}</th>
<th>{$lang->point_blamed}</th>
</tr> </tr>
<!--@foreach($mid_list as $key => $val)--> <!--@foreach($mid_list as $key => $val)-->
<!--@if(in_array($val->module,array('guestbook','board','blog')))--> <!--@if(in_array($val->module,array('guestbook','board','blog')))-->
<tr> <tr>
<th colspan="5" scope="col">{$val->browser_title} ({$val->mid})</th> <th colspan="7" scope="col">{$val->browser_title} ({$val->mid})</th>
</tr> </tr>
<tr> <tr>
<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_document_{$val->module_srl}" value="{$config->module_point[$val->module_srl]['insert_document']}" class="inputTypeText w40" /> {$config->point_name}</td>
@ -22,6 +24,8 @@
<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="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="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> <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>
<td><input type="text" name="voted_{$val->module_srl}" value="{$config->module_point[$val->module_srl]['voted']}" class="inputTypeText w40" /> {$config->point_name}</td>
<td><input type="text" name="blamed_{$val->module_srl}" value="{$config->module_point[$val->module_srl]['blamed']}" class="inputTypeText w40" /> {$config->point_name}</td>
</tr> </tr>
<!--@end--> <!--@end-->
<!--@end--> <!--@end-->

View file

@ -27,6 +27,14 @@
<th>{$lang->point_read_document}</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> <td><input type="text" name="read_document" value="{$module_config['read_document']}" class="inputTypeText w80" /> {$module_config['point_name']}</td>
</tr> </tr>
<tr>
<th>{$lang->point_voted}</th>
<td><input type="text" name="voted" value="{$module_config['voted']}" class="inputTypeText w80" /> {$module_config['point_name']}</td>
</tr>
<tr>
<th>{$lang->point_blamed}</th>
<td><input type="text" name="blamed" value="{$module_config['blamed']}" class="inputTypeText w80" /> {$module_config['point_name']}</td>
</tr>
<tr> <tr>
<th colspan="2" class="button"><span class="button"><input type="submit" value="{$lang->cmd_save}" /></span></th> <th colspan="2" class="button"><span class="button"><input type="submit" value="{$lang->cmd_save}" /></span></th>
</tr> </tr>