mirror of
https://github.com/e107inc/e107.git
synced 2025-01-16 20:28:28 +01:00
Search page completed. Bootstrap3 template functional. e-expandit can now accept multiple target IDs using the data-target attribute.
This commit is contained in:
parent
1fc86ddd51
commit
67cef013f3
@ -138,24 +138,28 @@ $SEARCH_TEMPLATE['form']['start'] = '
|
||||
<form class="form-horizontal" role="form" id="searchform" method="get" action="'.e_SELF.'">
|
||||
<div class="form-group">
|
||||
<label for="inputEmail3" class="col-sm-3 control-label">'.LAN_199.'</label>
|
||||
<div class="col-sm-9">{SEARCH_MAIN_SEARCHFIELD}{SEARCH_MAIN_SUBMIT} {ENHANCED_ICON}
|
||||
<div class="col-sm-9">{SEARCH_MAIN}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="search-enhanced" {ENHANCED_DISPLAY}>
|
||||
{SEARCH_ENHANCED}
|
||||
</div>
|
||||
';
|
||||
|
||||
$SEARCH_TEMPLATE['form']['advanced'] = '
|
||||
<div class="form-group">
|
||||
<label for="inputPassword3" class="col-sm-3 control-label">{SEARCH_ADV_A}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="col-sm-9">
|
||||
|
||||
{SEARCH_ADV_B}
|
||||
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
|
||||
|
||||
$SEARCH_TEMPLATE['form']['enhanced'] = '
|
||||
<div class="form-group">
|
||||
<div id="{ENHANCED_DISPLAY_ID}" class="form-group">
|
||||
<label for="inputPassword3" class="col-sm-3 control-label">{ENHANCED_TEXT}</label>
|
||||
<div class="col-sm-9">
|
||||
{ENHANCED_FIELD}
|
||||
@ -163,7 +167,7 @@ $SEARCH_TEMPLATE['form']['enhanced'] = '
|
||||
</div>';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
$SEARCH_TEMPLATE['form']['type'] = '
|
||||
<div class="form-group">
|
||||
<label for="inputPassword3" class="col-sm-3 control-label">'.LAN_SEARCH_75.'</label>
|
||||
@ -171,7 +175,7 @@ $SEARCH_TEMPLATE['form']['type'] = '
|
||||
{SEARCH_TYPE_SEL}
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
*/
|
||||
|
||||
$SEARCH_TEMPLATE['form']['category'] = '
|
||||
<div class="form-group">
|
||||
|
@ -2673,8 +2673,12 @@ class e_parser
|
||||
// Bootstrap 3 Glyph names.
|
||||
$bs3 = e107::getMedia()->getGlyphs('bs3','');
|
||||
|
||||
if(substr($text,0,5) != 'icon-' && substr($text,0,3) != 'fa-')
|
||||
{
|
||||
$text = 'icon-'.$text.'.glyph';
|
||||
}
|
||||
|
||||
if(substr($text,-6) == '.glyph' || strpos($text,".")==false) // Bootstrap or Font-Awesome.
|
||||
// if(substr($text,-6) == '.glyph' || strpos($text,".")==false) // Bootstrap or Font-Awesome.
|
||||
{
|
||||
list($cls,$tmp) = explode('.glyph',$text);
|
||||
list($type, $tmp2) = explode("-",$text,2);
|
||||
|
@ -1104,13 +1104,13 @@ class e_form
|
||||
|
||||
$labelFound = vartrue($options['label']);
|
||||
unset($options['label']); // label attribute not valid in html5
|
||||
|
||||
|
||||
$options = $this->format_options('radio', $name, $options);
|
||||
$options['checked'] = $checked; //comes as separate argument just for convenience
|
||||
// $options['class'] = 'inline';
|
||||
$text = "";
|
||||
|
||||
|
||||
|
||||
|
||||
// return print_a($options,true);
|
||||
if($labelFound) // Bootstrap compatible markup
|
||||
@ -1119,6 +1119,9 @@ class e_form
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$text .= "<input type='radio' name='{$name}' value='".$value."'".$this->get_attributes($options, $name, $value)." />";
|
||||
|
||||
if(vartrue($options['help']))
|
||||
@ -1150,8 +1153,8 @@ class e_form
|
||||
|
||||
if(vartrue($options['class']) == 'e-expandit' || vartrue($options['expandit'])) // See admin->prefs 'Single Login' for an example.
|
||||
{
|
||||
$options_on = array('class' => 'e-expandit-on');
|
||||
$options_off = array('class' => 'e-expandit-off');
|
||||
$options_on = array_merge($options, array('class' => 'e-expandit-on'));
|
||||
$options_off = array_merge($options, array('class' => 'e-expandit-off'));
|
||||
}
|
||||
|
||||
$options_on['label'] = $label_enabled ? defset($label_enabled,$label_enabled) : LAN_ENABLED;
|
||||
|
117
e107_plugins/news/e_search.php
Normal file
117
e107_plugins/news/e_search.php
Normal file
@ -0,0 +1,117 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2014 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* Chatbox e_search addon
|
||||
*/
|
||||
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
// v2 e_search addon.
|
||||
// Removes the need for search_parser.php, search_advanced.php and in most cases search language files.
|
||||
|
||||
class news_search extends e_search // include plugin-folder in the name.
|
||||
{
|
||||
|
||||
function config()
|
||||
{
|
||||
$sql = e107::getDb();
|
||||
|
||||
$catList = array();
|
||||
|
||||
$catList[] = array('id' => 'all', 'title' => LAN_SEARCH_51);
|
||||
|
||||
if ($sql ->select("news_category", "category_id, category_name"))
|
||||
{
|
||||
while($row = $sql->fetch())
|
||||
{
|
||||
$catList[] = array('id' => $row['category_id'], 'title' => $row['category_name']);
|
||||
// $advanced_caption['title'][$row['category_id']] = 'News -> '.$row['category_name'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$matchList = array(
|
||||
array('id' => 0, 'title' => LAN_SEARCH_53),
|
||||
array('id' => 1, 'title' => LAN_SEARCH_54)
|
||||
);
|
||||
|
||||
|
||||
$search = array(
|
||||
'name' => "News",
|
||||
'table' => 'news AS n LEFT JOIN #news_category AS c ON n.news_category = c.category_id',
|
||||
|
||||
'advanced' => array(
|
||||
'cat' => array('type' => 'dropdown', 'text' => LAN_SEARCH_55, 'list'=>$catList),
|
||||
'date'=> array('type' => 'date', 'text' => LAN_SEARCH_50),
|
||||
'match'=> array('type' => 'dropdown', 'text' => LAN_SEARCH_52, 'list'=>$matchList)
|
||||
),
|
||||
|
||||
'return_fields' => array('n.news_id', 'n.news_title', 'n.news_sef', 'n.news_body', 'n.news_extended', 'n.news_allow_comments', 'n.news_datestamp', 'n.news_category', 'c.category_name'),
|
||||
'search_fields' => array('n.news_title' => '1.2', 'n.news_body' => '0.6', 'n.news_extended' => '0.6', 'n.news_summary' => '1.2'), // fields and their weights.
|
||||
|
||||
'order' => array('news_datestamp' => DESC),
|
||||
'refpage' => 'news.php'
|
||||
);
|
||||
|
||||
|
||||
return $search;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Compile Database data for output */
|
||||
function compile($row)
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
|
||||
$res = array();
|
||||
|
||||
$res['link'] = e107::getUrl()->create('news/view/item', $row);//$row['news_allow_comments'] ? "news.php?item.".$row['news_id'] : "comment.php?comment.news.".$row['news_id'];
|
||||
$res['pre_title'] = $row['category_name']." | ";
|
||||
$res['title'] = $row['news_title'];
|
||||
$res['summary'] = $row['news_body'].' '.$row['news_extended'];
|
||||
$res['detail'] = LAN_SEARCH_3.$tp->toDate($row['news_datestamp'], "long");
|
||||
$res['image'] = $row['news_thumbnail'];
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Optional - Advanced Where
|
||||
* @param $parm - data returned from $parm (ie. advanced fields included. in this case 'date' and 'author' )
|
||||
*/
|
||||
function where($parm='')
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
|
||||
$time = time();
|
||||
|
||||
$qry = "(news_start < ".$time.") AND (news_end=0 OR news_end > ".$time.") AND news_class IN (".USERCLASS_LIST.") AND";
|
||||
|
||||
if (isset($parm['cat']) && $parm['cat'] != 'all') {
|
||||
$qry .= " c.category_id='".intval($parm['cat'])."' AND";
|
||||
}
|
||||
|
||||
if (isset($parm['time']) && is_numeric($parm['time'])) {
|
||||
$qry .= " n.news_datestamp ".($parm['on'] == 'new' ? '>=' : '<=')." '".(time() - $parm['time'])."' AND";
|
||||
}
|
||||
|
||||
return $qry;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//Old v1.
|
||||
// $search_info[] = array('sfile' => e_PLUGIN.'chatbox_menu/search/search_parser.php', 'qtype' => CB_SCH_LAN_1, 'refpage' => 'chat.php', 'advanced' => e_PLUGIN.'chatbox_menu/search/search_advanced.php');
|
||||
|
||||
?>
|
@ -72,9 +72,9 @@ function tablestyle($caption, $text, $mode='')
|
||||
}
|
||||
|
||||
echo '<h2>'.$caption.'</h2>
|
||||
<p>
|
||||
|
||||
'.$text.'
|
||||
</p>';
|
||||
';
|
||||
|
||||
return;
|
||||
|
||||
|
@ -67,11 +67,19 @@ $(document).ready(function()
|
||||
|
||||
var href = ($(this).is("a")) ? $(this).attr("href") : '';
|
||||
|
||||
if(href == '' && $(this).attr("data-target"))
|
||||
if((href === "#" || href == "") && $(this).attr("data-target"))
|
||||
{
|
||||
href = '#' + $(this).attr("data-target");
|
||||
select = $(this).attr("data-target").split(','); // support multiple targets (comma separated)
|
||||
|
||||
$(select).each( function() {
|
||||
|
||||
$('#'+ this).toggle("slow");
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(href === "#" || href == "")
|
||||
{
|
||||
@ -79,19 +87,33 @@ $(document).ready(function()
|
||||
$(idt).toggle("slow");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//var id = $(this).attr("href");
|
||||
$(href).toggle("slow");
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// On
|
||||
$(".e-expandit-on").click(function () {
|
||||
|
||||
if($(this).is("input") && $(this).attr("type")=='radio')
|
||||
{
|
||||
idt = $(this).parent().nextAll("div.e-expandit-container");
|
||||
if($(this).attr("data-target"))
|
||||
{
|
||||
idt = '#' + $(this).attr("data-target");
|
||||
}
|
||||
else
|
||||
{
|
||||
idt = $(this).parent().nextAll("div.e-expandit-container");
|
||||
}
|
||||
|
||||
$(idt).show("slow");
|
||||
return true;
|
||||
}
|
||||
@ -122,7 +144,15 @@ $(document).ready(function()
|
||||
|
||||
if($(this).is("input") && $(this).attr("type")=='radio')
|
||||
{
|
||||
idt = $(this).parent().nextAll("div.e-expandit-container");
|
||||
if($(this).attr("data-target"))
|
||||
{
|
||||
idt = '#' + $(this).attr("data-target");
|
||||
}
|
||||
else
|
||||
{
|
||||
idt = $(this).parent().nextAll("div.e-expandit-container");
|
||||
}
|
||||
|
||||
$(idt).hide("slow");
|
||||
return true;
|
||||
}
|
||||
@ -617,7 +647,7 @@ $(document).ready(function()
|
||||
|
||||
|
||||
|
||||
$(".e-ajax").click(function(){
|
||||
$("a.e-ajax").click(function(){
|
||||
|
||||
|
||||
var id = $(this).attr("href");
|
||||
@ -663,7 +693,42 @@ $(document).ready(function()
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$("select.e-ajax").on('change', function(){
|
||||
|
||||
var form = $(this).closest("form").attr('id');
|
||||
|
||||
var target = $(this).attr("data-target"); // support for input buttons etc.
|
||||
var loading = $(this).attr('data-loading'); // image to show loading.
|
||||
var handler = $(this).attr('data-src');
|
||||
|
||||
var data = $('#'+form).serialize();
|
||||
|
||||
if(loading != null)
|
||||
{
|
||||
$("#"+target).html("<img src='"+loading+"' alt='' />");
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: handler,
|
||||
data: data,
|
||||
success: function(data)
|
||||
{
|
||||
// console.log(data);
|
||||
$("#"+target).html(data).hide().show("slow");;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
362
search.php
362
search.php
@ -43,39 +43,133 @@ if (isset($_GET['t']) && is_numeric($_GET['t']))
|
||||
}
|
||||
|
||||
|
||||
|
||||
class search extends e_shortcode
|
||||
{
|
||||
|
||||
private $search_prefs = array();
|
||||
private $search_info = array();
|
||||
private $auto_order = 1000;
|
||||
private $enhanced = false;
|
||||
private $query = null;
|
||||
private $result_flag = 0;
|
||||
private $message = '';
|
||||
public $template = array();
|
||||
private $enhancedTypes = array(
|
||||
'in' => LAN_SEARCH_24,
|
||||
'ex' => LAN_SEARCH_25,
|
||||
'ep' => LAN_SEARCH_26,
|
||||
'be' => LAN_SEARCH_27
|
||||
);
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->search_prefs = e107::getConfig('search')->getPref();
|
||||
$this->search_prefs = e107::getConfig('search')->getPref();
|
||||
$this->search_info = $this->searchConfig();
|
||||
|
||||
if (!e_QUERY)
|
||||
|
||||
if(deftrue('BOOTSTRAP'))
|
||||
{
|
||||
$this->enhanced = true;
|
||||
$tmp = e107::getCoreTemplate('search','form');
|
||||
$SEARCH_TOP_TABLE = $tmp['start'];
|
||||
$SEARCH_BOT_TABLE = $tmp['end'];
|
||||
$SEARCH_CATS = $tmp['category'];
|
||||
$SEARCH_TYPE = $tmp['type'];
|
||||
$SEARCH_ADV = $tmp['advanced'];
|
||||
$SEARCH_ENHANCED = $tmp['enhanced'];
|
||||
$SEARCH_ADV_COMBO = $tmp['advanced-combo'];
|
||||
|
||||
$this->template = $tmp;
|
||||
|
||||
|
||||
|
||||
unset($tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (file_exists(THEME."search_template.php"))
|
||||
{
|
||||
require(THEME."search_template.php");
|
||||
}
|
||||
else
|
||||
{
|
||||
require(e_CORE."templates/search_template.php");
|
||||
}
|
||||
|
||||
$SEARCH_TOP_TABLE .= "{SEARCH_ENHANCED}";
|
||||
|
||||
$tmp = array();
|
||||
|
||||
$tmp['start'] = $SEARCH_TOP_TABLE ;
|
||||
$tmp['end'] = $SEARCH_BOT_TABLE ;
|
||||
$tmp['category'] = $SEARCH_CATS;
|
||||
$tmp['type'] = $SEARCH_TYPE;
|
||||
$tmp['advanced'] = $SEARCH_ADV;
|
||||
$tmp['enhanced'] = $SEARCH_ENHANCED;
|
||||
$tmp['advanced-combo'] = $SEARCH_ADV_COMBO;
|
||||
|
||||
$this->template = $tmp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(e_AJAX_REQUEST)
|
||||
{
|
||||
if(vartrue($_POST['t']))
|
||||
{
|
||||
echo $this->sc_search_advanced_block($_POST['t']);
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function getPrefs()
|
||||
{
|
||||
return $this->search_prefs;
|
||||
}
|
||||
|
||||
|
||||
function getConfig()
|
||||
{
|
||||
return $this->search_info;
|
||||
}
|
||||
|
||||
// Shortcodes -----------------------
|
||||
|
||||
function sc_search_main($parm = '')
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$value = isset($_GET['q']) ? $tp->post_toForm($_GET['q']) : "";
|
||||
|
||||
$text = "<div class='input-group'>
|
||||
<input class='tbox form-control m_search' type='text' id='q' name='q' size='35' value='".$value."' maxlength='50' />
|
||||
<div class='input-group-btn'>
|
||||
<button class='btn btn-primary' type='submit' name='s' value='1' >".$tp->toGlyph('search',false)."</button>
|
||||
<button class='btn btn-primary dropdown-toggle' tabindex='-1' data-toggle='dropdown' type='button'><span class='caret'></span></button>
|
||||
";
|
||||
|
||||
$text .= '<ul class="dropdown-menu pull-right">
|
||||
<li><a class="e-expandit" href="#" data-target="search-advanced,search-enhanced"><small>Toggle Advanced Mode</small></a></li>
|
||||
</ul>';
|
||||
|
||||
$text .= "
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<input type='hidden' name='r' value='0' />";
|
||||
|
||||
return $text;
|
||||
|
||||
}
|
||||
|
||||
function sc_search_main_searchfield($parm='')
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$value = isset($_GET['q']) ? $tp->post_toForm($_GET['q']) : "";
|
||||
return "<input class='tbox m_search' type='text' id='q' name='q' size='35' value='".$value."' maxlength='50' />";
|
||||
return "<input class='tbox form-control m_search' type='text' id='q' name='q' size='35' value='".$value."' maxlength='50' />";
|
||||
}
|
||||
|
||||
function sc_search_main_submit($parm='')
|
||||
@ -107,6 +201,10 @@ class search extends e_shortcode
|
||||
|
||||
function sc_search_type_sel($parm='')
|
||||
{
|
||||
return e107::getForm()->radio_switch('adv', vartrue($_GET['adv']), LAN_SEARCH_30, LAN_SEARCH_29, array('class'=>'e-expandit','reverse'=>1, 'data-target'=>'search-advanced'));
|
||||
|
||||
|
||||
|
||||
return "<input type='radio' name='adv' value='0' ".(varsettrue($_GET['adv']) ? "" : "checked='checked'")." /> ".LAN_SEARCH_29."
|
||||
<input type='radio' name='adv' value='1' ".(varsettrue($_GET['adv']) ? "checked='checked'" : "" )." /> ".LAN_SEARCH_30;
|
||||
}
|
||||
@ -131,7 +229,7 @@ class search extends e_shortcode
|
||||
// standard search config
|
||||
if ($this->search_prefs['selector'] == 2)
|
||||
{
|
||||
$dropdown = "<select name='t' id='t' class='tbox' onchange=\"ab()\">";
|
||||
$dropdown = "<select name='t' id='t' class='tbox form-control e-ajax' data-src='".e_SELF."' data-target='search-advanced' >";
|
||||
|
||||
if ($this->search_prefs['multisearch'])
|
||||
{
|
||||
@ -204,8 +302,142 @@ class search extends e_shortcode
|
||||
|
||||
}
|
||||
|
||||
function sc_search_enhanced()
|
||||
{
|
||||
|
||||
$tp = e107::getParser();
|
||||
|
||||
$text = '';
|
||||
$var = array();
|
||||
|
||||
foreach ($this->enhancedTypes as $en_id => $ENHANCED_TEXT)
|
||||
{
|
||||
$var['ENHANCED_TEXT'] = $ENHANCED_TEXT;
|
||||
$var['ENHANCED_DISPLAY_ID'] = "en_".$en_id;
|
||||
$var['ENHANCED_FIELD'] = "<input class='tbox form-control' type='text' id='".$en_id."' name='".$en_id."' size='35' value='".$tp->post_toForm($_GET[$en_id])."' maxlength='50' />";
|
||||
|
||||
$text .= $tp->simpleParse($this->template['enhanced'], $var);
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
function sc_enhanced_display()
|
||||
{
|
||||
return ($this->enhanced !== true) ? "style='display: none'" : "" ;
|
||||
}
|
||||
|
||||
function sc_search_advanced_block($parm='')
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$sql = e107::getDb();
|
||||
$sql2 = e107::getDb('search');
|
||||
|
||||
|
||||
if(!$parm)
|
||||
{
|
||||
// return;
|
||||
}
|
||||
|
||||
|
||||
if (isset($this->search_info[$parm]['advanced']))
|
||||
{
|
||||
|
||||
if(is_array($this->search_info[$parm]['advanced']))
|
||||
{
|
||||
$advanced = ($this->search_info[$parm]['advanced']);
|
||||
}
|
||||
elseif(isset($this->search_info[$parm]['advanced']))
|
||||
{
|
||||
require($this->search_info[$parm]['advanced']);
|
||||
|
||||
}
|
||||
|
||||
$vars = array();
|
||||
|
||||
|
||||
|
||||
foreach ($advanced as $adv_key => $adv_value)
|
||||
{
|
||||
if ($adv_value['type'] == 'single')
|
||||
{
|
||||
$vars['SEARCH_ADV_TEXT'] = $adv_value['text'];
|
||||
$text .= $tp->simpleParse($this->template['advanced-combo'], $vars);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($adv_value['type'] == 'dropdown')
|
||||
{
|
||||
$vars['SEARCH_ADV_A'] = $adv_value['text'];
|
||||
$vars['SEARCH_ADV_B'] = "<select name='".$adv_key."' class='tbox form-control'>";
|
||||
|
||||
foreach ($adv_value['list'] as $list_item)
|
||||
{
|
||||
$vars['SEARCH_ADV_B'] .= "<option value='".$list_item['id']."' ".($_GET[$adv_key] == $list_item['id'] ? "selected='selected'" : "").">".$list_item['title']."</option>";
|
||||
}
|
||||
$vars['SEARCH_ADV_B'] .= "</select>";
|
||||
}
|
||||
else if ($adv_value['type'] == 'date')
|
||||
{
|
||||
$vars['SEARCH_ADV_A'] = $adv_value['text'];
|
||||
$vars['SEARCH_ADV_B'] = "
|
||||
|
||||
<div class='form-inline'>
|
||||
<select id='on' name='on' class='tbox form-control '>
|
||||
<option value='new' ".($_GET['on'] == 'new' ? "selected='selected'" : "").">".LAN_SEARCH_34."</option>
|
||||
<option value='old' ".($_GET['on'] == 'old' ? "selected='selected'" : "").">".LAN_SEARCH_35."</option>
|
||||
</select>
|
||||
|
||||
<select id='time' name='time' class='tbox form-control '>";
|
||||
|
||||
$time = array(LAN_SEARCH_36 => 'any', LAN_SEARCH_37 => 86400, LAN_SEARCH_38 => 172800, LAN_SEARCH_39 => 259200, LAN_SEARCH_40 => 604800, LAN_SEARCH_41 => 1209600, LAN_SEARCH_42 => 1814400, LAN_SEARCH_43 => 2628000, LAN_SEARCH_44 => 5256000, LAN_SEARCH_45 => 7884000, LAN_SEARCH_46 => 15768000, LAN_SEARCH_47 => 31536000, LAN_SEARCH_48 => 63072000, LAN_SEARCH_49 => 94608000);
|
||||
|
||||
foreach ($time as $time_title => $time_secs)
|
||||
{
|
||||
$vars['SEARCH_ADV_B'] .= "<option value='".$time_secs."' ".($_GET['time'] == $time_secs ? "selected='selected'" : "").">".$time_title."</option>";
|
||||
}
|
||||
|
||||
$vars['SEARCH_ADV_B'] .= "</select>
|
||||
</div>";
|
||||
}
|
||||
else if ($adv_value['type'] == 'author')
|
||||
{
|
||||
// require_once(e_HANDLER.'user_select_class.php');
|
||||
|
||||
// $us = new user_select;
|
||||
$vars['SEARCH_ADV_A'] = $adv_value['text'];
|
||||
$vars['SEARCH_ADV_B'] = e107::getForm()->userpicker($adv_key."_name",$adv_key,$_GET[$adv_key]); // $us -> select_form('popup', $adv_key, $_GET[$adv_key]);
|
||||
|
||||
|
||||
|
||||
}
|
||||
else if ($adv_value['type'] == 'dual')
|
||||
{
|
||||
$vars['SEARCH_ADV_A'] = $adv_value['adv_a'];
|
||||
$vars['SEARCH_ADV_B'] = $adv_value['adv_b'];
|
||||
}
|
||||
|
||||
$text .= $tp->simpleParse($this->template['advanced'], $vars);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$_GET['adv'] = 0;
|
||||
}
|
||||
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------
|
||||
|
||||
|
||||
@ -285,12 +517,13 @@ class search extends e_shortcode
|
||||
|
||||
$search_info = array();
|
||||
|
||||
/*
|
||||
if ($search_info['news'] = $this->search_info('news', 'core', false, array('sfile' => e_HANDLER.'search/search_news.php', 'qtype' => LAN_SEARCH_98, 'refpage' => 'news.php', 'advanced' => e_HANDLER.'search/advanced_news.php', 'id' => 'news'))) {
|
||||
// $search_id++;
|
||||
} else {
|
||||
unset($search_info['news']);
|
||||
}
|
||||
|
||||
*/
|
||||
if(e107::getConfig('core')->get('comments_disabled')!=1) // Only when comments are enabled.
|
||||
{
|
||||
if ($search_info['comments'] = $this->search_info('comments', 'core', false, array('sfile' => e_HANDLER.'search/search_comment.php', 'qtype' => LAN_SEARCH_99, 'refpage' => 'comment.php', 'advanced' => e_HANDLER.'search/advanced_comment.php', 'id' => 'comment'))) {
|
||||
@ -350,7 +583,7 @@ class search extends e_shortcode
|
||||
$this->search_info = $search_info;
|
||||
|
||||
// print_a($this->search_prefs);
|
||||
print_a($this->search_info);
|
||||
// print_a($this->search_info);
|
||||
|
||||
return $search_info;
|
||||
}
|
||||
@ -500,6 +733,10 @@ class search extends e_shortcode
|
||||
|
||||
$className = $key."_search";
|
||||
|
||||
if(!class_exists($className))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$obj = new $className;
|
||||
|
||||
$where = (method_exists($obj,'where')) ? $obj->where($_GET) : "";
|
||||
@ -684,8 +921,8 @@ class search extends e_shortcode
|
||||
|
||||
|
||||
$srchObj = new search;
|
||||
$search_info = $srchObj->searchConfig();
|
||||
$search_prefs = $srchObj->searchPrefs();
|
||||
$search_info = $srchObj->getConfig();
|
||||
$search_prefs = $srchObj->getPrefs();
|
||||
|
||||
// validate search query
|
||||
$perform_search = true;
|
||||
@ -964,7 +1201,7 @@ if ($perform_search)
|
||||
require_once(HEADERF);
|
||||
|
||||
// render search config
|
||||
/*
|
||||
|
||||
if(deftrue('BOOTSTRAP'))
|
||||
{
|
||||
$tmp = e107::getCoreTemplate('search','form');
|
||||
@ -976,13 +1213,12 @@ if(deftrue('BOOTSTRAP'))
|
||||
$SEARCH_ENHANCED = $tmp['enhanced'];
|
||||
$SEARCH_ADV_COMBO = $tmp['advanced-combo'];
|
||||
|
||||
|
||||
$srchObj->template = $tmp;
|
||||
|
||||
|
||||
|
||||
unset($tmp);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@ -996,8 +1232,15 @@ if (!isset($SEARCH_TOP_TABLE))
|
||||
{
|
||||
require(e_CORE."templates/search_template.php");
|
||||
}
|
||||
|
||||
$SEARCH_TOP_TABLE .= "{SEARCH_ENHANCED}";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//$SEARCH_TOP_TABLE = $tp->parseTemplate($SEARCH_TOP_TABLE,true,$srchObj);
|
||||
//$SEARCH_TYPE = $tp->parseTemplate($SEARCH_TYPE,true, $srchObj);
|
||||
|
||||
@ -1062,7 +1305,7 @@ $tp = e107::getParser();
|
||||
|
||||
$text = $tp->parseTemplate($SEARCH_TOP_TABLE,true,$srchObj);
|
||||
|
||||
|
||||
/*
|
||||
foreach ($enhanced_types as $en_id => $ENHANCED_TEXT)
|
||||
{
|
||||
$SEARCH_VARS->ENHANCED_TEXT = $ENHANCED_TEXT;
|
||||
@ -1072,6 +1315,8 @@ foreach ($enhanced_types as $en_id => $ENHANCED_TEXT)
|
||||
$text .= $tp->simpleParse($SEARCH_ENHANCED, $SEARCH_VARS);
|
||||
}
|
||||
$SEARCH_VARS->ENHANCED_TEXT = $SEARCH_VARS->ENHANCED_DISPLAY_ID = $SEARCH_VARS->ENHANCED_FIELD = null;
|
||||
*/
|
||||
|
||||
|
||||
if ($search_prefs['user_select'])
|
||||
{
|
||||
@ -1084,77 +1329,11 @@ if ($search_prefs['user_select'])
|
||||
// $text .= $tp->simpleParse($SEARCH_TYPE, $SEARCH_VARS);
|
||||
$text .= $tp->parseTemplate($SEARCH_TYPE,true, $srchObj);
|
||||
|
||||
if ($_GET['adv'])
|
||||
{
|
||||
|
||||
if (isset($search_info[$_GET['t']]['advanced']))
|
||||
{
|
||||
|
||||
if(is_array($search_info[$_GET['t']]['advanced']))
|
||||
{
|
||||
$advanced = ($search_info[$_GET['t']]['advanced']);
|
||||
}
|
||||
elseif(isset($search_info[$_GET['t']]['advanced']))
|
||||
{
|
||||
require_once($search_info[$_GET['t']]['advanced']);
|
||||
|
||||
}
|
||||
|
||||
foreach ($advanced as $adv_key => $adv_value)
|
||||
{
|
||||
if ($adv_value['type'] == 'single')
|
||||
{
|
||||
$SEARCH_VARS->SEARCH_ADV_TEXT = $adv_value['text'];
|
||||
//$text .= preg_replace("/\{(.*?)\}/e", '$\1', $SEARCH_ADV_COMBO);
|
||||
$text .= $tp->simpleParse($SEARCH_ADV_COMBO, $SEARCH_VARS);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($adv_value['type'] == 'dropdown')
|
||||
{
|
||||
$SEARCH_VARS->SEARCH_ADV_A = $adv_value['text'];
|
||||
$SEARCH_VARS->SEARCH_ADV_B = "<select name='".$adv_key."' class='tbox'>";
|
||||
foreach ($adv_value['list'] as $list_item) {
|
||||
$SEARCH_VARS->SEARCH_ADV_B .= "<option value='".$list_item['id']."' ".($_GET[$adv_key] == $list_item['id'] ? "selected='selected'" : "").">".$list_item['title']."</option>";
|
||||
}
|
||||
$SEARCH_VARS->SEARCH_ADV_B .= "</select>";
|
||||
}
|
||||
else if ($adv_value['type'] == 'date')
|
||||
{
|
||||
$SEARCH_VARS->SEARCH_ADV_A = $adv_value['text'];
|
||||
$SEARCH_VARS->SEARCH_ADV_B = "<select id='on' name='on' class='tbox'>
|
||||
<option value='new' ".($_GET['on'] == 'new' ? "selected='selected'" : "").">".LAN_SEARCH_34."</option>
|
||||
<option value='old' ".($_GET['on'] == 'old' ? "selected='selected'" : "").">".LAN_SEARCH_35."</option>
|
||||
</select> <select id='time' name='time' class='tbox'>";
|
||||
$time = array(LAN_SEARCH_36 => 'any', LAN_SEARCH_37 => 86400, LAN_SEARCH_38 => 172800, LAN_SEARCH_39 => 259200, LAN_SEARCH_40 => 604800, LAN_SEARCH_41 => 1209600, LAN_SEARCH_42 => 1814400, LAN_SEARCH_43 => 2628000, LAN_SEARCH_44 => 5256000, LAN_SEARCH_45 => 7884000, LAN_SEARCH_46 => 15768000, LAN_SEARCH_47 => 31536000, LAN_SEARCH_48 => 63072000, LAN_SEARCH_49 => 94608000);
|
||||
foreach ($time as $time_title => $time_secs)
|
||||
{
|
||||
$SEARCH_VARS->SEARCH_ADV_B .= "<option value='".$time_secs."' ".($_GET['time'] == $time_secs ? "selected='selected'" : "").">".$time_title."</option>";
|
||||
}
|
||||
$SEARCH_VARS->SEARCH_ADV_B .= "</select>";
|
||||
}
|
||||
else if ($adv_value['type'] == 'author')
|
||||
{
|
||||
require_once(e_HANDLER.'user_select_class.php');
|
||||
$us = new user_select;
|
||||
$SEARCH_VARS->SEARCH_ADV_A = $adv_value['text'];
|
||||
$SEARCH_VARS->SEARCH_ADV_B = $us -> select_form('popup', $adv_key, $_GET[$adv_key]);
|
||||
}
|
||||
else if ($adv_value['type'] == 'dual')
|
||||
{
|
||||
$SEARCH_VARS->SEARCH_ADV_A = $adv_value['adv_a'];
|
||||
$SEARCH_VARS->SEARCH_ADV_B = $adv_value['adv_b'];
|
||||
}
|
||||
//$text .= preg_replace("/\{(.*?)\}/e", '$\1', $SEARCH_ADV);
|
||||
$text .= $tp->simpleParse($SEARCH_ADV, $SEARCH_VARS);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$_GET['adv'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$text .= "<div class='e-hideme' id='search-advanced' >";
|
||||
$text .= $tp->parseTemplate("{SEARCH_ADVANCED_BLOCK=".vartrue($_GET['t'])."}",true, $srchObj);
|
||||
$text .= "</div>";
|
||||
|
||||
|
||||
//$
|
||||
|
||||
@ -1308,18 +1487,7 @@ function headerjs() {
|
||||
|
||||
}
|
||||
|
||||
$script .= "<script type='text/javascript'>
|
||||
<!--
|
||||
function ab() {
|
||||
abid = document.getElementById('t').value;
|
||||
if (abid != 'all'".$js_adv.") {
|
||||
document.getElementById('advanced_type').style.display = '';
|
||||
} else {
|
||||
document.getElementById('advanced_type').style.display = 'none';
|
||||
}
|
||||
}
|
||||
//-->
|
||||
</script>";
|
||||
|
||||
|
||||
return $script;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user