Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezarticle/user/extendedsearch.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: extendedsearch.php 6206 2001-07-19 12:19:22Z jakobn $
5 //
6 // Created on: <29-Mar-2001 11:15:24 amos>
7 //
8 // This source file is part of Exponential Basic, publishing software.
9 //
10 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
11 //
12 // This program is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU General Public License
14 // as published by the Free Software Foundation; either version 2
15 // of the License, or (at your option) any later version.
16 //
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
25 //
26
27 // include_once( "classes/INIFile.php" );
28 // include_once( "classes/eztemplate.php" );
29 // include_once( "classes/ezlocale.php" );
30 // include_once( "classes/ezlist.php" );
31
32 // include_once( "ezarticle/classes/ezarticlecategory.php" );
33 // include_once( "ezarticle/classes/ezarticle.php" );
34
35 $ini =& eZINI::instance( 'site.ini' );
36
37 $Language = $ini->variable( "eZArticleMain", "Language" );
38
39 $t = new eZTemplate( "kernel/ezarticle/user/" . $ini->variable( "eZArticleMain", "TemplateDir" ),
40 "kernel/ezarticle/user/intl/", $Language, "extendedsearch.php" );
41
42 $t->setAllStrings();
43
44 $t->set_file( "extended_search_tpl", "extendedsearch.tpl" );
45
46 $t->set_block( "extended_search_tpl", "search_item_tpl", "search_item" );
47 $t->set_block( "search_item_tpl", "category_item_tpl", "category_item" );
48
49 $t->set_block( "extended_search_tpl", "article_list_tpl", "article_list" );
50 $t->set_block( "article_list_tpl", "article_item_tpl", "article_item" );
51
52 $contents =& eZArticle::shortContents();
53 $t->set_var( "category_item", "" );
54 foreach( $contents as $content )
55 {
56 $t->set_var( "category_id", $content );
57 $t->set_var( "category_name", $content );
58 $t->set_var( "category_level", "" );
59 $t->set_var( "category_selected", $Category == $content ? "selected" : "" );
60 $t->parse( "category_item", "category_item_tpl", true );
61 }
62 $t->set_var( "search_text", $SearchText );
63 $t->set_var( "search_url_text", $SearchText == "" ? "+" : $SearchText );
64
65 $t->parse( "search_item", "search_item_tpl" );
66
67 $t->set_var( "article_list", "" );
68
69 if ( !is_numeric( $Offset ) )
70 $Offset = 0;
71 if ( !is_numeric( $Max ) )
72 $Max = 4;
73
74 if ( isset( $Search ) )
75 {
76 $words = preg_split( "/[, ]+/", $SearchText );
77 $keywords = array();
78 foreach( $words as $word )
79 {
80 $keyword = strtolower( trim( $word ) );
81 if ( $keyword != "" )
82 $keywords[] = $keyword;
83 }
84 $articles =& eZArticle::searchByShortContent( $Category, $keywords, $Offset, $Max );
85 $t->set_var( "article_item", "" );
86 $t->set_var( "category", $Category == "" ? "+" : $Category );
87 foreach( $articles as $article )
88 {
89 $t->set_var( "article_id", $article->id() );
90 $t->set_var( "article_name", $article->name() );
91 $t->set_var( "article_page", 1 );
92 $cats =& $article->categories( false );
93 $t->set_var( "article_category", $cats[0] );
94 $t->parse( "article_item", "article_item_tpl", true );
95 }
96 $articleCount = eZArticle::searchByShortContent( $Category, $keywords, true );
97
98 eZList::drawNavigator( $t, $articleCount, $Max, $Offset, "article_list_tpl" );
99
100 $t->parse( "article_list", "article_list_tpl" );
101
102 }
103
104 $t->pparse( "output", "extended_search_tpl" );
105
106 ?>
$articleCount
$articleCount
Definition: admin/articlelist.php:456
$article
$article
Definition: articlelog.php:45
$articles
$articles
Definition: authorview.php:64
eZArticle\searchByShortContent
static & searchByShortContent( $short_content, $keywords, $offset=0, $max=-1, $as_object=true)
Definition: ezarticle.php:1159
eZList\drawNavigator
static drawNavigator(&$t, $total_types, $max_types, $index, $parent=false, $variables=false)
Definition: ezlist.php:401
eZTemplate
Definition: eztemplate.php:107
$Max
$Max
Definition: countrylist.php:31
$SearchText
$SearchText
Definition: ezaddress/admin/typelist.php:143
$t
$t
Definition: ezarticle/user/extendedsearch.php:39
$contents
$contents
Definition: ezarticle/user/extendedsearch.php:52
$Language
$Language
Definition: ezarticle/user/extendedsearch.php:37
$ini
$ini
Definition: ezarticle/user/extendedsearch.php:35
$Offset
$Offset
Definition: ezarticle/user/search.php:110
$content
$content
Definition: ezimagecatalogue/admin/filedownload.php:53
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.