mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-03 17:22:20 +09:00
issue 2662 install, integration_search
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12249 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
e7177034b3
commit
9aefe700b6
10 changed files with 1720 additions and 1577 deletions
|
|
@ -1,116 +1,126 @@
|
|||
<?php
|
||||
/**
|
||||
* The admin view class of the integration_search module
|
||||
/**
|
||||
* The admin view class of the integration_search module
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
*/
|
||||
class integration_searchAdminController extends integration_search
|
||||
{
|
||||
/**
|
||||
* Initialization
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
**/
|
||||
* @return void
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
class integration_searchAdminController extends integration_search {
|
||||
/**
|
||||
* Initialization
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function init()
|
||||
/**
|
||||
* Save Settings
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function procIntegration_searchAdminInsertConfig()
|
||||
{
|
||||
// Get configurations (using module model object)
|
||||
$oModuleModel = &getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('integration_search');
|
||||
|
||||
$args->skin = Context::get('skin');
|
||||
$args->target = Context::get('target');
|
||||
$args->target_module_srl = Context::get('target_module_srl');
|
||||
if(!$args->target_module_srl) $args->target_module_srl = '';
|
||||
$args->skin_vars = $config->skin_vars;
|
||||
|
||||
$oModuleController = &getController('module');
|
||||
$output = $oModuleController->insertModuleConfig('integration_search',$args);
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispIntegration_searchAdminContent');
|
||||
return $this->setRedirectUrl($returnUrl, $output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the skin information
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function procIntegration_searchAdminInsertSkin()
|
||||
{
|
||||
// Get configurations (using module model object)
|
||||
$oModuleModel = &getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('integration_search');
|
||||
|
||||
$args->skin = $config->skin;
|
||||
$args->target_module_srl = $config->target_module_srl;
|
||||
// Get skin information (to check extra_vars)
|
||||
$skin_info = $oModuleModel->loadSkinInfo($this->module_path, $config->skin);
|
||||
// Check received variables (delete the basic variables such as mo, act, module_srl, page)
|
||||
$obj = Context::getRequestVars();
|
||||
unset($obj->act);
|
||||
unset($obj->module_srl);
|
||||
unset($obj->page);
|
||||
// Separately handle if the extra_vars is an image type in the original skin_info
|
||||
if($skin_info->extra_vars)
|
||||
{
|
||||
foreach($skin_info->extra_vars as $vars)
|
||||
{
|
||||
if($vars->type!='image') continue;
|
||||
|
||||
$image_obj = $obj->{$vars->name};
|
||||
// Get a variable on a request to delete
|
||||
$del_var = $obj->{"del_".$vars->name};
|
||||
unset($obj->{"del_".$vars->name});
|
||||
if($del_var == 'Y')
|
||||
{
|
||||
FileHandler::removeFile($module_info->{$vars->name});
|
||||
continue;
|
||||
}
|
||||
// Use the previous data if not uploaded
|
||||
if(!$image_obj['tmp_name'])
|
||||
{
|
||||
$obj->{$vars->name} = $module_info->{$vars->name};
|
||||
continue;
|
||||
}
|
||||
// Ignore if the file is not successfully uploaded
|
||||
if(!is_uploaded_file($image_obj['tmp_name']))
|
||||
{
|
||||
unset($obj->{$vars->name});
|
||||
continue;
|
||||
}
|
||||
// Ignore if the file is not an image
|
||||
if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name']))
|
||||
{
|
||||
unset($obj->{$vars->name});
|
||||
continue;
|
||||
}
|
||||
// Upload the file to a path
|
||||
$path = sprintf("./files/attach/images/%s/", $module_srl);
|
||||
// Create a directory
|
||||
if(!FileHandler::makeDir($path)) return false;
|
||||
|
||||
$filename = $path.$image_obj['name'];
|
||||
// Move the file
|
||||
if(!move_uploaded_file($image_obj['tmp_name'], $filename))
|
||||
{
|
||||
unset($obj->{$vars->name});
|
||||
continue;
|
||||
}
|
||||
// Change a variable
|
||||
unset($obj->{$vars->name});
|
||||
$obj->{$vars->name} = $filename;
|
||||
}
|
||||
}
|
||||
// Serialize and save
|
||||
$args->skin_vars = serialize($obj);
|
||||
|
||||
/**
|
||||
* Save Settings
|
||||
*
|
||||
* @return mixed
|
||||
**/
|
||||
function procIntegration_searchAdminInsertConfig() {
|
||||
// Get configurations (using module model object)
|
||||
$oModuleModel = &getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('integration_search');
|
||||
$oModuleController = &getController('module');
|
||||
$output = $oModuleController->insertModuleConfig('integration_search',$args);
|
||||
|
||||
$args->skin = Context::get('skin');
|
||||
$args->target = Context::get('target');
|
||||
$args->target_module_srl = Context::get('target_module_srl');
|
||||
if(!$args->target_module_srl) $args->target_module_srl = '';
|
||||
$args->skin_vars = $config->skin_vars;
|
||||
$this->setMessage('success_updated', 'info');
|
||||
|
||||
$oModuleController = &getController('module');
|
||||
$output = $oModuleController->insertModuleConfig('integration_search',$args);
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispIntegration_searchAdminContent');
|
||||
return $this->setRedirectUrl($returnUrl, $output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the skin information
|
||||
*
|
||||
* @return mixed
|
||||
**/
|
||||
function procIntegration_searchAdminInsertSkin() {
|
||||
// Get configurations (using module model object)
|
||||
$oModuleModel = &getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('integration_search');
|
||||
|
||||
$args->skin = $config->skin;
|
||||
$args->target_module_srl = $config->target_module_srl;
|
||||
// Get skin information (to check extra_vars)
|
||||
$skin_info = $oModuleModel->loadSkinInfo($this->module_path, $config->skin);
|
||||
// Check received variables (delete the basic variables such as mo, act, module_srl, page)
|
||||
$obj = Context::getRequestVars();
|
||||
unset($obj->act);
|
||||
unset($obj->module_srl);
|
||||
unset($obj->page);
|
||||
// Separately handle if the extra_vars is an image type in the original skin_info
|
||||
if($skin_info->extra_vars) {
|
||||
foreach($skin_info->extra_vars as $vars) {
|
||||
if($vars->type!='image') continue;
|
||||
|
||||
$image_obj = $obj->{$vars->name};
|
||||
// Get a variable on a request to delete
|
||||
$del_var = $obj->{"del_".$vars->name};
|
||||
unset($obj->{"del_".$vars->name});
|
||||
if($del_var == 'Y') {
|
||||
FileHandler::removeFile($module_info->{$vars->name});
|
||||
continue;
|
||||
}
|
||||
// Use the previous data if not uploaded
|
||||
if(!$image_obj['tmp_name']) {
|
||||
$obj->{$vars->name} = $module_info->{$vars->name};
|
||||
continue;
|
||||
}
|
||||
// Ignore if the file is not successfully uploaded
|
||||
if(!is_uploaded_file($image_obj['tmp_name'])) {
|
||||
unset($obj->{$vars->name});
|
||||
continue;
|
||||
}
|
||||
// Ignore if the file is not an image
|
||||
if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) {
|
||||
unset($obj->{$vars->name});
|
||||
continue;
|
||||
}
|
||||
// Upload the file to a path
|
||||
$path = sprintf("./files/attach/images/%s/", $module_srl);
|
||||
// Create a directory
|
||||
if(!FileHandler::makeDir($path)) return false;
|
||||
|
||||
$filename = $path.$image_obj['name'];
|
||||
// Move the file
|
||||
if(!move_uploaded_file($image_obj['tmp_name'], $filename)) {
|
||||
unset($obj->{$vars->name});
|
||||
continue;
|
||||
}
|
||||
// Change a variable
|
||||
unset($obj->{$vars->name});
|
||||
$obj->{$vars->name} = $filename;
|
||||
}
|
||||
}
|
||||
// Serialize and save
|
||||
$args->skin_vars = serialize($obj);
|
||||
|
||||
$oModuleController = &getController('module');
|
||||
$output = $oModuleController->insertModuleConfig('integration_search',$args);
|
||||
|
||||
$this->setMessage('success_updated', 'info');
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispIntegration_searchAdminSkinInfo');
|
||||
return $this->setRedirectUrl($returnUrl, $output);
|
||||
}
|
||||
}
|
||||
?>
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispIntegration_searchAdminSkinInfo');
|
||||
return $this->setRedirectUrl($returnUrl, $output);
|
||||
}
|
||||
}
|
||||
/* End of file integration_search.admin.controller.php */
|
||||
/* Location: ./modules/integration_search/integration_search.admin.controller.php */
|
||||
|
|
|
|||
|
|
@ -1,99 +1,104 @@
|
|||
<?php
|
||||
/**
|
||||
* The admin view class of the integration_search module
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
**/
|
||||
|
||||
class integration_searchAdminView extends integration_search {
|
||||
|
||||
/**
|
||||
* The admin view class of the integration_search module
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
*/
|
||||
class integration_searchAdminView extends integration_search
|
||||
{
|
||||
/**
|
||||
* Cofiguration of integration serach module
|
||||
*
|
||||
* @var object module config
|
||||
*/
|
||||
var $config = null;
|
||||
var $config = null;
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function init() {
|
||||
// Get configurations (using module model object)
|
||||
$oModuleModel = &getModel('module');
|
||||
$this->config = $oModuleModel->getModuleConfig('integration_search');
|
||||
Context::set('config',$this->config);
|
||||
|
||||
$this->setTemplatePath($this->module_path."/tpl/");
|
||||
}
|
||||
/**
|
||||
* Initialization
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
// Get configurations (using module model object)
|
||||
$oModuleModel = &getModel('module');
|
||||
$this->config = $oModuleModel->getModuleConfig('integration_search');
|
||||
Context::set('config',$this->config);
|
||||
|
||||
/**
|
||||
* Module selection and skin set
|
||||
*
|
||||
* @return Object
|
||||
**/
|
||||
function dispIntegration_searchAdminContent() {
|
||||
// Get a list of skins(themes)
|
||||
$oModuleModel = &getModel('module');
|
||||
$skin_list = $oModuleModel->getSkins($this->module_path);
|
||||
Context::set('skin_list',$skin_list);
|
||||
// Get a list of module categories
|
||||
$module_categories = $oModuleModel->getModuleCategories();
|
||||
// Generated mid Wanted list
|
||||
$obj->site_srl = 0;
|
||||
$this->setTemplatePath($this->module_path."/tpl/");
|
||||
}
|
||||
|
||||
// Shown below as obsolete comments - modify by cherryfilter
|
||||
/*$mid_list = $oModuleModel->getMidList($obj);
|
||||
// module_category and module combination
|
||||
if($module_categories) {
|
||||
foreach($mid_list as $module_srl => $module) {
|
||||
$module_categories[$module->module_category_srl]->list[$module_srl] = $module;
|
||||
}
|
||||
} else {
|
||||
$module_categories[0]->list = $mid_list;
|
||||
}
|
||||
/**
|
||||
* Module selection and skin set
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function dispIntegration_searchAdminContent()
|
||||
{
|
||||
// Get a list of skins(themes)
|
||||
$oModuleModel = &getModel('module');
|
||||
$skin_list = $oModuleModel->getSkins($this->module_path);
|
||||
Context::set('skin_list',$skin_list);
|
||||
// Get a list of module categories
|
||||
$module_categories = $oModuleModel->getModuleCategories();
|
||||
// Generated mid Wanted list
|
||||
$obj->site_srl = 0;
|
||||
|
||||
Context::set('mid_list',$module_categories);*/
|
||||
// Shown below as obsolete comments - modify by cherryfilter
|
||||
/*$mid_list = $oModuleModel->getMidList($obj);
|
||||
// module_category and module combination
|
||||
if($module_categories) {
|
||||
foreach($mid_list as $module_srl => $module) {
|
||||
$module_categories[$module->module_category_srl]->list[$module_srl] = $module;
|
||||
}
|
||||
} else {
|
||||
$module_categories[0]->list = $mid_list;
|
||||
}
|
||||
|
||||
$security = new Security();
|
||||
$security->encodeHTML('skin_list..title');
|
||||
Context::set('mid_list',$module_categories);*/
|
||||
|
||||
// Sample Code
|
||||
Context::set('sample_code', htmlspecialchars('<form action="{getUrl()}" method="get"><input type="hidden" name="vid" value="{$vid}" /><input type="hidden" name="mid" value="{$mid}" /><input type="hidden" name="act" value="IS" /><input type="text" name="is_keyword" value="{$is_keyword}" /><span class="btn"><input type="submit" value="{$lang->cmd_search}" /></span></form>') );
|
||||
$security = new Security();
|
||||
$security->encodeHTML('skin_list..title');
|
||||
|
||||
$this->setTemplateFile("index");
|
||||
}
|
||||
// Sample Code
|
||||
Context::set('sample_code', htmlspecialchars('<form action="{getUrl()}" method="get"><input type="hidden" name="vid" value="{$vid}" /><input type="hidden" name="mid" value="{$mid}" /><input type="hidden" name="act" value="IS" /><input type="text" name="is_keyword" value="{$is_keyword}" /><span class="btn"><input type="submit" value="{$lang->cmd_search}" /></span></form>') );
|
||||
|
||||
/**
|
||||
* Skin Settings
|
||||
*
|
||||
* @return Object
|
||||
**/
|
||||
function dispIntegration_searchAdminSkinInfo() {
|
||||
$oModuleModel = &getModel('module');
|
||||
$skin_info = $oModuleModel->loadSkinInfo($this->module_path, $this->config->skin);
|
||||
$skin_vars = unserialize($this->config->skin_vars);
|
||||
// value for skin_info extra_vars
|
||||
if(count($skin_info->extra_vars)) {
|
||||
foreach($skin_info->extra_vars as $key => $val) {
|
||||
$name = $val->name;
|
||||
$type = $val->type;
|
||||
$value = $skin_vars->{$name};
|
||||
if($type=="checkbox"&&!$value) $value = array();
|
||||
$skin_info->extra_vars[$key]->value= $value;
|
||||
}
|
||||
}
|
||||
Context::set('skin_info', $skin_info);
|
||||
Context::set('skin_vars', $skin_vars);
|
||||
$this->setTemplateFile("index");
|
||||
}
|
||||
|
||||
$config = $oModuleModel->getModuleConfig('integration_search');
|
||||
Context::set('module_info', unserialize($config->skin_vars));
|
||||
|
||||
$security = new Security();
|
||||
$security->encodeHTML('skin_info...');
|
||||
|
||||
$this->setTemplateFile("skin_info");
|
||||
}
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* Skin Settings
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function dispIntegration_searchAdminSkinInfo()
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
$skin_info = $oModuleModel->loadSkinInfo($this->module_path, $this->config->skin);
|
||||
$skin_vars = unserialize($this->config->skin_vars);
|
||||
// value for skin_info extra_vars
|
||||
if(count($skin_info->extra_vars))
|
||||
{
|
||||
foreach($skin_info->extra_vars as $key => $val)
|
||||
{
|
||||
$name = $val->name;
|
||||
$type = $val->type;
|
||||
$value = $skin_vars->{$name};
|
||||
if($type=="checkbox"&&!$value) $value = array();
|
||||
$skin_info->extra_vars[$key]->value= $value;
|
||||
}
|
||||
}
|
||||
Context::set('skin_info', $skin_info);
|
||||
Context::set('skin_vars', $skin_vars);
|
||||
|
||||
$config = $oModuleModel->getModuleConfig('integration_search');
|
||||
Context::set('module_info', unserialize($config->skin_vars));
|
||||
|
||||
$security = new Security();
|
||||
$security->encodeHTML('skin_info...');
|
||||
|
||||
$this->setTemplateFile("skin_info");
|
||||
}
|
||||
}
|
||||
/* End of file integration_search.admin.view.php */
|
||||
/* Location: ./modules/integration_search/integration_search.admin.view.php */
|
||||
|
|
|
|||
|
|
@ -1,81 +1,83 @@
|
|||
<?php
|
||||
/**
|
||||
* The view class of the integration_search module
|
||||
/**
|
||||
* The view class of the integration_search module
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
*/
|
||||
class integration_search extends ModuleObject
|
||||
{
|
||||
/**
|
||||
* Implement if additional tasks are necessary when installing
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
**/
|
||||
* @return Object
|
||||
*/
|
||||
function moduleInstall()
|
||||
{
|
||||
// Registered in action forward
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController->insertActionForward('integration_search', 'view', 'IS');
|
||||
|
||||
class integration_search extends ModuleObject {
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement if additional tasks are necessary when installing
|
||||
*
|
||||
* @return Object
|
||||
**/
|
||||
function moduleInstall() {
|
||||
// Registered in action forward
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController->insertActionForward('integration_search', 'view', 'IS');
|
||||
/**
|
||||
* Check methoda whether successfully installed
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function checkUpdate()
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('integration_search');
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check methoda whether successfully installed
|
||||
*
|
||||
* @return bool
|
||||
**/
|
||||
function checkUpdate()
|
||||
if($config->skin)
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('integration_search');
|
||||
|
||||
if($config->skin)
|
||||
$config_parse = explode('.', $config->skin);
|
||||
if(count($config_parse) > 1)
|
||||
{
|
||||
$config_parse = explode('.', $config->skin);
|
||||
if (count($config_parse) > 1)
|
||||
$template_path = sprintf('./themes/%s/modules/integration_search/', $config_parse[0]);
|
||||
if(is_dir($template_path)) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute update
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function moduleUpdate()
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('message');
|
||||
|
||||
if($config->skin)
|
||||
{
|
||||
$config_parse = explode('.', $config->skin);
|
||||
if(count($config_parse) > 1)
|
||||
{
|
||||
$template_path = sprintf('./themes/%s/modules/integration_search/', $config_parse[0]);
|
||||
if(is_dir($template_path))
|
||||
{
|
||||
$template_path = sprintf('./themes/%s/modules/integration_search/', $config_parse[0]);
|
||||
if(is_dir($template_path)) return true;
|
||||
$config->skin = implode('|@|', $config_parse);
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController->updateModuleConfig('integration_search', $config);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute update
|
||||
*
|
||||
* @return Object
|
||||
**/
|
||||
function moduleUpdate()
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('message');
|
||||
return new Object(0, 'success_updated');
|
||||
}
|
||||
|
||||
if($config->skin)
|
||||
{
|
||||
$config_parse = explode('.', $config->skin);
|
||||
if (count($config_parse) > 1)
|
||||
{
|
||||
$template_path = sprintf('./themes/%s/modules/integration_search/', $config_parse[0]);
|
||||
if(is_dir($template_path))
|
||||
{
|
||||
$config->skin = implode('|@|', $config_parse);
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController->updateModuleConfig('integration_search', $config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Object(0, 'success_updated');
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-generate the cache file
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function recompileCache() {
|
||||
}
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* Re-generate the cache file
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function recompileCache()
|
||||
{
|
||||
}
|
||||
}
|
||||
/* End of file integration_search.class.php */
|
||||
/* Location: ./modules/integration_search/integration_search.class.php */
|
||||
|
|
|
|||
|
|
@ -1,246 +1,270 @@
|
|||
<?php
|
||||
/**
|
||||
* The model class of integration module
|
||||
/**
|
||||
* The model class of integration module
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
*/
|
||||
class integration_searchModel extends module
|
||||
{
|
||||
/**
|
||||
* Initialization
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
**/
|
||||
* @return void
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
class integration_searchModel extends module {
|
||||
/**
|
||||
* Initialization
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
/**
|
||||
* Search documents
|
||||
*
|
||||
* @param string $target choose target. exclude or include for $module_srls_list
|
||||
* @param string $module_srls_list module_srl list to string type. ef - 102842,59392,102038
|
||||
* @param string $search_target Target
|
||||
* @param string $search_keyword Keyword
|
||||
* @param integer $page page of page navigation
|
||||
* @param integer $list_count list count of page navigation
|
||||
*
|
||||
* @return Object output document list
|
||||
*/
|
||||
function getDocuments($target, $module_srls_list, $search_target, $search_keyword, $page=1, $list_count = 20)
|
||||
{
|
||||
if(is_array($module_srls_list)) $module_srls_list = implode(',',$module_srls_list);
|
||||
|
||||
/**
|
||||
* Search documents
|
||||
*
|
||||
* @param string $target choose target. exclude or include for $module_srls_list
|
||||
* @param string $module_srls_list module_srl list to string type. ef - 102842,59392,102038
|
||||
* @param string $search_target Target
|
||||
* @param string $search_keyword Keyword
|
||||
* @param integer $page page of page navigation
|
||||
* @param integer $list_count list count of page navigation
|
||||
*
|
||||
* @return Object output document list
|
||||
**/
|
||||
function getDocuments($target, $module_srls_list, $search_target, $search_keyword, $page=1, $list_count = 20) {
|
||||
if(is_array($module_srls_list)) $module_srls_list = implode(',',$module_srls_list);
|
||||
if($target == 'exclude')
|
||||
{
|
||||
$module_srls_list .= ',0'; // exclude 'trash'
|
||||
if ($module_srls_list{0} == ',') $module_srls_list = substr($module_srls_list, 1);
|
||||
$args->exclude_module_srl = $module_srls_list;
|
||||
}
|
||||
else
|
||||
{
|
||||
$args->module_srl = $module_srls_list;
|
||||
$args->exclude_module_srl = '0'; // exclude 'trash'
|
||||
}
|
||||
|
||||
if($target == 'exclude') {
|
||||
$module_srls_list .= ',0'; // exclude 'trash'
|
||||
if ($module_srls_list{0} == ',') $module_srls_list = substr($module_srls_list, 1);
|
||||
$args->exclude_module_srl = $module_srls_list;
|
||||
} else {
|
||||
$args->module_srl = $module_srls_list;
|
||||
$args->exclude_module_srl = '0'; // exclude 'trash'
|
||||
}
|
||||
$args->page = $page;
|
||||
$args->list_count = $list_count;
|
||||
$args->page_count = 10;
|
||||
$args->search_target = $search_target;
|
||||
$args->search_keyword = $search_keyword;
|
||||
$args->sort_index = 'list_order';
|
||||
$args->order_type = 'asc';
|
||||
$args->statusList = array('PUBLIC');
|
||||
if(!$args->module_srl) unset($args->module_srl);
|
||||
// Get a list of documents
|
||||
$oDocumentModel = &getModel('document');
|
||||
|
||||
$args->page = $page;
|
||||
$args->list_count = $list_count;
|
||||
$args->page_count = 10;
|
||||
$args->search_target = $search_target;
|
||||
$args->search_keyword = $search_keyword;
|
||||
$args->sort_index = 'list_order';
|
||||
$args->order_type = 'asc';
|
||||
$args->statusList = array('PUBLIC');
|
||||
if(!$args->module_srl) unset($args->module_srl);
|
||||
// Get a list of documents
|
||||
$oDocumentModel = &getModel('document');
|
||||
return $oDocumentModel->getDocumentList($args);
|
||||
}
|
||||
|
||||
return $oDocumentModel->getDocumentList($args);
|
||||
}
|
||||
/**
|
||||
* Search comment
|
||||
*
|
||||
* @param string $target choose target. exclude or include for $module_srls_list
|
||||
* @param string $module_srls_list module_srl list to string type. ef - 102842,59392,102038
|
||||
* @param string $search_keyword Keyword
|
||||
* @param integer $page page of page navigation
|
||||
* @param integer $list_count list count of page navigation
|
||||
*
|
||||
* @return Object output comment list
|
||||
*/
|
||||
function getComments($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20)
|
||||
{
|
||||
if(is_array($module_srls_list))
|
||||
{
|
||||
if (count($module_srls_list) > 0) $module_srls = implode(',',$module_srls_list);
|
||||
else $module_srls = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$module_srls = ($module_srls_list)?$module_srls_list:0;
|
||||
}
|
||||
if($target == 'exclude') $args->exclude_module_srl = $module_srls;
|
||||
else $args->module_srl = $module_srls;
|
||||
|
||||
/**
|
||||
* Search comment
|
||||
*
|
||||
* @param string $target choose target. exclude or include for $module_srls_list
|
||||
* @param string $module_srls_list module_srl list to string type. ef - 102842,59392,102038
|
||||
* @param string $search_keyword Keyword
|
||||
* @param integer $page page of page navigation
|
||||
* @param integer $list_count list count of page navigation
|
||||
*
|
||||
* @return Object output comment list
|
||||
**/
|
||||
function getComments($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20) {
|
||||
if(is_array($module_srls_list)){
|
||||
if (count($module_srls_list) > 0) $module_srls = implode(',',$module_srls_list);
|
||||
else $module_srls = 0;
|
||||
$args->page = $page;
|
||||
$args->list_count = $list_count;
|
||||
$args->page_count = 10;
|
||||
$args->search_target = 'content';
|
||||
$args->search_keyword = $search_keyword;
|
||||
$args->sort_index = 'list_order';
|
||||
$args->order_type = 'asc';
|
||||
// Get a list of documents
|
||||
$oCommentModel = &getModel('comment');
|
||||
$output = $oCommentModel->getTotalCommentList($args);
|
||||
if(!$output->toBool()|| !$output->data) return $output;
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search trackbacks
|
||||
*
|
||||
* @param string $target choose target. exclude or include for $module_srls_list
|
||||
* @param string $module_srls_list module_srl list to string type. ef - 102842,59392,102038
|
||||
* @param string $search_target Target
|
||||
* @param string $search_keyword Keyword
|
||||
* @param integer $page page of page navigation
|
||||
* @param integer $list_count list count of page navigation
|
||||
*
|
||||
* @return Object output trackback list
|
||||
*/
|
||||
function getTrackbacks($target, $module_srls_list, $search_target = "title", $search_keyword, $page=1, $list_count = 20)
|
||||
{
|
||||
if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list);
|
||||
else $module_srls = $module_srls_list;
|
||||
if($target == 'exclude') $args->exclude_module_srl = $module_srls;
|
||||
else $args->module_srl = $module_srls;
|
||||
$args->page = $page;
|
||||
$args->list_count = $list_count;
|
||||
$args->page_count = 10;
|
||||
$args->search_target = $search_target;
|
||||
$args->search_keyword = $search_keyword;
|
||||
$args->sort_index = 'list_order';
|
||||
$args->order_type = 'asc';
|
||||
// Get a list of documents
|
||||
$oTrackbackModel = &getAdminModel('trackback');
|
||||
$output = $oTrackbackModel->getTotalTrackbackList($args);
|
||||
if(!$output->toBool()|| !$output->data) return $output;
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search file
|
||||
*
|
||||
* @param string $target choose target. exclude or include for $module_srls_list
|
||||
* @param string $module_srls_list module_srl list to string type. ef - 102842,59392,102038
|
||||
* @param string $search_keyword Keyword
|
||||
* @param integer $page page of page navigation
|
||||
* @param integer $list_count list count of page navigation
|
||||
* @param string $direct_download Y or N
|
||||
*
|
||||
* @return Object output file list
|
||||
*/
|
||||
function _getFiles($target, $module_srls_list, $search_keyword, $page, $list_count, $direct_download = 'Y')
|
||||
{
|
||||
if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list);
|
||||
else $module_srls = $module_srls_list;
|
||||
if($target == 'exclude') $args->exclude_module_srl = $module_srls;
|
||||
else $args->module_srl = $module_srls;
|
||||
$args->page = $page;
|
||||
$args->list_count = $list_count;
|
||||
$args->page_count = 10;
|
||||
$args->search_target = 'filename';
|
||||
$args->search_keyword = $search_keyword;
|
||||
$args->sort_index = 'files.file_srl';
|
||||
$args->order_type = 'desc';
|
||||
$args->isvalid = 'Y';
|
||||
$args->direct_download = $direct_download=='Y'?'Y':'N';
|
||||
// Get a list of documents
|
||||
$oFileAdminModel = &getAdminModel('file');
|
||||
$output = $oFileAdminModel->getFileList($args);
|
||||
if(!$output->toBool() || !$output->data) return $output;
|
||||
|
||||
$list = array();
|
||||
foreach($output->data as $key => $val)
|
||||
{
|
||||
$obj = null;
|
||||
$obj->filename = $val->source_filename;
|
||||
$obj->download_count = $val->download_count;
|
||||
if(substr($val->download_url,0,2)=='./') $val->download_url = substr($val->download_url,2);
|
||||
$obj->download_url = Context::getRequestUri().$val->download_url;
|
||||
$obj->target_srl = $val->upload_target_srl;
|
||||
$obj->file_size = $val->file_size;
|
||||
// Images
|
||||
if(preg_match('/\.(jpg|jpeg|gif|png)$/i', $val->source_filename))
|
||||
{
|
||||
$obj->type = 'image';
|
||||
|
||||
$thumbnail_path = sprintf('files/cache/thumbnails/%s',getNumberingPath($val->file_srl, 3));
|
||||
if(!is_dir($thumbnail_path)) FileHandler::makeDir($thumbnail_path);
|
||||
$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, 120, 120, 'crop');
|
||||
$thumbnail_url = Context::getRequestUri().$thumbnail_file;
|
||||
if(!file_exists($thumbnail_file)) FileHandler::createImageFile($val->uploaded_filename, $thumbnail_file, 120, 120, 'jpg', 'crop');
|
||||
$obj->src = sprintf('<img src="%s" alt="%s" width="%d" height="%d" />', $thumbnail_url, htmlspecialchars($obj->filename), 120, 120);
|
||||
// Videos
|
||||
}
|
||||
else {
|
||||
$module_srls = ($module_srls_list)?$module_srls_list:0;
|
||||
else if(preg_match('/\.(swf|flv|wmv|avi|mpg|mpeg|asx|asf|mp3)$/i', $val->source_filename))
|
||||
{
|
||||
$obj->type = 'multimedia';
|
||||
$obj->src = sprintf('<script>displayMultimedia("%s",120,120);</script>', $obj->download_url);
|
||||
// Others
|
||||
}
|
||||
else
|
||||
{
|
||||
$obj->type = 'binary';
|
||||
$obj->src = '';
|
||||
}
|
||||
if($target == 'exclude') $args->exclude_module_srl = $module_srls;
|
||||
else $args->module_srl = $module_srls;
|
||||
|
||||
$args->page = $page;
|
||||
$args->list_count = $list_count;
|
||||
$args->page_count = 10;
|
||||
$args->search_target = 'content';
|
||||
$args->search_keyword = $search_keyword;
|
||||
$args->sort_index = 'list_order';
|
||||
$args->order_type = 'asc';
|
||||
// Get a list of documents
|
||||
$oCommentModel = &getModel('comment');
|
||||
$output = $oCommentModel->getTotalCommentList($args);
|
||||
if(!$output->toBool()|| !$output->data) return $output;
|
||||
return $output;
|
||||
}
|
||||
$list[] = $obj;
|
||||
$target_list[] = $val->upload_target_srl;
|
||||
}
|
||||
$output->data = $list;
|
||||
|
||||
/**
|
||||
* Search trackbacks
|
||||
*
|
||||
* @param string $target choose target. exclude or include for $module_srls_list
|
||||
* @param string $module_srls_list module_srl list to string type. ef - 102842,59392,102038
|
||||
* @param string $search_target Target
|
||||
* @param string $search_keyword Keyword
|
||||
* @param integer $page page of page navigation
|
||||
* @param integer $list_count list count of page navigation
|
||||
*
|
||||
* @return Object output trackback list
|
||||
**/
|
||||
function getTrackbacks($target, $module_srls_list, $search_target = "title", $search_keyword, $page=1, $list_count = 20) {
|
||||
if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list);
|
||||
else $module_srls = $module_srls_list;
|
||||
if($target == 'exclude') $args->exclude_module_srl = $module_srls;
|
||||
else $args->module_srl = $module_srls;
|
||||
$args->page = $page;
|
||||
$args->list_count = $list_count;
|
||||
$args->page_count = 10;
|
||||
$args->search_target = $search_target;
|
||||
$args->search_keyword = $search_keyword;
|
||||
$args->sort_index = 'list_order';
|
||||
$args->order_type = 'asc';
|
||||
// Get a list of documents
|
||||
$oTrackbackModel = &getAdminModel('trackback');
|
||||
$output = $oTrackbackModel->getTotalTrackbackList($args);
|
||||
if(!$output->toBool()|| !$output->data) return $output;
|
||||
return $output;
|
||||
}
|
||||
$oDocumentModel = &getModel('document');
|
||||
$document_list = $oDocumentModel->getDocuments($target_list);
|
||||
if($document_list) foreach($document_list as $key => $val)
|
||||
{
|
||||
foreach($output->data as $k => $v)
|
||||
{
|
||||
if($v->target_srl== $val->document_srl)
|
||||
{
|
||||
$output->data[$k]->url = $val->getPermanentUrl();
|
||||
$output->data[$k]->regdate = $val->getRegdate("Y-m-d H:i");
|
||||
$output->data[$k]->nick_name = $val->getNickName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Search file
|
||||
*
|
||||
* @param string $target choose target. exclude or include for $module_srls_list
|
||||
* @param string $module_srls_list module_srl list to string type. ef - 102842,59392,102038
|
||||
* @param string $search_keyword Keyword
|
||||
* @param integer $page page of page navigation
|
||||
* @param integer $list_count list count of page navigation
|
||||
* @param string $direct_download Y or N
|
||||
*
|
||||
* @return Object output file list
|
||||
**/
|
||||
function _getFiles($target, $module_srls_list, $search_keyword, $page, $list_count, $direct_download = 'Y') {
|
||||
if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list);
|
||||
else $module_srls = $module_srls_list;
|
||||
if($target == 'exclude') $args->exclude_module_srl = $module_srls;
|
||||
else $args->module_srl = $module_srls;
|
||||
$args->page = $page;
|
||||
$args->list_count = $list_count;
|
||||
$args->page_count = 10;
|
||||
$args->search_target = 'filename';
|
||||
$args->search_keyword = $search_keyword;
|
||||
$args->sort_index = 'files.file_srl';
|
||||
$args->order_type = 'desc';
|
||||
$args->isvalid = 'Y';
|
||||
$args->direct_download = $direct_download=='Y'?'Y':'N';
|
||||
// Get a list of documents
|
||||
$oFileAdminModel = &getAdminModel('file');
|
||||
$output = $oFileAdminModel->getFileList($args);
|
||||
if(!$output->toBool() || !$output->data) return $output;
|
||||
$oCommentModel = &getModel('comment');
|
||||
$comment_list = $oCommentModel->getComments($target_list);
|
||||
if($comment_list) foreach($comment_list as $key => $val)
|
||||
{
|
||||
foreach($output->data as $k => $v)
|
||||
{
|
||||
if($v->target_srl== $val->comment_srl)
|
||||
{
|
||||
$output->data[$k]->url = $val->getPermanentUrl();
|
||||
$output->data[$k]->regdate = $val->getRegdate("Y-m-d H:i");
|
||||
$output->data[$k]->nick_name = $val->getNickName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$list = array();
|
||||
foreach($output->data as $key => $val) {
|
||||
$obj = null;
|
||||
$obj->filename = $val->source_filename;
|
||||
$obj->download_count = $val->download_count;
|
||||
if(substr($val->download_url,0,2)=='./') $val->download_url = substr($val->download_url,2);
|
||||
$obj->download_url = Context::getRequestUri().$val->download_url;
|
||||
$obj->target_srl = $val->upload_target_srl;
|
||||
$obj->file_size = $val->file_size;
|
||||
// Images
|
||||
if(preg_match('/\.(jpg|jpeg|gif|png)$/i', $val->source_filename)) {
|
||||
$obj->type = 'image';
|
||||
return $output;
|
||||
}
|
||||
|
||||
$thumbnail_path = sprintf('files/cache/thumbnails/%s',getNumberingPath($val->file_srl, 3));
|
||||
if(!is_dir($thumbnail_path)) FileHandler::makeDir($thumbnail_path);
|
||||
$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, 120, 120, 'crop');
|
||||
$thumbnail_url = Context::getRequestUri().$thumbnail_file;
|
||||
if(!file_exists($thumbnail_file)) FileHandler::createImageFile($val->uploaded_filename, $thumbnail_file, 120, 120, 'jpg', 'crop');
|
||||
$obj->src = sprintf('<img src="%s" alt="%s" width="%d" height="%d" />', $thumbnail_url, htmlspecialchars($obj->filename), 120, 120);
|
||||
// Videos
|
||||
} elseif(preg_match('/\.(swf|flv|wmv|avi|mpg|mpeg|asx|asf|mp3)$/i', $val->source_filename)) {
|
||||
$obj->type = 'multimedia';
|
||||
$obj->src = sprintf('<script>displayMultimedia("%s",120,120);</script>', $obj->download_url);
|
||||
// Others
|
||||
} else {
|
||||
$obj->type = 'binary';
|
||||
$obj->src = '';
|
||||
}
|
||||
/**
|
||||
* Search Multimedia. call function _getFiles().
|
||||
*
|
||||
* @param string $target choose target. exclude or include for $module_srls_list
|
||||
* @param string $module_srls_list module_srl list to string type. ef - 102842,59392,102038
|
||||
* @param string $search_keyword Keyword
|
||||
* @param integer $page page of page navigation
|
||||
* @param integer $list_count list count of page navigation
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function getImages($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20)
|
||||
{
|
||||
return $this->_getFiles($target, $module_srls_list, $search_keyword, $page, $list_count);
|
||||
}
|
||||
|
||||
$list[] = $obj;
|
||||
$target_list[] = $val->upload_target_srl;
|
||||
}
|
||||
$output->data = $list;
|
||||
|
||||
$oDocumentModel = &getModel('document');
|
||||
$document_list = $oDocumentModel->getDocuments($target_list);
|
||||
if($document_list) foreach($document_list as $key => $val) {
|
||||
foreach($output->data as $k => $v) {
|
||||
if($v->target_srl== $val->document_srl) {
|
||||
$output->data[$k]->url = $val->getPermanentUrl();
|
||||
$output->data[$k]->regdate = $val->getRegdate("Y-m-d H:i");
|
||||
$output->data[$k]->nick_name = $val->getNickName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$oCommentModel = &getModel('comment');
|
||||
$comment_list = $oCommentModel->getComments($target_list);
|
||||
if($comment_list) foreach($comment_list as $key => $val) {
|
||||
foreach($output->data as $k => $v) {
|
||||
if($v->target_srl== $val->comment_srl) {
|
||||
$output->data[$k]->url = $val->getPermanentUrl();
|
||||
$output->data[$k]->regdate = $val->getRegdate("Y-m-d H:i");
|
||||
$output->data[$k]->nick_name = $val->getNickName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search Multimedia. call function _getFiles().
|
||||
*
|
||||
* @param string $target choose target. exclude or include for $module_srls_list
|
||||
* @param string $module_srls_list module_srl list to string type. ef - 102842,59392,102038
|
||||
* @param string $search_keyword Keyword
|
||||
* @param integer $page page of page navigation
|
||||
* @param integer $list_count list count of page navigation
|
||||
*
|
||||
* @return Object
|
||||
**/
|
||||
function getImages($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20) {
|
||||
return $this->_getFiles($target, $module_srls_list, $search_keyword, $page, $list_count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for attachments. call function _getFiles().
|
||||
*
|
||||
* @param string $target choose target. exclude or include for $module_srls_list
|
||||
* @param string $module_srls_list module_srl list to string type. ef - 102842,59392,102038
|
||||
* @param string $search_keyword Keyword
|
||||
* @param integer $page page of page navigation
|
||||
* @param integer $list_count list count of page navigation
|
||||
*
|
||||
* @return Object
|
||||
**/
|
||||
function getFiles($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20) {
|
||||
return $this->_getFiles($target, $module_srls_list, $search_keyword, $page, $list_count, 'N');
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* Search for attachments. call function _getFiles().
|
||||
*
|
||||
* @param string $target choose target. exclude or include for $module_srls_list
|
||||
* @param string $module_srls_list module_srl list to string type. ef - 102842,59392,102038
|
||||
* @param string $search_keyword Keyword
|
||||
* @param integer $page page of page navigation
|
||||
* @param integer $list_count list count of page navigation
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function getFiles($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20)
|
||||
{
|
||||
return $this->_getFiles($target, $module_srls_list, $search_keyword, $page, $list_count, 'N');
|
||||
}
|
||||
}
|
||||
/* End of file integration_search.model.php */
|
||||
/* Location: ./modules/integration_search/integration_search.model.php */
|
||||
|
|
|
|||
|
|
@ -1,134 +1,140 @@
|
|||
<?php
|
||||
/**
|
||||
* The view class of the integration_search module
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
**/
|
||||
|
||||
class integration_searchView extends integration_search {
|
||||
|
||||
/**
|
||||
* The view class of the integration_search module
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
*/
|
||||
class integration_searchView extends integration_search
|
||||
{
|
||||
/**
|
||||
* Target mid
|
||||
* @var array target mid
|
||||
*/
|
||||
var $target_mid = array();
|
||||
var $target_mid = array();
|
||||
/**
|
||||
* Skin
|
||||
* @var string skin name
|
||||
*/
|
||||
var $skin = 'default';
|
||||
var $skin = 'default';
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
/**
|
||||
* Initialization
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Search Result
|
||||
*
|
||||
* @return Object
|
||||
**/
|
||||
function IS() {
|
||||
$oFile = &getClass('file');
|
||||
$oModuleModel = &getModel('module');
|
||||
// Check permissions
|
||||
if(!$this->grant->access) return new Object(-1,'msg_not_permitted');
|
||||
/**
|
||||
* Search Result
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function IS()
|
||||
{
|
||||
$oFile = &getClass('file');
|
||||
$oModuleModel = &getModel('module');
|
||||
// Check permissions
|
||||
if(!$this->grant->access) return new Object(-1,'msg_not_permitted');
|
||||
|
||||
$config = $oModuleModel->getModuleConfig('integration_search');
|
||||
if(!$config->skin)
|
||||
$config = $oModuleModel->getModuleConfig('integration_search');
|
||||
if(!$config->skin)
|
||||
{
|
||||
$config->skin = 'default';
|
||||
$template_path = sprintf('%sskins/%s', $this->module_path, $config->skin);
|
||||
}
|
||||
else
|
||||
{
|
||||
//check theme
|
||||
$config_parse = explode('|@|', $config->skin);
|
||||
if (count($config_parse) > 1)
|
||||
{
|
||||
$template_path = sprintf('./themes/%s/modules/integration_search/', $config_parse[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$config->skin = 'default';
|
||||
$template_path = sprintf('%sskins/%s', $this->module_path, $config->skin);
|
||||
}
|
||||
else
|
||||
}
|
||||
// Template path
|
||||
$this->setTemplatePath($template_path);
|
||||
Context::set('module_info', unserialize($config->skin_vars));
|
||||
|
||||
$target = $config->target;
|
||||
if(!$target) $target = 'include';
|
||||
|
||||
if(empty($config->target_module_srl))
|
||||
$module_srl_list = array();
|
||||
else
|
||||
$module_srl_list = explode(',',$config->target_module_srl);
|
||||
|
||||
// Set a variable for search keyword
|
||||
$is_keyword = Context::get('is_keyword');
|
||||
// Set page variables
|
||||
$page = (int)Context::get('page');
|
||||
if(!$page) $page = 1;
|
||||
// Search by search tab
|
||||
$where = Context::get('where');
|
||||
// Create integration search model object
|
||||
if($is_keyword)
|
||||
{
|
||||
$oIS = &getModel('integration_search');
|
||||
switch($where)
|
||||
{
|
||||
//check theme
|
||||
$config_parse = explode('|@|', $config->skin);
|
||||
if (count($config_parse) > 1)
|
||||
{
|
||||
$template_path = sprintf('./themes/%s/modules/integration_search/', $config_parse[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$template_path = sprintf('%sskins/%s', $this->module_path, $config->skin);
|
||||
}
|
||||
case 'document' :
|
||||
$search_target = Context::get('search_target');
|
||||
if(!in_array($search_target, array('title','content','title_content','tag'))) $search_target = 'title';
|
||||
Context::set('search_target', $search_target);
|
||||
|
||||
$output = $oIS->getDocuments($target, $module_srl_list, $search_target, $is_keyword, $page, 10);
|
||||
Context::set('output', $output);
|
||||
$this->setTemplateFile("document", $page);
|
||||
break;
|
||||
case 'comment' :
|
||||
$output = $oIS->getComments($target, $module_srl_list, $is_keyword, $page, 10);
|
||||
Context::set('output', $output);
|
||||
$this->setTemplateFile("comment", $page);
|
||||
break;
|
||||
case 'trackback' :
|
||||
$search_target = Context::get('search_target');
|
||||
if(!in_array($search_target, array('title','url','blog_name','excerpt'))) $search_target = 'title';
|
||||
Context::set('search_target', $search_target);
|
||||
|
||||
$output = $oIS->getTrackbacks($target, $module_srl_list, $search_target, $is_keyword, $page, 10);
|
||||
Context::set('output', $output);
|
||||
$this->setTemplateFile("trackback", $page);
|
||||
break;
|
||||
case 'multimedia' :
|
||||
$output = $oIS->getImages($target, $module_srl_list, $is_keyword, $page,20);
|
||||
Context::set('output', $output);
|
||||
$this->setTemplateFile("multimedia", $page);
|
||||
break;
|
||||
case 'file' :
|
||||
$output = $oIS->getFiles($target, $module_srl_list, $is_keyword, $page, 20);
|
||||
Context::set('output', $output);
|
||||
$this->setTemplateFile("file", $page);
|
||||
break;
|
||||
default :
|
||||
$output['document'] = $oIS->getDocuments($target, $module_srl_list, 'title', $is_keyword, $page, 5);
|
||||
$output['comment'] = $oIS->getComments($target, $module_srl_list, $is_keyword, $page, 5);
|
||||
$output['trackback'] = $oIS->getTrackbacks($target, $module_srl_list, 'title', $is_keyword, $page, 5);
|
||||
$output['multimedia'] = $oIS->getImages($target, $module_srl_list, $is_keyword, $page, 5);
|
||||
$output['file'] = $oIS->getFiles($target, $module_srl_list, $is_keyword, $page, 5);
|
||||
Context::set('search_result', $output);
|
||||
Context::set('search_target', 'title');
|
||||
$this->setTemplateFile("index", $page);
|
||||
break;
|
||||
}
|
||||
// Template path
|
||||
$this->setTemplatePath($template_path);
|
||||
Context::set('module_info', unserialize($config->skin_vars));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setTemplateFile("no_keywords");
|
||||
}
|
||||
|
||||
$target = $config->target;
|
||||
if(!$target) $target = 'include';
|
||||
|
||||
if (empty($config->target_module_srl))
|
||||
$module_srl_list = array();
|
||||
else
|
||||
$module_srl_list = explode(',',$config->target_module_srl);
|
||||
|
||||
// Set a variable for search keyword
|
||||
$is_keyword = Context::get('is_keyword');
|
||||
// Set page variables
|
||||
$page = (int)Context::get('page');
|
||||
if(!$page) $page = 1;
|
||||
// Search by search tab
|
||||
$where = Context::get('where');
|
||||
// Create integration search model object
|
||||
if($is_keyword) {
|
||||
$oIS = &getModel('integration_search');
|
||||
switch($where) {
|
||||
case 'document' :
|
||||
$search_target = Context::get('search_target');
|
||||
if(!in_array($search_target, array('title','content','title_content','tag'))) $search_target = 'title';
|
||||
Context::set('search_target', $search_target);
|
||||
|
||||
$output = $oIS->getDocuments($target, $module_srl_list, $search_target, $is_keyword, $page, 10);
|
||||
Context::set('output', $output);
|
||||
$this->setTemplateFile("document", $page);
|
||||
break;
|
||||
case 'comment' :
|
||||
$output = $oIS->getComments($target, $module_srl_list, $is_keyword, $page, 10);
|
||||
Context::set('output', $output);
|
||||
$this->setTemplateFile("comment", $page);
|
||||
break;
|
||||
case 'trackback' :
|
||||
$search_target = Context::get('search_target');
|
||||
if(!in_array($search_target, array('title','url','blog_name','excerpt'))) $search_target = 'title';
|
||||
Context::set('search_target', $search_target);
|
||||
|
||||
$output = $oIS->getTrackbacks($target, $module_srl_list, $search_target, $is_keyword, $page, 10);
|
||||
Context::set('output', $output);
|
||||
$this->setTemplateFile("trackback", $page);
|
||||
break;
|
||||
case 'multimedia' :
|
||||
$output = $oIS->getImages($target, $module_srl_list, $is_keyword, $page,20);
|
||||
Context::set('output', $output);
|
||||
$this->setTemplateFile("multimedia", $page);
|
||||
break;
|
||||
case 'file' :
|
||||
$output = $oIS->getFiles($target, $module_srl_list, $is_keyword, $page, 20);
|
||||
Context::set('output', $output);
|
||||
$this->setTemplateFile("file", $page);
|
||||
break;
|
||||
default :
|
||||
$output['document'] = $oIS->getDocuments($target, $module_srl_list, 'title', $is_keyword, $page, 5);
|
||||
$output['comment'] = $oIS->getComments($target, $module_srl_list, $is_keyword, $page, 5);
|
||||
$output['trackback'] = $oIS->getTrackbacks($target, $module_srl_list, 'title', $is_keyword, $page, 5);
|
||||
$output['multimedia'] = $oIS->getImages($target, $module_srl_list, $is_keyword, $page, 5);
|
||||
$output['file'] = $oIS->getFiles($target, $module_srl_list, $is_keyword, $page, 5);
|
||||
Context::set('search_result', $output);
|
||||
Context::set('search_target', 'title');
|
||||
$this->setTemplateFile("index", $page);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$this->setTemplateFile("no_keywords");
|
||||
}
|
||||
|
||||
$security = new Security();
|
||||
$security->encodeHTML('is_keyword', 'search_target', 'where', 'page');
|
||||
}
|
||||
}
|
||||
?>
|
||||
$security = new Security();
|
||||
$security->encodeHTML('is_keyword', 'search_target', 'where', 'page');
|
||||
}
|
||||
}
|
||||
/* End of file integration_search.view.php */
|
||||
/* Location: ./modules/integration_search/integration_search.view.php */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue