Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

user/forumlist.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: forumlist.php 7782 2001-10-11 11:06:20Z jhe $
5 //
6 // Created on: <11-Sep-2000 22:10:06 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( "ezforum/classes/ezforum.php" );
30 // include_once( "ezforum/classes/ezforummessage.php" );
31 // include_once( "ezforum/classes/ezforumcategory.php" );
32 // include_once( "ezuser/classes/ezuser.php" );
33 // include_once( "ezuser/classes/ezusergroup.php" );
34
35
36 $ini =& eZINI::instance( 'site.ini' );
37 $Language = $ini->variable( "eZForumMain", "Language" );
38
39
40 if( isset( $CategoryID ) && $CategoryID != 0 )
41 {
42 $t = new eZTemplate( "kernel/ezforum/user/" . $ini->variable( "eZForumMain", "TemplateDir"),
43 "kernel/ezforum/user/intl", $Language, "forumlist.php" );
44
45 $t->setAllStrings();
46 $t->set_file( "forumlist", "forumlist.tpl" );
47
48 $t->set_block( "forumlist", "view_forums_tpl", "view_forums" );
49 $t->set_block( "view_forums_tpl", "forum_item_tpl", "forum_item" );
50 // prev/next
51 $t->set_block( "forumlist", "previous_tpl", "previous" );
52 $t->set_block( "forumlist", "next_tpl", "next" );
53
54
55 $category = new eZForumCategory( $CategoryID );
56
57 if ( !isset( $Offset ) )
58 {
59 $Offset = 0;
60 }
61
62 if ( !isset( $UserListLimit ) )
63 {
64 $UserListLimit = 15;
65 }
66
67 //
68 // sections
69 // include_once( "ezsitemanager/classes/ezsection.php" );
70
71 $GlobalSectionID = eZForumCategory::sectionIDStatic( $CategoryID );
72
73 // init the section
74 $sectionObject =& eZSection::globalSectionObject( $GlobalSectionID );
75 $sectionObject->setOverrideVariables();
76
77
78 $t->set_var( "category_id", $category->id( ) );
79 $t->set_var( "category_name", $category->name( ) );
80 $t->set_var( "category_description", $category->name( ) );
81
82 $forumList =& $category->forums( $Offset,$UserListLimit );
83 $forumCount = $category->forumCount();
84
85 $t->set_var( "forum_item", "" );
86
87 if ( !$forumList )
88 {
89 $languageIni = new eZINI( "kernel/ezforum/user/intl/" . $Language . "/categorylist.php.ini", false );
90 $noitem = $languageIni->variable( "strings", "noitem" );
91
92 $t->set_var( "forum_item", $noitem );
93 }
94
95 // $linkModules = $ini->variable( "eZForumMain", "LinkModules" );
96 $module_array = explode(',', $ini->variable( "eZForumMain", "LinkModules") );
97
98 $showForum = true;
99 foreach ($module_array as $module)
100 {
101 $moduleBits = explode(':', $module);
102 if ($moduleBits[1]=$category->id() )
103 $showForum=false;
104 }
105
106 $i=0;
107 $j=0; // The number of viewable forums for this session.
108 foreach ( $forumList as $forum )
109 {
110 $t->set_var( "forum_id", $forum->id() );
111
112 $t->set_var( "name", $forum->name() );
113 $t->set_var( "description", $forum->description() );
114
115 $t->set_var( "threads", $forum->messageCount( false, false ) );
116 $t->set_var( "messages", $forum->messageCount( false, true ) );
117
118 if ( ( $i %2 ) == 0 )
119 $t->set_var( "td_class", "bglight" );
120 else
121 $t->set_var( "td_class", "bgdark" );
122
123 $group =& $forum->group();
124
125 if ( is_a( $group, "eZUserGroup" ) )
126 {
127 $user =& eZUser::currentUser();
128 if ( is_a( $user, "eZUser" ) )
129 {
130 $groupList =& $user->groups();
131
132 foreach ( $groupList as $userGroup )
133 {
134 if ( $userGroup->id() == $group->id() )
135 {
136 $t->parse( "forum_item", "forum_item_tpl", true );
137 $j++;
138 break;
139 }
140 }
141 }
142 }
143 else
144 {
145 $t->parse( "forum_item", "forum_item_tpl", true );
146 $j++;
147 }
148
149 $i++;
150 }
151
152 if ( $j == 0 && $i > 0 )
153 {
154 $t->set_var( "view_forums", $t->Ini->variable( "strings", "no_forums_for_you" ) );
155 }
156 else if ( $j == 0 && $i == 0 )
157 {
158 $t->set_var( "view_forums", $t->Ini->variable( "strings", "no_forums" ) );
159 }
160 else
161 {
162 $t->parse( "view_forums", "view_forums_tpl" );
163 }
164
165 $t->set_var( "category_id", $CategoryID );
166
167 eZList::drawNavigator( $t, $forumCount, $UserListLimit, $Offset, "forumlist" );
168
169 $t->pparse( "output", "forumlist" );
170 }
171 else
172 {
173 $t = new eZTemplate( "kernel/ezforum/user/" . $ini->variable( "eZForumMain", "TemplateDir" ),
174 "kernel/ezforum/user/intl", $Language, "categorylist.php" );
175 $t->setAllStrings();
176
177 $t->set_file( Array( "categorylist" => "categorylist.tpl" ) );
178
179 $t->set_block( "categorylist", "category_item_tpl", "category_item" );
180
181 $category = new eZForumCategory();
182 $categoryList = $category->getAllCategories();
183 if ( !$categoryList )
184 {
185 $languageIni = new eZINI( "kernel/ezforum/user/intl/" . $Language . "/categorylist.php.ini", false );
186 $noitem = $languageIni->variable( "strings", "noitem" );
187
188 $t->set_var( "next", "" );
189 $t->set_var( "previous", "" );
190 $t->set_var( "category_item", $noitem );
191 }
192 else
193 {
194 $i=0;
195 foreach ( $categoryList as $categoryItem )
196 {
197 if ( ( $i %2 ) == 0 )
198 $t->set_var( "td_class", "bgdark" );
199 else
200 $t->set_var( "td_class", "bglight" );
201
202 $t->set_var( "category_id", $categoryItem->id() );
203 $t->set_var( "category_name", $categoryItem->name() );
204 $t->set_var( "category_description", $categoryItem->description() );
205 $i++;
206
207 $t->parse( "category_item", "category_item_tpl", true);
208 }
209 }
210
211 $t->pparse( "output", "categorylist" );
212 }
213
214 ?>
$i
$i
Definition: admin/adlist.php:91
$CategoryID
$CategoryID
Definition: admin/articleedit.php:53
$groupList
$groupList
Definition: admin/articleedit.php:800
$group
$group
Definition: admin/articleedit.php:799
$forum
$forum
Definition: admin/forumlist.php:50
$forumList
$forumList
Definition: admin/forumlist.php:54
$sectionObject
$sectionObject
Definition: articleheaderlist.php:49
eZForumCategory
Definition: ezforumcategory.php:44
eZForumCategory\sectionIDStatic
static sectionIDStatic( $categoryID)
Definition: ezforumcategory.php:320
eZINI
Reads and writes .ini style configuration files.
eZList\drawNavigator
static drawNavigator(&$t, $total_types, $max_types, $index, $parent=false, $variables=false)
Definition: ezlist.php:401
eZSection\globalSectionObject
static & globalSectionObject( $sectionID)
Definition: ezsection.php:366
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
$module
$module
Definition: classes/admin/linkselect.php:219
$GlobalSectionID
$GlobalSectionID
Definition: ezad/user/datasupplier.php:28
$Offset
$Offset
Definition: ezarticle/user/search.php:110
$j
$j
Definition: ezimagecatalogue/admin/imagelist.php:345
$languageIni
$languageIni
Definition: pendinglist.php:43
$user
$user
Definition: user/adlist.php:39
$UserListLimit
$UserListLimit
Definition: user/articlelist.php:52
$category
$category
Definition: user/forumlist.php:181
$Language
$Language
Definition: user/forumlist.php:37
$ini
$ini
Definition: user/forumlist.php:36
$categoryList
$categoryList
Definition: user/forumlist.php:182
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.