当前位置: 首页>>代码示例>>PHP>>正文


PHP Search::from_params方法代码示例

本文整理汇总了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'] .= "&amp;search_position=" . ($this->search_position + 1);
     }
     $this->total_items = $search->total;
 }
开发者ID:archives-of-michigan,项目名称:Governing-Michigan-cdm,代码行数:25,代码来源:search_status.php

示例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);
 }
开发者ID:JillArnold,项目名称:dnr-ContentDM,代码行数:8,代码来源:search.php

示例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']);
 }
开发者ID:JillArnold,项目名称:dnr-ContentDM,代码行数:9,代码来源:SearchFromParamsTest.php

示例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);
 }
开发者ID:JillArnold,项目名称:dnr-ContentDM,代码行数:9,代码来源:SearchFormFieldsTest.php

示例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 &mdash; 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 
开发者ID:JillArnold,项目名称:dnr-ContentDM,代码行数:31,代码来源:seek_results.php

示例6: testShouldReturnFalseIfSpecificSearch

 public function testShouldReturnFalseIfSpecificSearch()
 {
     $search = Search::from_params(array('CISOROOT' => 'all', 's' => 'smokey'));
     $this->assertFalse($search->is_default_search());
 }
开发者ID:JillArnold,项目名称:dnr-ContentDM,代码行数:5,代码来源:SearchIsDefaultSearchTest.php

示例7: from_param_string

 public static function from_param_string($param_string)
 {
     parse_str(urldecode($param_string), $params);
     return Search::from_params($params);
 }
开发者ID:archives-of-michigan,项目名称:Governing-Michigan-cdm,代码行数:5,代码来源:search.php

示例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);
 }
开发者ID:JillArnold,项目名称:dnr-ContentDM,代码行数:6,代码来源:SeekResultsHelperSearchFieldsWithoutAliasTest.php


注:本文中的Search::from_params方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。