Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

articleheaderlist.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: articleheaderlist.php 9788 2003-03-24 08:52:52Z br $
5 //
6 // Created on: <26-Oct-2000 21:15:58 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( "ezarticle/classes/ezarticlecategory.php" );
32 // include_once( "ezarticle/classes/ezarticle.php" );
33 // include_once( "ezarticle/classes/ezarticlerenderer.php" );
34 // include_once( "ezuser/classes/ezobjectpermission.php" );
35 // include_once( "ezsitemanager/classes/ezsection.php" );
36
37 $ini =& eZINI::instance( 'site.ini' );
38 $Language = $ini->variable( "eZArticleMain", "Language" );
39 $ImageDir = $ini->variable( "eZArticleMain", "ImageDir" );
40
41 if ( !is_numeric( $CategoryID ) )
42 {
43 eZHTTPTool::header( "Location: /error/404" );
44 exit();
45 }
46
47 $GlobalSectionID = eZArticleCategory::sectionIDStatic( $CategoryID );
48
49 $sectionObject =& eZSection::globalSectionObject( $GlobalSectionID );
50 $sectionObject->setOverrideVariables();
51
52 $t = new eZTemplate( "kernel/ezarticle/user/" . $ini->variable( "eZArticleMain", "TemplateDir" ),
53 "kernel/ezarticle/user/intl/", $Language, "articleheaderlist.php" );
54
55 $t->setAllStrings();
56
57 $t->set_file( array(
58 "article_list_page_tpl" => "articleheaderlist.tpl"
59 ) );
60
61 // path
62 $t->set_block( "article_list_page_tpl", "path_item_tpl", "path_item" );
63
64 // article
65 $t->set_block( "article_list_page_tpl", "category_list_tpl", "category_list" );
66 $t->set_block( "category_list_tpl", "category_item_tpl", "category_item" );
67
68 // product
69 $t->set_block( "article_list_page_tpl", "article_list_tpl", "article_list" );
70 $t->set_block( "article_list_tpl", "article_item_tpl", "article_item" );
71
72
73 // image dir
74 $t->set_var( "image_dir", $ImageDir );
75
76 $category = new eZArticleCategory( $CategoryID );
77
78 $t->set_var( "current_category_name", $category->name() );
79 $t->set_var( "current_category_description", $category->description() );
80
81 // path
82 $pathArray = $category->path();
83
84 $t->set_var( "path_item", "" );
85 foreach ( $pathArray as $path )
86 {
87 $t->set_var( "category_id", $path[0] );
88
89 $t->set_var( "category_name", $path[1] );
90
91 $t->parse( "path_item", "path_item_tpl", true );
92 }
93
94 $categoryList = $category->getByParent( $category );
95
96
97 // categories
98 $i=0;
99 $t->set_var( "category_list", "" );
100 $t->set_var( "category_item", "" );
101
102 if (is_array($categoryList))
103 {
104 foreach ( $categoryList as $categoryItem )
105 {
106 $t->set_var( "category_id", $categoryItem->id() );
107
108 $t->set_var( "category_name", $categoryItem->name() );
109
110 $parent = $categoryItem->parent();
111
112
113 if ( ( $i % 2 ) == 0 )
114 {
115 $t->set_var( "td_class", "bglight" );
116 }
117 else
118 {
119 $t->set_var( "td_class", "bgdark" );
120 }
121
122 $t->set_var( "category_description", $categoryItem->description() );
123
124 $t->parse( "category_item", "category_item_tpl", true );
125 $i++;
126 }
127 }
128
129 if ( count( $categoryList ) > 0 )
130 $t->parse( "category_list", "category_list_tpl" );
131 else
132 $t->set_var( "category_list", "" );
133
134
135 if ( !isset( $SortMode ) )
136 $SortMode = "";
137
138 if ( $CategoryID == 0 )
139 {
140 $article = new eZArticle();
141 $articleList = $article->articles( $SortMode, false );
142 }
143 else
144 {
145 $articleList = $category->articles( $SortMode, false, true );
146 }
147
148 $locale = new eZLocale( $Language );
149 $i=0;
150 $t->set_var( "article_list", "" );
151 foreach ( $articleList as $article )
152 {
153 if ( eZObjectPermission::hasPermission( $article->id(), "article_article", 'r' ) )
154 {
155 $catDef =& $article->categoryDefinition();
156 $t->set_var( "category_id", $catDef->id() );
157
158 $t->set_var( "article_id", $article->id() );
159 $t->set_var( "article_name", $article->name() );
160 $def = $article->categoryDefinition();
161 if( $def )
162 $t->set_var( "article_category_name", $def->name() );
163 else
164 $t->set_var( "article_category_name" ,"" );
165
166 $published = $article->published();
167
168 $t->set_var( "article_published", $locale->format( $published ) );
169
170 if ( ( $i % 2 ) == 0 )
171 {
172 $t->set_var( "td_class", "bglight" );
173 }
174 else
175 {
176 $t->set_var( "td_class", "bgdark" );
177 }
178
179 if ( $article->linkText() != "" )
180 {
181 $t->set_var( "article_link_text", $article->linkText() );
182 }
183 else
184 {
185 $t->set_var( "article_link_text", "more" );
186 }
187
188 $t->parse( "article_item", "article_item_tpl", true );
189 $i++;
190 }
191 }
192
193 if ( $i > 0 )
194 $t->parse( "article_list", "article_list_tpl" );
195 else
196 $t->set_var( "article_list", "" );
197
198 $t->set_var( "section_id", $GlobalSectionID );
199
200 $t->pparse( "output", "article_list_page_tpl" );
201
202 ?>
$CategoryID
$CategoryID
Definition: admin/articleedit.php:53
$category
$category
Definition: articleheaderlist.php:76
$ImageDir
$ImageDir
Definition: articleheaderlist.php:39
$locale
$locale
Definition: articleheaderlist.php:148
$t
$t
Definition: articleheaderlist.php:52
$pathArray
$pathArray
Definition: articleheaderlist.php:82
$sectionObject
$sectionObject
Definition: articleheaderlist.php:49
$i
$i
Definition: articleheaderlist.php:98
$Language
$Language
Definition: articleheaderlist.php:38
$ini
$ini
Definition: articleheaderlist.php:37
$categoryList
foreach( $pathArray as $path) $categoryList
Definition: articleheaderlist.php:94
$GlobalSectionID
if(!is_numeric( $CategoryID)) $GlobalSectionID
Definition: articleheaderlist.php:47
$article
$article
Definition: articlelog.php:45
eZArticleCategory
Definition: ezarticlecategory.php:45
eZArticleCategory\sectionIDStatic
static sectionIDStatic($categoryID)
Definition: ezarticlecategory.php:662
eZArticle
Definition: ezarticle.php:82
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZLocale
Definition: ezlocale.php:119
eZObjectPermission\hasPermission
static hasPermission( $objectID, $moduleTable, $permission, $user=false)
Definition: ezobjectpermission.php:76
eZSection\globalSectionObject
static & globalSectionObject( $sectionID)
Definition: ezsection.php:366
eZTemplate
Definition: eztemplate.php:107
$def
$def
Definition: ezprestauthorizedclient.php:12
exit
exit
Definition: folder.php:81
$articleList
$articleList
Definition: pendinglist.php:112
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.