Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezarticle/admin/search.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: search.php 7268 2001-09-16 18:37:39Z bf $
5 //
6 // Created on: <28-Oct-2000 15:56:58 bf>
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
31 // include_once( "ezarticle/classes/ezarticlecategory.php" );
32 // include_once( "ezarticle/classes/ezarticle.php" );
33 // include_once( "ezuser/classes/ezobjectpermission.php" );
34 // include_once( "classes/ezlist.php" );
35
36 $ini =& eZINI::instance( 'site.ini' );
37 $Language = $ini->variable( "eZArticleMain", "Language" );
38 $Limit = $ini->variable( "eZArticleMain", "AdminListLimit" );
39
40
41 if( isset( $Delete ) && count( $ArticleArrayID ) > 0 )
42 {
43 foreach( $ArticleArrayID as $articleID )
44 {
45 if( eZObjectPermission::hasPermission( $articleID, "article_article", 'w' ) )
46 {
47 $article = new eZArticle( $articleID );
48 $article->delete();
49 }
50 }
51 }
52
53 $t = new eZTemplate( "kernel/ezarticle/admin/" . $ini->variable( "eZArticleMain", "AdminTemplateDir" ),
54 "kernel/ezarticle/admin/intl/", $Language, "search.php" );
55
56 $t->setAllStrings();
57
58 $t->set_file( array(
59 "article_list_page_tpl" => "search.tpl"
60 ) );
61
62 if ( !isset ( $Offset ) )
63 $Offset = 0;
64 if ( !isset ( $StartMonth ) or $StartMonth == '' )
65 $StartMonth = 0;
66 if ( !isset ( $StartDay ) or $StartDay == '' )
67 $StartDay = 0;
68 if ( !isset ( $StartYear ) or $StartYear == '' )
69 $StartYear = 0;
70
71 if ( !isset ( $StopMonth ) or $StopMonth == '' )
72 $StopMonth = 0;
73 if ( !isset ( $StopDay ) or $StopDay == '' )
74 $StopDay = 0;
75 if ( !isset ( $StopYear ) or $StopYear == '' )
76 $StopYear = 0;
77
78 // article
79 $t->set_block( "article_list_page_tpl", "article_list_tpl", "article_list" );
80 $t->set_block( "article_list_tpl", "article_item_tpl", "article_item" );
81 $t->set_block( "article_item_tpl", "article_is_published_tpl", "article_is_published" );
82 $t->set_block( "article_item_tpl", "article_not_published_tpl", "article_not_published" );
83 $t->set_block( "article_list_page_tpl", "article_delete_tpl", "article_delete" );
84
85 // Init url variables - for eZList...
86 $t->set_var( "url_start_stamp", urlencode( "+" ) );
87 $t->set_var( "url_stop_stamp", urlencode( "+" ) );
88 $t->set_var( "url_category_array", urlencode( "+" ) );
89 $t->set_var( "url_contentswriter_id", urlencode( "+" ) );
90 $t->set_var( "url_photographer_id", urlencode( "+" ) );
91
92 if ( checkdate ( $StartMonth, $StartDay, $StartYear ) )
93 {
94 $startDate = new eZDateTime( $StartYear, $StartMonth, $StartDay, $StartHour, $StartMinute, 0 );
95 $StartStamp = $startDate->timeStamp();
96 }
97 if ( checkdate ( $StopMonth, $StopDay, $StopYear ) )
98 {
99 $stopDate = new eZDateTime( $StopYear, $StopMonth, $StopDay, $StopHour, $StopMinute, 0 );
100 $StopStamp = $stopDate->timeStamp();
101 }
102
103
104 // BUILDING THE SEARCH
105 // If url parameters are present when loading page, they are decoded in the datasupplier
106 $paramsArray = array();
107 if ( $SearchText )
108 {
109 if ( isset( $StartStamp ) )
110 {
111 $paramsArray["FromDate"] = $StartStamp;
112 $t->set_var( "url_start_stamp", urlencode( $StartStamp ) );
113 }
114
115 if ( isset( $StopStamp ) )
116 {
117 $paramsArray["ToDate"] = $StopStamp;
118 $t->set_var( "url_stop_stamp", urlencode( $StopStamp ) );
119 }
120
121 if( isset( $ContentsWriterID ) && $ContentsWriterID != 0 )
122 {
123 $paramsArray["AuthorID"] = $ContentsWriterID;
124 $t->set_var( "url_contentswriter_id", urlencode( $ContentsWriterID ) );
125 }
126
127 if( isset( $PhotographerID ) && $PhotographerID != 0 )
128 {
129 $paramsArray["PhotographerID"] = $PhotographerID;
130 $t->set_var( "url_photographer_id", urlencode( $PhotographerID ) );
131 }
132
133 if( isset( $CategoryArray ) && is_array( $CategoryArray ) && count( $CategoryArray ) > 0 && !in_array( 0, $CategoryArray ) )
134 {
135 $paramsArray["Categories"] = $CategoryArray;
136
137 // fix output string for URL
138 $t->set_var( "url_category_array", urlencode( implode( "-", $CategoryArray ) ) );
139 }
140
141 // $paramsArray["SearchExcludedArticles"] = "true";
142
143
144 $article = new eZArticle();
145 $totalCount = false;
146 $articleList = $article->search( $SearchText, "time", true, $Offset, $Limit, $paramsArray, $totalCount );
147
148 $t->set_var( "search_text", $SearchText );
149 $t->set_var( "url_text", urlencode ( $SearchText ) );
150 }
151
152 if ( isset( $articleList ) && count ( $articleList ) > 0 )
153 {
154 $locale = new eZLocale( $Language );
155 $i=0;
156 $t->set_var( "article_list", "" );
157 foreach ( $articleList as $article )
158 {
159 $t->set_var( "article_name", $article->name() );
160
161 $t->set_var( "article_id", $article->id() );
162
163 if ( $article->isPublished() == true )
164 {
165 $t->parse( "article_is_published", "article_is_published_tpl" );
166 $t->set_var( "article_not_published", "" );
167 }
168 else
169 {
170 $t->set_var( "article_is_published", "" );
171 $t->parse( "article_not_published", "article_not_published_tpl" );
172 }
173
174 if ( ( $i % 2 ) == 0 )
175 {
176 $t->set_var( "td_class", "bglight" );
177 }
178 else
179 {
180 $t->set_var( "td_class", "bgdark" );
181 }
182
183 $t->parse( "article_item", "article_item_tpl", true );
184 $i++;
185 }
186 }
187
188 //echo "<pre>";
189 //print_r ( $t );
190
191 //echo "totalCount:".$totalCount."<br>";
192 //echo "Limit:".$Limit."<br>";
193 //echo "Offset:".$Offset."<br>";
194 //echo "</pre>";
195 //exit();
196
197 eZList::drawNavigator( $t, $totalCount, $Limit, $Offset, "article_list_page_tpl" );
198
199 if ( isset( $articleList ) && count( $articleList ) > 0 )
200 {
201 $t->parse( "article_list", "article_list_tpl" );
202 $t->parse( "article_delete", "article_delete_tpl" );
203 }
204 else
205 {
206 $t->set_var( "article_list", "" );
207 $t->set_var( "article_delete", "" );
208 }
209
210 $t->set_var( "article_start", $Offset + 1 );
211 $t->set_var( "article_end", min( $Offset + $Limit, $totalCount ) );
212 $t->set_var( "article_total", $totalCount );
213
214 $t->pparse( "output", "article_list_page_tpl" );
215
216 ?>
$locale
$locale
Definition: admin/adlist.php:127
$i
$i
Definition: admin/adlist.php:91
$article
$article
Definition: articlelog.php:45
eZArticle
Definition: ezarticle.php:82
eZDateTime
Definition: ezdatetime.php:55
eZList\drawNavigator
static drawNavigator(&$t, $total_types, $max_types, $index, $parent=false, $variables=false)
Definition: ezlist.php:401
eZLocale
Definition: ezlocale.php:119
eZObjectPermission\hasPermission
static hasPermission( $objectID, $moduleTable, $permission, $user=false)
Definition: ezobjectpermission.php:76
eZTemplate
Definition: eztemplate.php:107
$SearchText
$SearchText
Definition: ezaddress/admin/typelist.php:143
$totalCount
$totalCount
Definition: ezarticle/admin/formlist.php:73
$Limit
$Limit
Definition: ezarticle/admin/search.php:38
$t
if(isset( $Delete) &&count( $ArticleArrayID) > 0) $t
Definition: ezarticle/admin/search.php:53
$Language
$Language
Definition: ezarticle/admin/search.php:37
$ini
$ini
Definition: ezarticle/admin/search.php:36
$paramsArray
if(checkdate( $StartMonth, $StartDay, $StartYear)) if(checkdate( $StopMonth, $StopDay, $StopYear)) $paramsArray
Definition: ezarticle/admin/search.php:106
$Offset
$Offset
Definition: ezarticle/user/search.php:110
$articleList
$articleList
Definition: pendinglist.php:112
$articleID
if( $Action=="New") $articleID
Definition: user/articleedit.php:269
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.