Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

unpublished.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: unpublished.php 8504 2001-11-19 09:46:46Z jhe $
5 //
6 // Created on: <29-Nov-2000 18:10:27 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 // include_once( "classes/ezdb.php" );
34
35 $db =& eZDB::globalDatabase();
36 if ( isset( $Publish ) )
37 $Action = "Publish";
38
39 if ( isset( $Delete ) )
40 $Action = "Delete";
41
42 if( isset( $DeleteCat ) )
43 $Action = "DeleteCat";
44
45 if ( isset( $Action ) && $Action == "Publish" )
46 {
47 if ( isset( $NewsPublishIDArray ) && count( $NewsPublishIDArray ) > 0 )
48 {
49 foreach ( $NewsPublishIDArray as $newsID )
50 {
51 $news = new eZNews( $newsID );
52 $news->setName( $db->escapeString( $news->name() ) );
53 $news->setIntro( $db->escapeString( $news->intro() ) );
54 $news->setIsPublished( true );
55
56 $news->store();
57 }
58 }
59
60 // delete the cache
61 $dir = eZPBFile::dir( "eznewsfeed/cache/" );
62 $files = array();
63 while( $entry = $dir->read() )
64 {
65 if ( $entry != "." && $entry != ".." )
66 {
67 if ( ereg( "latestnews,([^,]+)\..*", $entry, $regArray ) )
68 {
69 if ( $regArray[1] == $CategoryID )
70 {
71 eZPBFile::unlink( "eznewsfeed/cache/" . $entry );
72 }
73 }
74
75 if ( ereg( "headlines,([^,]+)\..*", $entry, $regArray ) )
76 {
77 if ( $regArray[1] == $CategoryID )
78 {
79 eZPBFile::unlink( "eznewsfeed/cache/" . $entry );
80 }
81 }
82 }
83 }
84 $dir->close();
85 }
86
87
88 if ( isset( $Action ) && $Action == "Delete" )
89 {
90 if ( count( $NewsDeleteIDArray ) > 0 )
91 {
92 foreach ( $NewsDeleteIDArray as $newsID )
93 {
94 $news = new eZNews( $newsID );
95 $news->delete();
96 }
97 }
98 }
99
100 if( isset( $Action ) && $Action == "DeleteCat" )
101 {
102 if( count( $CategoryArrayID ) > 0 )
103 {
104 foreach( $CategoryArrayID as $categoryID )
105 {
106 $category = new eZNewsCategory( $categoryID );
107 $category->delete();
108 }
109 }
110 }
111
112 $ini = eZINI::instance( 'site.ini' );
113
114 $Language = $ini->variable( "eZNewsFeedMain", "Language" );
115
116 $t = new eZTemplate( "kernel/eznewsfeed/admin/" . $ini->variable( "eZNewsFeedMain", "AdminTemplateDir" ),
117 "kernel/eznewsfeed/admin/intl/", $Language, "unpublished.php" );
118
119 $t->setAllStrings();
120
121 $t->set_file( array(
122 "news_unpublished_page_tpl" => "unpublished.tpl"
123 ) );
124
125 // path
126 $t->set_block( "news_unpublished_page_tpl", "path_item_tpl", "path_item" );
127
128 // category
129 $t->set_block( "news_unpublished_page_tpl", "category_list_tpl", "category_list" );
130 $t->set_block( "category_list_tpl", "category_item_tpl", "category_item" );
131
132 // news
133 $t->set_block( "news_unpublished_page_tpl", "news_list_tpl", "news_list" );
134 $t->set_block( "news_list_tpl", "news_item_tpl", "news_item" );
135
136 $t->set_block( "news_unpublished_page_tpl", "previous_tpl", "previous" );
137 $t->set_block( "news_unpublished_page_tpl", "next_tpl", "next" );
138
139 $t->set_var( "site_style", $SiteDesign );
140
141 $category = new eZNewsCategory( $CategoryID );
142
143 $t->set_var( "current_category_id", $category->id() );
144 $t->set_var( "current_category_name", $category->name() );
145 $t->set_var( "current_category_description", $category->description() );
146
147 // path
148 $pathArray = $category->path();
149
150 $t->set_var( "path_item", "" );
151 foreach ( $pathArray as $path )
152 {
153 $t->set_var( "category_id", $path[0] );
154
155 $t->set_var( "category_name", $path[1] );
156
157 $t->parse( "path_item", "path_item_tpl", true );
158 }
159
160 $categoryList =& $category->getByParent( $category, true );
161
162
163 // categories
164 $i=0;
165 $t->set_var( "category_list", "" );
166
167 foreach ( $categoryList as $categoryItem )
168 {
169 $t->set_var( "category_id", $categoryItem->id() );
170
171 $t->set_var( "category_name", $categoryItem->name() );
172
173 $parent = $categoryItem->parent();
174
175 if ( ( $i % 2 ) == 0 )
176 {
177 $t->set_var( "td_class", "bglight" );
178 }
179 else
180 {
181 $t->set_var( "td_class", "bgdark" );
182 }
183
184 $t->set_var( "category_description", $categoryItem->description() );
185 $t->set_var( "category_nr", $categoryItem->ID() );
186
187 $t->parse( "category_item", "category_item_tpl", true );
188 $i++;
189 }
190
191 if ( count( $categoryList ) > 0 )
192 $t->parse( "category_list", "category_list_tpl" );
193 else
194 $t->set_var( "category_list", "" );
195
196
197 if ( !isset( $Limit ) )
198 $Limit = 20;
199 if ( !isset( $Offset ) )
200 $Offset = 0;
201
202
203 // news
204 $newsList =& $category->newsList( "time", "only", $Offset, $Limit );
205 $newsListCount = $category->newsListCount( "time", "only" );
206
207 $locale = new eZLocale( $Language );
208 $i = 0;
209 $t->set_var( "news_list", "" );
210 foreach ( $newsList as $news )
211 {
212 if ( $news->name() == "" )
213 $t->set_var( "news_name", "&nbsp;" );
214 else
215 $t->set_var( "news_name", $news->name() );
216
217 $t->set_var( "news_id", $news->id() );
218
219 if ( ( $i % 2 ) == 0 )
220 {
221 $t->set_var( "td_class", "bglight" );
222 }
223 else
224 {
225 $t->set_var( "td_class", "bgdark" );
226 }
227
228 $t->set_var( "news_origin", $news->origin() );
229
230 $published = $news->originalPublishingDate();
231 $date =& $published->date();
232 $t->set_var( "news_date", $locale->format( $date ) );
233
234
235 $t->parse( "news_item", "news_item_tpl", true );
236 $i++;
237 }
238
239 if ( count( $newsList ) > 0 )
240 $t->parse( "news_list", "news_list_tpl" );
241 else
242 $t->set_var( "news_list", "" );
243
244
245 $prevOffs = $Offset - $Limit;
246 $nextOffs = $Offset + $Limit;
247
248 if ( $prevOffs >= 0 )
249 {
250 $t->set_var( "prev_offset", $prevOffs );
251 $t->parse( "previous", "previous_tpl" );
252 }
253 else
254 {
255 $t->set_var( "previous", "" );
256 }
257
258 if ( $nextOffs <= $newsListCount )
259 {
260 $t->set_var( "next_offset", $nextOffs );
261 $t->parse( "next", "next_tpl" );
262 }
263 else
264 {
265 $t->set_var( "next", "" );
266 }
267
268 $t->pparse( "output", "news_unpublished_page_tpl" );
269
270 ?>
$CategoryID
$CategoryID
Definition: admin/articleedit.php:53
$files
$files
Definition: articlepreview.php:91
$date
$date
Definition: bugpreview.php:66
eZDB\globalDatabase
static & globalDatabase()
Definition: ezdb.php:134
eZLocale
Definition: ezlocale.php:119
eZNewsCategory
Definition: eznewscategory.php:42
eZNews
Definition: eznews.php:63
eZPBFile\dir
static dir( $dir, $add_sitedir=true)
Definition: ezpbfile.php:384
eZPBFile\unlink
static unlink( $filename)
Definition: ezpbfile.php:352
eZTemplate
Definition: eztemplate.php:107
$Action
$Action
Definition: companysearch.php:80
$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
$dir
$dir
Definition: ezsitemanager/admin/filelist.php:87
$categoryID
else $categoryID
Definition: productview.php:66
$category
$category
Definition: unpublished.php:141
$db
$db
Definition: unpublished.php:35
$locale
$locale
Definition: unpublished.php:207
$t
$t
Definition: unpublished.php:116
$nextOffs
$nextOffs
Definition: unpublished.php:246
$newsListCount
$newsListCount
Definition: unpublished.php:205
$pathArray
$pathArray
Definition: unpublished.php:148
$prevOffs
$prevOffs
Definition: unpublished.php:245
$i
$i
Definition: unpublished.php:164
$Language
$Language
Definition: unpublished.php:114
$categoryList
foreach( $pathArray as $path) $categoryList
Definition: unpublished.php:160
$ini
if(isset( $Action) && $Action=="Publish") if(isset( $Action) && $Action=="Delete") if(isset( $Action) && $Action=="DeleteCat") $ini
Definition: unpublished.php:112
$newsList
$newsList
Definition: unpublished.php:204
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.