本文整理汇总了PHP中Search::from_params方法的典型用法代码示例。如果您正苦于以下问题:PHP Search::from_params方法的具体用法?PHP Search::from_params怎么用?PHP Search::from_params使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Search
的用法示例。
在下文中一共展示了Search::from_params方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($seek_search_params, $search_position)
{
$this->search_position = $search_position;
if (is_string($seek_search_params)) {
parse_str($seek_search_params, $query_params);
} else {
$query_params = $seek_search_params;
}
$search = Search::from_params($query_params);
$search->maxrecs = 3;
$prev_item_num = $this->search_position > 1 ? $this->search_position - 1 : null;
$current_result_index = $this->search_position - 1;
$search->start = array(0, max(1, $current_result_index));
$results = $search->results();
if ($this->search_position > 1) {
$this->previous_item = get_item($results[0]['collection'], $results[0]['pointer']);
$this->previous_item['query_string'] .= "&search_position=" . ($this->search_position - 1);
}
if ($this->search_position < $search->total) {
$next_result_index = $this->search_position > 1 ? 2 : 1;
$this->next_item = get_item($results[$next_result_index]['collection'], $results[$next_result_index]['pointer']);
$this->next_item['query_string'] .= "&search_position=" . ($this->search_position + 1);
}
$this->total_items = $search->total;
}
示例2: from_param_string
public static function from_param_string($param_string)
{
if (!preg_match('/=/', $param_string)) {
$param_string = urldecode($param_string);
}
parse_str($param_string, $params);
return Search::from_params($params);
}
示例3: testShouldParseSimpleSearch
public function testShouldParseSimpleSearch()
{
$params = array('s' => 'Lansing mayor');
$search = Search::from_params($params);
$this->assertEquals(13, count($search->search_alias));
$this->assertEquals('Lansing mayor', $search->search_string[0]['string']);
$this->assertEquals('CISOSEARCHALL', $search->search_string[0]['field']);
$this->assertEquals('any', $search->search_string[0]['mode']);
}
示例4: testShouldOverrideGivenParams
public function testShouldOverrideGivenParams()
{
$params = array('CISOROOT' => '/p4006coll3', 'CISOBOX1' => 'street car', 'CISOOP1' => 'exact', 'CISOFIELD1' => 'title', 'CISOBOX2' => 'Lansing', 'CISOOP2' => 'any', 'CISOFIELD2' => 'title', 'CISOBOX3' => 'station', 'CISOOP3' => 'any', 'CISOFIELD3' => 'subjec', 'CISOSTART' => '1,21');
$search = Search::from_params($params);
$fields = $search->form_fields(array('CISOROOT' => 'abracadabra'));
$new_params = $params;
$new_params['CISOROOT'] = 'abracadabra';
$this->assertEquals($new_params, $fields);
}
示例5: include
<?
include("config.php");
include('lib/paginator.php');
$search = Search::from_params($_GET);
$collections = dmGetCollectionList();
$results = $search->results();
$search_url = $_SERVER['QUERY_STRING'];
$breadcrumbs = array('Home' => SEEKING_MICHIGAN_HOST,
'Seek' => 'seek_advanced.php', 'Search Results' => '');
app()->partial('header',
array('body_class' => 'seek',
'breadcrumbs' => $breadcrumbs,
'title' => 'Results : Seek — Seeking Michigan'));
?>
<div id="section-header">
<h1><a href="seek_advanced.php">Seek</a></h1>
</div>
<div id="main-content">
<div class="wrapper">
<? $search->terms; ?>
<? if(!$search->is_default_search()): ?>
<h1>
Search Results for:
<? foreach($search->terms() as $term): ?>
<a href="seek_results.php?<?php
echo $search->term_search_string($term);
?>
">
<?php
示例6: testShouldReturnFalseIfSpecificSearch
public function testShouldReturnFalseIfSpecificSearch()
{
$search = Search::from_params(array('CISOROOT' => 'all', 's' => 'smokey'));
$this->assertFalse($search->is_default_search());
}
示例7: from_param_string
public static function from_param_string($param_string)
{
parse_str(urldecode($param_string), $params);
return Search::from_params($params);
}
示例8: testSholdReturnListOfFieldsSansCISOROOT
public function testSholdReturnListOfFieldsSansCISOROOT()
{
$search = Search::from_params(array('s' => 'crumbly apple cobbler'));
$results = $this->helper->search_fields_without_alias($search);
$this->assertEquals(array('CISOBOX1' => 'crumbly apple cobbler', 'CISOOP1' => 'any', 'CISOFIELD1' => 'CISOSEARCHALL', 'CISOSTART' => '1,1'), $results);
}