Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

eztrade/user/categorylist.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: categorylist.php 7919 2001-10-17 07:30:29Z bf $
5 //
6 // Created on: <23-Nov-2000 09:23:42 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
28 $ini =& eZINI::instance( 'site.ini' );
29 $PageCaching =& $ini->variable( "eZTradeMain", "PageCaching");
30
31 $PureStatic = "false";
32 //$PureStatic = "true";
33
34 //unset( $CacheFile );
35 $GenerateStaticPage = "false";
36 //$GenerateStaticPage = "true";
37
38
39 if ( $PageCaching == "enabled" )
40 {
41 // include_once( "classes/ezcachefile.php" );
42 $CacheFile = new eZCacheFile( "kernel/eztrade/cache/",
43 array( "cateorylist", $CategoryID, $GlobalSiteDesign ),
44 "cache", "," );
45 if ( $CacheFile->exists() )
46 {
47 include( $CacheFile->filename( true ) );
48 $PureStatic = "true";
49 }
50 else
51 {
52 $GenerateStaticPage = "true";
53 }
54 }
55
56
57 if ( $PureStatic == "false" )
58 {
59 // include_once( "classes/INIFile.php" );
60 // include_once( "classes/eztemplate.php" );
61 // include_once( "classes/ezlocale.php" );
62 // include_once( "classes/ezcurrency.php" );
63
64 // include_once( "ezuser/classes/ezuser.php" );
65 // include_once( "ezuser/classes/ezpermission.php" );
66 // include_once( "ezuser/classes/ezobjectpermission.php" );
67
68 $ini =& eZINI::instance( 'site.ini' );
69 $Language = $ini->variable( "eZTradeMain", "Language" );
70 $CategoryListProductImages = $ini->variable( "eZTradeMain", "CategoryListProductImages" ) == "enabled" ? true : false;
71
72
73 // include_once( "eztrade/classes/ezproduct.php" );
74 // include_once( "eztrade/classes/ezproductcategory.php" );
75
76 $t = new eZTemplate( "kernel/eztrade/user/" . $ini->variable( "eZTradeMain", "TemplateDir" ),
77 "kernel/eztrade/user/intl/", $Language, "categorylist.php" );
78
79 $t->set_file( "category_list_page_tpl", "categorylist.tpl" );
80
81 $t->set_block( "category_list_page_tpl", "category_list_tpl", "category_list" );
82 $t->set_block( "category_list_tpl", "category_tpl", "category" );
83
84 $t->set_block( "category_list_tpl",'category_image_hot_deals_tpl', "category_image_hot_deals" );
85 $t->set_block( "category_list_tpl", "category_image_list_tpl", "category_image_list" );
86 $t->set_block( "category_image_list_tpl", "category_image_tpl", "category_image" );
87 $t->set_block( "category_list_tpl", "category_text_hot_deals_tpl", "category_text_hot_deals" );
88
89 $t->setAllStrings();
90
91 $category = new eZProductCategory( );
92 $category->get( $CategoryID );
93
94
95 $categoryList = $category->getByParent( $category );
96
97 $t->set_var( "sitedesign", $GlobalSiteDesign );
98
99 $user =& eZUser::currentUser();
100
101 // categories
102 $i=0;
103 foreach ( $categoryList as $categoryItem )
104 {
105 if ( $categoryItem->id() != "312" ) {
106
107 if ( eZObjectPermission::hasPermission( $categoryItem->id(), "trade_category", "r", $user ) )
108 {
109 $t->set_var( "category_id", $categoryItem->id() );
110
111 if ( $CategoryListProductImages == "true" )
112 {
113 $t_category_name = $categoryItem->id().".gif";
114 $t->set_var( "category_image_name", $t_category_name );
115 }
116
117 $t->set_var( "category_name", $categoryItem->name() );
118
119 $t->set_var( "category_description", $categoryItem->description() );
120
121 $parent = $categoryItem->parent();
122
123 if ( $categoryItem->parent() != 0 )
124 {
125 $parent = $categoryItem->parent();
126 $t->set_var( "category_parent", $parent->name() );
127 }
128 else
129 {
130 $t->set_var( "category_parent", "&nbsp;" );
131 }
132
133 if ( ( $i % 2 ) == 0 )
134 {
135 $t->set_var( "td_class", "bglight" );
136 }
137 else
138 {
139 $t->set_var( "td_class", "bgdark" );
140 }
141
142
143 if ( $CategoryListProductImages == "true" ) {
144 $t->parse( "category_image", "category_image_tpl", true);
145 $t->set_var( "category", "");
146 $t->set_var( "category_text_hot_deals", "");
147 $t->set_var( "category_hot_deals","");
148 }
149 else {
150 $t->set_var( "category_image", "");
151 $t->parse( "category", "category_tpl", true );
152 }
153 // $t->parse( "category", "category_tpl", true );
154 $i++;
155 }
156 }
157 }
158
159 if ( $CategoryListProductImages == "true" ) {
160 $t->parse( "category_image_hot_deals", "category_image_hot_deals_tpl", true);
161 $t->parse( "category_image_list", "category_image_list_tpl", true);
162 $t->set_var( "category_text_hot_deals", "");
163 $t->set_var( "category", "");
164 $t->set_var( "category_hot_deals","");
165 }
166 else
167 {
168 $t->set_var( "category_image_list", "");
169 $t->set_var( "category_image_hot_deals", "");
170 // should be in an en_US ini file
171 $t->set_var( "category_hot_deals","HOT DEALS");
172 $t->parse( "category_text_hot_deals", "category_text_hot_deals_tpl", true);
173 }
174 if ( $i == 0 || is_array( $i) && count( $i ) == 0 )
175 {
176 $t->set_var( "category_list", "" );
177 }
178 else
179 {
180 $t->parse( "category_list", "category_list_tpl" );
181 }
182
183
184
185 if ( $GenerateStaticPage == "true" )
186 {
187 $output = $t->parse( "output", "category_list_page_tpl" );
188 // print the output the first time while printing the cache file.
189 print( $output );
190 $CacheFile->store( $output );
191 }
192 else
193 {
194 $t->pparse( "output", "category_list_page_tpl" );
195 }
196 }
197
198
199 ?>
$category
if( $Action=="Edit") $category
Definition: adedit.php:378
$i
$i
Definition: admin/adlist.php:91
$categoryList
foreach( $pathArray as $path) $categoryList
Definition: admin/adlist.php:86
$CategoryID
$CategoryID
Definition: admin/articleedit.php:53
eZObjectPermission\hasPermission
static hasPermission( $objectID, $moduleTable, $permission, $user=false)
Definition: ezobjectpermission.php:76
eZProductCategory
Definition: ezproductcategory.php:90
eZTemplate
Definition: eztemplate.php:107
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
$t
foreach( $Modules as $module) if(isset( $ItemInsert)) $t
Definition: classes/admin/linklist.php:168
$Language
$Language
Definition: classes/admin/linklist.php:65
$PureStatic
$PureStatic
Definition: eztrade/user/categorylist.php:31
$GenerateStaticPage
$GenerateStaticPage
Definition: eztrade/user/categorylist.php:35
$ini
$ini
Definition: eztrade/user/categorylist.php:28
$PageCaching
$PageCaching
Definition: eztrade/user/categorylist.php:29
$CategoryListProductImages
$CategoryListProductImages
Definition: eztrade/user/menubox.php:31
$output
$output
Definition: formpreview.php:81
$GlobalSiteDesign
global $GlobalSiteDesign
Definition: latestmessages.php:52
$user
$user
Definition: user/adlist.php:39
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.