Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

user/imageview.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: imageview.php 9345 2002-03-06 10:34:39Z jhe $
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
30 // include_once( "ezimagecatalogue/classes/ezimage.php" );
31 // include_once( "ezimagecatalogue/classes/ezimagevariation.php" );
32
33 // include_once( "ezuser/classes/ezuser.php" );
34 // include_once( "ezuser/classes/ezobjectpermission.php" );
35 // include_once( "classes/ezhttptool.php" );
36
37 $ini =& eZINI::instance( 'site.ini' );
38
39 $Language = $ini->variable( "eZImageCatalogueMain", "Language" );
40
41 $ShowOriginal = $ini->variable( "eZImageCatalogueMain", "ShowOriginal" );
42
43
44 $t = new eZTemplate( "kernel/ezimagecatalogue/user/" . $ini->variable( "eZImageCatalogueMain", "TemplateDir" ),
45 "kernel/ezimagecatalogue/user/intl/", $Language, "imageview.php" );
46
47 $t->set_file( "image_view_tpl", "imageview.tpl" );
48 $t->set_block( "image_view_tpl", "product_item_tpl", "product_item" );
49 $t->set_block( "image_view_tpl", "article_item_tpl", "article_item" );
50 $t->set_block( "image_view_tpl", "related_products_tpl", "related_products" );
51 $t->set_block( "image_view_tpl", "related_articles_tpl", "related_articles" );
52 $t->set_block( "image_view_tpl", "path_tpl", "path" );
53 $t->set_var( "related_products", "" );
54 $t->set_var( "related_articles", "" );
55
56 $t->setAllStrings();
57
58 $user =& eZUser::currentUser();
59
60 $image = new eZImage( $ImageID );
61
62 // sections
63 // include_once( "ezsitemanager/classes/ezsection.php" );
64
65 $parent_category = $image->categories();
66
67 // tempo fix for admin users - maybe in the future must be changed
68 if ( $parent_category != 0 )
69 {
70 $GlobalSectionID = eZImageCategory::sectionIDstatic ( $parent_category[0] ); // We use always first category ;-( [0]
71 }
72
73 if ( !$GlobalSectionID )
74 $GlobalSectionID = $ini->variable( "eZImageCatalogueMain", "DefaultSection" );
75
76 // init the section
77 $sectionObject =& eZSection::globalSectionObject( $GlobalSectionID );
78 $sectionObject->setOverrideVariables();
79
80 //if ( eZObjectPermission::hasPermission( $image->id(), "imagecatalogue_image", "r", $user ) == false )
81 //{
82 // eZHTTPTool::header( "Location: /error/403/" );
83 // exit();
84 //}
85
86 if ( $ShowOriginal != "enabled" && !isset( $VariationID ) )
87 {
88 $variation =& $image->requestImageVariation( $ini->variable( "eZImageCatalogueMain", "ImageViewWidth" ),
89 $ini->variable( "eZImageCatalogueMain", "ImageViewHeight" ) );
90 }
91 else if ( isset( $VariationID ) )
92 {
93 $variation = new eZImageVariation( $VariationID );
94 if ( $variation->imageID() != $ImageID )
95 {
96
97 $variation =& $image->requestImageVariation( $ini->variable( "eZImageCatalogueMain", "ImageViewWidth" ),
98 $ini->variable( "eZImageCatalogueMain", "ImageViewHeight" ) );
99 }
100 }
101
102
103 $t->set_var( "path", "" );
104 $category = $image->categoryDefinition();
105 if ( $category != -1 )
106 {
107 $pathArray =& $category->path();
108 foreach ( $pathArray as $path )
109 {
110 $t->set_var( "category_id", $path[0] );
111 $t->set_var( "category_name", $path[1] );
112 $t->parse( "path", "path_tpl", true );
113 }
114 }
115
116 // added related articles, products
117
118 $info_items = 0;
119 $t->set_var( "article_item", "" );
120 $articles = $image->articles();
121
122 foreach( $articles as $article )
123 {
124 if ( ( $user ) &&
125 ( eZObjectPermission::hasPermission( $article->id(), "article_article", "r", $user ) ) &&
126 ( $article->isPublished() )
127 )
128 {
129 $t->set_var( "td_class", ( $i % 2 ) == 0 ? "bglight" : "bgdark" );
130 $t->set_var( "article_id", $article->id() );
131 $t->set_var( "article_name", $article->name() );
132
133 $t->parse( "article_item", "article_item_tpl", true );
134 $info_items++;
135 }
136 }
137 if( $info_items > 0 )
138 $t->parse( "related_articles", "related_articles_tpl", false );
139
140 $info_items = 0;
141 $t->set_var( "product_item", "" );
142 $products = $image->products();
143
144 foreach( $products as $product )
145 if ( $product->showProduct() )
146 {
147 $t->set_var( "td_class", ( $i % 2 ) == 0 ? "bglight" : "bgdark" );
148 $t->set_var( "product_id", $product->id() );
149 $t->set_var( "product_name", $product->name() );
150 $t->parse( "product_item", "product_item_tpl", true );
151 $info_items++;
152 }
153 if( $info_items > 0 )
154 $t->parse( "related_products", "related_products_tpl", false );
155
156 if ( $image->fileExists( true ) )
157 {
158 $imagePath =& $image->filePath( true );
159 $size = eZPBFile::filesize( $imagePath );
160 $t->set_var( "image_path", $imagePath );
161 }
162 else
163 {
164 $size = 0;
165 $t->set_var( "image_path", "" );
166 }
167
168 $size = eZPBFile::siFileSize( $size );
169
170 $width =& $ini->variable( "eZImageCatalogueMain", "ThumbnailViewWidth" );
171 $height =& $ini->variable( "eZImageCatalogueMain", "ThumbnailViewHight" );
172 $thumbnail =& $image->requestImageVariation( $width, $height );
173 $SiteURL = $ini->variable( "site", "UserSiteURL" );
174
175 $t->set_var( "orig_width", $image->width() );
176 $t->set_var( "orig_height", $image->height() );
177 $t->set_var( "image_src", "/" . $thumbnail->imagePath() );
178 $t->set_var( "site_url", $SiteURL );
179
180 $t->set_var( "image_size", $size["size-string"] );
181 $t->set_var( "image_unit", $size["unit"] );
182
183 $t->set_var( "image_id", $image->id() );
184 $t->set_var( "image_uri", "/" . $variation->imagePath() );
185 $t->set_var( "image_width", $variation->width() );
186 $t->set_var( "image_height", $variation->height() );
187 $t->set_var( "image_caption", $image->caption() );
188 $t->set_var( "image_name", $image->name() );
189 $t->set_var( "image_description", $image->description() );
190 $t->set_var( "original_image_name", $image->originalFileName() );
191
192 if ( !isset( $RefererURL ) || !$RefererURL )
193 $RefererURL="";
194
195 $t->set_var( "referer_url", $RefererURL );
196
197 $t->pparse( "output", "image_view_tpl" );
198
199 ?>
$pathArray
$pathArray
Definition: admin/adlist.php:74
$i
$i
Definition: admin/adlist.php:91
$article
$article
Definition: articlelog.php:45
eZImageVariation
Definition: ezimagevariation.php:41
eZImage
Definition: ezimage.php:95
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
eZSection\globalSectionObject
static & globalSectionObject( $sectionID)
Definition: ezsection.php:366
eZTemplate
Definition: eztemplate.php:107
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
$ImageID
$ImageID
Definition: companytypelist.php:201
$GlobalSectionID
$GlobalSectionID
Definition: ezad/user/datasupplier.php:28
$variation
$variation
Definition: ezimagecatalogue/user/menubox.php:55
$product
$product
Definition: homepage.php:202
$articles
$articles
Definition: user/imageview.php:120
$category
$category
Definition: user/imageview.php:104
$SiteURL
$SiteURL
Definition: user/imageview.php:173
$height
$height
Definition: user/imageview.php:171
$t
$t
Definition: user/imageview.php:44
$info_items
if( $category !=-1) $info_items
Definition: user/imageview.php:118
$width
$width
Definition: user/imageview.php:170
$user
$user
Definition: user/imageview.php:58
$parent_category
$parent_category
Definition: user/imageview.php:65
$sectionObject
$sectionObject
Definition: user/imageview.php:77
$thumbnail
$thumbnail
Definition: user/imageview.php:172
$ShowOriginal
$ShowOriginal
Definition: user/imageview.php:41
$Language
$Language
Definition: user/imageview.php:39
$ini
$ini
Definition: user/imageview.php:37
$image
$image
Definition: user/imageview.php:60
$products
$products
Definition: user/imageview.php:142
$size
$size
Definition: user/imageview.php:168
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.