Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

messagelistflat.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: messagelistflat.php 7759 2001-10-10 13:18:29Z jhe $
5 //
6 // Created on: <03-Jul-2001 13:24:26 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
29 $ini =& eZINI::instance( 'site.ini' );
30
31 // include_once( "classes/eztemplate.php" );
32 // include_once( "classes/ezlocale.php" );
33 // include_once( "classes/ezdatetime.php" );
34 // include_once( "classes/ezlist.php" );
35 // include_once( "ezsession/classes/ezpreferences.php" );
36 // include_once( "ezuser/classes/ezuser.php" );
37
38 // include_once( "ezforum/classes/ezforummessage.php" );
39 // include_once( "ezforum/classes/ezforumcategory.php" );
40 // include_once( "ezforum/classes/ezforum.php" );
41
42 $Language = $ini->variable( "eZForumMain", "Language" );
43 $UserLimit = $ini->variable( "eZForumMain", "MessageUserLimit" );
44 $NewMessageLimit = $ini->variable( "eZForumMain", "NewMessageLimit" );
45
46 $t = new eZTemplate( "kernel/ezforum/user/" . $ini->variable( "eZForumMain", "TemplateDir" ),
47 "kernel/ezforum/user/intl", $Language, "messagelistflat.php" );
48
49 $t->set_file( "messagelist_tpl", "messagelistflat.tpl" );
50
51 $t->set_block( "messagelist_tpl", "message_item_tpl", "message_item" );
52 $t->set_block( "message_item_tpl", "edit_message_item_tpl", "edit_message_item" );
53 $t->set_block( "messagelist_tpl", "previous_tpl", "previous" );
54
55 $t->set_block( "message_item_tpl", "new_icon_tpl", "new_icon" );
56 $t->set_block( "message_item_tpl", "old_icon_tpl", "old_icon" );
57
58 $t->setAllStrings();
59
60 $forum = new eZForum( $ForumID );
61
62 $categories =& $forum->categories();
63
64 $user =& eZUser::currentUser();
65
66
67 $group =& $forum->group();
68 $viewer = $user;
69 if ( is_a( $group, "eZUserGroup" ) )
70 {
71 if ( is_a( $viewer, "eZUser" ) )
72 {
73 $groupList =& $viewer->groups();
74
75 foreach ( $groupList as $userGroup )
76 {
77 if ( $userGroup->id() == $group->id() )
78 {
79 $readPermission = true;
80 break;
81 }
82 }
83 }
84 }
85 else
86 {
87 $readPermission = true;
88 }
89
90 if ( count( $categories ) > 0 )
91 {
92 $category = new eZForumCategory( $categories[0]->id() );
93
94 $t->set_var( "category_id", $category->id() );
95 $t->set_var( "category_name", $category->name() );
96 }
97
98 $locale = new eZLocale( $Language );
99
100 if ( !$Offset )
101 $Offset = 0;
102
103 $messageList =& $forum->messageTreeArray( $Offset, $UserLimit, false, false );
104 $messageCount =& $forum->messageCount( false, true );
105
106 if ( !$messageList )
107 {
108 $languageIni = new eZINI( "kernel/ezforum/user/intl/" . $Language . "/messagelistflat.php.ini", false );
109 $noitem = $languageIni->variable( "strings", "noitem" );
110
111 $t->set_var( "message_item", $noitem );
112 }
113 else
114 {
115 $db =& eZDB::globalDatabase();
116
117 $level = 0;
118 $i = 0;
119 $time = new eZDateTime();
120 foreach ( $messageList as $message )
121 {
122 $author = new eZUser();
123 $t->set_var( "user", "" );
124 $t->set_var( "edit_message_item", "" );
125
126 if ( ( $i % 2 ) == 0 )
127 $t->set_var( "td_class", "articlelist1" );
128 else
129 $t->set_var( "td_class", "articlelist2" );
130
131 $t->set_var( "topic", $message[$db->fieldName( "Topic" )] );
132 $t->set_var( "body", $message[$db->fieldName( "Body" )] );
133
134 $time->setTimeStamp( $message[$db->fieldName( "PostingTime" )] );
135 $t->set_var( "postingtime", $locale->format( $time ) );
136
137 $t->set_var( "message_id", $message[$db->fieldName( "ID" )] );
138
139
140 $messageAge = round( $message[$db->fieldName( "Age" )] / 86400 );
141 if ( $messageAge <= $NewMessageLimit )
142 {
143 $t->parse( "new_icon", "new_icon_tpl" );
144 $t->set_var( "old_icon", "" );
145 }
146 else
147 {
148 $t->parse( "old_icon", "old_icon_tpl" );
149 $t->set_var( "new_icon", "" );
150 }
151
152 $userID = $message[$db->fieldName( "UserID" )];
153
154 $author->get( $userID );
155
156 $t->set_var( "count_replies", "" );
157 $level = $message[$db->fieldName( "Depth" )];
158
159 if ( $level > 0 )
160 $t->set_var( "spacer", str_repeat( "&nbsp;", $level ) );
161 else
162 $t->set_var( "spacer", "" );
163
164 if ( $author->id() == 0 )
165 {
166 $t->set_var( "user", $ini->variable( "eZForumMain", "AnonymousPoster" ) );
167 }
168 else
169 {
170 $t->set_var( "user", $author->firstName() . " " . $author->lastName() );
171 }
172
173 $t->parse( "message_item", "message_item_tpl", true );
174 $i++;
175 }
176 }
177 eZList::drawNavigator( $t, $messageCount, $UserLimit, $Offset, "messagelist_tpl" );
178
179 $t->set_var( "forum_start", $Offset + 1 );
180 $t->set_var( "forum_end", min( $Offset + $UserLimit, $messageCount ) );
181 $t->set_var( "forum_total", $messageCount );
182
183 $t->set_var( "newmessage", $newmessage );
184
185 $t->set_var( "forum_id", $forum->id() );
186 $t->set_var( "forum_name", $forum->name() );
187
188 if ( $readPermission )
189 $t->pparse( "output", "messagelist_tpl" );
190
191 ?>
$category
if( $Action=="Edit") $category
Definition: adedit.php:378
$groupList
$groupList
Definition: admin/articleedit.php:800
$author
$author
Definition: admin/articleedit.php:834
$message
$message
Definition: admin/message.php:51
$userID
else $userID
Definition: appointmentedit.php:121
eZDB\globalDatabase
static & globalDatabase()
Definition: ezdb.php:134
eZDateTime
Definition: ezdatetime.php:55
eZForumCategory
Definition: ezforumcategory.php:44
eZForum
Definition: ezforum.php:44
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
eZLocale
Definition: ezlocale.php:119
eZTemplate
Definition: eztemplate.php:107
eZUser
Definition: ezuser.php:76
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
$db
$db
Definition: ezarticle/user/authorlist.php:53
$Offset
$Offset
Definition: ezarticle/user/search.php:110
$UserLimit
$UserLimit
Definition: messagelistflat.php:43
$viewer
$viewer
Definition: messagelistflat.php:68
$t
$t
Definition: messagelistflat.php:46
$NewMessageLimit
$NewMessageLimit
Definition: messagelistflat.php:44
$forum
$forum
Definition: messagelistflat.php:60
$user
$user
Definition: messagelistflat.php:64
$time
$time
Definition: messagelistflat.php:119
$locale
if(count( $categories) > 0) $locale
Definition: messagelistflat.php:98
$i
$i
Definition: messagelistflat.php:118
$Language
$Language
Definition: messagelistflat.php:42
$ini
$ini
Definition: messagelistflat.php:29
$level
$level
Definition: messagelistflat.php:117
$group
$group
Definition: messagelistflat.php:67
$messageCount
$messageCount
Definition: messagelistflat.php:104
$messageList
$messageList
Definition: messagelistflat.php:103
$categories
$categories
Definition: messagelistflat.php:62
$languageIni
$languageIni
Definition: pendinglist.php:43
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.