Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

admin/tiplist.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: tiplist.php,v 1.16 2001/07/19 11:56:33 jakobn Exp $
5 //
6 // Created on: <22-Nov-2000 21:08:34 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/ezlocale.php" );
30
31 // include_once( "eztip/classes/eztip.php" );
32 // include_once( "eztip/classes/eztipcategory.php" );
33
34 $ini =& eZINI::instance( 'site.ini' );
35 $Language = $ini->variable( "eZTipMain", "Language" );
36
37 $t = new eZTemplate( "kernel/eztip/admin/" . $ini->variable( "eZTipMain", "AdminTemplateDir" ),
38 "kernel/eztip/admin/intl/", $Language, "tiplist.php" );
39
40 $t->setAllStrings();
41
42 $t->set_file( array(
43 "tip_list_page_tpl" => "tiplist.tpl"
44 ) );
45
46
47 // path
48 $t->set_block( "tip_list_page_tpl", "path_item_tpl", "path_item" );
49
50 // category
51 $t->set_block( "tip_list_page_tpl", "category_list_tpl", "category_list" );
52 $t->set_block( "category_list_tpl", "category_item_tpl", "category_item" );
53
54 // ad
55 $t->set_block( "tip_list_page_tpl", "tip_list_tpl", "tip_list" );
56 $t->set_block( "tip_list_tpl", "tip_item_tpl", "tip_item" );
57 $t->set_block( "tip_item_tpl", "tip_is_active_tpl", "tip_is_active" );
58 $t->set_block( "tip_item_tpl", "tip_not_active_tpl", "tip_not_active" );
59 $t->set_block( "tip_item_tpl", "image_item_tpl", "image_item" );
60 $t->set_block( "tip_item_tpl", "html_item_tpl", "html_item" );
61 $t->set_block( "tip_item_tpl", "no_image_tpl", "no_image" );
62
63 $t->set_var( "site_style", $SiteDesign );
64
65 if ( !isset( $CategoryID ) || !is_numeric( $CategoryID ) )
66 $CategoryID = 0;
67
68 $category = new eZTipCategory( $CategoryID );
69
70 $t->set_var( "current_category_id", $category->id() );
71 $t->set_var( "current_category_name", $category->name() );
72 $t->set_var( "current_category_description", $category->description() );
73
74 // path
75 $pathArray = $category->path();
76
77 $t->set_var( "path_item", "" );
78 foreach ( $pathArray as $path )
79 {
80 $t->set_var( "category_id", $path[0] );
81
82 $t->set_var( "category_name", $path[1] );
83
84 $t->parse( "path_item", "path_item_tpl", true );
85 }
86
87 $categoryList = $category->getByParent( $category, true );
88
89 // categories
90 $i=0;
91 $t->set_var( "category_list", "" );
92
93 foreach ( $categoryList as $categoryItem )
94 {
95 $t->set_var( "category_id", $categoryItem->id() );
96
97 $t->set_var( "category_name", $categoryItem->name() );
98
99 $parent = $categoryItem->parent();
100
101
102 if ( ( $i % 2 ) == 0 )
103 {
104 $t->set_var( "td_class", "bglight" );
105 }
106 else
107 {
108 $t->set_var( "td_class", "bgdark" );
109 }
110
111 $t->set_var( "category_description", $categoryItem->description() );
112
113 $t->parse( "category_item", "category_item_tpl", true );
114 $i++;
115 }
116
117 if ( count( $categoryList ) > 0 )
118 $t->parse( "category_list", "category_list_tpl" );
119 else
120 $t->set_var( "category_list", "" );
121
122
123 // tips
124 $tipList =& $category->tiplist( "time", true );
125
126 $locale = new eZLocale( $Language );
127 $i=0;
128 $t->set_var( "tip_list", "" );
129 foreach ( $tipList as $tip )
130 {
131 if ( $tip->name() == "" )
132 $t->set_var( "tip_name", "&nbsp;" );
133 else
134 $t->set_var( "tip_name", $tip->name() );
135
136 $t->set_var( "tip_id", $tip->id() );
137
138 if ( $tip->isActive() == true )
139 {
140 $t->parse( "tip_is_active", "tip_is_active_tpl" );
141 $t->set_var( "tip_not_active", "" );
142 }
143 else
144 {
145 $t->set_var( "tip_is_active", "" );
146 $t->parse( "tip_not_active", "tip_not_active_tpl" );
147 }
148
149 $image = $tip->image();
150
151 if ( $tip->useHTML() )
152 {
153 $t->set_var( "image_item", "" );
154 $t->set_var( "no_image", "" );
155
156 $t->set_var( "html_banner", $tip->htmlBanner() );
157 $t->parse( "html_item", "html_item_tpl" );
158 }
159 else
160 {
161 if ( get_class ( $image ) == "ezimage" )
162 {
163 $imageURL = $image->filePath();
164
165 $t->set_var( "image_width", $image->width() );
166 $t->set_var( "image_height", $image->height() );
167 $t->set_var( "image_url", $imageURL );
168 $t->set_var( "image_caption", $image->caption() );
169 $t->parse( "image_item", "image_item_tpl" );
170 $t->set_var( "no_image", "" );
171 $t->set_var( "html_item", "" );
172 }
173 else
174 {
175 $t->set_var( "html_item", "" );
176 $t->set_var( "image_item", "" );
177 $t->parse( "no_image", "no_image_tpl" );
178 }
179 }
180
181
182 if ( ( $i % 2 ) == 0 )
183 {
184 $t->set_var( "td_class", "bglight" );
185 }
186 else
187 {
188 $t->set_var( "td_class", "bgdark" );
189 }
190
191 $t->parse( "tip_item", "tip_item_tpl", true );
192 $i++;
193 }
194
195 if ( count( $tipList ) > 0 )
196 $t->parse( "tip_list", "tip_list_tpl" );
197 else
198 $t->set_var( "tip_list", "" );
199
200 $t->pparse( "output", "tip_list_page_tpl" );
201
202 ?>
$CategoryID
$CategoryID
Definition: admin/articleedit.php:53
$category
$category
Definition: admin/tiplist.php:68
$locale
$locale
Definition: admin/tiplist.php:126
$t
$t
Definition: admin/tiplist.php:37
$pathArray
$pathArray
Definition: admin/tiplist.php:75
$tipList
$tipList
Definition: admin/tiplist.php:124
$i
$i
Definition: admin/tiplist.php:90
$Language
$Language
Definition: admin/tiplist.php:35
$ini
$ini
Definition: admin/tiplist.php:34
$categoryList
foreach( $pathArray as $path) $categoryList
Definition: admin/tiplist.php:87
eZLocale
Definition: ezlocale.php:119
eZTemplate
Definition: eztemplate.php:107
eZTipCategory
Definition: eztipcategory.php:44
$SiteDesign
$SiteDesign
Definition: ezbulkmail/user/datasupplier.php:31
$tip
$tip
Definition: tipstatistics.php:57
$image
$image
Definition: user/articlelist.php:242
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.