Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezimagecatalogue/admin/browse.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: browse.php 6847 2001-09-03 10:22:42Z bf $
5 //
6 // Christoffer A. Elo
7 // Created on: <15-May-2001 15:01:28 ce>
8 //
9 // This source file is part of Exponential Basic, publishing software.
10 //
11 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
12 //
13 // This program is free software; you can redistribute it and/or
14 // modify it under the terms of the GNU General Public License
15 // as published by the Free Software Foundation; either version 2
16 // of the License, or (at your option) any later version.
17 //
18 // This program is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU General Public License for more details.
22 //
23 // You should have received a copy of the GNU General Public License
24 // along with this program; if not, write to the Free Software
25 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
26 //
27
28 // include_once( "classes/INIFile.php" );
29 // include_once( "classes/eztemplate.php" );
30 // include_once( "classes/ezlog.php" );
31
32 // include_once( "ezuser/classes/ezuser.php" );
33 // include_once( "ezuser/classes/ezpermission.php" );
34 // include_once( "ezuser/classes/ezobjectpermission.php" );
35
36 // include_once( "ezimagecatalogue/classes/ezimage.php" );
37 // include_once( "ezimagecatalogue/classes/ezimagecategory.php" );
38 // include_once( "classes/ezhttptool.php" );
39
40 $ini =& eZINI::instance( 'site.ini' );
41
42 $Language = $ini->variable( "eZImageCatalogueMain", "Language" );
43
44 $ImageDir = $ini->variable( "eZImageCatalogueMain", "ImageDir" );
45
46 $t = new eZTemplate( "kernel/ezimagecatalogue/admin/" . $ini->variable( "eZImageCatalogueMain", "AdminTemplateDir" ),
47 "kernel/ezimagecatalogue/admin/intl/", $Language, "browse.php" );
48
49 $t->set_file( "image_list_page_tpl", "browse.tpl" );
50
51 $t->setAllStrings();
52
53 $user =& eZUser::currentUser();
54
55
56 $session =& eZSession::globalSession();
57
58 $returnUrl = $session->variable( "ImageListReturnTo" );
59
60 $t->set_var( "action_url", $returnUrl );
61
62 $t->set_block( "image_list_page_tpl", "current_category_tpl", "current_category" );
63
64 // path
65 $t->set_block( "image_list_page_tpl", "path_item_tpl", "path_item" );
66
67 $t->set_block( "image_list_page_tpl", "image_list_tpl", "image_list" );
68
69 $t->set_block( "image_list_tpl", "detail_view_tpl", "detail_view" );
70
71 $t->set_block( "detail_view_tpl", "detail_read_tpl", "detail_read" );
72 $t->set_block( "detail_view_tpl", "detail_write_tpl", "detail_write" );
73
74 $t->set_block( "detail_read_tpl", "single_images_tpl", "single_images" );
75 $t->set_block( "detail_read_tpl", "multi_images_tpl", "multi_images" );
76
77 $t->set_block( "image_list_page_tpl", "category_list_tpl", "category_list" );
78 $t->set_block( "category_list_tpl", "category_tpl", "category" );
79
80 $t->set_block( "category_tpl", "category_read_tpl", "category_read" );
81
82 $t->set_var( "read", "" );
83 $t->set_var( "write_menu", "" );
84
85 $t->set_var( "delete_images_button" , "" );
86 $t->set_var( "delete_categories_button" , "" );
87 $t->set_var( "default_new" , "" );
88 $t->set_var( "default_delete" , "" );
89
90 if ( !is_numeric( $CategoryID ) )
91 $CategoryID = 0;
92
93 $category = new eZImageCategory( $CategoryID );
94
95 // Check if user have permission to the current category
96
97 $error = true;
98
99 if ( eZObjectPermission::hasPermission( $category->id(), "imagecatalogue_category", "r", $user )
100 || eZImageCategory::isOwner( $user, $CategoryID ) )
101 {
102 $error = false;
103 }
104
105 if ( $CategoryID == 0 )
106 {
107 $t->set_var( "current_category_description", "" );
108 $error = false;
109 }
110
111 $t->set_var( "current_category", "" );
112
113 if ( $category->id() != 0 )
114 {
115 $t->set_var( "current_category_description", $category->description() );
116 $t->set_var( "category_id", $category->id() );
117 $t->set_var( "category_name", $category->name() );
118
119 $t->parse( "current_category", "current_category_tpl" );
120 }
121
122 // path
123 $pathArray = $category->path();
124
125 $t->set_var( "path_item", "" );
126 foreach ( $pathArray as $path )
127 {
128 $t->set_var( "category_id", $path[0] );
129
130 $t->set_var( "category_name", $path[1] );
131
132 $t->parse( "path_item", "path_item_tpl", true );
133 }
134
135
136 // Print out all the categories
137 $categoryList =& $category->getByParent( $category );
138
139 $i=0;
140 foreach ( $categoryList as $categoryItem )
141 {
142 $t->set_var( "category_name", $categoryItem->name() );
143 $t->set_var( "category_id", $categoryItem->id() );
144 $t->set_var( "category_description", $categoryItem->description() );
145
146 $t->set_var( "category_read", "" );
147 $t->set_var( "category_write", "" );
148 ( $i % 2 ) ? $t->set_var( "td_class", "bgdark" ) : $t->set_var( "td_class", "bglight" );
149
150 // Check if user have read permission
151 if ( eZObjectPermission::hasPermission( $categoryItem->id(), "imagecatalogue_category", "r", $user ) ||
152 eZImageCategory::isOwner( $user, $categoryItem->id()) )
153 {
154 $t->parse( "category_read", "category_read_tpl" );
155 }
156
157 $t->parse( "category", "category_tpl", true );
158 $i++;
159 }
160
161 if ( ( count( $categoryList ) > 0 ) && !isset( $SearchText ) )
162 {
163 $t->parse( "category_list", "category_list_tpl" );
164 }
165 else
166 {
167 $t->set_var( "category_list", "" );
168 }
169
170 // Print out all the images
171 if ( isset( $SearchText ) )
172 {
173 $imageList =& eZImage::search( $SearchText );
174 }
175 else
176 {
177 $imageList =& $category->images();
178 }
179
180
181 $selectImages = $session->variable( "SelectImages" );
182 if( !$selectImages )
183 $selectImages = "single";
184
185 $t->set_var( "name", $session->variable( "NameInBrowse" ) );
186
187 $i = 0;
188 $counter = 0;
189 foreach ( $imageList as $image )
190 {
191 $t->set_var( "end_tr", "" );
192 $t->set_var( "begin_tr", "" );
193
194 $t->set_var( "image_id", $image->id() );
195 $t->set_var( "original_image_name", $image->originalFileName() );
196 $t->set_var( "image_name", $image->name() );
197 $t->set_var( "image_caption", $image->name() );
198 $t->set_var( "image_url", $image->name() );
199
200 if ( $selectImages == "single" )
201 {
202 $t->set_var( "image_id", $image->id() );
203 $t->set_var( "multi_images", "" );
204 $t->parse( "single_images", "single_images_tpl" );
205 }
206 elseif ( $selectImages == "multi" )
207 {
208 $t->set_var( "image_id", $image->id() );
209 $t->set_var( "single_images", "" );
210 $t->parse( "multi_images", "multi_images_tpl" );
211 }
212
213 $width =& $ini->variable( "eZImageCatalogueMain", "ThumbnailViewWidth" );
214
215 $height =& $ini->variable( "eZImageCatalogueMain", "ThumbnailViewHight" );
216
217 $variation =& $image->requestImageVariation( $width, $height );
218
219 $t->set_var( "image_description",$image->description() );
220 $t->set_var( "image_alt", $image->name() );
221 $t->set_var( "image_src", "/" .$variation->imagePath() );
222 $t->set_var( "image_width", $variation->width() );
223 $t->set_var( "image_height", $variation->height() );
224 $t->set_var( "image_file_name", $image->originalFileName() );
225
226 if ( $image->fileExists( true ) )
227 {
228 $imagePath =& $image->filePath( true );
229 $size = eZPBFile::filesize( $imagePath );
230 }
231 else
232 {
233 $size = 0;
234 }
235
236 $size = eZPBFile::siFileSize( $size );
237
238 $t->set_var( "image_size", $size["size-string"] );
239 $t->set_var( "image_unit", $size["unit"] );
240 $t->set_var( "image_caption", $image->caption() );
241
242 $t->set_var( "read", "" );
243 $t->set_var( "write", "" );
244
245 // Check if user have read permission
246 $t->set_var( "detail_read", "" );
247 $can_read = false;
248 $can_write = false;
249 if ( eZObjectPermission::hasPermission( $image->id(), "imagecatalogue_image", "r", $user ) ||
250 eZImage::isOwner( $user, $image->id() ) )
251 {
252 $can_read = true;
253 if ( ( $i % 4 ) == 0 )
254 {
255 $t->set_var( "begin_tr", "<tr>" );
256 }
257 else if ( ( $i % 4 ) == 3 )
258 {
259 $t->set_var( "end_tr", "</tr>" );
260 }
261
262 $t->parse( "detail_read", "detail_read_tpl" );
263 $i++;
264 }
265
266
267 $t->parse( "detail_view", "detail_view_tpl", true );
268
269 $counter++;
270 }
271
272 $t->set_var( "detail_button", "" );
273 $t->set_var( "normal_button", "" );
274
275 if ( count( $imageList ) > 0 )
276 {
277 $t->parse( "image_list", "image_list_tpl" );
278 }
279 else
280 {
281 $t->set_var( "normal_button", "" );
282 $t->set_var( "detail_button", "" );
283 $t->set_var( "image_list", "" );
284 }
285
286 $t->set_var( "image_dir", $ImageDir );
287
288 $t->set_var( "main_category_id", $CategoryID );
289
290 if ( $error == false )
291 {
292 $t->pparse( "output", "image_list_page_tpl" );
293 }
294 else
295 {
296 eZHTTPTool::header( "Location: /error/403/" );
297 exit();
298 }
299
300
301 ?>
$CategoryID
$CategoryID
Definition: admin/articleedit.php:53
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZImageCategory
Definition: ezimagecategory.php:43
eZImageCategory\isOwner
static isOwner( $user, $imageCategory=false)
Definition: ezimagecategory.php:480
eZImage\isOwner
static isOwner( $user, $image)
Definition: ezimage.php:1274
eZImage\search
static search(&$queryText, $offset=0, $limit=30, $userID=-1)
Definition: ezimage.php:221
eZObjectPermission\hasPermission
static hasPermission( $objectID, $moduleTable, $permission, $user=false)
Definition: ezobjectpermission.php:76
eZPBFile\siFileSize
static & siFileSize( $size)
Definition: ezpbfile.php:220
eZPBFile\filesize
static filesize( $filename)
Definition: ezpbfile.php:339
eZSession\globalSession
static & globalSession( $id="", $fetch=true)
Definition: kernel/ezsession/classes/ezsession.php:614
eZTemplate
Definition: eztemplate.php:107
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
$SearchText
$SearchText
Definition: ezaddress/admin/typelist.php:143
$size
if($file_debug) $size
Definition: ezfilemanager/user/filedownload.php:165
$category
$category
Definition: ezimagecatalogue/admin/browse.php:93
$ImageDir
$ImageDir
Definition: ezimagecatalogue/admin/browse.php:44
$t
$t
Definition: ezimagecatalogue/admin/browse.php:46
$pathArray
if( $category->id() !=0) $pathArray
Definition: ezimagecatalogue/admin/browse.php:123
$returnUrl
$returnUrl
Definition: ezimagecatalogue/admin/browse.php:58
$user
$user
Definition: ezimagecatalogue/admin/browse.php:53
$i
$i
Definition: ezimagecatalogue/admin/browse.php:139
$Language
$Language
Definition: ezimagecatalogue/admin/browse.php:42
$ini
$ini
Definition: ezimagecatalogue/admin/browse.php:40
$categoryList
foreach( $pathArray as $path) $categoryList
Definition: ezimagecatalogue/admin/browse.php:137
$session
$session
Definition: ezimagecatalogue/admin/browse.php:56
$selectImages
$selectImages
Definition: ezimagecatalogue/admin/browse.php:181
$counter
$counter
Definition: ezimagecatalogue/admin/browse.php:188
$error
$error
Definition: ezimagecatalogue/admin/browse.php:97
$imageList
$imageList
Definition: ezimagecatalogue/admin/unassigned.php:96
$variation
$variation
Definition: ezimagecatalogue/user/menubox.php:55
exit
exit
Definition: folder.php:81
$image
$image
Definition: user/articlelist.php:242
$height
$height
Definition: user/imageview.php:171
$width
$width
Definition: user/imageview.php:170
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.