Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

onepagelinklist.php
Go to the documentation of this file.
1 <?
3 //
4 // $Id: onepagelinklist.php 6951 2001-09-05 08:29:58Z br $
5 //
6 // Bj�rn Reiten <br@ez.no>
7 // Created on: Created on: <03-Sep-2001 11:09:42 br>
8 //
9 // This source file is part of Exponential Basic, publishing software.
10 // Copyright (C) 1999-2001 eZ systems as
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/eztemplate.php" );
28 // include_once( "classes/INIFile.php" );
29 // include_once( "classes/ezlist.php" );
30
31 $ini =& eZINI::instance( 'site.ini' );
32 $Language = $ini->variable( "eZLinkMain", "Language" );
33 $UserLimit = $ini->variable( "eZLinkMain", "UserLinkLimit" );
34 $languageIni = new eZINI( "kernel/ezlink/user/intl/". $Language . "/onepagelinklist.php.ini", false );
35 $IDArrayStr = $ini->variable( "eZLinkMain", "CategoryIDSequence" );
36 eval( "\$IDArray = array( $IDArrayStr );" );
37
38 // include_once( "ezlink/classes/ezlinkcategory.php" );
39 // include_once( "ezlink/classes/ezlink.php" );
40 // include_once( "ezlink/classes/ezhit.php" );
41 // include_once( "ezlink/classes/ezlinktype.php" );
42
43
44 $t = new eZTemplate( "kernel/ezlink/user/" . $ini->variable( "eZLinkMain", "TemplateDir" ),
45 "kernel/ezlink/user/intl", $Language, "onepagelinklist.php" );
46
47 $t->setAllStrings();
48
49 $t->set_file( "link_page_tpl", "onepagelinklist.tpl" );
50
51
52 $t->set_block( "link_page_tpl", "category_list_tpl", "category_list" );
53 $t->set_block( "category_list_tpl", "category_item_tpl", "category_item" );
54
55
56 $t->set_block( "category_item_tpl", "image_item_tpl", "image_item" );
57 $t->set_block( "category_item_tpl", "no_image_tpl", "no_image" );
58
59 $t->set_block( "category_item_tpl", "link_list_tpl", "link_list" );
60 $t->set_block( "link_list_tpl", "link_item_tpl", "link_item" );
61 $t->set_block( "link_item_tpl", "link_image_item_tpl", "link_image_item" );
62
63 $t->set_block( "link_list_tpl", "attribute_list_tpl", "attribute_list" );
64 $t->set_block( "attribute_list_tpl", "attribute_tpl", "attribute" );
65 $t->set_block( "attribute_list_tpl", "attribute_value_tpl", "attribute_value" );
66
67 $t->set_block( "attribute_list_tpl", "attribute_header_tpl", "attribute_header" );
68
69 $t->set_block( "link_page_tpl", "path_item_tpl", "path_item" );
70 $t->set_block( "link_page_tpl", "path_tpl", "path" );
71
72 $t->set_var( "category_list", "" );
73
74 if ( !$Offset )
75 $Offset = 0;
76
77 // List all the categories
78 $linkCategory = new eZLinkCategory( $LinkCategoryID );
79
80 // Path
81 $pathArray = $linkCategory->path();
82
83 $linkCategory_array = $linkCategory->getByParent( $linkCategory );
84
85 // correct the sequence of elements to the order of IDArray.
86 // eks $IDArray = array( 2, 1, 3 );
87 // this is set in site.ini as CategoryIDSequence=2, 1, 3
88
89 for( $i = 0; $i < count( $IDArray ); $i++ )
90 {
91 if( count( $linkCategory_array ) > $i && $linkCategory_array[$i]->id() != $IDArray[$i] )
92 {
93 $j = 0;
94 while ( ( $j < count( $linkCategory_array ) ) &&
95 ( $linkCategory_array[$j]->id() != $IDArray[$i] ) )
96 {
97 $j++;
98 }
99
100 if( $j < count( $linkCategory_array ) )
101 {
102 $tmp = $linkCategory_array[$j];
103 $linkCategory_array[$j] = $linkCategory_array[$i];
104 $linkCategory_array[$i] = $tmp;
105 }
106 }
107 }
108
109 $t->set_var( "path_item", "" );
110 $t->set_var( "path", "" );
111 foreach ( $pathArray as $path )
112 {
113 $t->set_var( "category_id", $path[0] );
114
115 $t->set_var( "category_name", $path[1] );
116
117 $t->parse( "path_item", "path_item_tpl", true );
118 }
119
120 if ( count( $linkCategory_array ) == 0 )
121 {
122 $t->set_var( "categories", "" );
123 $t->set_var( "category_list", "" );
124 }
125 else
126 {
127 $i=0;
128 foreach( $linkCategory_array as $categoryItem )
129 {
130 $links = $categoryItem->links( $Offset, $UserLimit );
131 $linkCount = $categoryItem->linkCount();
132 if ( $categoryItem->linkCount() != 0 )
133 {
134 $t->set_var( "td_class", ( $i % 2 ) == 0 ? "bglight" : "bgdark" );
135
136 $t->set_var( "linkcategory_id", $categoryItem->id() );
137 $t->set_var( "linkcategory_name", $categoryItem->name() );
138 $t->set_var( "linkcategory_description", $categoryItem->description() );
139 $t->set_var( "linkcategory_parent", $categoryItem->parent() );
140
141 $image =& $categoryItem->image();
142
143 $t->set_var( "image_item" , "" );
144
145 if ( $image )
146 {
147 $imageWidth =& $ini->variable( "eZLinkMain", "CategoryImageWidth" );
148 $imageHeight =& $ini->variable( "eZLinkMain", "CategoryImageHeight" );
149
150 $variation =& $image->requestImageVariation( $imageWidth, $imageHeight );
151
152 $imageURL = "/" . $variation->imagePath();
153 $imageWidth = $variation->width();
154 $imageHeight = $variation->height();
155 $imageCaption = $image->caption();
156
157 $t->set_var( "image_width", $imageWidth );
158 $t->set_var( "image_height", $imageHeight );
159 $t->set_var( "image_url", $imageURL );
160 $t->set_var( "image_caption", $imageCaption );
161 $t->set_var( "no_image", "" );
162 $t->parse( "image_item", "image_item_tpl" );
163 }
164 else
165 {
166 $t->parse( "no_image", "no_image_tpl" );
167 $t->set_var( "image_item", "" );
168 }
169
170 $categories = $languageIni->variable( "strings", "categories" );
171
172 $t->set_var( "categories", $categories );
173
174
175 // List all the links in the category
176
177 if ( count( $links ) == 0 )
178 {
179 if ( $LinkCategoryID == 0 )
180 {
181 $t->set_var( "link_list", "" );
182 }
183 else
184 {
185 $t->set_var( "links", "" );
186 $t->set_var( "link_list", "" );
187 }
188
189 }
190 else
191 {
192 $t->set_var( "link_list", "" );
193 $t->set_var( "link_item", "" );
194 $i=0;
195 foreach( $links as $linkItem )
196 {
197 if ( ( $i % 2 ) == 0 )
198 {
199 $t->set_var( "td_class", "bglight" );
200 }
201 else
202 {
203 $t->set_var( "td_class", "bgdark" );
204 }
205 $t->set_var( "link_id", $linkItem->id() );
206 $t->set_var( "link_name", $linkItem->name() );
207 $t->set_var( "link_description", $linkItem->description() );
208 $t->set_var( "link_keywords", $linkItem->keywords() );
209 $t->set_var( "link_created", $linkItem->created() );
210 $t->set_var( "link_modified", $linkItem->modified() );
211 $t->set_var( "link_accepted", $linkItem->accepted() );
212 $t->set_var( "link_url", $linkItem->url() );
213
214 $image =& $linkItem->image();
215
216 $t->set_var( "link_image_item", "" );
217
218 if ( $image )
219 {
220 $imageWidth =& $ini->variable( "eZLinkMain", "LinkImageWidth" );
221 $imageHeight =& $ini->variable( "eZLinkMain", "LinkImageHeight" );
222
223 $variation =& $image->requestImageVariation( $imageWidth, $imageHeight );
224
225 $imageURL = "/" . $variation->imagePath();
226 $imageWidth = $variation->width();
227 $imageHeight = $variation->height();
228 $imageCaption = $image->caption();
229
230 $t->set_var( "image_width", $imageWidth );
231 $t->set_var( "image_height", $imageHeight );
232 $t->set_var( "image_url", $imageURL );
233 $t->set_var( "image_caption", $imageCaption );
234
235 $t->parse( "link_image_item", "link_image_item_tpl" );
236 }
237
238 $hit = new eZHit();
239 $hits = $hit->getLinkHits( $linkItem->id() );
240 $t->set_var( "link_hits", $hits );
241
242 $links = $languageIni->variable( "strings", "links" );
243 $t->set_var( "links", $links );
244 $i++;
245
246
247 $t->set_var( "attribute", "" );
248 $t->set_var( "attribute_value", "" );
249 $t->set_var( "attribute_header", "" );
250 // attribute list
251 $type = $linkItem->type();
252 if ( $type )
253 {
254 $attributes = $type->attributes();
255 for( $i2 = 0; $i2 < count( $attributes ); $i2++ )
256 {
257 if ( ( $i2 % 2 ) == 0 )
258 {
259 $t->set_var( "begin_tr", "<tr>" );
260 $t->set_var( "end_tr", "" );
261 }
262 else
263 {
264 $t->set_var( "begin_tr", "" );
265 $t->set_var( "end_tr", "</tr>" );
266 }
267
268 $value =& $attributes[$i2]->value( $linkItem );
269 $t->set_var( "attribute_id", $attributes[$i2]->id( ) );
270 $t->set_var( "attribute_name", $attributes[$i2]->name( ) );
271 $t->set_var( "attribute_unit", $attributes[$i2]->unit( ) );
272 $t->set_var( "attribute_value_var", $value );
273
274 if ( ( is_numeric( $value ) and ( $value > 0 ) ) ||
275 ( !is_numeric( $value ) and $value != "" ) )
276 {
277 $t->parse( "attribute", "attribute_value_tpl", true );
278 }
279 }
280 }
281
282 if ( count( $attributes ) > 0 and $type )
283 {
284 $t->parse( "attribute_list", "attribute_list_tpl" );
285 }
286 else
287 {
288 $t->set_var( "attribute_list", "" );
289 }
290
291
292 $t->parse( "link_item", "link_item_tpl", true );
293 }
294 $t->parse( "link_list", "link_list_tpl", true );
295 }
296 eZList::drawNavigator( $t, $linkCount, $UserLimit, $Offset, "category_item_tpl" );
297
298 $t->set_var( "link_start", $Offset + 1 );
299 $t->set_var( "link_end", min( $Offset + $UserLimit, $linkCount ) );
300 $t->set_var( "link_total", $linkCount );
301
302 $i++;
303 $t->parse( "category_item", "category_item_tpl", true );
304
305 }
306 }
307 $t->parse( "category_list", "category_list_tpl", true );
308 }
309
310 $t->pparse( "output", "link_page_tpl" );
311
312 ?>
$i
$i
Definition: admin/adlist.php:91
$linkCount
$linkCount
Definition: admin/linkcategorylist.php:190
$tmp
$tmp
Definition: bugview.php:99
eZHit
Definition: ezhit.php:40
eZINI
Reads and writes .ini style configuration files.
eZLinkCategory
Definition: ezlinkcategory.php:37
eZList\drawNavigator
static drawNavigator(&$t, $total_types, $max_types, $index, $parent=false, $variables=false)
Definition: ezlist.php:401
eZTemplate
Definition: eztemplate.php:107
$type
$type
Definition: classes/admin/linkselect.php:220
$categories
$categories
Definition: ezarticle/admin/categoryedit.php:636
$Offset
$Offset
Definition: ezarticle/user/search.php:110
$j
$j
Definition: ezimagecatalogue/admin/imagelist.php:345
$variation
$variation
Definition: ezimagecatalogue/user/menubox.php:55
$UserLimit
$UserLimit
Definition: onepagelinklist.php:33
$linkCategory
$linkCategory
Definition: onepagelinklist.php:78
$languageIni
$languageIni
Definition: onepagelinklist.php:34
$t
$t
Definition: onepagelinklist.php:44
$pathArray
$pathArray
Definition: onepagelinklist.php:81
$IDArrayStr
$IDArrayStr
Definition: onepagelinklist.php:35
$Language
$Language
Definition: onepagelinklist.php:32
$linkCategory_array
$linkCategory_array
Definition: onepagelinklist.php:83
$ini
$ini
Definition: onepagelinklist.php:31
$image
$image
Definition: user/articlelist.php:242
$links
$links
Definition: user/linkcategorylist.php:181
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.