mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
issue 2662 counter, document
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12241 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
e665650392
commit
77a1c3e89f
12 changed files with 4563 additions and 4059 deletions
|
|
@ -1,51 +1,53 @@
|
|||
<?php
|
||||
/**
|
||||
* Admin view class of counter module
|
||||
/**
|
||||
* Admin view class of counter module
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
*/
|
||||
class counterAdminView extends counter
|
||||
{
|
||||
/**
|
||||
* Initialization
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
**/
|
||||
* @return void
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
// set the template path
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
}
|
||||
|
||||
class counterAdminView extends counter {
|
||||
/**
|
||||
* Admin page
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function dispCounterAdminIndex()
|
||||
{
|
||||
// set today's if no date is given
|
||||
$selected_date = Context::get('selected_date');
|
||||
if(!$selected_date) $selected_date = date("Ymd");
|
||||
Context::set('selected_date', $selected_date);
|
||||
// create the counter model object
|
||||
$oCounterModel = &getModel('counter');
|
||||
// get a total count and daily count
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
$status = $oCounterModel->getStatus(array(0,$selected_date),$site_module_info->site_srl);
|
||||
Context::set('total_counter', $status[0]);
|
||||
Context::set('selected_day_counter', $status[$selected_date]);
|
||||
// get data by time, day, month, and year
|
||||
$type = Context::get('type');
|
||||
if(!$type)
|
||||
{
|
||||
$type = 'day';
|
||||
Context::set('type',$type);
|
||||
}
|
||||
$detail_status = $oCounterModel->getHourlyStatus($type, $selected_date, $site_module_info->site_srl);
|
||||
Context::set('detail_status', $detail_status);
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function init() {
|
||||
// set the template path
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin page
|
||||
*
|
||||
* @return Object
|
||||
**/
|
||||
function dispCounterAdminIndex() {
|
||||
// set today's if no date is given
|
||||
$selected_date = Context::get('selected_date');
|
||||
if(!$selected_date) $selected_date = date("Ymd");
|
||||
Context::set('selected_date', $selected_date);
|
||||
// create the counter model object
|
||||
$oCounterModel = &getModel('counter');
|
||||
// get a total count and daily count
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
$status = $oCounterModel->getStatus(array(0,$selected_date),$site_module_info->site_srl);
|
||||
Context::set('total_counter', $status[0]);
|
||||
Context::set('selected_day_counter', $status[$selected_date]);
|
||||
// get data by time, day, month, and year
|
||||
$type = Context::get('type');
|
||||
if(!$type) {
|
||||
$type = 'day';
|
||||
Context::set('type',$type);
|
||||
}
|
||||
$detail_status = $oCounterModel->getHourlyStatus($type, $selected_date, $site_module_info->site_srl);
|
||||
Context::set('detail_status', $detail_status);
|
||||
|
||||
// display
|
||||
$this->setTemplateFile('index');
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
// display
|
||||
$this->setTemplateFile('index');
|
||||
}
|
||||
}
|
||||
/* End of file counter.admin.view.php */
|
||||
/* Location: ./modules/counter/counter.admin.view.php */
|
||||
|
|
|
|||
|
|
@ -1,60 +1,64 @@
|
|||
<?php
|
||||
/**
|
||||
* High class of counter module
|
||||
/**
|
||||
* High class of counter module
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
*/
|
||||
class counter extends ModuleObject
|
||||
{
|
||||
/**
|
||||
* Implement if additional tasks are necessary when installing
|
||||
* @return Object
|
||||
*/
|
||||
function moduleInstall()
|
||||
{
|
||||
$oCounterController = &getController('counter');
|
||||
// add a row for the total visit history
|
||||
//$oCounterController->insertTotalStatus();
|
||||
// add a row for today's status
|
||||
//$oCounterController->insertTodayStatus();
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* method if successfully installed
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
**/
|
||||
* @return bool
|
||||
*/
|
||||
function checkUpdate()
|
||||
{
|
||||
// Add site_srl to the counter
|
||||
$oDB = &DB::getInstance();
|
||||
if(!$oDB->isColumnExists('counter_log', 'site_srl')) return true;
|
||||
if(!$oDB->isIndexExists('counter_log','idx_site_counter_log')) return true;
|
||||
|
||||
class counter extends ModuleObject {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement if additional tasks are necessary when installing
|
||||
* @return Object
|
||||
**/
|
||||
function moduleInstall() {
|
||||
$oCounterController = &getController('counter');
|
||||
// add a row for the total visit history
|
||||
//$oCounterController->insertTotalStatus();
|
||||
// add a row for today's status
|
||||
//$oCounterController->insertTodayStatus();
|
||||
/**
|
||||
* Module update
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function moduleUpdate()
|
||||
{
|
||||
// Add site_srl to the counter
|
||||
$oDB = &DB::getInstance();
|
||||
if(!$oDB->isColumnExists('counter_log', 'site_srl')) $oDB->addColumn('counter_log','site_srl','number',11,0,true);
|
||||
if(!$oDB->isIndexExists('counter_log','idx_site_counter_log')) $oDB->addIndex('counter_log','idx_site_counter_log',array('site_srl','ipaddress'),false);
|
||||
|
||||
return new Object();
|
||||
}
|
||||
return new Object(0, 'success_updated');
|
||||
}
|
||||
|
||||
/**
|
||||
* method if successfully installed
|
||||
*
|
||||
* @return bool
|
||||
**/
|
||||
function checkUpdate() {
|
||||
// Add site_srl to the counter
|
||||
$oDB = &DB::getInstance();
|
||||
if(!$oDB->isColumnExists('counter_log', 'site_srl')) return true;
|
||||
if(!$oDB->isIndexExists('counter_log','idx_site_counter_log')) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Module update
|
||||
*
|
||||
* @return Object
|
||||
**/
|
||||
function moduleUpdate() {
|
||||
// Add site_srl to the counter
|
||||
$oDB = &DB::getInstance();
|
||||
if(!$oDB->isColumnExists('counter_log', 'site_srl')) $oDB->addColumn('counter_log','site_srl','number',11,0,true);
|
||||
if(!$oDB->isIndexExists('counter_log','idx_site_counter_log')) $oDB->addIndex('counter_log','idx_site_counter_log',array('site_srl','ipaddress'),false);
|
||||
|
||||
return new Object(0, 'success_updated');
|
||||
}
|
||||
|
||||
/**
|
||||
* re-generate the cache file
|
||||
*
|
||||
* @return Object
|
||||
**/
|
||||
function recompileCache() {
|
||||
}
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* re-generate the cache file
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function recompileCache()
|
||||
{
|
||||
}
|
||||
}
|
||||
/* End of file counter.class.php */
|
||||
/* Location: ./modules/counter/counter.class.php */
|
||||
|
|
|
|||
|
|
@ -1,170 +1,197 @@
|
|||
<?php
|
||||
/**
|
||||
* Counter module's controller class
|
||||
/**
|
||||
* Counter module's controller class
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
*/
|
||||
class counterController extends counter
|
||||
{
|
||||
/**
|
||||
* Initialization
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
**/
|
||||
* @return void
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
class counterController extends counter {
|
||||
/**
|
||||
* Counter logs.
|
||||
* If want use below function, you can use 'counterExecute' function instead this function
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function procCounterExecute()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
/**
|
||||
* Counter logs
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function counterExecute()
|
||||
{
|
||||
$oDB = &DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
||||
/**
|
||||
* Counter logs.
|
||||
* If want use below function, you can use 'counterExecute' function instead this function
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function procCounterExecute() {
|
||||
}
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
$site_srl = (int)$site_module_info->site_srl;
|
||||
// Check the logs
|
||||
$oCounterModel = &getModel('counter');
|
||||
// Register today's row if not exist
|
||||
if(!$oCounterModel->isInsertedTodayStatus($site_srl))
|
||||
{
|
||||
$this->insertTodayStatus(0,$site_srl);
|
||||
// check user if the previous row exists
|
||||
}
|
||||
else
|
||||
{
|
||||
// If unregistered IP
|
||||
if(!$oCounterModel->isLogged($site_srl))
|
||||
{
|
||||
// Leave logs
|
||||
$this->insertLog($site_srl);
|
||||
// Register unique and pageview
|
||||
$this->insertUniqueVisitor($site_srl);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Register pageview
|
||||
$this->insertPageView($site_srl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Counter logs
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function counterExecute() {
|
||||
$oDB = &DB::getInstance();
|
||||
$oDB->begin();
|
||||
$oDB->commit();
|
||||
}
|
||||
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
$site_srl = (int)$site_module_info->site_srl;
|
||||
// Check the logs
|
||||
$oCounterModel = &getModel('counter');
|
||||
// Register today's row if not exist
|
||||
if(!$oCounterModel->isInsertedTodayStatus($site_srl)) {
|
||||
$this->insertTodayStatus(0,$site_srl);
|
||||
// check user if the previous row exists
|
||||
} else {
|
||||
// If unregistered IP
|
||||
if(!$oCounterModel->isLogged($site_srl)) {
|
||||
// Leave logs
|
||||
$this->insertLog($site_srl);
|
||||
// Register unique and pageview
|
||||
$this->insertUniqueVisitor($site_srl);
|
||||
} else {
|
||||
// Register pageview
|
||||
$this->insertPageView($site_srl);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Leave logs
|
||||
*
|
||||
* @param integer $site_srl
|
||||
* @return Object result of count query
|
||||
*/
|
||||
function insertLog($site_srl=0)
|
||||
{
|
||||
$args->regdate = date("YmdHis");
|
||||
$args->user_agent = substr ($_SERVER['HTTP_USER_AGENT'], 0, 250);
|
||||
$args->site_srl = $site_srl;
|
||||
return executeQuery('counter.insertCounterLog', $args);
|
||||
}
|
||||
|
||||
$oDB->commit();
|
||||
}
|
||||
/**
|
||||
* Register the unique visitor
|
||||
*
|
||||
* @param integer $site_srl
|
||||
* @return void
|
||||
*/
|
||||
function insertUniqueVisitor($site_srl=0)
|
||||
{
|
||||
if($site_srl)
|
||||
{
|
||||
$args->regdate = '0';
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('counter.updateSiteCounterUnique', $args);
|
||||
$args->regdate = date('Ymd');
|
||||
$output = executeQuery('counter.updateSiteCounterUnique', $args);
|
||||
}
|
||||
else
|
||||
{
|
||||
$args->regdate = '0';
|
||||
$output = executeQuery('counter.updateCounterUnique', $args);
|
||||
$args->regdate = date('Ymd');
|
||||
$output = executeQuery('counter.updateCounterUnique', $args);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Leave logs
|
||||
*
|
||||
* @param integer $site_srl
|
||||
* @return Object result of count query
|
||||
**/
|
||||
function insertLog($site_srl=0) {
|
||||
$args->regdate = date("YmdHis");
|
||||
$args->user_agent = substr ($_SERVER['HTTP_USER_AGENT'], 0, 250);
|
||||
$args->site_srl = $site_srl;
|
||||
return executeQuery('counter.insertCounterLog', $args);
|
||||
}
|
||||
/**
|
||||
* Register pageview
|
||||
*
|
||||
* @param integer $site_srl
|
||||
* @return void
|
||||
*/
|
||||
function insertPageView($site_srl=0)
|
||||
{
|
||||
if($site_srl)
|
||||
{
|
||||
$args->regdate = '0';
|
||||
$args->site_srl = $site_srl;
|
||||
executeQuery('counter.updateSiteCounterPageview', $args);
|
||||
$args->regdate = date('Ymd');
|
||||
executeQuery('counter.updateSiteCounterPageview', $args);
|
||||
}
|
||||
else
|
||||
{
|
||||
$args->regdate = '0';
|
||||
executeQuery('counter.updateCounterPageview', $args);
|
||||
$args->regdate = date('Ymd');
|
||||
executeQuery('counter.updateCounterPageview', $args);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the unique visitor
|
||||
*
|
||||
* @param integer $site_srl
|
||||
* @return void
|
||||
**/
|
||||
function insertUniqueVisitor($site_srl=0) {
|
||||
if($site_srl) {
|
||||
$args->regdate = '0';
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('counter.updateSiteCounterUnique', $args);
|
||||
$args->regdate = date('Ymd');
|
||||
$output = executeQuery('counter.updateSiteCounterUnique', $args);
|
||||
} else {
|
||||
$args->regdate = '0';
|
||||
$output = executeQuery('counter.updateCounterUnique', $args);
|
||||
$args->regdate = date('Ymd');
|
||||
$output = executeQuery('counter.updateCounterUnique', $args);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Add the total counter status
|
||||
*
|
||||
* @param integer $site_srl
|
||||
* @return void
|
||||
*/
|
||||
function insertTotalStatus($site_srl=0)
|
||||
{
|
||||
$args->regdate = 0;
|
||||
if($site_srl)
|
||||
{
|
||||
$args->site_srl = $site_srl;
|
||||
executeQuery('counter.insertSiteTodayStatus', $args);
|
||||
}
|
||||
else
|
||||
{
|
||||
executeQuery('counter.insertTodayStatus', $args);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register pageview
|
||||
*
|
||||
* @param integer $site_srl
|
||||
* @return void
|
||||
**/
|
||||
function insertPageView($site_srl=0) {
|
||||
if($site_srl) {
|
||||
$args->regdate = '0';
|
||||
$args->site_srl = $site_srl;
|
||||
executeQuery('counter.updateSiteCounterPageview', $args);
|
||||
$args->regdate = date('Ymd');
|
||||
executeQuery('counter.updateSiteCounterPageview', $args);
|
||||
} else {
|
||||
$args->regdate = '0';
|
||||
executeQuery('counter.updateCounterPageview', $args);
|
||||
$args->regdate = date('Ymd');
|
||||
executeQuery('counter.updateCounterPageview', $args);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Add today's counter status
|
||||
*
|
||||
* @param integer $regdate date(YYYYMMDD) type
|
||||
* @param integer $site_srl
|
||||
* @return void
|
||||
*/
|
||||
function insertTodayStatus($regdate = 0, $site_srl=0)
|
||||
{
|
||||
if($regdate) $args->regdate = $regdate;
|
||||
else $args->regdate = date("Ymd");
|
||||
if($site_srl)
|
||||
{
|
||||
$args->site_srl = $site_srl;
|
||||
$query_id = 'counter.insertSiteTodayStatus';
|
||||
|
||||
/**
|
||||
* Add the total counter status
|
||||
*
|
||||
* @param integer $site_srl
|
||||
* @return void
|
||||
**/
|
||||
function insertTotalStatus($site_srl=0) {
|
||||
$args->regdate = 0;
|
||||
if($site_srl) {
|
||||
$args->site_srl = $site_srl;
|
||||
executeQuery('counter.insertSiteTodayStatus', $args);
|
||||
} else {
|
||||
executeQuery('counter.insertTodayStatus', $args);
|
||||
}
|
||||
}
|
||||
$u_args->site_srl = $site_srl; // /< when inserting a daily row, attempt to inser total rows(where regdate=0) together
|
||||
executeQuery($query_id, $u_args);
|
||||
}
|
||||
else
|
||||
{
|
||||
$query_id = 'counter.insertTodayStatus';
|
||||
executeQuery($query_id); // /< when inserting a daily row, attempt to inser total rows(where regdate=0) together
|
||||
}
|
||||
$output = executeQuery($query_id, $args);
|
||||
// Leave logs
|
||||
$this->insertLog($site_srl);
|
||||
// Register unique and pageview
|
||||
$this->insertUniqueVisitor($site_srl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add today's counter status
|
||||
*
|
||||
* @param integer $regdate date(YYYYMMDD) type
|
||||
* @param integer $site_srl
|
||||
* @return void
|
||||
**/
|
||||
function insertTodayStatus($regdate = 0, $site_srl=0) {
|
||||
if($regdate) $args->regdate = $regdate;
|
||||
else $args->regdate = date("Ymd");
|
||||
if($site_srl) {
|
||||
$args->site_srl = $site_srl;
|
||||
$query_id = 'counter.insertSiteTodayStatus';
|
||||
|
||||
$u_args->site_srl = $site_srl; // /< when inserting a daily row, attempt to inser total rows(where regdate=0) together
|
||||
executeQuery($query_id, $u_args);
|
||||
} else {
|
||||
$query_id = 'counter.insertTodayStatus';
|
||||
executeQuery($query_id); // /< when inserting a daily row, attempt to inser total rows(where regdate=0) together
|
||||
}
|
||||
$output = executeQuery($query_id, $args);
|
||||
// Leave logs
|
||||
$this->insertLog($site_srl);
|
||||
// Register unique and pageview
|
||||
$this->insertUniqueVisitor($site_srl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete counter logs of the specific virtual site
|
||||
*
|
||||
* @param integer $site_srl
|
||||
* @return void
|
||||
**/
|
||||
function deleteSiteCounterLogs($site_srl) {
|
||||
$args->site_srl = $site_srl;
|
||||
executeQuery('counter.deleteSiteCounter',$args);
|
||||
executeQuery('counter.deleteSiteCounterLog',$args);
|
||||
}
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* Delete counter logs of the specific virtual site
|
||||
*
|
||||
* @param integer $site_srl
|
||||
* @return void
|
||||
*/
|
||||
function deleteSiteCounterLogs($site_srl)
|
||||
{
|
||||
$args->site_srl = $site_srl;
|
||||
executeQuery('counter.deleteSiteCounter',$args);
|
||||
executeQuery('counter.deleteSiteCounterLog',$args);
|
||||
}
|
||||
}
|
||||
/* End of file counter.controller.php */
|
||||
/* Location: ./modules/counter/counter.controller.php */
|
||||
|
|
|
|||
|
|
@ -1,217 +1,258 @@
|
|||
<?php
|
||||
/**
|
||||
* Model class of counter module
|
||||
/**
|
||||
* Model class of counter module
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
*/
|
||||
class counterModel extends counter
|
||||
{
|
||||
/**
|
||||
* Initialization
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
**/
|
||||
* @return void
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
class counterModel extends counter {
|
||||
/**
|
||||
* Verify logs
|
||||
*
|
||||
* @param integer $site_srl Site_srl
|
||||
* @return bool
|
||||
*/
|
||||
function isLogged($site_srl=0)
|
||||
{
|
||||
$args->regdate = date("Ymd");
|
||||
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('counter.getCounterLog', $args);
|
||||
return $output->data->count?true:false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
/**
|
||||
* Check if a row of today's counter status exists
|
||||
*
|
||||
* @param integer $site_srl Site_srl
|
||||
* @return bool
|
||||
*/
|
||||
function isInsertedTodayStatus($site_srl=0)
|
||||
{
|
||||
$args->regdate = date("Ymd");
|
||||
if($site_srl)
|
||||
{
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('counter.getSiteTodayStatus', $args);
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = executeQuery('counter.getTodayStatus', $args);
|
||||
}
|
||||
return $output->data->count?true:false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify logs
|
||||
*
|
||||
* @param integer $site_srl Site_srl
|
||||
* @return bool
|
||||
**/
|
||||
function isLogged($site_srl=0) {
|
||||
$args->regdate = date("Ymd");
|
||||
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('counter.getCounterLog', $args);
|
||||
return $output->data->count?true:false;
|
||||
}
|
||||
/**
|
||||
* Get access statistics for a given date
|
||||
*
|
||||
* @param mixed $selected_date Date(YYYYMMDD) list
|
||||
* @param integer $site_srl Site_srl
|
||||
* @return Object
|
||||
*/
|
||||
function getStatus($selected_date, $site_srl = 0)
|
||||
{
|
||||
// If more than one date logs are selected
|
||||
if(is_array($selected_date))
|
||||
{
|
||||
$date_count = count($selected_date);
|
||||
$args->regdate = implode(',',$selected_date);
|
||||
// If a single date log is selected
|
||||
}
|
||||
else
|
||||
{
|
||||
if(strlen($selected_date) == 8) $selected_date = $selected_date;
|
||||
$args->regdate = $selected_date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a row of today's counter status exists
|
||||
*
|
||||
* @param integer $site_srl Site_srl
|
||||
* @return bool
|
||||
**/
|
||||
function isInsertedTodayStatus($site_srl=0) {
|
||||
$args->regdate = date("Ymd");
|
||||
if($site_srl) {
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('counter.getSiteTodayStatus', $args);
|
||||
} else {
|
||||
$output = executeQuery('counter.getTodayStatus', $args);
|
||||
}
|
||||
return $output->data->count?true:false;
|
||||
}
|
||||
if($site_srl)
|
||||
{
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('counter.getSiteCounterStatusDays', $args);
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = executeQuery('counter.getCounterStatusDays', $args);
|
||||
}
|
||||
$status = $output->data;
|
||||
|
||||
/**
|
||||
* Get access statistics for a given date
|
||||
*
|
||||
* @param mixed $selected_date Date(YYYYMMDD) list
|
||||
* @param integer $site_srl Site_srl
|
||||
* @return Object
|
||||
**/
|
||||
function getStatus($selected_date, $site_srl = 0) {
|
||||
// If more than one date logs are selected
|
||||
if(is_array($selected_date)) {
|
||||
$date_count = count($selected_date);
|
||||
$args->regdate = implode(',',$selected_date);
|
||||
// If a single date log is selected
|
||||
} else {
|
||||
if(strlen($selected_date) == 8) $selected_date = $selected_date;
|
||||
$args->regdate = $selected_date;
|
||||
}
|
||||
if(!is_array($selected_date)) return $status;
|
||||
|
||||
if($site_srl) {
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('counter.getSiteCounterStatusDays', $args);
|
||||
} else {
|
||||
$output = executeQuery('counter.getCounterStatusDays', $args);
|
||||
}
|
||||
$status = $output->data;
|
||||
if(!is_array($status)) $status = array($status);
|
||||
unset($output);
|
||||
|
||||
if(!is_array($selected_date)) return $status;
|
||||
foreach($status as $key => $val)
|
||||
{
|
||||
$output[substr($val->regdate,0,8)] = $val;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
if(!is_array($status)) $status = array($status);
|
||||
unset($output);
|
||||
/**
|
||||
* Select hourly logs of a given date
|
||||
*
|
||||
* @param string $type Choice time interval (year, week, month, hour or DEFAULT)
|
||||
* @param integer $selected_date Date(YYYYMMDD)
|
||||
* @param integer $site_srl Site_srl
|
||||
* @return Object
|
||||
*/
|
||||
function getHourlyStatus($type='hour', $selected_date, $site_srl=0)
|
||||
{
|
||||
$max = 0;
|
||||
$sum = 0;
|
||||
switch($type)
|
||||
{
|
||||
case 'year' :
|
||||
// Get a date to start counting
|
||||
if($site_srl)
|
||||
{
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('counter.getSiteStartLogDate', $args);
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = executeQuery('counter.getStartLogDate');
|
||||
}
|
||||
$start_year = substr($output->data->regdate,0,4);
|
||||
if(!$start_year) $start_year = date("Y");
|
||||
for($i=$start_year;$i<=date("Y");$i++)
|
||||
{
|
||||
unset($args);
|
||||
$args->start_date = sprintf('%04d0000', $i);
|
||||
$args->end_date = sprintf('%04d1231', $i);
|
||||
if($site_srl)
|
||||
{
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('counter.getSiteCounterStatus', $args);
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = executeQuery('counter.getCounterStatus', $args);
|
||||
}
|
||||
$count = (int)$output->data->unique_visitor;
|
||||
$status->list[$i] = $count;
|
||||
if($count>$max) $max = $count;
|
||||
$sum += $count;
|
||||
}
|
||||
break;
|
||||
case 'week' :
|
||||
$time = strtotime($selected_date);
|
||||
$w = date("D");
|
||||
while(date("D",$time) != "Sun")
|
||||
{
|
||||
$time += 60*60*24;
|
||||
}
|
||||
$time -= 60*60*24;
|
||||
while(date("D",$time)!="Sun")
|
||||
{
|
||||
$thisWeek[] = date("Ymd",$time);
|
||||
$time -= 60*60*24;
|
||||
}
|
||||
$thisWeek[] = date("Ymd",$time);
|
||||
asort($thisWeek);
|
||||
foreach($thisWeek as $day)
|
||||
{
|
||||
unset($args);
|
||||
$args->start_date = $day;
|
||||
$args->end_date = $day;
|
||||
if($site_srl)
|
||||
{
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('counter.getSiteCounterStatus', $args);
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = executeQuery('counter.getCounterStatus', $args);
|
||||
}
|
||||
$count = (int)$output->data->unique_visitor;
|
||||
$status->list[$day] = (int)$count;
|
||||
if($count>$max) $max = $count;
|
||||
$sum += $count;
|
||||
}
|
||||
break;
|
||||
case 'month' :
|
||||
$year = substr($selected_date, 0, 4);
|
||||
for($i=1;$i<=12;$i++)
|
||||
{
|
||||
unset($args);
|
||||
$args->start_date = sprintf('%04d%02d00', $year, $i);
|
||||
$args->end_date = sprintf('%04d%02d31', $year, $i);
|
||||
if($site_srl)
|
||||
{
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('counter.getSiteCounterStatus', $args);
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = executeQuery('counter.getCounterStatus', $args);
|
||||
}
|
||||
$count = (int)$output->data->unique_visitor;
|
||||
$status->list[$i] = (int)$count;
|
||||
if($count>$max) $max = $count;
|
||||
$sum += $count;
|
||||
}
|
||||
break;
|
||||
case 'hour' :
|
||||
for($i=0;$i<24;$i++)
|
||||
{
|
||||
unset($args);
|
||||
$args->start_date = sprintf('%08d%02d0000', $selected_date, $i);
|
||||
$args->end_date = sprintf('%08d%02d5959', $selected_date, $i);
|
||||
if($site_srl)
|
||||
{
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('counter.getSiteCounterLogStatus', $args);
|
||||
}
|
||||
else
|
||||
{
|
||||
$args->site_srl = 0;
|
||||
$output = executeQuery('counter.getCounterLogStatus', $args);
|
||||
}
|
||||
$count = (int)$output->data->count;
|
||||
$status->list[$i] = $count;
|
||||
if($count>$max) $max = $count;
|
||||
$sum += $count;
|
||||
}
|
||||
break;
|
||||
default :
|
||||
$year = substr($selected_date, 0, 4);
|
||||
$month = substr($selected_date, 4, 2);
|
||||
$end_day = date('t', mktime(0,0,0,$month,1,$year));
|
||||
for($i=1;$i<=$end_day;$i++)
|
||||
{
|
||||
unset($args);
|
||||
$args->start_date = sprintf('%04d%02d%02d', $year, $month, $i);
|
||||
$args->end_date = sprintf('%04d%02d%02d', $year, $month, $i);
|
||||
if($site_srl)
|
||||
{
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('counter.getSiteCounterStatus', $args);
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = executeQuery('counter.getCounterStatus', $args);
|
||||
}
|
||||
$count = (int)$output->data->unique_visitor;
|
||||
$status->list[$i] = $count;
|
||||
if($count>$max) $max = $count;
|
||||
$sum += $count;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
foreach($status as $key => $val) {
|
||||
$output[substr($val->regdate,0,8)] = $val;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
$status->max = $max;
|
||||
$status->sum = $sum;
|
||||
return $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select hourly logs of a given date
|
||||
*
|
||||
* @param string $type Choice time interval (year, week, month, hour or DEFAULT)
|
||||
* @param integer $selected_date Date(YYYYMMDD)
|
||||
* @param integer $site_srl Site_srl
|
||||
* @return Object
|
||||
**/
|
||||
function getHourlyStatus($type='hour', $selected_date, $site_srl=0) {
|
||||
$max = 0;
|
||||
$sum = 0;
|
||||
switch($type) {
|
||||
case 'year' :
|
||||
// Get a date to start counting
|
||||
if($site_srl) {
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('counter.getSiteStartLogDate', $args);
|
||||
} else {
|
||||
$output = executeQuery('counter.getStartLogDate');
|
||||
}
|
||||
$start_year = substr($output->data->regdate,0,4);
|
||||
if(!$start_year) $start_year = date("Y");
|
||||
for($i=$start_year;$i<=date("Y");$i++) {
|
||||
unset($args);
|
||||
$args->start_date = sprintf('%04d0000', $i);
|
||||
$args->end_date = sprintf('%04d1231', $i);
|
||||
if($site_srl) {
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('counter.getSiteCounterStatus', $args);
|
||||
} else {
|
||||
$output = executeQuery('counter.getCounterStatus', $args);
|
||||
}
|
||||
$count = (int)$output->data->unique_visitor;
|
||||
$status->list[$i] = $count;
|
||||
if($count>$max) $max = $count;
|
||||
$sum += $count;
|
||||
}
|
||||
break;
|
||||
case 'week' :
|
||||
$time = strtotime($selected_date);
|
||||
$w = date("D");
|
||||
while(date("D",$time) != "Sun") {
|
||||
$time += 60*60*24;
|
||||
}
|
||||
$time -= 60*60*24;
|
||||
while(date("D",$time)!="Sun") {
|
||||
$thisWeek[] = date("Ymd",$time);
|
||||
$time -= 60*60*24;
|
||||
}
|
||||
$thisWeek[] = date("Ymd",$time);
|
||||
asort($thisWeek);
|
||||
foreach($thisWeek as $day) {
|
||||
unset($args);
|
||||
$args->start_date = $day;
|
||||
$args->end_date = $day;
|
||||
if($site_srl) {
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('counter.getSiteCounterStatus', $args);
|
||||
} else {
|
||||
$output = executeQuery('counter.getCounterStatus', $args);
|
||||
}
|
||||
$count = (int)$output->data->unique_visitor;
|
||||
$status->list[$day] = (int)$count;
|
||||
if($count>$max) $max = $count;
|
||||
$sum += $count;
|
||||
}
|
||||
break;
|
||||
case 'month' :
|
||||
$year = substr($selected_date, 0, 4);
|
||||
for($i=1;$i<=12;$i++) {
|
||||
unset($args);
|
||||
$args->start_date = sprintf('%04d%02d00', $year, $i);
|
||||
$args->end_date = sprintf('%04d%02d31', $year, $i);
|
||||
if($site_srl) {
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('counter.getSiteCounterStatus', $args);
|
||||
} else {
|
||||
$output = executeQuery('counter.getCounterStatus', $args);
|
||||
}
|
||||
$count = (int)$output->data->unique_visitor;
|
||||
$status->list[$i] = (int)$count;
|
||||
if($count>$max) $max = $count;
|
||||
$sum += $count;
|
||||
}
|
||||
break;
|
||||
case 'hour' :
|
||||
for($i=0;$i<24;$i++) {
|
||||
unset($args);
|
||||
$args->start_date = sprintf('%08d%02d0000', $selected_date, $i);
|
||||
$args->end_date = sprintf('%08d%02d5959', $selected_date, $i);
|
||||
if($site_srl) {
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('counter.getSiteCounterLogStatus', $args);
|
||||
} else {
|
||||
$args->site_srl = 0;
|
||||
$output = executeQuery('counter.getCounterLogStatus', $args);
|
||||
}
|
||||
$count = (int)$output->data->count;
|
||||
$status->list[$i] = $count;
|
||||
if($count>$max) $max = $count;
|
||||
$sum += $count;
|
||||
}
|
||||
break;
|
||||
default :
|
||||
$year = substr($selected_date, 0, 4);
|
||||
$month = substr($selected_date, 4, 2);
|
||||
$end_day = date('t', mktime(0,0,0,$month,1,$year));
|
||||
for($i=1;$i<=$end_day;$i++) {
|
||||
unset($args);
|
||||
$args->start_date = sprintf('%04d%02d%02d', $year, $month, $i);
|
||||
$args->end_date = sprintf('%04d%02d%02d', $year, $month, $i);
|
||||
if($site_srl) {
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('counter.getSiteCounterStatus', $args);
|
||||
} else {
|
||||
$output = executeQuery('counter.getCounterStatus', $args);
|
||||
}
|
||||
$count = (int)$output->data->unique_visitor;
|
||||
$status->list[$i] = $count;
|
||||
if($count>$max) $max = $count;
|
||||
$sum += $count;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$status->max = $max;
|
||||
$status->sum = $sum;
|
||||
return $status;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
}
|
||||
/* End of file counter.model.php */
|
||||
/* Location: ./modules/counter/counter.model.php */
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,103 +1,111 @@
|
|||
<?php
|
||||
/**
|
||||
* documentAdminModel class
|
||||
* Document the module's admin model class
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/document
|
||||
* @version 0.1
|
||||
*/
|
||||
class documentAdminModel extends document
|
||||
{
|
||||
/**
|
||||
* documentAdminModel class
|
||||
* Document the module's admin model class
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/document
|
||||
* @version 0.1
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
class documentAdminModel extends document {
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init() {
|
||||
}
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a document list from the trash
|
||||
* @param object $obj
|
||||
* @return object
|
||||
*/
|
||||
function getDocumentTrashList($obj) {
|
||||
// check a list and its order
|
||||
if (!in_array($obj->sort_index, array('list_order','delete_date','title'))) $obj->sort_index = 'list_order';
|
||||
if (!in_array($obj->order_type, array('desc','asc'))) $obj->order_type = 'asc';
|
||||
// get a module_srl if mid is returned instead of modul_srl
|
||||
if ($obj->mid) {
|
||||
$oModuleModel = &getModel('module');
|
||||
$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
|
||||
unset($obj->mid);
|
||||
}
|
||||
// check if the module_srl is an array
|
||||
if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
|
||||
else $args->module_srl = $obj->module_srl;
|
||||
// Variable check
|
||||
$args->sort_index = $obj->sort_index;
|
||||
$args->order_type = $obj->order_type;
|
||||
$args->page = $obj->page?$obj->page:1;
|
||||
$args->list_count = $obj->list_count?$obj->list_count:20;
|
||||
$args->page_count = $obj->page_count?$obj->page_count:10;
|
||||
$args->member_srl = $obj->member_srl;
|
||||
// Specify query_id
|
||||
$query_id = 'document.getTrashList';
|
||||
// Execute a query
|
||||
$output = executeQueryArray($query_id, $args);
|
||||
// Return if no result or an error occurs
|
||||
if (!$output->toBool() || !count($output->data)) return $output;
|
||||
/**
|
||||
* Get a document list from the trash
|
||||
* @param object $obj
|
||||
* @return object
|
||||
*/
|
||||
function getDocumentTrashList($obj)
|
||||
{
|
||||
// check a list and its order
|
||||
if(!in_array($obj->sort_index, array('list_order','delete_date','title'))) $obj->sort_index = 'list_order';
|
||||
if(!in_array($obj->order_type, array('desc','asc'))) $obj->order_type = 'asc';
|
||||
// get a module_srl if mid is returned instead of modul_srl
|
||||
if($obj->mid)
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
|
||||
unset($obj->mid);
|
||||
}
|
||||
// check if the module_srl is an array
|
||||
if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
|
||||
else $args->module_srl = $obj->module_srl;
|
||||
// Variable check
|
||||
$args->sort_index = $obj->sort_index;
|
||||
$args->order_type = $obj->order_type;
|
||||
$args->page = $obj->page?$obj->page:1;
|
||||
$args->list_count = $obj->list_count?$obj->list_count:20;
|
||||
$args->page_count = $obj->page_count?$obj->page_count:10;
|
||||
$args->member_srl = $obj->member_srl;
|
||||
// Specify query_id
|
||||
$query_id = 'document.getTrashList';
|
||||
// Execute a query
|
||||
$output = executeQueryArray($query_id, $args);
|
||||
// Return if no result or an error occurs
|
||||
if(!$output->toBool() || !count($output->data)) return $output;
|
||||
|
||||
$idx = 0;
|
||||
$data = $output->data;
|
||||
unset($output->data);
|
||||
$idx = 0;
|
||||
$data = $output->data;
|
||||
unset($output->data);
|
||||
|
||||
$keys = array_keys($data);
|
||||
$virtual_number = $keys[0];
|
||||
$keys = array_keys($data);
|
||||
$virtual_number = $keys[0];
|
||||
|
||||
foreach($data as $key => $attribute) {
|
||||
$oDocument = null;
|
||||
$oDocument = new documentItem();
|
||||
$oDocument->setAttribute($attribute, false);
|
||||
if ($is_admin) $oDocument->setGrant();
|
||||
foreach($data as $key => $attribute)
|
||||
{
|
||||
$oDocument = null;
|
||||
$oDocument = new documentItem();
|
||||
$oDocument->setAttribute($attribute, false);
|
||||
if($is_admin) $oDocument->setGrant();
|
||||
|
||||
$output->data[$virtual_number] = $oDocument;
|
||||
$virtual_number--;
|
||||
}
|
||||
$output->data[$virtual_number] = $oDocument;
|
||||
$virtual_number--;
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the doc which has trash_srl from the trash can
|
||||
* @param int $trash_srl
|
||||
* @return object
|
||||
*/
|
||||
function getDocumentTrash($trash_srl) {
|
||||
$args->trash_srl = $trash_srl;
|
||||
$output = executeQuery('document.getTrash', $args);
|
||||
/**
|
||||
* Get the doc which has trash_srl from the trash can
|
||||
* @param int $trash_srl
|
||||
* @return object
|
||||
*/
|
||||
function getDocumentTrash($trash_srl)
|
||||
{
|
||||
$args->trash_srl = $trash_srl;
|
||||
$output = executeQuery('document.getTrash', $args);
|
||||
|
||||
$node = $output->data;
|
||||
if (!$node) return;
|
||||
$node = $output->data;
|
||||
if(!$node) return;
|
||||
|
||||
return $node;
|
||||
}
|
||||
return $node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return document count with date
|
||||
* @param string $date
|
||||
* @parpam array $moduleSrlList
|
||||
* @param array $statusList
|
||||
* @return int
|
||||
*/
|
||||
function getDocumentCountByDate($date = '', $moduleSrlList = array(), $statusList = array()) {
|
||||
if($date) $args->regDate = date('Ymd', strtotime($date));
|
||||
if(count($moduleSrlList)>0) $args->moduleSrlList = $moduleSrlList;
|
||||
if(count($statusList)>0) $args->statusList = $statusList;
|
||||
/**
|
||||
* Return document count with date
|
||||
* @param string $date
|
||||
* @parpam array $moduleSrlList
|
||||
* @param array $statusList
|
||||
* @return int
|
||||
*/
|
||||
function getDocumentCountByDate($date = '', $moduleSrlList = array(), $statusList = array())
|
||||
{
|
||||
if($date) $args->regDate = date('Ymd', strtotime($date));
|
||||
if(count($moduleSrlList)>0) $args->moduleSrlList = $moduleSrlList;
|
||||
if(count($statusList)>0) $args->statusList = $statusList;
|
||||
|
||||
$output = executeQuery('document.getDocumentCountByDate', $args);
|
||||
if(!$output->toBool()) return 0;
|
||||
$output = executeQuery('document.getDocumentCountByDate', $args);
|
||||
if(!$output->toBool()) return 0;
|
||||
|
||||
return $output->data->count;
|
||||
}
|
||||
}
|
||||
?>
|
||||
return $output->data->count;
|
||||
}
|
||||
}
|
||||
/* End of file document.admin.model.php */
|
||||
/* Location: ./modules/document/document.admin.model.php */
|
||||
|
|
|
|||
|
|
@ -1,188 +1,199 @@
|
|||
<?php
|
||||
/**
|
||||
* documentAdminView class
|
||||
* Document admin view of the module class
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/document
|
||||
* @version 0.1
|
||||
*/
|
||||
class documentAdminView extends document
|
||||
{
|
||||
/**
|
||||
* documentAdminView class
|
||||
* Document admin view of the module class
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/document
|
||||
* @version 0.1
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
class documentAdminView extends document {
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init() {
|
||||
// check current location in admin menu
|
||||
$oModuleModel = &getModel('module');
|
||||
$info = $oModuleModel->getModuleActionXml('document');
|
||||
foreach($info->menu AS $key => $menu)
|
||||
function init()
|
||||
{
|
||||
// check current location in admin menu
|
||||
$oModuleModel = &getModel('module');
|
||||
$info = $oModuleModel->getModuleActionXml('document');
|
||||
foreach($info->menu AS $key => $menu)
|
||||
{
|
||||
if(in_array($this->act, $menu->acts))
|
||||
{
|
||||
if(in_array($this->act, $menu->acts))
|
||||
{
|
||||
Context::set('currentMenu', $key);
|
||||
break;
|
||||
}
|
||||
Context::set('currentMenu', $key);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a list(administrative)
|
||||
* @return void
|
||||
*/
|
||||
function dispDocumentAdminList() {
|
||||
// option to get a list
|
||||
$args->page = Context::get('page'); // /< Page
|
||||
$args->list_count = 30; // /< the number of posts to display on a single page
|
||||
$args->page_count = 5; // /< the number of pages that appear in the page navigation
|
||||
/**
|
||||
* Display a list(administrative)
|
||||
* @return void
|
||||
*/
|
||||
function dispDocumentAdminList()
|
||||
{
|
||||
// option to get a list
|
||||
$args->page = Context::get('page'); // /< Page
|
||||
$args->list_count = 30; // /< the number of posts to display on a single page
|
||||
$args->page_count = 5; // /< the number of pages that appear in the page navigation
|
||||
|
||||
$args->search_target = Context::get('search_target'); // /< search (title, contents ...)
|
||||
$args->search_keyword = Context::get('search_keyword'); // /< keyword to search
|
||||
$args->search_target = Context::get('search_target'); // /< search (title, contents ...)
|
||||
$args->search_keyword = Context::get('search_keyword'); // /< keyword to search
|
||||
|
||||
$args->sort_index = 'list_order'; // /< sorting value
|
||||
$args->sort_index = 'list_order'; // /< sorting value
|
||||
|
||||
$args->module_srl = Context::get('module_srl');
|
||||
$args->module_srl = Context::get('module_srl');
|
||||
|
||||
// get a list
|
||||
$oDocumentModel = &getModel('document');
|
||||
$columnList = array('document_srl', 'title', 'member_srl', 'nick_name', 'readed_count', 'voted_count', 'blamed_count', 'regdate', 'ipaddress', 'status');
|
||||
$output = $oDocumentModel->getDocumentList($args, false, true, $columnList);
|
||||
// get a list
|
||||
$oDocumentModel = &getModel('document');
|
||||
$columnList = array('document_srl', 'title', 'member_srl', 'nick_name', 'readed_count', 'voted_count', 'blamed_count', 'regdate', 'ipaddress', 'status');
|
||||
$output = $oDocumentModel->getDocumentList($args, false, true, $columnList);
|
||||
|
||||
// get Status name list
|
||||
$statusNameList = $oDocumentModel->getStatusNameList();
|
||||
// get Status name list
|
||||
$statusNameList = $oDocumentModel->getStatusNameList();
|
||||
|
||||
// Set values of document_model::getDocumentList() objects for a template
|
||||
Context::set('total_count', $output->total_count);
|
||||
Context::set('total_page', $output->total_page);
|
||||
Context::set('page', $output->page);
|
||||
Context::set('document_list', $output->data);
|
||||
Context::set('status_name_list', $statusNameList);
|
||||
Context::set('page_navigation', $output->page_navigation);
|
||||
// Set values of document_model::getDocumentList() objects for a template
|
||||
Context::set('total_count', $output->total_count);
|
||||
Context::set('total_page', $output->total_page);
|
||||
Context::set('page', $output->page);
|
||||
Context::set('document_list', $output->data);
|
||||
Context::set('status_name_list', $statusNameList);
|
||||
Context::set('page_navigation', $output->page_navigation);
|
||||
|
||||
// set a search option used in the template
|
||||
$count_search_option = count($this->search_option);
|
||||
for($i=0;$i<$count_search_option;$i++) {
|
||||
$search_option[$this->search_option[$i]] = Context::getLang($this->search_option[$i]);
|
||||
}
|
||||
Context::set('search_option', $search_option);
|
||||
// set a search option used in the template
|
||||
$count_search_option = count($this->search_option);
|
||||
for($i=0;$i<$count_search_option;$i++)
|
||||
{
|
||||
$search_option[$this->search_option[$i]] = Context::getLang($this->search_option[$i]);
|
||||
}
|
||||
Context::set('search_option', $search_option);
|
||||
|
||||
// Specify a template
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('document_list');
|
||||
}
|
||||
// Specify a template
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('document_list');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a document module
|
||||
* @return void
|
||||
*/
|
||||
function dispDocumentAdminConfig() {
|
||||
$oDocumentModel = &getModel('document');
|
||||
$config = $oDocumentModel->getDocumentConfig();
|
||||
Context::set('config',$config);
|
||||
/**
|
||||
* Set a document module
|
||||
* @return void
|
||||
*/
|
||||
function dispDocumentAdminConfig()
|
||||
{
|
||||
$oDocumentModel = &getModel('document');
|
||||
$config = $oDocumentModel->getDocumentConfig();
|
||||
Context::set('config',$config);
|
||||
|
||||
// Set the template file
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('document_config');
|
||||
}
|
||||
// Set the template file
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('document_config');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a report list on the admin page
|
||||
* @return void
|
||||
*/
|
||||
function dispDocumentAdminDeclared() {
|
||||
// option for a list
|
||||
$args->page = Context::get('page'); // /< Page
|
||||
$args->list_count = 30; // /< the number of posts to display on a single page
|
||||
$args->page_count = 10; // /< the number of pages that appear in the page navigation
|
||||
/**
|
||||
* Display a report list on the admin page
|
||||
* @return void
|
||||
*/
|
||||
function dispDocumentAdminDeclared()
|
||||
{
|
||||
// option for a list
|
||||
$args->page = Context::get('page'); // /< Page
|
||||
$args->list_count = 30; // /< the number of posts to display on a single page
|
||||
$args->page_count = 10; // /< the number of pages that appear in the page navigation
|
||||
|
||||
$args->sort_index = 'document_declared.declared_count'; // /< sorting values
|
||||
$args->order_type = 'desc'; // /< sorting values by order
|
||||
$args->sort_index = 'document_declared.declared_count'; // /< sorting values
|
||||
$args->order_type = 'desc'; // /< sorting values by order
|
||||
|
||||
// get Status name list
|
||||
$oDocumentModel = &getModel('document');
|
||||
$statusNameList = $oDocumentModel->getStatusNameList();
|
||||
// get Status name list
|
||||
$oDocumentModel = &getModel('document');
|
||||
$statusNameList = $oDocumentModel->getStatusNameList();
|
||||
|
||||
// get a list
|
||||
$declared_output = executeQuery('document.getDeclaredList', $args);
|
||||
if($declared_output->data && count($declared_output->data)) {
|
||||
$document_list = array();
|
||||
// get a list
|
||||
$declared_output = executeQuery('document.getDeclaredList', $args);
|
||||
if($declared_output->data && count($declared_output->data))
|
||||
{
|
||||
$document_list = array();
|
||||
|
||||
foreach($declared_output->data as $key => $document) {
|
||||
$document_list[$key] = new documentItem();
|
||||
$document_list[$key]->setAttribute($document);
|
||||
}
|
||||
$declared_output->data = $document_list;
|
||||
foreach($declared_output->data as $key => $document)
|
||||
{
|
||||
$document_list[$key] = new documentItem();
|
||||
$document_list[$key]->setAttribute($document);
|
||||
}
|
||||
$declared_output->data = $document_list;
|
||||
}
|
||||
|
||||
// Set values of document_model::getDocumentList() objects for a template
|
||||
Context::set('total_count', $declared_output->total_count);
|
||||
Context::set('total_page', $declared_output->total_page);
|
||||
Context::set('page', $declared_output->page);
|
||||
Context::set('document_list', $declared_output->data);
|
||||
Context::set('page_navigation', $declared_output->page_navigation);
|
||||
Context::set('status_name_list', $statusNameList);
|
||||
// Set the template
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('declared_list');
|
||||
}
|
||||
// Set values of document_model::getDocumentList() objects for a template
|
||||
Context::set('total_count', $declared_output->total_count);
|
||||
Context::set('total_page', $declared_output->total_page);
|
||||
Context::set('page', $declared_output->page);
|
||||
Context::set('document_list', $declared_output->data);
|
||||
Context::set('page_navigation', $declared_output->page_navigation);
|
||||
Context::set('status_name_list', $statusNameList);
|
||||
// Set the template
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('declared_list');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a alias list on the admin page
|
||||
* @return void
|
||||
*/
|
||||
function dispDocumentAdminAlias() {
|
||||
$args->document_srl = Context::get('document_srl');
|
||||
if(!$args->document_srl) return $this->dispDocumentAdminList();
|
||||
/**
|
||||
* Display a alias list on the admin page
|
||||
* @return void
|
||||
*/
|
||||
function dispDocumentAdminAlias()
|
||||
{
|
||||
$args->document_srl = Context::get('document_srl');
|
||||
if(!$args->document_srl) return $this->dispDocumentAdminList();
|
||||
|
||||
$oModel = &getModel('document');
|
||||
$oDocument = $oModel->getDocument($args->document_srl);
|
||||
if(!$oDocument->isExists()) return $this->dispDocumentAdminList();
|
||||
Context::set('oDocument', $oDocument);
|
||||
$oModel = &getModel('document');
|
||||
$oDocument = $oModel->getDocument($args->document_srl);
|
||||
if(!$oDocument->isExists()) return $this->dispDocumentAdminList();
|
||||
Context::set('oDocument', $oDocument);
|
||||
|
||||
$output = executeQueryArray('document.getAliases', $args);
|
||||
if(!$output->data)
|
||||
{
|
||||
$aliases = array();
|
||||
}
|
||||
else
|
||||
{
|
||||
$aliases = $output->data;
|
||||
}
|
||||
$output = executeQueryArray('document.getAliases', $args);
|
||||
if(!$output->data)
|
||||
{
|
||||
$aliases = array();
|
||||
}
|
||||
else
|
||||
{
|
||||
$aliases = $output->data;
|
||||
}
|
||||
|
||||
Context::set('aliases', $aliases);
|
||||
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('document_alias');
|
||||
}
|
||||
Context::set('aliases', $aliases);
|
||||
|
||||
/**
|
||||
* Display a trash list on the admin page
|
||||
* @return void
|
||||
*/
|
||||
function dispDocumentAdminTrashList() {
|
||||
// options for a list
|
||||
$args->page = Context::get('page'); // /< Page
|
||||
$args->list_count = 30; // /< the number of posts to display on a single page
|
||||
$args->page_count = 10; // /< the number of pages that appear in the page navigation
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('document_alias');
|
||||
}
|
||||
|
||||
$args->sort_index = 'list_order'; // /< sorting values
|
||||
$args->order_type = 'desc'; // /< sorting values by order
|
||||
/**
|
||||
* Display a trash list on the admin page
|
||||
* @return void
|
||||
*/
|
||||
function dispDocumentAdminTrashList()
|
||||
{
|
||||
// options for a list
|
||||
$args->page = Context::get('page'); // /< Page
|
||||
$args->list_count = 30; // /< the number of posts to display on a single page
|
||||
$args->page_count = 10; // /< the number of pages that appear in the page navigation
|
||||
|
||||
$args->module_srl = Context::get('module_srl');
|
||||
$args->sort_index = 'list_order'; // /< sorting values
|
||||
$args->order_type = 'desc'; // /< sorting values by order
|
||||
|
||||
// get a list
|
||||
$oDocumentAdminModel = &getAdminModel('document');
|
||||
$output = $oDocumentAdminModel->getDocumentTrashList($args);
|
||||
$args->module_srl = Context::get('module_srl');
|
||||
|
||||
// Set values of document_admin_model::getDocumentTrashList() objects for a template
|
||||
Context::set('total_count', $output->total_count);
|
||||
Context::set('total_page', $output->total_page);
|
||||
Context::set('page', $output->page);
|
||||
Context::set('document_list', $output->data);
|
||||
Context::set('page_navigation', $output->page_navigation);
|
||||
// set the template
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('document_trash_list');
|
||||
}
|
||||
}
|
||||
?>
|
||||
// get a list
|
||||
$oDocumentAdminModel = &getAdminModel('document');
|
||||
$output = $oDocumentAdminModel->getDocumentTrashList($args);
|
||||
|
||||
// Set values of document_admin_model::getDocumentTrashList() objects for a template
|
||||
Context::set('total_count', $output->total_count);
|
||||
Context::set('total_page', $output->total_page);
|
||||
Context::set('page', $output->page);
|
||||
Context::set('document_list', $output->data);
|
||||
Context::set('page_navigation', $output->page_navigation);
|
||||
// set the template
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('document_trash_list');
|
||||
}
|
||||
}
|
||||
/* End of file document.admin.view.php */
|
||||
/* Location: ./modules/document/document.admin.view.php */
|
||||
|
|
|
|||
|
|
@ -130,30 +130,36 @@ class document extends ModuleObject
|
|||
* Execute update
|
||||
* @return Object
|
||||
*/
|
||||
function moduleUpdate() {
|
||||
function moduleUpdate()
|
||||
{
|
||||
$oDB = &DB::getInstance();
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleController = &getController('module');
|
||||
|
||||
// 2007. 7. 25: Add a column(notify_message) for notification
|
||||
if(!$oDB->isColumnExists("documents","notify_message")) {
|
||||
if(!$oDB->isColumnExists("documents","notify_message"))
|
||||
{
|
||||
$oDB->addColumn('documents',"notify_message","char",1);
|
||||
}
|
||||
|
||||
// 2007. 8. 23: create a clustered index in the document table
|
||||
if(!$oDB->isIndexExists("documents","idx_module_list_order")) {
|
||||
if(!$oDB->isIndexExists("documents","idx_module_list_order"))
|
||||
{
|
||||
$oDB->addIndex("documents","idx_module_list_order", array("module_srl","list_order"));
|
||||
}
|
||||
|
||||
if(!$oDB->isIndexExists("documents","idx_module_update_order")) {
|
||||
if(!$oDB->isIndexExists("documents","idx_module_update_order"))
|
||||
{
|
||||
$oDB->addIndex("documents","idx_module_update_order", array("module_srl","update_order"));
|
||||
}
|
||||
|
||||
if(!$oDB->isIndexExists("documents","idx_module_readed_count")) {
|
||||
if(!$oDB->isIndexExists("documents","idx_module_readed_count"))
|
||||
{
|
||||
$oDB->addIndex("documents","idx_module_readed_count", array("module_srl","readed_count"));
|
||||
}
|
||||
|
||||
if(!$oDB->isIndexExists("documents","idx_module_voted_count")) {
|
||||
if(!$oDB->isIndexExists("documents","idx_module_voted_count"))
|
||||
{
|
||||
$oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count"));
|
||||
}
|
||||
// 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted
|
||||
|
|
@ -172,12 +178,14 @@ class document extends ModuleObject
|
|||
// 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian))
|
||||
if(!$oDB->isIndexExists("documents","idx_module_document_srl")) $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl"));
|
||||
// 2008. 04. 23 Add a column(blamed count)
|
||||
if(!$oDB->isColumnExists("documents", "blamed_count")) {
|
||||
if(!$oDB->isColumnExists("documents", "blamed_count"))
|
||||
{
|
||||
$oDB->addColumn('documents', 'blamed_count', 'number', 11, 0, true);
|
||||
$oDB->addIndex('documents', 'idx_blamed_count', array('blamed_count'));
|
||||
}
|
||||
|
||||
if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) {
|
||||
if(!$oDB->isIndexExists("documents","idx_module_blamed_count"))
|
||||
{
|
||||
$oDB->addIndex('documents', 'idx_module_blamed_count', array('module_srl', 'blamed_count'));
|
||||
}
|
||||
|
||||
|
|
@ -194,24 +202,28 @@ class document extends ModuleObject
|
|||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'))
|
||||
$oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before');
|
||||
// 2009. 03. 09 Add a column(lang_code) to the documnets table
|
||||
if(!$oDB->isColumnExists("documents","lang_code")) {
|
||||
if(!$oDB->isColumnExists("documents","lang_code"))
|
||||
{
|
||||
$db_info = Context::getDBInfo();
|
||||
$oDB->addColumn('documents',"lang_code","varchar",10, $db_info->lang_code);
|
||||
$obj->lang_code = $db_info->lang_type;
|
||||
executeQuery('document.updateDocumentsLangCode', $obj);
|
||||
}
|
||||
// 2009. 03. 11 Check the index in the document_extra_vars table
|
||||
if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) {
|
||||
if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars"))
|
||||
{
|
||||
$oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true);
|
||||
}
|
||||
|
||||
if($oDB->isIndexExists("document_extra_vars", "unique_module_vars")) {
|
||||
if($oDB->isIndexExists("document_extra_vars", "unique_module_vars"))
|
||||
{
|
||||
$oDB->dropIndex("document_extra_vars", "unique_module_vars", true);
|
||||
}
|
||||
|
||||
// 2009. 03. 19: Add a column(eid)
|
||||
// 2009. 04. 12: Fixed the issue(#17922959) that changes another column values when adding eid column
|
||||
if(!$oDB->isColumnExists("document_extra_keys","eid")) {
|
||||
if(!$oDB->isColumnExists("document_extra_keys","eid"))
|
||||
{
|
||||
$oDB->addColumn("document_extra_keys","eid","varchar",40);
|
||||
|
||||
$output = executeQuery('document.getGroupsExtraKeys', $obj);
|
||||
|
|
@ -225,12 +237,15 @@ class document extends ModuleObject
|
|||
}
|
||||
}
|
||||
|
||||
if(!$oDB->isColumnExists("document_extra_vars","eid")) {
|
||||
if(!$oDB->isColumnExists("document_extra_vars","eid"))
|
||||
{
|
||||
$oDB->addColumn("document_extra_vars","eid","varchar",40);
|
||||
$obj->var_idx = '-1,-2';
|
||||
$output = executeQuery('document.getGroupsExtraVars', $obj);
|
||||
if($output->toBool() && $output->data && count($output->data)) {
|
||||
foreach($output->data as $extra_vars) {
|
||||
if($output->toBool() && $output->data && count($output->data))
|
||||
{
|
||||
foreach($output->data as $extra_vars)
|
||||
{
|
||||
$args->module_srl = $extra_vars->module_srl;
|
||||
$args->var_idx = $extra_vars->idx;
|
||||
$args->new_eid = "extra_vars".$extra_vars->idx;
|
||||
|
|
@ -240,7 +255,8 @@ class document extends ModuleObject
|
|||
}
|
||||
|
||||
// 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table
|
||||
if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) {
|
||||
if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order"))
|
||||
{
|
||||
$oDB->addIndex("document_extra_vars", "idx_document_list_order", array("document_srl","module_srl","var_idx"), false);
|
||||
}
|
||||
|
||||
|
|
@ -312,7 +328,8 @@ class document extends ModuleObject
|
|||
* Re-generate the cache file
|
||||
* @return void
|
||||
*/
|
||||
function recompileCache() {
|
||||
function recompileCache()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -343,4 +360,5 @@ class document extends ModuleObject
|
|||
else $this->getDefaultStatus();
|
||||
}
|
||||
}
|
||||
?>
|
||||
/* End of file document.class.php */
|
||||
/* Location: ./modules/document/document.class.php */
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,163 +1,173 @@
|
|||
<?php
|
||||
/**
|
||||
* documentView class
|
||||
* View class of the module document
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/document
|
||||
* @version 0.1
|
||||
*/
|
||||
class documentView extends document
|
||||
{
|
||||
/**
|
||||
* documentView class
|
||||
* View class of the module document
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/document
|
||||
* @version 0.1
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
class documentView extends document {
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init() {
|
||||
}
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Document printing
|
||||
* I make it out to find the geulman;;
|
||||
* @return void|Object
|
||||
*/
|
||||
function dispDocumentPrint() {
|
||||
// Bring a list of variables needed to implement
|
||||
$document_srl = Context::get('document_srl');
|
||||
/**
|
||||
* Document printing
|
||||
* I make it out to find the geulman;;
|
||||
* @return void|Object
|
||||
*/
|
||||
function dispDocumentPrint()
|
||||
{
|
||||
// Bring a list of variables needed to implement
|
||||
$document_srl = Context::get('document_srl');
|
||||
|
||||
// module_info not use in UI
|
||||
//$oModuleModel = &getModel('module');
|
||||
//$module_info = $oModuleModel->getModuleInfoByDocumentSrl($document_srl);
|
||||
// module_info not use in UI
|
||||
//$oModuleModel = &getModel('module');
|
||||
//$module_info = $oModuleModel->getModuleInfoByDocumentSrl($document_srl);
|
||||
|
||||
// Create the document object. If the document module of basic data structures, write it all works .. -_-;
|
||||
$oDocumentModel = &getModel('document');
|
||||
// Creates an object for displaying the selected document
|
||||
$oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager);
|
||||
if(!$oDocument->isExists()) return new Object(-1,'msg_invalid_request');
|
||||
// Check permissions
|
||||
if(!$oDocument->isAccessible()) return new Object(-1,'msg_not_permitted');
|
||||
// Information setting module
|
||||
//Context::set('module_info', $module_info); //module_info not use in UI
|
||||
// Browser title settings
|
||||
Context::setBrowserTitle($oDocument->getTitleText());
|
||||
Context::set('oDocument', $oDocument);
|
||||
// Create the document object. If the document module of basic data structures, write it all works .. -_-;
|
||||
$oDocumentModel = &getModel('document');
|
||||
// Creates an object for displaying the selected document
|
||||
$oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager);
|
||||
if(!$oDocument->isExists()) return new Object(-1,'msg_invalid_request');
|
||||
// Check permissions
|
||||
if(!$oDocument->isAccessible()) return new Object(-1,'msg_not_permitted');
|
||||
// Information setting module
|
||||
//Context::set('module_info', $module_info); //module_info not use in UI
|
||||
// Browser title settings
|
||||
Context::setBrowserTitle($oDocument->getTitleText());
|
||||
Context::set('oDocument', $oDocument);
|
||||
|
||||
Context::set('layout','none');
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('print_page');
|
||||
}
|
||||
Context::set('layout','none');
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('print_page');
|
||||
}
|
||||
|
||||
/**
|
||||
* Preview
|
||||
* @return void
|
||||
*/
|
||||
function dispDocumentPreview() {
|
||||
Context::set('layout','none');
|
||||
/**
|
||||
* Preview
|
||||
* @return void
|
||||
*/
|
||||
function dispDocumentPreview()
|
||||
{
|
||||
Context::set('layout','none');
|
||||
|
||||
$content = Context::get('content');
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('preview_page');
|
||||
}
|
||||
$content = Context::get('content');
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('preview_page');
|
||||
}
|
||||
|
||||
/**
|
||||
* Selected by the administrator for the document management
|
||||
* @return void|Object
|
||||
*/
|
||||
function dispDocumentManageDocument() {
|
||||
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
|
||||
// Taken from a list of selected sessions
|
||||
$flag_list = $_SESSION['document_management'];
|
||||
if(count($flag_list)) {
|
||||
foreach($flag_list as $key => $val) {
|
||||
if(!is_bool($val)) continue;
|
||||
$document_srl_list[] = $key;
|
||||
}
|
||||
}
|
||||
|
||||
if(count($document_srl_list)) {
|
||||
$oDocumentModel = &getModel('document');
|
||||
$document_list = $oDocumentModel->getDocuments($document_srl_list, $this->grant->is_admin);
|
||||
Context::set('document_list', $document_list);
|
||||
}
|
||||
|
||||
$oModuleModel = &getModel('module');
|
||||
// The combination of module categories list and the list of modules
|
||||
if(count($module_list)>1) Context::set('module_list', $module_categories);
|
||||
|
||||
$module_srl=Context::get('module_srl');
|
||||
Context::set('module_srl',$module_srl);
|
||||
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
|
||||
Context::set('mid',$module_info->mid);
|
||||
Context::set('browser_title',$module_info->browser_title);
|
||||
|
||||
|
||||
// Select Pop-up layout
|
||||
$this->setLayoutPath('./common/tpl');
|
||||
$this->setLayoutFile('popup_layout');
|
||||
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('checked_list');
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger method.
|
||||
* Additional information realte to document setting
|
||||
* @param string $obj
|
||||
* @return Object
|
||||
*/
|
||||
function triggerDispDocumentAdditionSetup(&$obj) {
|
||||
$current_module_srl = Context::get('module_srl');
|
||||
$current_module_srls = Context::get('module_srls');
|
||||
|
||||
if(!$current_module_srl && !$current_module_srls) {
|
||||
// Get information of the current module
|
||||
$current_module_info = Context::get('current_module_info');
|
||||
$current_module_srl = $current_module_info->module_srl;
|
||||
if(!$current_module_srl) return new Object();
|
||||
}
|
||||
|
||||
$oModuleModel = &getModel('module');
|
||||
if($current_module_srl)
|
||||
{
|
||||
$document_config = $oModuleModel->getModulePartConfig('document', $current_module_srl);
|
||||
}
|
||||
if(!isset($document_config->use_history)) $document_config->use_history = 'N';
|
||||
Context::set('document_config', $document_config);
|
||||
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
$tpl = $oTemplate->compile($this->module_path.'tpl', 'document_module_config');
|
||||
$obj .= $tpl;
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* Document temp saved list
|
||||
* @return void
|
||||
*/
|
||||
function dispTempSavedList()
|
||||
/**
|
||||
* Selected by the administrator for the document management
|
||||
* @return void|Object
|
||||
*/
|
||||
function dispDocumentManageDocument()
|
||||
{
|
||||
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
|
||||
// Taken from a list of selected sessions
|
||||
$flag_list = $_SESSION['document_management'];
|
||||
if(count($flag_list))
|
||||
{
|
||||
$this->setLayoutFile('popup_layout');
|
||||
|
||||
$oMemberModel = &getModel('member');
|
||||
// A message appears if the user is not logged-in
|
||||
if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
|
||||
// Get the saved document (module_srl is set to member_srl instead)
|
||||
$logged_info = Context::get('logged_info');
|
||||
$args->member_srl = $logged_info->member_srl;
|
||||
$args->statusList = array($this->getConfigStatus('temp'));
|
||||
$args->page = (int)Context::get('page');
|
||||
$args->list_count = 10;
|
||||
|
||||
$oDocumentModel = &getModel('document');
|
||||
$output = $oDocumentModel->getDocumentList($args, true);
|
||||
Context::set('total_count', $output->total_count);
|
||||
Context::set('total_page', $output->total_page);
|
||||
Context::set('page', $output->page);
|
||||
Context::set('document_list', $output->data);
|
||||
Context::set('page_navigation', $output->page_navigation);
|
||||
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('saved_list_popup');
|
||||
foreach($flag_list as $key => $val)
|
||||
{
|
||||
if(!is_bool($val)) continue;
|
||||
$document_srl_list[] = $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
if(count($document_srl_list))
|
||||
{
|
||||
$oDocumentModel = &getModel('document');
|
||||
$document_list = $oDocumentModel->getDocuments($document_srl_list, $this->grant->is_admin);
|
||||
Context::set('document_list', $document_list);
|
||||
}
|
||||
|
||||
$oModuleModel = &getModel('module');
|
||||
// The combination of module categories list and the list of modules
|
||||
if(count($module_list)>1) Context::set('module_list', $module_categories);
|
||||
|
||||
$module_srl=Context::get('module_srl');
|
||||
Context::set('module_srl',$module_srl);
|
||||
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
|
||||
Context::set('mid',$module_info->mid);
|
||||
Context::set('browser_title',$module_info->browser_title);
|
||||
|
||||
// Select Pop-up layout
|
||||
$this->setLayoutPath('./common/tpl');
|
||||
$this->setLayoutFile('popup_layout');
|
||||
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('checked_list');
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger method.
|
||||
* Additional information realte to document setting
|
||||
* @param string $obj
|
||||
* @return Object
|
||||
*/
|
||||
function triggerDispDocumentAdditionSetup(&$obj)
|
||||
{
|
||||
$current_module_srl = Context::get('module_srl');
|
||||
$current_module_srls = Context::get('module_srls');
|
||||
|
||||
if(!$current_module_srl && !$current_module_srls)
|
||||
{
|
||||
// Get information of the current module
|
||||
$current_module_info = Context::get('current_module_info');
|
||||
$current_module_srl = $current_module_info->module_srl;
|
||||
if(!$current_module_srl) return new Object();
|
||||
}
|
||||
|
||||
$oModuleModel = &getModel('module');
|
||||
if($current_module_srl)
|
||||
{
|
||||
$document_config = $oModuleModel->getModulePartConfig('document', $current_module_srl);
|
||||
}
|
||||
if(!isset($document_config->use_history)) $document_config->use_history = 'N';
|
||||
Context::set('document_config', $document_config);
|
||||
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
$tpl = $oTemplate->compile($this->module_path.'tpl', 'document_module_config');
|
||||
$obj .= $tpl;
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* Document temp saved list
|
||||
* @return void
|
||||
*/
|
||||
function dispTempSavedList()
|
||||
{
|
||||
$this->setLayoutFile('popup_layout');
|
||||
|
||||
$oMemberModel = &getModel('member');
|
||||
// A message appears if the user is not logged-in
|
||||
if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
|
||||
// Get the saved document (module_srl is set to member_srl instead)
|
||||
$logged_info = Context::get('logged_info');
|
||||
$args->member_srl = $logged_info->member_srl;
|
||||
$args->statusList = array($this->getConfigStatus('temp'));
|
||||
$args->page = (int)Context::get('page');
|
||||
$args->list_count = 10;
|
||||
|
||||
$oDocumentModel = &getModel('document');
|
||||
$output = $oDocumentModel->getDocumentList($args, true);
|
||||
Context::set('total_count', $output->total_count);
|
||||
Context::set('total_page', $output->total_page);
|
||||
Context::set('page', $output->page);
|
||||
Context::set('document_list', $output->data);
|
||||
Context::set('page_navigation', $output->page_navigation);
|
||||
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('saved_list_popup');
|
||||
}
|
||||
}
|
||||
/* End of file document.view.php */
|
||||
/* Location: ./modules/document/document.view.php */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue