mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 02:31:40 +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,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