Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

newsarchive.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: newsarchive.php 8504 2001-11-19 09:46:46Z jhe $
5 //
6 // Created on: <13-Nov-2000 16:56:48 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( "eznewsfeed/classes/eznews.php" );
28 // include_once( "eznewsfeed/classes/eznewscategory.php" );
29 // include_once( "eznewsfeed/classes/eznewsimporter.php" );
30
31 // include_once( "classes/ezdatetime.php" );
32 // include_once( "classes/ezlocale.php" );
33
34 $ini = eZINI::instance( 'site.ini' );
35
36 $Language = $ini->variable( "eZNewsFeedMain", "Language" );
37
38 if( isset( $DeleteCategories ) && count( $CategoryArrayID ) > 0 )
39 {
40 foreach( $CategoryArrayID as $categoryID )
41 {
42 $category = new eZNewsCategory( $categoryID );
43 $category->delete();
44 }
45 }
46
47 if( isset( $DeleteNews ) && count( $NewsArrayID ) > 0)
48 {
49 foreach( $NewsArrayID as $newsID )
50 {
51 $news = new eZNews( $newsID );
52 $news->delete();
53 }
54 }
55
56 $t = new eZTemplate( "kernel/eznewsfeed/admin/" . $ini->variable( "eZNewsFeedMain", "AdminTemplateDir" ),
57 "kernel/eznewsfeed/admin/intl/", $Language, "newsarchive.php" );
58
59 $t->setAllStrings();
60
61 $t->set_file( array(
62 "news_archive_page_tpl" => "newsarchive.tpl"
63 ) );
64
65 // path
66 $t->set_block( "news_archive_page_tpl", "path_item_tpl", "path_item" );
67
68 // category
69 $t->set_block( "news_archive_page_tpl", "category_list_tpl", "category_list" );
70 $t->set_block( "category_list_tpl", "category_item_tpl", "category_item" );
71
72 // news
73 $t->set_block( "news_archive_page_tpl", "news_list_tpl", "news_list" );
74 $t->set_block( "news_list_tpl", "news_item_tpl", "news_item" );
75 $t->set_block( "news_item_tpl", "news_is_published_tpl", "news_is_published" );
76 $t->set_block( "news_item_tpl", "news_not_published_tpl", "news_not_published" );
77
78 $t->set_block( "news_archive_page_tpl", "previous_tpl", "previous" );
79 $t->set_block( "news_archive_page_tpl", "next_tpl", "next" );
80 $t->set_block( "news_archive_page_tpl", "delete_categories_tpl", "delete_categories" );
81 $t->set_block( "news_archive_page_tpl", "delete_news_tpl", "delete_news" );
82
83 $category = new eZNewsCategory( $CategoryID );
84
85 $t->set_var( "current_category_id", $category->id() );
86 $t->set_var( "current_category_name", $category->name() );
87 $t->set_var( "current_category_description", $category->description() );
88
89 $t->set_var( "site_style", $SiteDesign );
90
91 // path
92 $pathArray = $category->path();
93
94 $t->set_var( "path_item", "" );
95 foreach ( $pathArray as $path )
96 {
97 $t->set_var( "category_id", $path[0] );
98
99 $t->set_var( "category_name", $path[1] );
100
101 $t->parse( "path_item", "path_item_tpl", true );
102 }
103
104 $categoryList =& $category->getByParent( $category, true );
105
106
107 // categories
108 $i=0;
109 $t->set_var( "category_list", "" );
110
111 foreach ( $categoryList as $categoryItem )
112 {
113 $t->set_var( "category_id", $categoryItem->id() );
114
115 $t->set_var( "category_name", $categoryItem->name() );
116
117 $parent = $categoryItem->parent();
118
119 if ( ( $i % 2 ) == 0 )
120 {
121 $t->set_var( "td_class", "bglight" );
122 }
123 else
124 {
125 $t->set_var( "td_class", "bgdark" );
126 }
127
128 $t->set_var( "category_description", $categoryItem->description() );
129
130 $t->parse( "category_item", "category_item_tpl", true );
131 $i++;
132 }
133
134 if ( count( $categoryList ) > 0 )
135 {
136 $t->parse( "category_list", "category_list_tpl" );
137 $t->parse( "delete_categories", "delete_categories_tpl" );
138 }
139 else
140 {
141 $t->set_var( "category_list", "" );
142 $t->set_var( "delete_categories", "" );
143 }
144
145
146 if ( !isset( $Limit ) )
147 $Limit = 20;
148 if ( !isset( $Offset ) )
149 $Offset = 0;
150
151 // news
152 if ( $ShowUnPublished = "no" )
153 {
154 $newsList =& $category->newsList( "time", "no", $Offset, $Limit );
155 $newsListCount = $category->newsListCount( "time", "no" );
156 }
157 else
158 {
159 $newsList =& $category->newsList( "time", "only", $Offset, $Limit );
160 $newsListCount = $category->newsListCount( "time", "only" );
161 }
162
163 $locale = new eZLocale( $Language );
164 $i=0;
165 $t->set_var( "news_list", "" );
166 foreach ( $newsList as $news )
167 {
168 if ( $news->name() == "" )
169 $t->set_var( "news_name", "&nbsp;" );
170 else
171 $t->set_var( "news_name", $news->name() );
172
173 $t->set_var( "news_id", $news->id() );
174
175 if ( $news->isPublished() == true )
176 {
177 $t->parse( "news_is_published", "news_is_published_tpl" );
178 $t->set_var( "news_not_published", "" );
179 }
180 else
181 {
182 $t->set_var( "news_is_published", "" );
183 $t->parse( "news_not_published", "news_not_published_tpl" );
184 }
185
186 $t->set_var( "news_origin", $news->origin() );
187
188 $published = $news->originalPublishingDate();
189 $date =& $published->date();
190 $t->set_var( "news_date", $locale->format( $date ) );
191
192 if ( ( $i % 2 ) == 0 )
193 {
194 $t->set_var( "td_class", "bglight" );
195 }
196 else
197 {
198 $t->set_var( "td_class", "bgdark" );
199 }
200
201 $t->parse( "news_item", "news_item_tpl", true );
202 $i++;
203 }
204
205
206 if ( count( $newsList ) > 0 )
207 {
208 $t->parse( "news_list", "news_list_tpl" );
209 $t->parse( "delete_news", "delete_news_tpl" );
210 }
211 else
212 {
213 $t->set_var( "news_list", "" );
214 $t->set_var( "delete_news", "" );
215 }
216
217
218 $prevOffs = $Offset - $Limit;
219 $nextOffs = $Offset + $Limit;
220
221 if ( $prevOffs >= 0 )
222 {
223 $t->set_var( "prev_offset", $prevOffs );
224 $t->parse( "previous", "previous_tpl" );
225 }
226 else
227 {
228 $t->set_var( "previous", "" );
229 }
230
231 if ( $nextOffs <= $newsListCount )
232 {
233 $t->set_var( "next_offset", $nextOffs );
234 $t->parse( "next", "next_tpl" );
235 }
236 else
237 {
238 $t->set_var( "next", "" );
239 }
240
241 $t->pparse( "output", "news_archive_page_tpl" );
242
243 ?>
$CategoryID
$CategoryID
Definition: admin/articleedit.php:53
$date
$date
Definition: bugpreview.php:66
eZLocale
Definition: ezlocale.php:119
eZNewsCategory
Definition: eznewscategory.php:42
eZNews
Definition: eznews.php:63
eZTemplate
Definition: eztemplate.php:107
$Limit
$Limit
Definition: ezarticle/admin/categorylist.php:66
$Offset
$Offset
Definition: ezarticle/user/search.php:110
$SiteDesign
$SiteDesign
Definition: ezbulkmail/user/datasupplier.php:31
$news
if( $Action=="Insert") if( $Action=="Update") if( $Action=="Delete") $news
Definition: eznewsfeed/admin/categoryedit.php:69
$category
$category
Definition: newsarchive.php:83
$locale
$locale
Definition: newsarchive.php:163
$nextOffs
$nextOffs
Definition: newsarchive.php:219
$newsListCount
$newsListCount
Definition: newsarchive.php:160
$pathArray
$pathArray
Definition: newsarchive.php:92
$prevOffs
$prevOffs
Definition: newsarchive.php:218
$i
$i
Definition: newsarchive.php:108
$Language
$Language
Definition: newsarchive.php:36
$ini
$ini
Definition: newsarchive.php:34
$t
if(isset( $DeleteCategories) &&count( $CategoryArrayID) > 0) if(isset( $DeleteNews) &&count( $NewsArrayID) > 0) $t
Definition: newsarchive.php:56
$categoryList
foreach( $pathArray as $path) $categoryList
Definition: newsarchive.php:104
$newsList
if(isset( $URLQueryString)) $newsList
Definition: newssearch.php:68
$categoryID
else $categoryID
Definition: productview.php:66
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.