Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

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