diff --git a/modules/document/document.controller.php b/modules/document/document.controller.php index ff5cedfd2..cb58526d2 100644 --- a/modules/document/document.controller.php +++ b/modules/document/document.controller.php @@ -415,14 +415,22 @@ $args->voted_count = $oDocument->get('voted_count') + $point; $output = executeQuery('document.updateVotedCount', $args); } + if(!$output->toBool()) return $output; // 로그 남기기 $args->point = $point; $output = executeQuery('document.insertDocumentVotedLog', $args); + if(!$output->toBool()) return $output; // 세션 정보에 남김 $_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) return new Object(0, 'success_voted'); diff --git a/modules/point/lang/en.lang.php b/modules/point/lang/en.lang.php index 3bfea5867..67f988279 100644 --- a/modules/point/lang/en.lang.php +++ b/modules/point/lang/en.lang.php @@ -48,6 +48,8 @@ $lang->point_delete_file = 'On Deleting Files'; $lang->point_download_file = 'On Downloading Files (Exclude images)'; $lang->point_read_document = 'On Reading'; + $lang->point_voted = 'On Recommended'; + $lang->point_blamed = 'On Blamed'; $lang->cmd_point_config = 'Default Setting'; diff --git a/modules/point/lang/es.lang.php b/modules/point/lang/es.lang.php index f0b9c7978..3eb4aadf9 100644 --- a/modules/point/lang/es.lang.php +++ b/modules/point/lang/es.lang.php @@ -48,6 +48,8 @@ $lang->point_delete_file = 'Al borrar archivos'; $lang->point_download_file = 'Al descargar archivos (Excepto imágenes)'; $lang->point_read_document = 'El Reading'; + $lang->point_voted = '추천 받음'; + $lang->point_blamed = '비추천 받음'; $lang->cmd_point_config = 'Configuración predefinida'; diff --git a/modules/point/lang/jp.lang.php b/modules/point/lang/jp.lang.php index b16ba2c92..041db5e44 100644 --- a/modules/point/lang/jp.lang.php +++ b/modules/point/lang/jp.lang.php @@ -48,6 +48,8 @@ $lang->point_delete_file = 'ファイル削除'; $lang->point_download_file = 'ダウンロード'; $lang->point_read_document = '書き込み照会'; + $lang->point_voted = '추천 받음'; + $lang->point_blamed = '비추천 받음'; $lang->cmd_point_config = 'デフォルト設定'; diff --git a/modules/point/lang/ko.lang.php b/modules/point/lang/ko.lang.php index c3c4d1785..15eb8d59b 100644 --- a/modules/point/lang/ko.lang.php +++ b/modules/point/lang/ko.lang.php @@ -48,7 +48,8 @@ $lang->point_delete_file = '파일 삭제'; $lang->point_download_file = '파일 다운로드 (이미지 제외)'; $lang->point_read_document = '게시글 조회'; - + $lang->point_voted = '추천 받음'; + $lang->point_blamed = '비추천 받음'; $lang->cmd_point_config = '기본 설정'; $lang->cmd_point_module_config = '모듈별 설정'; diff --git a/modules/point/lang/ru.lang.php b/modules/point/lang/ru.lang.php index ad5e92199..38ff7b1f2 100644 --- a/modules/point/lang/ru.lang.php +++ b/modules/point/lang/ru.lang.php @@ -48,6 +48,8 @@ $lang->point_delete_file = 'При скачке файлов'; $lang->point_download_file = 'При скачке файлов (кроме изображений)'; $lang->point_read_document = '게시글 조회'; + $lang->point_voted = '추천 받음'; + $lang->point_blamed = '비추천 받음'; $lang->cmd_point_config = 'Настройки по умолчанию'; diff --git a/modules/point/lang/zh-CN.lang.php b/modules/point/lang/zh-CN.lang.php index f7d51e4de..378a64c2d 100644 --- a/modules/point/lang/zh-CN.lang.php +++ b/modules/point/lang/zh-CN.lang.php @@ -48,6 +48,8 @@ $lang->point_delete_file = '删除文件'; $lang->point_download_file = '下载文件 (图片除外)'; $lang->point_read_document = '查看主题'; + $lang->point_voted = '추천 받음'; + $lang->point_blamed = '비추천 받음'; $lang->cmd_point_config = '基本设置'; diff --git a/modules/point/point.admin.controller.php b/modules/point/point.admin.controller.php index 4ef8cb560..d1fa15f59 100644 --- a/modules/point/point.admin.controller.php +++ b/modules/point/point.admin.controller.php @@ -36,6 +36,8 @@ $config->insert_comment = (int)$args->insert_comment; $config->upload_file = (int)$args->upload_file; $config->download_file = (int)$args->download_file; + $config->voted = (int)$args->voted; + $config->blamed = (int)$args->blamed; // 최고 레벨 $config->max_level = $args->max_level; @@ -89,7 +91,7 @@ $args = Context::getRequestVars(); 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; $name = $matches[1]; $module_srl = $matches[2]; @@ -130,6 +132,8 @@ $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]['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'); diff --git a/modules/point/point.class.php b/modules/point/point.class.php index b5c2c93b1..5c67e638f 100644 --- a/modules/point/point.class.php +++ b/modules/point/point.class.php @@ -75,6 +75,10 @@ // 조회 $config->read_document = 0; + // 추천 / 비추천 + $config->voted = 0; + $config->blamed = 0; + // 설정 저장 $oModuleController->insertModuleConfig('point', $config); @@ -96,6 +100,9 @@ $oModuleController->insertTrigger('module.dispAdditionSetup', 'point', 'view', 'triggerDispPointAdditionSetup', 'after'); $oModuleController->insertTrigger('document.updateReadedCount', 'point', 'controller', 'triggerUpdateReadedCount', 'after'); + // 추천 / 비추천에 대한 트리거 추가 2008.05.13 haneul + $oModuleController->insertTrigger('document.updateVotedCount', 'point', 'controller', 'triggerUpdateVotedCount', 'after'); + return new Object(); } @@ -121,6 +128,9 @@ if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'point', 'view', 'triggerDispPointAdditionSetup', '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; } @@ -160,6 +170,10 @@ if(!$oModuleModel->getTrigger('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'); } diff --git a/modules/point/point.controller.php b/modules/point/point.controller.php index b62e50a0f..349453af7 100644 --- a/modules/point/point.controller.php +++ b/modules/point/point.controller.php @@ -351,6 +351,41 @@ 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 포인트 설정 **/ diff --git a/modules/point/point.view.php b/modules/point/point.view.php index 9c47076bb..d3333ae26 100644 --- a/modules/point/point.view.php +++ b/modules/point/point.view.php @@ -42,6 +42,10 @@ $module_config['upload_file'] = $config->upload_file; $module_config['download_file'] = $config->download_file; $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; diff --git a/modules/point/tpl/config.html b/modules/point/tpl/config.html index 14035a43f..46b23d990 100644 --- a/modules/point/tpl/config.html +++ b/modules/point/tpl/config.html @@ -44,7 +44,7 @@ - {$lang->is_default} + {$lang->is_default} {$lang->point_signup} {$config->point_name} @@ -75,6 +75,14 @@ {$lang->point_read_document} {$config->point_name} + + {$lang->point_voted} + {$config->point_name} + + + {$lang->point_blamed} + {$config->point_name} + {$lang->level_icon} diff --git a/modules/point/tpl/module_config.html b/modules/point/tpl/module_config.html index 260ec59ab..95fe45fb5 100644 --- a/modules/point/tpl/module_config.html +++ b/modules/point/tpl/module_config.html @@ -10,11 +10,13 @@ {$lang->point_upload_file} {$lang->point_download_file} {$lang->point_read_document} + {$lang->point_voted} + {$lang->point_blamed} - {$val->browser_title} ({$val->mid}) + {$val->browser_title} ({$val->mid}) {$config->point_name} @@ -22,6 +24,8 @@ {$config->point_name} {$config->point_name} {$config->point_name} + {$config->point_name} + {$config->point_name} diff --git a/modules/point/tpl/point_module_config.html b/modules/point/tpl/point_module_config.html index 0ac5d524f..378a2bc2b 100644 --- a/modules/point/tpl/point_module_config.html +++ b/modules/point/tpl/point_module_config.html @@ -27,6 +27,14 @@ {$lang->point_read_document} {$module_config['point_name']} + + {$lang->point_voted} + {$module_config['point_name']} + + + {$lang->point_blamed} + {$module_config['point_name']} +