mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-10 04:24:14 +09:00
issue 2662 point
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12256 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
7bb7241447
commit
580222822a
6 changed files with 1462 additions and 1371 deletions
|
|
@ -3,20 +3,21 @@
|
||||||
* @class pointAdminController
|
* @class pointAdminController
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief The admin controller class of the point module
|
* @brief The admin controller class of the point module
|
||||||
**/
|
*/
|
||||||
|
class pointAdminController extends point
|
||||||
class pointAdminController extends point {
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialization
|
* @brief Initialization
|
||||||
**/
|
*/
|
||||||
function init() {
|
function init()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Save the default configurations
|
* @brief Save the default configurations
|
||||||
**/
|
*/
|
||||||
function procPointAdminInsertConfig() {
|
function procPointAdminInsertConfig()
|
||||||
|
{
|
||||||
// Get the configuration information
|
// Get the configuration information
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$config = $oModuleModel->getModuleConfig('point');
|
$config = $oModuleModel->getModuleConfig('point');
|
||||||
|
|
@ -71,7 +72,8 @@
|
||||||
$config->group_reset = $args->group_reset;
|
$config->group_reset = $args->group_reset;
|
||||||
// Per-level point configurations
|
// Per-level point configurations
|
||||||
unset($config->level_step);
|
unset($config->level_step);
|
||||||
for($i=1;$i<=$config->max_level;$i++) {
|
for($i=1;$i<=$config->max_level;$i++)
|
||||||
|
{
|
||||||
$key = "level_step_".$i;
|
$key = "level_step_".$i;
|
||||||
$config->level_step[$i] = (int)$args->{$key};
|
$config->level_step[$i] = (int)$args->{$key};
|
||||||
}
|
}
|
||||||
|
|
@ -89,11 +91,13 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Save per-module configurations
|
* @brief Save per-module configurations
|
||||||
**/
|
*/
|
||||||
function procPointAdminInsertModuleConfig() {
|
function procPointAdminInsertModuleConfig()
|
||||||
|
{
|
||||||
$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|voted|blamed)_([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];
|
||||||
|
|
@ -102,14 +106,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$oModuleController = &getController('module');
|
$oModuleController = &getController('module');
|
||||||
if(count($module_config)) {
|
if(count($module_config))
|
||||||
foreach($module_config as $module_srl => $config) {
|
{
|
||||||
|
foreach($module_config as $module_srl => $config)
|
||||||
|
{
|
||||||
$oModuleController->insertModulePartConfig('point',$module_srl,$config);
|
$oModuleController->insertModulePartConfig('point',$module_srl,$config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setMessage('success_updated');
|
$this->setMessage('success_updated');
|
||||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
|
||||||
|
{
|
||||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispPointAdminModuleConfig');
|
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispPointAdminModuleConfig');
|
||||||
header('location:'.$returnUrl);
|
header('location:'.$returnUrl);
|
||||||
return;
|
return;
|
||||||
|
|
@ -118,8 +125,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Save individual points per module
|
* @brief Save individual points per module
|
||||||
**/
|
*/
|
||||||
function procPointAdminInsertPointModuleConfig() {
|
function procPointAdminInsertPointModuleConfig()
|
||||||
|
{
|
||||||
$module_srl = Context::get('target_module_srl');
|
$module_srl = Context::get('target_module_srl');
|
||||||
if(!$module_srl) return new Object(-1, 'msg_invalid_request');
|
if(!$module_srl) return new Object(-1, 'msg_invalid_request');
|
||||||
// In case of batch configuration of several modules
|
// In case of batch configuration of several modules
|
||||||
|
|
@ -127,7 +135,8 @@
|
||||||
else $module_srl = array($module_srl);
|
else $module_srl = array($module_srl);
|
||||||
// Save configurations
|
// Save configurations
|
||||||
$oModuleController = &getController('module');
|
$oModuleController = &getController('module');
|
||||||
for($i=0;$i<count($module_srl);$i++) {
|
for($i=0;$i<count($module_srl);$i++)
|
||||||
|
{
|
||||||
$srl = trim($module_srl[$i]);
|
$srl = trim($module_srl[$i]);
|
||||||
if(!$srl) continue;
|
if(!$srl) continue;
|
||||||
unset($config);
|
unset($config);
|
||||||
|
|
@ -150,8 +159,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Change members points
|
* @brief Change members points
|
||||||
**/
|
*/
|
||||||
function procPointAdminUpdatePoint() {
|
function procPointAdminUpdatePoint()
|
||||||
|
{
|
||||||
$member_srl = Context::get('member_srl');
|
$member_srl = Context::get('member_srl');
|
||||||
$point = Context::get('point');
|
$point = Context::get('point');
|
||||||
|
|
||||||
|
|
@ -163,11 +173,9 @@
|
||||||
case '+':
|
case '+':
|
||||||
$action = 'add';
|
$action = 'add';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '-':
|
case '-':
|
||||||
$action = 'minus';
|
$action = 'minus';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$action = 'update';
|
$action = 'update';
|
||||||
break;
|
break;
|
||||||
|
|
@ -186,8 +194,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Recalculate points based on the list/comment/attachment and registration information. Granted only once a first-time login score.
|
* @brief Recalculate points based on the list/comment/attachment and registration information. Granted only once a first-time login score.
|
||||||
**/
|
*/
|
||||||
function procPointAdminReCal() {
|
function procPointAdminReCal()
|
||||||
|
{
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
// Get per-module points information
|
// Get per-module points information
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
|
|
@ -201,8 +210,10 @@
|
||||||
$output = executeQueryArray('point.getMemberCount');
|
$output = executeQueryArray('point.getMemberCount');
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
|
||||||
if($output->data) {
|
if($output->data)
|
||||||
foreach($output->data as $key => $val) {
|
{
|
||||||
|
foreach($output->data as $key => $val)
|
||||||
|
{
|
||||||
if(!$val->member_srl) continue;
|
if(!$val->member_srl) continue;
|
||||||
$member[$val->member_srl] = 0;
|
$member[$val->member_srl] = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -212,8 +223,10 @@
|
||||||
$output = executeQueryArray('point.getDocumentPoint');
|
$output = executeQueryArray('point.getDocumentPoint');
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
|
||||||
if($output->data) {
|
if($output->data)
|
||||||
foreach($output->data as $key => $val) {
|
{
|
||||||
|
foreach($output->data as $key => $val)
|
||||||
|
{
|
||||||
if($module_config[$val->module_srl]['insert_document']) $insert_point = $module_config[$val->module_srl]['insert_document'];
|
if($module_config[$val->module_srl]['insert_document']) $insert_point = $module_config[$val->module_srl]['insert_document'];
|
||||||
else $insert_point = $config->insert_document;
|
else $insert_point = $config->insert_document;
|
||||||
|
|
||||||
|
|
@ -228,8 +241,10 @@
|
||||||
$output = executeQueryArray('point.getCommentPoint');
|
$output = executeQueryArray('point.getCommentPoint');
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
|
||||||
if($output->data) {
|
if($output->data)
|
||||||
foreach($output->data as $key => $val) {
|
{
|
||||||
|
foreach($output->data as $key => $val)
|
||||||
|
{
|
||||||
if($module_config[$val->module_srl]['insert_comment']) $insert_point = $module_config[$val->module_srl]['insert_comment'];
|
if($module_config[$val->module_srl]['insert_comment']) $insert_point = $module_config[$val->module_srl]['insert_comment'];
|
||||||
else $insert_point = $config->insert_comment;
|
else $insert_point = $config->insert_comment;
|
||||||
|
|
||||||
|
|
@ -243,8 +258,10 @@
|
||||||
$output = executeQueryArray('point.getFilePoint');
|
$output = executeQueryArray('point.getFilePoint');
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
|
||||||
if($output->data) {
|
if($output->data)
|
||||||
foreach($output->data as $key => $val) {
|
{
|
||||||
|
foreach($output->data as $key => $val)
|
||||||
|
{
|
||||||
if($module_config[$val->module_srl]['upload_file']) $insert_point = $module_config[$val->module_srl]['upload_file'];
|
if($module_config[$val->module_srl]['upload_file']) $insert_point = $module_config[$val->module_srl]['upload_file'];
|
||||||
else $insert_point = $config->upload_file;
|
else $insert_point = $config->upload_file;
|
||||||
|
|
||||||
|
|
@ -259,7 +276,8 @@
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
// Save the file temporarily
|
// Save the file temporarily
|
||||||
$f = fopen("./files/cache/pointRecal.txt","w");
|
$f = fopen("./files/cache/pointRecal.txt","w");
|
||||||
foreach($member as $key => $val) {
|
foreach($member as $key => $val)
|
||||||
|
{
|
||||||
$val += (int)$config->signup_point;
|
$val += (int)$config->signup_point;
|
||||||
fwrite($f, $key.','.$val."\r\n");
|
fwrite($f, $key.','.$val."\r\n");
|
||||||
}
|
}
|
||||||
|
|
@ -272,8 +290,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Apply member points saved by file to units of 5,000 people
|
* @brief Apply member points saved by file to units of 5,000 people
|
||||||
**/
|
*/
|
||||||
function procPointAdminApplyPoint() {
|
function procPointAdminApplyPoint()
|
||||||
|
{
|
||||||
$position = (int)Context::get('position');
|
$position = (int)Context::get('position');
|
||||||
$total = (int)Context::get('total');
|
$total = (int)Context::get('total');
|
||||||
|
|
||||||
|
|
@ -281,10 +300,12 @@
|
||||||
|
|
||||||
$idx = 0;
|
$idx = 0;
|
||||||
$f = fopen("./files/cache/pointRecal.txt","r");
|
$f = fopen("./files/cache/pointRecal.txt","r");
|
||||||
while(!feof($f)) {
|
while(!feof($f))
|
||||||
|
{
|
||||||
$str = trim(fgets($f, 1024));
|
$str = trim(fgets($f, 1024));
|
||||||
$idx ++;
|
$idx ++;
|
||||||
if($idx > $position) {
|
if($idx > $position)
|
||||||
|
{
|
||||||
list($member_srl, $point) = explode(',',$str);
|
list($member_srl, $point) = explode(',',$str);
|
||||||
|
|
||||||
$args = null;
|
$args = null;
|
||||||
|
|
@ -295,7 +316,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(feof($f)) {
|
if(feof($f))
|
||||||
|
{
|
||||||
FileHandler::removeFile('./files/cache/pointRecal.txt');
|
FileHandler::removeFile('./files/cache/pointRecal.txt');
|
||||||
$idx = $total;
|
$idx = $total;
|
||||||
|
|
||||||
|
|
@ -313,8 +335,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Reset points for each module
|
* @brief Reset points for each module
|
||||||
**/
|
*/
|
||||||
function procPointAdminReset() {
|
function procPointAdminReset()
|
||||||
|
{
|
||||||
$module_srl = Context::get('module_srls');
|
$module_srl = Context::get('module_srls');
|
||||||
if(!$module_srl) return new Object(-1, 'msg_invalid_request');
|
if(!$module_srl) return new Object(-1, 'msg_invalid_request');
|
||||||
// In case of batch configuration of several modules
|
// In case of batch configuration of several modules
|
||||||
|
|
@ -322,7 +345,8 @@
|
||||||
else $module_srl = array($module_srl);
|
else $module_srl = array($module_srl);
|
||||||
// Save configurations
|
// Save configurations
|
||||||
$oModuleController = &getController('module');
|
$oModuleController = &getController('module');
|
||||||
for($i=0;$i<count($module_srl);$i++) {
|
for($i=0;$i<count($module_srl);$i++)
|
||||||
|
{
|
||||||
$srl = trim($module_srl[$i]);
|
$srl = trim($module_srl[$i]);
|
||||||
if(!$srl) continue;
|
if(!$srl) continue;
|
||||||
unset($args);
|
unset($args);
|
||||||
|
|
@ -337,10 +361,11 @@
|
||||||
/**
|
/**
|
||||||
* @brief Save the cache files
|
* @brief Save the cache files
|
||||||
* @deprecated
|
* @deprecated
|
||||||
**/
|
*/
|
||||||
function cacheActList() {
|
function cacheActList()
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
/* End of file point.admin.controller.php */
|
||||||
|
/* Location: ./modules/point/point.admin.controller.php */
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,14 @@
|
||||||
* @class pointAdminView
|
* @class pointAdminView
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief The admin view class of the point module
|
* @brief The admin view class of the point module
|
||||||
**/
|
*/
|
||||||
|
class pointAdminView extends point
|
||||||
class pointAdminView extends point {
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialization
|
* @brief Initialization
|
||||||
**/
|
*/
|
||||||
function init() {
|
function init()
|
||||||
|
{
|
||||||
// Get teh configuration information
|
// Get teh configuration information
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$config = $oModuleModel->getModuleConfig('point');
|
$config = $oModuleModel->getModuleConfig('point');
|
||||||
|
|
@ -28,8 +28,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Default configurations
|
* @brief Default configurations
|
||||||
**/
|
*/
|
||||||
function dispPointAdminConfig() {
|
function dispPointAdminConfig()
|
||||||
|
{
|
||||||
// Get the list of level icons
|
// Get the list of level icons
|
||||||
$level_icon_list = FileHandler::readDir("./modules/point/icons");
|
$level_icon_list = FileHandler::readDir("./modules/point/icons");
|
||||||
Context::set('level_icon_list', $level_icon_list);
|
Context::set('level_icon_list', $level_icon_list);
|
||||||
|
|
@ -37,8 +38,10 @@
|
||||||
$oMemberModel = &getModel('member');
|
$oMemberModel = &getModel('member');
|
||||||
$group_list = $oMemberModel->getGroups();
|
$group_list = $oMemberModel->getGroups();
|
||||||
$selected_group_list = array();
|
$selected_group_list = array();
|
||||||
if(count($group_list)) {
|
if(count($group_list))
|
||||||
foreach($group_list as $key => $val) {
|
{
|
||||||
|
foreach($group_list as $key => $val)
|
||||||
|
{
|
||||||
$selected_group_list[$key] = $val;
|
$selected_group_list[$key] = $val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -53,8 +56,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set per-module scores
|
* @brief Set per-module scores
|
||||||
**/
|
*/
|
||||||
function dispPointAdminModuleConfig() {
|
function dispPointAdminModuleConfig()
|
||||||
|
{
|
||||||
// Get a list of mid
|
// Get a list of mid
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$columnList = array('module_srl', 'mid', 'browser_title');
|
$columnList = array('module_srl', 'mid', 'browser_title');
|
||||||
|
|
@ -72,16 +76,18 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configure the functional act
|
* @brief Configure the functional act
|
||||||
**/
|
*/
|
||||||
function dispPointAdminActConfig() {
|
function dispPointAdminActConfig()
|
||||||
|
{
|
||||||
// Set the template
|
// Set the template
|
||||||
$this->setTemplateFile('action_config');
|
$this->setTemplateFile('action_config');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get a list of member points
|
* @brief Get a list of member points
|
||||||
**/
|
*/
|
||||||
function dispPointAdminPointList() {
|
function dispPointAdminPointList()
|
||||||
|
{
|
||||||
$oPointModel = &getModel('point');
|
$oPointModel = &getModel('point');
|
||||||
|
|
||||||
$args->list_count = 20;
|
$args->list_count = 20;
|
||||||
|
|
@ -114,4 +120,5 @@
|
||||||
$this->setTemplateFile('member_list');
|
$this->setTemplateFile('member_list');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
/* End of file point.admin.view.php */
|
||||||
|
/* Location: ./modules/point/point.admin.view.php */
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,14 @@
|
||||||
* @class point
|
* @class point
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief The parent class of the point module
|
* @brief The parent class of the point module
|
||||||
**/
|
*/
|
||||||
|
class point extends ModuleObject
|
||||||
class point extends ModuleObject {
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Additional tasks required to accomplish during the installation
|
* @brief Additional tasks required to accomplish during the installation
|
||||||
**/
|
*/
|
||||||
function moduleInstall() {
|
function moduleInstall()
|
||||||
|
{
|
||||||
// Registration in action forward (for using in the administrator mode)
|
// Registration in action forward (for using in the administrator mode)
|
||||||
$oModuleController = &getController('module');
|
$oModuleController = &getController('module');
|
||||||
// Create a directory to store points information
|
// Create a directory to store points information
|
||||||
|
|
@ -20,7 +20,8 @@
|
||||||
// The highest level
|
// The highest level
|
||||||
$config->max_level = 30;
|
$config->max_level = 30;
|
||||||
// Per-level score
|
// Per-level score
|
||||||
for($i=1;$i<=30;$i++) {
|
for($i=1;$i<=30;$i++)
|
||||||
|
{
|
||||||
$config->level_step[$i] = pow($i,2)*90;
|
$config->level_step[$i] = pow($i,2)*90;
|
||||||
}
|
}
|
||||||
// Points for registration
|
// Points for registration
|
||||||
|
|
@ -36,7 +37,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the default points per module as well as all actions (as we do not know if it is forum or blogs, specify "act")
|
* Define the default points per module as well as all actions (as we do not know if it is forum or blogs, specify "act")
|
||||||
**/
|
*/
|
||||||
// Insert document
|
// Insert document
|
||||||
$config->insert_document = 10;
|
$config->insert_document = 10;
|
||||||
|
|
||||||
|
|
@ -89,8 +90,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A method to check if the installation has been successful
|
* @brief A method to check if the installation has been successful
|
||||||
**/
|
*/
|
||||||
function checkUpdate() {
|
function checkUpdate()
|
||||||
|
{
|
||||||
// Get the information of the point module
|
// Get the information of the point module
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
// Add a trigger for registration/insert document/insert comment/upload a file/download
|
// Add a trigger for registration/insert document/insert comment/upload a file/download
|
||||||
|
|
@ -120,8 +122,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Execute update
|
* @brief Execute update
|
||||||
**/
|
*/
|
||||||
function moduleUpdate() {
|
function moduleUpdate()
|
||||||
|
{
|
||||||
// Get the information of the point module
|
// Get the information of the point module
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$oModuleController = &getController('module');
|
$oModuleController = &getController('module');
|
||||||
|
|
@ -169,12 +172,13 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Re-create the cache file
|
* @brief Re-create the cache file
|
||||||
**/
|
*/
|
||||||
function recompileCache() {
|
function recompileCache()
|
||||||
|
{
|
||||||
// redefine point action file
|
// redefine point action file
|
||||||
$oPointAdminController = &getAdminController('point');
|
$oPointAdminController = &getAdminController('point');
|
||||||
$oPointAdminController->cacheActList();
|
$oPointAdminController->cacheActList();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
/* End of file point.class.php */
|
||||||
|
/* Location: ./modules/point/point.class.php */
|
||||||
|
|
|
||||||
|
|
@ -3,20 +3,21 @@
|
||||||
* @class pointController
|
* @class pointController
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief Controller class of point modules
|
* @brief Controller class of point modules
|
||||||
**/
|
*/
|
||||||
|
class pointController extends point
|
||||||
class pointController extends point {
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialization
|
* @brief Initialization
|
||||||
**/
|
*/
|
||||||
function init() {
|
function init()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Membership point application trigger
|
* @brief Membership point application trigger
|
||||||
**/
|
*/
|
||||||
function triggerInsertMember(&$obj) {
|
function triggerInsertMember(&$obj)
|
||||||
|
{
|
||||||
// Get the point module information
|
// Get the point module information
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$config = $oModuleModel->getModuleConfig('point');
|
$config = $oModuleModel->getModuleConfig('point');
|
||||||
|
|
@ -36,8 +37,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A trigger to add points to the member for login
|
* @brief A trigger to add points to the member for login
|
||||||
**/
|
*/
|
||||||
function triggerAfterLogin(&$obj) {
|
function triggerAfterLogin(&$obj)
|
||||||
|
{
|
||||||
$member_srl = $obj->member_srl;
|
$member_srl = $obj->member_srl;
|
||||||
if(!$member_srl) return new Object();
|
if(!$member_srl) return new Object();
|
||||||
// If the last login is not today, give the points
|
// If the last login is not today, give the points
|
||||||
|
|
@ -59,8 +61,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A trigger to add points to the member for creating a post
|
* @brief A trigger to add points to the member for creating a post
|
||||||
**/
|
*/
|
||||||
function triggerInsertDocument(&$obj) {
|
function triggerInsertDocument(&$obj)
|
||||||
|
{
|
||||||
$oDocumentModel = &getModel('document');
|
$oDocumentModel = &getModel('document');
|
||||||
if($obj->status != $oDocumentModel->getConfigStatus('temp'))
|
if($obj->status != $oDocumentModel->getConfigStatus('temp'))
|
||||||
{
|
{
|
||||||
|
|
@ -94,8 +97,9 @@
|
||||||
/**
|
/**
|
||||||
* @brief The trigger to give points for normal saving the temporarily saved document
|
* @brief The trigger to give points for normal saving the temporarily saved document
|
||||||
* Temporary storage at the point in 1.2.3 changed to avoid payment
|
* Temporary storage at the point in 1.2.3 changed to avoid payment
|
||||||
**/
|
*/
|
||||||
function triggerUpdateDocument(&$obj) {
|
function triggerUpdateDocument(&$obj)
|
||||||
|
{
|
||||||
$oDocumentModel = &getModel('document');
|
$oDocumentModel = &getModel('document');
|
||||||
$document_srl = $obj->document_srl;
|
$document_srl = $obj->document_srl;
|
||||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||||
|
|
@ -124,13 +128,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Object();
|
return new Object();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The trigger which deducts the points related to post comments before deleting the post itself
|
* @brief The trigger which deducts the points related to post comments before deleting the post itself
|
||||||
**/
|
*/
|
||||||
function triggerBeforeDeleteDocument(&$obj) {
|
function triggerBeforeDeleteDocument(&$obj)
|
||||||
|
{
|
||||||
$document_srl = $obj->document_srl;
|
$document_srl = $obj->document_srl;
|
||||||
$member_srl = $obj->member_srl;
|
$member_srl = $obj->member_srl;
|
||||||
|
|
||||||
|
|
@ -154,7 +158,8 @@
|
||||||
// Organize the member number
|
// Organize the member number
|
||||||
$member_srls = array();
|
$member_srls = array();
|
||||||
$cnt = count($output->data);
|
$cnt = count($output->data);
|
||||||
for($i=0;$i<$cnt;$i++) {
|
for($i=0;$i<$cnt;$i++)
|
||||||
|
{
|
||||||
if($output->data[$i]->member_srl<1) continue;
|
if($output->data[$i]->member_srl<1) continue;
|
||||||
$member_srls[abs($output->data[$i]->member_srl)] = $output->data[$i]->count;
|
$member_srls[abs($output->data[$i]->member_srl)] = $output->data[$i]->count;
|
||||||
}
|
}
|
||||||
|
|
@ -165,7 +170,8 @@
|
||||||
$oPointModel = &getModel('point');
|
$oPointModel = &getModel('point');
|
||||||
// Get the points
|
// Get the points
|
||||||
$point = $module_config['download_file'];
|
$point = $module_config['download_file'];
|
||||||
foreach($member_srls as $member_srl => $cnt) {
|
foreach($member_srls as $member_srl => $cnt)
|
||||||
|
{
|
||||||
$cur_point = $oPointModel->getPoint($member_srl, true);
|
$cur_point = $oPointModel->getPoint($member_srl, true);
|
||||||
$cur_point -= $cnt * $comment_point;
|
$cur_point -= $cnt * $comment_point;
|
||||||
$this->setPoint($member_srl,$cur_point);
|
$this->setPoint($member_srl,$cur_point);
|
||||||
|
|
@ -176,8 +182,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A trigger to give points for deleting the post
|
* @brief A trigger to give points for deleting the post
|
||||||
**/
|
*/
|
||||||
function triggerDeleteDocument(&$obj) {
|
function triggerDeleteDocument(&$obj)
|
||||||
|
{
|
||||||
$module_srl = $obj->module_srl;
|
$module_srl = $obj->module_srl;
|
||||||
$member_srl = $obj->member_srl;
|
$member_srl = $obj->member_srl;
|
||||||
// The process related to clearing the post object
|
// The process related to clearing the post object
|
||||||
|
|
@ -210,8 +217,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A trigger which gives points for entering a comment
|
* @brief A trigger which gives points for entering a comment
|
||||||
**/
|
*/
|
||||||
function triggerInsertComment(&$obj) {
|
function triggerInsertComment(&$obj)
|
||||||
|
{
|
||||||
$module_srl = $obj->module_srl;
|
$module_srl = $obj->module_srl;
|
||||||
$member_srl = $obj->member_srl;
|
$member_srl = $obj->member_srl;
|
||||||
if(!$module_srl || !$member_srl) return new Object();
|
if(!$module_srl || !$member_srl) return new Object();
|
||||||
|
|
@ -239,8 +247,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A trigger which gives points for deleting a comment
|
* @brief A trigger which gives points for deleting a comment
|
||||||
**/
|
*/
|
||||||
function triggerDeleteComment(&$obj) {
|
function triggerDeleteComment(&$obj)
|
||||||
|
{
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$oPointModel = &getModel('point');
|
$oPointModel = &getModel('point');
|
||||||
$oDocumentModel = &getModel('document');
|
$oDocumentModel = &getModel('document');
|
||||||
|
|
@ -273,16 +282,18 @@
|
||||||
/**
|
/**
|
||||||
* @brief Add the file registration trigger
|
* @brief Add the file registration trigger
|
||||||
* To prevent taking points for invalid file registration this method wlil return a null object
|
* To prevent taking points for invalid file registration this method wlil return a null object
|
||||||
**/
|
*/
|
||||||
function triggerInsertFile(&$obj) {
|
function triggerInsertFile(&$obj)
|
||||||
|
{
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A trigger to give points for deleting a file
|
* @brief A trigger to give points for deleting a file
|
||||||
* Remove points only in case an invalid file is being deleted
|
* Remove points only in case an invalid file is being deleted
|
||||||
**/
|
*/
|
||||||
function triggerDeleteFile(&$obj) {
|
function triggerDeleteFile(&$obj)
|
||||||
|
{
|
||||||
if($obj->isvalid != 'Y') return new Object();
|
if($obj->isvalid != 'Y') return new Object();
|
||||||
|
|
||||||
$module_srl = $obj->module_srl;
|
$module_srl = $obj->module_srl;
|
||||||
|
|
@ -307,8 +318,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The trigger called before a file is downloaded
|
* @brief The trigger called before a file is downloaded
|
||||||
**/
|
*/
|
||||||
function triggerBeforeDownloadFile(&$obj) {
|
function triggerBeforeDownloadFile(&$obj)
|
||||||
|
{
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
$member_srl = $logged_info->member_srl;
|
$member_srl = $logged_info->member_srl;
|
||||||
$module_srl = $obj->module_srl;
|
$module_srl = $obj->module_srl;
|
||||||
|
|
@ -339,8 +351,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The trigger to give points for downloading the file
|
* @brief The trigger to give points for downloading the file
|
||||||
**/
|
*/
|
||||||
function triggerDownloadFile(&$obj) {
|
function triggerDownloadFile(&$obj)
|
||||||
|
{
|
||||||
// Run only when logged in
|
// Run only when logged in
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
if(!$logged_info->member_srl) return new Object();
|
if(!$logged_info->member_srl) return new Object();
|
||||||
|
|
@ -369,8 +382,9 @@
|
||||||
/**
|
/**
|
||||||
* @brief Give points for hits increase
|
* @brief Give points for hits increase
|
||||||
* Run it even if there are no points
|
* Run it even if there are no points
|
||||||
**/
|
*/
|
||||||
function triggerUpdateReadedCount(&$obj) {
|
function triggerUpdateReadedCount(&$obj)
|
||||||
|
{
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$oPointModel = &getModel('point');
|
$oPointModel = &getModel('point');
|
||||||
// Get visitor information
|
// Get visitor information
|
||||||
|
|
@ -389,19 +403,23 @@
|
||||||
// Pass if there are no requested points
|
// Pass if there are no requested points
|
||||||
if(!$point) return new Object();
|
if(!$point) return new Object();
|
||||||
// In case of a registered member, if it is read but cannot just pass, then get the current points
|
// In case of a registered member, if it is read but cannot just pass, then get the current points
|
||||||
if($member_srl) {
|
if($member_srl)
|
||||||
|
{
|
||||||
$args->member_srl = $member_srl;
|
$args->member_srl = $member_srl;
|
||||||
$args->document_srl = $obj->document_srl;
|
$args->document_srl = $obj->document_srl;
|
||||||
$output = executeQuery('document.getDocumentReadedLogInfo', $args);
|
$output = executeQuery('document.getDocumentReadedLogInfo', $args);
|
||||||
if($output->data->count) return new Object();
|
if($output->data->count) return new Object();
|
||||||
$cur_point = $oPointModel->getPoint($member_srl, true);
|
$cur_point = $oPointModel->getPoint($member_srl, true);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$cur_point = 0;
|
$cur_point = 0;
|
||||||
}
|
}
|
||||||
// Get the defaul configurations of the Point Module
|
// Get the defaul configurations of the Point Module
|
||||||
$config = $oModuleModel->getModuleConfig('point');
|
$config = $oModuleModel->getModuleConfig('point');
|
||||||
// When the requested points are negative, compared it with the current point
|
// When the requested points are negative, compared it with the current point
|
||||||
if($config->disable_read_document == 'Y' && $point < 0 && abs($point)>$cur_point) {
|
if($config->disable_read_document == 'Y' && $point < 0 && abs($point)>$cur_point)
|
||||||
|
{
|
||||||
$obj->add('content', sprintf(Context::getLang('msg_disallow_by_point'), abs($point), $cur_point));
|
$obj->add('content', sprintf(Context::getLang('msg_disallow_by_point'), abs($point), $cur_point));
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
@ -420,9 +438,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Points for voting up or down
|
* @brief Points for voting up or down
|
||||||
**/
|
*/
|
||||||
|
function triggerUpdateVotedCount(&$obj)
|
||||||
function triggerUpdateVotedCount(&$obj) {
|
{
|
||||||
$module_srl = $obj->module_srl;
|
$module_srl = $obj->module_srl;
|
||||||
$member_srl = $obj->member_srl;
|
$member_srl = $obj->member_srl;
|
||||||
if(!$module_srl || !$member_srl) return new Object();
|
if(!$module_srl || !$member_srl) return new Object();
|
||||||
|
|
@ -434,10 +452,13 @@
|
||||||
$oPointModel = &getModel('point');
|
$oPointModel = &getModel('point');
|
||||||
$cur_point = $oPointModel->getPoint($member_srl, true);
|
$cur_point = $oPointModel->getPoint($member_srl, true);
|
||||||
|
|
||||||
if( $obj->point > 0 ) {
|
if( $obj->point > 0 )
|
||||||
|
{
|
||||||
$point = $module_config['voted'];
|
$point = $module_config['voted'];
|
||||||
if(!isset($point)) $point = $config->voted;
|
if(!isset($point)) $point = $config->voted;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$point = $module_config['blamed'];
|
$point = $module_config['blamed'];
|
||||||
if(!isset($point)) $point = $config->blamed;
|
if(!isset($point)) $point = $config->blamed;
|
||||||
}
|
}
|
||||||
|
|
@ -452,8 +473,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set points
|
* @brief Set points
|
||||||
**/
|
*/
|
||||||
function setPoint($member_srl, $point, $mode = null) {
|
function setPoint($member_srl, $point, $mode = null)
|
||||||
|
{
|
||||||
$member_srl = abs($member_srl);
|
$member_srl = abs($member_srl);
|
||||||
$mode_arr = array('add', 'minus', 'update', 'signup');
|
$mode_arr = array('add', 'minus', 'update', 'signup');
|
||||||
if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update';
|
if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update';
|
||||||
|
|
@ -469,8 +491,8 @@
|
||||||
$args->member_srl = $member_srl;
|
$args->member_srl = $member_srl;
|
||||||
$args->point = $prev_point;
|
$args->point = $prev_point;
|
||||||
|
|
||||||
switch($mode) {
|
switch($mode)
|
||||||
|
{
|
||||||
case 'add' :
|
case 'add' :
|
||||||
$args->point += $point;
|
$args->point += $point;
|
||||||
break;
|
break;
|
||||||
|
|
@ -493,11 +515,13 @@
|
||||||
// Get a new level
|
// Get a new level
|
||||||
$level = $oPointModel->getLevel($point, $config->level_step);
|
$level = $oPointModel->getLevel($point, $config->level_step);
|
||||||
// If existing level and a new one are different attempt to set a point group
|
// If existing level and a new one are different attempt to set a point group
|
||||||
if($level != $prev_level) {
|
if($level != $prev_level)
|
||||||
|
{
|
||||||
// Check if the level, for which the current points are prepared, is calculate and set the correct group
|
// Check if the level, for which the current points are prepared, is calculate and set the correct group
|
||||||
$point_group = $config->point_group;
|
$point_group = $config->point_group;
|
||||||
// If the point group exists
|
// If the point group exists
|
||||||
if($point_group && is_array($point_group) && count($point_group) ) {
|
if($point_group && is_array($point_group) && count($point_group) )
|
||||||
|
{
|
||||||
// Get the default group
|
// Get the default group
|
||||||
$default_group = $oMemberModel->getDefaultGroup();
|
$default_group = $oMemberModel->getDefaultGroup();
|
||||||
// Get the removed group and the newly granted group
|
// Get the removed group and the newly granted group
|
||||||
|
|
@ -506,41 +530,51 @@
|
||||||
|
|
||||||
asort($point_group);
|
asort($point_group);
|
||||||
// Reset group after initialization
|
// Reset group after initialization
|
||||||
if($config->group_reset != 'N') {
|
if($config->group_reset != 'N')
|
||||||
|
{
|
||||||
// If the new level is in the right group
|
// If the new level is in the right group
|
||||||
if(in_array($level, $point_group)) {
|
if(in_array($level, $point_group))
|
||||||
|
{
|
||||||
// Delete all groups except the one which the current level belongs to
|
// Delete all groups except the one which the current level belongs to
|
||||||
foreach($point_group as $group_srl => $target_level) {
|
foreach($point_group as $group_srl => $target_level)
|
||||||
|
{
|
||||||
$del_group_list[] = $group_srl;
|
$del_group_list[] = $group_srl;
|
||||||
if($target_level == $level) $new_group_srls[] = $group_srl;
|
if($target_level == $level) $new_group_srls[] = $group_srl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Otherwise, in case the level is reduced, add the recent group
|
// Otherwise, in case the level is reduced, add the recent group
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
$i = $level;
|
$i = $level;
|
||||||
while($i > 0) {
|
while($i > 0)
|
||||||
if(in_array($i, $point_group)) {
|
{
|
||||||
foreach($point_group as $group_srl => $target_level) {
|
if(in_array($i, $point_group))
|
||||||
if ($target_level == $i) {
|
{
|
||||||
|
foreach($point_group as $group_srl => $target_level)
|
||||||
|
{
|
||||||
|
if($target_level == $i)
|
||||||
|
{
|
||||||
$new_group_srls[] = $group_srl;
|
$new_group_srls[] = $group_srl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$i = 0;
|
$i = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$i--;
|
$i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Delete the group of a level which is higher than the current level
|
// Delete the group of a level which is higher than the current level
|
||||||
foreach($point_group as $group_srl => $target_level) {
|
foreach($point_group as $group_srl => $target_level)
|
||||||
|
{
|
||||||
if($target_level > $level) $del_group_list[] = $group_srl;
|
if($target_level > $level) $del_group_list[] = $group_srl;
|
||||||
}
|
}
|
||||||
$del_group_list[] = $default_group->group_srl;
|
$del_group_list[] = $default_group->group_srl;
|
||||||
}
|
}
|
||||||
// Grant a new group
|
// Grant a new group
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
// Check until the current level by rotating setting the configurations of the point groups
|
// Check until the current level by rotating setting the configurations of the point groups
|
||||||
foreach($point_group as $group_srl => $target_level) {
|
foreach($point_group as $group_srl => $target_level)
|
||||||
|
{
|
||||||
$del_group_list[] = $group_srl;
|
$del_group_list[] = $group_srl;
|
||||||
if($target_level <= $level) $new_group_srls[] = $group_srl;
|
if($target_level <= $level) $new_group_srls[] = $group_srl;
|
||||||
}
|
}
|
||||||
|
|
@ -548,13 +582,15 @@
|
||||||
// If there is no a new group, granted the default group
|
// If there is no a new group, granted the default group
|
||||||
if(!$new_group_srls[0]) $new_group_srls[0] = $default_group->group_srl;
|
if(!$new_group_srls[0]) $new_group_srls[0] = $default_group->group_srl;
|
||||||
// Remove linkage group
|
// Remove linkage group
|
||||||
if($del_group_list && count($del_group_list)) {
|
if($del_group_list && count($del_group_list))
|
||||||
|
{
|
||||||
$del_group_args->member_srl = $member_srl;
|
$del_group_args->member_srl = $member_srl;
|
||||||
$del_group_args->group_srl = implode(',', $del_group_list);
|
$del_group_args->group_srl = implode(',', $del_group_list);
|
||||||
$del_group_output = executeQuery('point.deleteMemberGroup', $del_group_args);
|
$del_group_output = executeQuery('point.deleteMemberGroup', $del_group_args);
|
||||||
}
|
}
|
||||||
// Grant a new group
|
// Grant a new group
|
||||||
foreach($new_group_srls as $group_srl) {
|
foreach($new_group_srls as $group_srl)
|
||||||
|
{
|
||||||
$new_group_args->member_srl = $member_srl;
|
$new_group_args->member_srl = $member_srl;
|
||||||
$new_group_args->group_srl = $group_srl;
|
$new_group_args->group_srl = $group_srl;
|
||||||
executeQuery('member.addMemberToGroup', $new_group_args);
|
executeQuery('member.addMemberToGroup', $new_group_args);
|
||||||
|
|
@ -597,4 +633,5 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
/* End of file point.controller.php */
|
||||||
|
/* Location: ./modules/point/point.controller.php */
|
||||||
|
|
|
||||||
|
|
@ -3,21 +3,23 @@
|
||||||
* @class pointModel
|
* @class pointModel
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief The model class fo the point module
|
* @brief The model class fo the point module
|
||||||
**/
|
*/
|
||||||
|
class pointModel extends point
|
||||||
class pointModel extends point {
|
{
|
||||||
var $pointList = array();
|
var $pointList = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialization
|
* @brief Initialization
|
||||||
**/
|
*/
|
||||||
function init() {
|
function init()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Check if there is points information
|
* @brief Check if there is points information
|
||||||
**/
|
*/
|
||||||
function isExistsPoint($member_srl) {
|
function isExistsPoint($member_srl)
|
||||||
|
{
|
||||||
$member_srl = abs($member_srl);
|
$member_srl = abs($member_srl);
|
||||||
|
|
||||||
// Get from instance memory
|
// Get from instance memory
|
||||||
|
|
@ -46,8 +48,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the points
|
* @brief Get the points
|
||||||
**/
|
*/
|
||||||
function getPoint($member_srl, $from_db = false) {
|
function getPoint($member_srl, $from_db = false)
|
||||||
|
{
|
||||||
$member_srl = abs($member_srl);
|
$member_srl = abs($member_srl);
|
||||||
|
|
||||||
// Get from instance memory
|
// Get from instance memory
|
||||||
|
|
@ -77,8 +80,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the level
|
* @brief Get the level
|
||||||
**/
|
*/
|
||||||
function getLevel($point, $level_step) {
|
function getLevel($point, $level_step)
|
||||||
|
{
|
||||||
$level_count = count($level_step);
|
$level_count = count($level_step);
|
||||||
for($level=0;$level<=$level_count;$level++) if($point < $level_step[$level]) break;
|
for($level=0;$level<=$level_count;$level++) if($point < $level_step[$level]) break;
|
||||||
$level --;
|
$level --;
|
||||||
|
|
@ -111,8 +115,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get a list of points members list
|
* @brief Get a list of points members list
|
||||||
**/
|
*/
|
||||||
function getMemberList($args = null, $columnList = array()) {
|
function getMemberList($args = null, $columnList = array())
|
||||||
|
{
|
||||||
// Arrange the search options
|
// Arrange the search options
|
||||||
$args->is_admin = Context::get('is_admin')=='Y'?'Y':'';
|
$args->is_admin = Context::get('is_admin')=='Y'?'Y':'';
|
||||||
$args->is_denied = Context::get('is_denied')=='Y'?'Y':'';
|
$args->is_denied = Context::get('is_denied')=='Y'?'Y':'';
|
||||||
|
|
@ -121,8 +126,10 @@
|
||||||
$search_target = trim(Context::get('search_target'));
|
$search_target = trim(Context::get('search_target'));
|
||||||
$search_keyword = trim(Context::get('search_keyword'));
|
$search_keyword = trim(Context::get('search_keyword'));
|
||||||
|
|
||||||
if($search_target && $search_keyword) {
|
if($search_target && $search_keyword)
|
||||||
switch($search_target) {
|
{
|
||||||
|
switch($search_target)
|
||||||
|
{
|
||||||
case 'user_id' :
|
case 'user_id' :
|
||||||
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
|
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
|
||||||
$args->s_user_id = $search_keyword;
|
$args->s_user_id = $search_keyword;
|
||||||
|
|
@ -151,19 +158,24 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If there is a selected_group_srl, change the "query id" (for table join)
|
// If there is a selected_group_srl, change the "query id" (for table join)
|
||||||
if($args->selected_group_srl) {
|
if($args->selected_group_srl)
|
||||||
|
{
|
||||||
$query_id = 'point.getMemberListWithinGroup';
|
$query_id = 'point.getMemberListWithinGroup';
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$query_id = 'point.getMemberList';
|
$query_id = 'point.getMemberList';
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = executeQuery($query_id, $args, $columnList);
|
$output = executeQuery($query_id, $args, $columnList);
|
||||||
|
|
||||||
if($output->total_count) {
|
if($output->total_count)
|
||||||
|
{
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$config = $oModuleModel->getModuleConfig('point');
|
$config = $oModuleModel->getModuleConfig('point');
|
||||||
|
|
||||||
foreach($output->data as $key => $val) {
|
foreach($output->data as $key => $val)
|
||||||
|
{
|
||||||
$output->data[$key]->level = $this->getLevel($val->point, $config->level_step);
|
$output->data[$key]->level = $this->getLevel($val->point, $config->level_step);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -171,4 +183,5 @@
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
/* End of file point.model.php */
|
||||||
|
/* Location: ./modules/point/point.model.php */
|
||||||
|
|
|
||||||
|
|
@ -6,25 +6,27 @@
|
||||||
*
|
*
|
||||||
* POINT 2.0 format document output
|
* POINT 2.0 format document output
|
||||||
*
|
*
|
||||||
**/
|
*/
|
||||||
|
class pointView extends point
|
||||||
class pointView extends point {
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialization
|
* @brief Initialization
|
||||||
**/
|
*/
|
||||||
function init() {
|
function init()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Additional configurations for a service module
|
* @brief Additional configurations for a service module
|
||||||
* Receive the form for the form used by point
|
* Receive the form for the form used by point
|
||||||
**/
|
*/
|
||||||
function triggerDispPointAdditionSetup(&$obj) {
|
function triggerDispPointAdditionSetup(&$obj)
|
||||||
|
{
|
||||||
$current_module_srl = Context::get('module_srl');
|
$current_module_srl = Context::get('module_srl');
|
||||||
$current_module_srls = Context::get('module_srls');
|
$current_module_srls = Context::get('module_srls');
|
||||||
|
|
||||||
if(!$current_module_srl && !$current_module_srls) {
|
if(!$current_module_srl && !$current_module_srls)
|
||||||
|
{
|
||||||
$current_module_info = Context::get('current_module_info');
|
$current_module_info = Context::get('current_module_info');
|
||||||
$current_module_srl = $current_module_info->module_srl;
|
$current_module_srl = $current_module_info->module_srl;
|
||||||
if(!$current_module_srl) return new Object();
|
if(!$current_module_srl) return new Object();
|
||||||
|
|
@ -33,9 +35,11 @@
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$config = $oModuleModel->getModuleConfig('point');
|
$config = $oModuleModel->getModuleConfig('point');
|
||||||
|
|
||||||
if($current_module_srl) {
|
if($current_module_srl)
|
||||||
|
{
|
||||||
$module_config = $oModuleModel->getModulePartConfig('point', $current_module_srl);
|
$module_config = $oModuleModel->getModulePartConfig('point', $current_module_srl);
|
||||||
if(!$module_config) {
|
if(!$module_config)
|
||||||
|
{
|
||||||
$module_config['insert_document'] = $config->insert_document;
|
$module_config['insert_document'] = $config->insert_document;
|
||||||
$module_config['insert_comment'] = $config->insert_comment;
|
$module_config['insert_comment'] = $config->insert_comment;
|
||||||
$module_config['upload_file'] = $config->upload_file;
|
$module_config['upload_file'] = $config->upload_file;
|
||||||
|
|
@ -57,4 +61,5 @@
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
/* End of file point.view.php */
|
||||||
|
/* Location: ./modules/point/point.view.php */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue