Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezimagecatalogue/admin/unassigned.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: unassigned.php 8425 2001-11-15 09:20:48Z br $
5 //
6 // Created on: <26-Oct-2000 19:40:18 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/ezlog.php" );
30 // include_once( "classes/ezlist.php" );
31 // include_once( "classes/ezhttptool.php" );
32
33 // include_once( "ezuser/classes/ezuser.php" );
34 // include_once( "ezuser/classes/ezpermission.php" );
35 // include_once( "ezuser/classes/ezobjectpermission.php" );
36
37 // include_once( "ezimagecatalogue/classes/ezimage.php" );
38 // include_once( "ezimagecatalogue/classes/ezimagecategory.php" );
39
40 $ini =& eZINI::instance( 'site.ini' );
41 $Language = $ini->variable( "eZImageCatalogueMain", "Language" );
42 $ImageDir = $ini->variable( "eZImageCatalogueMain", "ImageDir" );
43
44 $t = new eZTemplate( "kernel/ezimagecatalogue/admin/" . $ini->variable( "eZImageCatalogueMain", "AdminTemplateDir" ),
45 "kernel/ezimagecatalogue/admin/intl/", $Language, "unassigned.php" );
46
47 $t->set_file( "image_list_page_tpl", "unassigned.tpl" );
48
49 $t->setAllStrings();
50
51 $user =& eZUser::currentUser();
52
53 $t->set_block( "image_list_page_tpl", "image_list_tpl", "image_list" );
54
55 $t->set_block( "image_list_tpl", "value_tpl", "value" );
56 $t->set_block( "image_list_tpl", "detail_view_tpl", "detail_view" );
57
58 $t->set_block( "detail_view_tpl", "detail_read_tpl", "detail_read" );
59 $t->set_block( "detail_view_tpl", "detail_write_tpl", "detail_write" );
60
61 $t->set_var( "read", "" );
62 $t->set_var( "write_menu", "" );
63
64 $t->set_var( "delete_images_button" , "" );
65 $t->set_var( "delete_categories_button" , "" );
66 $t->set_var( "default_new" , "" );
67 $t->set_var( "default_delete" , "" );
68
69
70 if ( !( $Offset > 0 ) )
71 $Offset = 0;
72 if ( !( $Limit > 0 ) )
73 $Limit = $ini->variable( "eZImageCatalogueMain", "ListImagesPerPage" );
74
75
76 if ( isset( $Update ) )
77 {
78 for ( $i = 0; $i < count( $ImageArrayID ); $i++ )
79 {
80 if ( ( $CategoryArrayID[$i] != "-1" ) && ( is_numeric( $CategoryArrayID[$i] ) ) )
81 {
82 $image = new eZImage( $ImageArrayID[$i] );
83 $category = new eZImageCategory( $CategoryArrayID[$i] );
84 $category->addImage( $image );
85 }
86 }
87 }
88
89
90 $t->set_var( "offset", $Offset );
91 $t->set_var( "limit", $Limit );
92
93
94 // Print out all the images
95
96 $imageList =& eZImage::getUnassigned( $Offset, $Limit );
97
98
99 if ( $imageList )
100 $imageCount =& eZImage::countUnassigned();
101 else
102 $imageCount = 0;
103
104 $i = 0;
105 $counter = 0;
106
107 if ( !is_null( $imageList ) && count ( $imageList ) > 0 )
108 {
109 foreach ( $imageList as $image )
110 {
111 $t->set_var( "end_tr", "" );
112 $t->set_var( "begin_tr", "" );
113
114 $t->set_var( "image_id", $image->id() );
115 $t->set_var( "original_image_name", $image->originalFileName() );
116 $t->set_var( "image_name", $image->name() );
117 $t->set_var( "image_caption", $image->name() );
118 $t->set_var( "image_url", $image->name() );
119
120 $width =& $ini->variable( "eZImageCatalogueMain", "ThumbnailViewWidth" );
121
122 $height =& $ini->variable( "eZImageCatalogueMain", "ThumbnailViewHight" );
123
124 $variation =& $image->requestImageVariation( $width, $height );
125
126 $t->set_var( "image_description",$image->description() );
127 $t->set_var( "image_alt", $image->name() );
128 $t->set_var( "image_src", "/" .$variation->imagePath() );
129 $t->set_var( "image_width", $variation->width() );
130 $t->set_var( "image_height", $variation->height() );
131 $t->set_var( "image_file_name", $image->originalFileName() );
132
133 if ( $image->fileExists( true ) )
134 {
135 $imagePath =& $image->filePath( true );
136 $size = eZPBFile::filesize( $imagePath );
137 }
138 else
139 {
140 $size = 0;
141 }
142
143 if ( ( $i % 2 ) == 0 )
144 {
145 $t->set_var( "td_class", "bglight" );
146 }
147 else
148 {
149 $t->set_var( "td_class", "bgdark" );
150 }
151
152 $size = eZPBFile::siFileSize( $size );
153
154 $t->set_var( "image_size", $size["size-string"] );
155 $t->set_var( "image_unit", $size["unit"] );
156 $t->set_var( "image_caption", $image->caption() );
157
158 $t->set_var( "read", "" );
159 $t->set_var( "write", "" );
160
161 // Check if user have read permission
162 $t->set_var( "detail_read", "" );
163 $can_read = false;
164 $can_write = false;
165 if ( eZObjectPermission::hasPermission( $image->id(), "imagecatalogue_image", "r", $user ) ||
166 eZImage::isOwner( $user, $image->id() ) )
167 {
168 $can_read = true;
169 if ( ( $i % 4 ) == 0 )
170 {
171 $t->set_var( "begin_tr", "<tr>" );
172 }
173 else if ( ( $i % 4 ) == 3 )
174 {
175 $t->set_var( "end_tr", "</tr>" );
176 }
177
178 $t->parse( "detail_read", "detail_read_tpl" );
179 $i++;
180 }
181
182
183 $t->parse( "detail_view", "detail_view_tpl", true );
184
185 $counter++;
186 }
187 }
188
189
190 eZList::drawNavigator( $t, $imageCount, $Limit, $Offset, "image_list_page_tpl" );
191
192 if ( !is_null( $imageList ) && count( $imageList ) > 0 )
193 {
194 $t->parse( "image_list", "image_list_tpl" );
195 }
196 else
197 {
198 $t->set_var( "normal_button", "" );
199 $t->set_var( "detail_button", "" );
200 $t->set_var( "image_list", "" );
201 }
202
203 $category = new eZImageCategory() ;
204 $categoryList =& $category->getTree( );
205
206 // Make a category list
207 foreach ( $categoryList as $categoryItem )
208 {
209 if( eZObjectPermission::hasPermission( $categoryItem[0]->id(), "imagecatalogue_category", 'w' )
210 || eZImageCategory::isOwner( eZUser::currentUser(), $categoryItem[0]->id() ) )
211 {
212 $t->set_var( "option_name", $categoryItem[0]->name() );
213 $t->set_var( "option_value", $categoryItem[0]->id() );
214
215 if ( $categoryItem[1] > 0 )
216 $t->set_var( "option_level", str_repeat( "&nbsp;", $categoryItem[1] ) );
217 else
218 $t->set_var( "option_level", "" );
219
220 $t->parse( "value", "value_tpl", true );
221 }
222 }
223
224 $t->set_var( "image_dir", $ImageDir );
225
226
227 $t->pparse( "output", "image_list_page_tpl" );
228
229 ?>
eZImageCategory
Definition: ezimagecategory.php:43
eZImageCategory\isOwner
static isOwner( $user, $imageCategory=false)
Definition: ezimagecategory.php:480
eZImage
Definition: ezimage.php:95
eZImage\countUnassigned
static countUnassigned()
Definition: ezimage.php:543
eZImage\getUnassigned
static getUnassigned( $offset=-1, $limit=-1)
Definition: ezimage.php:515
eZImage\isOwner
static isOwner( $user, $image)
Definition: ezimage.php:1274
eZList\drawNavigator
static drawNavigator(&$t, $total_types, $max_types, $index, $parent=false, $variables=false)
Definition: ezlist.php:401
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
eZTemplate
Definition: eztemplate.php:107
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
$Limit
$Limit
Definition: ezarticle/admin/categorylist.php:66
$Offset
$Offset
Definition: ezarticle/user/search.php:110
$size
if($file_debug) $size
Definition: ezfilemanager/user/filedownload.php:165
$category
$category
Definition: ezimagecatalogue/admin/unassigned.php:203
$imageList
$imageList
Definition: ezimagecatalogue/admin/unassigned.php:96
$ImageDir
$ImageDir
Definition: ezimagecatalogue/admin/unassigned.php:42
$t
$t
Definition: ezimagecatalogue/admin/unassigned.php:44
$imageCount
else $imageCount
Definition: ezimagecatalogue/admin/unassigned.php:102
$user
$user
Definition: ezimagecatalogue/admin/unassigned.php:51
$i
$i
Definition: ezimagecatalogue/admin/unassigned.php:104
$Language
$Language
Definition: ezimagecatalogue/admin/unassigned.php:41
$ini
$ini
Definition: ezimagecatalogue/admin/unassigned.php:40
$categoryList
$categoryList
Definition: ezimagecatalogue/admin/unassigned.php:204
$counter
$counter
Definition: ezimagecatalogue/admin/unassigned.php:105
$variation
$variation
Definition: ezimagecatalogue/user/menubox.php:55
$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+.