Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

smallproductlist.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: smallproductlist.php 9895 2004-04-06 11:08:44Z br $
5 //
6 // Created on: <04-Oct-2001 12:20:03 ce>
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 $ini =& eZINI::instance( 'site.ini' );
28 $PageCaching =& $ini->variable( "eZTradeMain", "PageCaching");
29
30 $PureStatic = "false";
31
32 unset( $CacheFile );
33
34 $GenerateStaticPage = "false";
35 if ( $PageCaching == "enabled" )
36 {
37 // include_once( "classes/ezcachefile.php" );
38 $CacheFile = new eZCacheFile( "kernel/eztrade/cache/",
39 array( "smallproductlist", $CategoryID, $GlobalSiteDesign ),
40 "cache", "," );
41 if ( $CacheFile->exists() )
42 {
43 include( $CacheFile->filename( true ) );
44 $PureStatic = "true";
45 }
46 else
47 {
48 $GenerateStaticPage = "true";
49 }
50 }
51
52 if ( $PureStatic != "true" )
53 {
54 // include_once( "classes/INIFile.php" );
55 // include_once( "classes/eztemplate.php" );
56 // include_once( "classes/ezlocale.php" );
57 // include_once( "classes/ezcurrency.php" );
58
59 // include_once( "ezuser/classes/ezuser.php" );
60 // include_once( "ezuser/classes/ezpermission.php" );
61 // include_once( "ezuser/classes/ezobjectpermission.php" );
62
63 $ini =& eZINI::instance( 'site.ini' );
64 $Language = $ini->variable( "eZTradeMain", "Language" );
65
66 // include_once( "eztrade/classes/ezproduct.php" );
67 // include_once( "eztrade/classes/ezproductcategory.php" );
68
69 $t = new eZTemplate( "kernel/eztrade/user/" . $ini->variable( "eZTradeMain", "TemplateDir" ),
70 "kernel/eztrade/user/intl/", $Language, "smallproductlist.php" );
71
72 $t->set_file( "product_list_page_tpl", "smallproductlist.tpl" );
73
74 $t->set_block( "product_list_page_tpl", "product_list_tpl", "product_list" );
75 $t->set_block( "product_list_tpl", "product_tpl", "product" );
76
77
78 $t->setAllStrings();
79
80 $category = new eZProductCategory( $CategoryID );
81
82 $productList =& $category->activeProducts( $category->sortMode(), 0, $Limit, $CategoryID );
83 $t->set_var( "sitedesign", $GlobalSiteDesign );
84 $t->set_var( "category_id", $CategoryID );
85 $t->set_var( "category_name", $category->name() );
86 $user =& eZUser::currentUser();
87
88 // categories
89 $i=0;
90 foreach ( $productList as $productItem )
91 {
92 // if ( eZObjectPermission::hasPermission( $productItem->id(), "trade_product", "r", $user ) )
93 {
94 $t->set_var( "product_id", $productItem->id() );
95
96
97 $t->set_var( "product_name", $productItem->name() );
98
99 if ( ( $i % 2 ) == 0 )
100 {
101 $t->set_var( "td_class", "bglight" );
102 }
103 else
104 {
105 $t->set_var( "td_class", "bgdark" );
106 }
107
108 $t->parse( "product", "product_tpl", true );
109 $i++;
110 }
111 }
112
113 if ( count( $i ) == 0 )
114 {
115 $t->set_var( "product_list", "" );
116 }
117 else
118 {
119 $t->parse( "product_list", "product_list_tpl" );
120 }
121
122 if ( $GenerateStaticPage == "true" )
123 {
124 $output = $t->parse( "output", "product_list_page_tpl" );
125 // print the output the first time while printing the cache file.
126 print( $output );
127 $CacheFile->store( $output );
128 }
129 else
130 {
131 $t->pparse( "output", "product_list_page_tpl" );
132 }
133 }
134 ?>
$category
if( $Action=="Edit") $category
Definition: adedit.php:378
$i
$i
Definition: admin/adlist.php:91
$CategoryID
$CategoryID
Definition: admin/articleedit.php:53
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
$Limit
$Limit
Definition: ezarticle/admin/categorylist.php:66
$productList
$productList
Definition: ezarticle/admin/categorylist.php:248
$output
$output
Definition: formpreview.php:81
$GlobalSiteDesign
global $GlobalSiteDesign
Definition: latestmessages.php:52
$PureStatic
$PureStatic
Definition: smallproductlist.php:30
$GenerateStaticPage
$GenerateStaticPage
Definition: smallproductlist.php:34
$ini
$ini
Definition: smallproductlist.php:27
$PageCaching
$PageCaching
Definition: smallproductlist.php:28
$user
$user
Definition: user/adlist.php:39
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.