Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezmessage/user/messagelist.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: messagelist.php,v 1.4 2001/07/30 13:22:37 bf Exp $
5 //
6 // Created on: <05-Jun-2001 16:42:09 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/ezlocale.php" );
28 // include_once( "classes/ezhttptool.php" );
29 // include_once( "classes/eztemplate.php" );
30 // include_once( "classes/INIFile.php" );
31
32 // include_once( "ezmessage/classes/ezmessage.php" );
33 // include_once( "ezmessage/classes/ezmessagemessagedefinition.php" );
34
35 $ini =& eZINI::instance( 'site.ini' );
36 $Language = $ini->variable( "eZMessageMain", "Language" );
37
38 $t = new eZTemplate( "kernel/ezmessage/user/" . $ini->variable( "eZMessageMain", "TemplateDir" ),
39 "kernel/ezmessage/user/intl", $Language, "messagelist.php" );
40
41 $locale = new eZLocale( $Language );
42
43 $t->set_file( "message_page_tpl", "messagelist.tpl" );
44
45 if ( isSet( $Delete ) && isSet( $DelMessage ) && count( $DelMessage ) > 0 )
46 {
47 foreach( $DelMessage as $value )
48 {
49 $message = new eZMessage( $value );
50 $toUser = $message->toUser();
51 $fromUser = $message->fromUser();
52 $user =& eZUser::currentUser();
53
54 if ( $toUser->id() == $user->id() )
55 {
56
57 $messageDefinition = new eZMessageDefinition();
58 $definitionArray = $messageDefinition->getMessageID( $value );
59
60 foreach ( $definitionArray as $definition )
61 {
62 $to_user = $definition->toUserID();
63
64 if ( $to_user->id() == $user->id() )
65 $definition->delete();
66 }
67 //print_r($definitionArray);
68 //echo count($definitionArray);
69 if ( count( $definitionArray ) == 1 )
70 $message->delete();
71 }
72 }
73 }
74
75 $t->setAllStrings();
76
77 $t->set_block( "message_page_tpl", "message_list_tpl", "message_list" );
78 $t->set_block( "message_list_tpl", "message_item_tpl", "message_item" );
79 $t->set_block( "message_item_tpl", "message_read_tpl", "message_read" );
80 $t->set_block( "message_item_tpl", "message_unread_tpl", "message_unread" );
81
82 $user =& eZUser::currentUser();
83 $t->set_var( "user_first_name", $user->firstName() );
84 $t->set_var( "user_last_name", $user->lastName() );
85
86 $message = new eZMessage( );
87
88 $messageArray =& $message->messagesToUser( $user );
89
90 $i = 0;
91 foreach ( $messageArray as $key => $message )
92 {
93 $t->set_var( "message_id", $message->id() );
94
95 $created = $message->created();
96 $t->set_var( "message_date", $locale->format( $created ) );
97
98 $fromUser = $message->fromUser();
99 $t->set_var( "message_from_user", $fromUser->firstName() . " " . $fromUser->lastName() );
100
101 $t->set_var( "message_subject", $message->subject() );
102
103 if ( ( $i %2 ) == 0 )
104 $t->set_var( "td_class", "bglight" );
105 else
106 $t->set_var( "td_class", "bgdark" );
107
108 if ( $message->isRead() == true )
109 {
110 $t->set_var( "message_disabled", "" );
111 $t->set_var( "message_unread", "" );
112 $timeread = $message->TimeRead();
113 $t->set_var( "time_read", $locale->format( $timeread ) );
114 $t->parse( "message_read", "message_read_tpl" );
115 }
116 else
117 {
118 $t->set_var( "message_disabled", "disabled" );
119 $t->set_var( "message_read", "" );
120 $t->parse( "message_unread", "message_unread_tpl" );
121 }
122
123 $i++;
124 $t->parse( "message_item", "message_item_tpl", true );
125 }
126 if ( count( $messageArray ) > 0 )
127 $t->parse( "message_list", "message_list_tpl" );
128 else
129 $t->set_var( "message_list", "" );
130
131
132 $t->pparse( "output", "message_page_tpl" );
133
134
135 ?>
136
eZLocale
Definition: ezlocale.php:119
eZMessageDefinition
Definition: ezmessagemessagedefinition.php:8
eZMessage
Definition: ezmessage.php:39
eZTemplate
Definition: eztemplate.php:107
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
$messageArray
$messageArray
Definition: ezmessage/user/messagelist.php:88
$locale
$locale
Definition: ezmessage/user/messagelist.php:41
$t
$t
Definition: ezmessage/user/messagelist.php:38
$user
$user
Definition: ezmessage/user/messagelist.php:82
$i
$i
Definition: ezmessage/user/messagelist.php:90
$Language
$Language
Definition: ezmessage/user/messagelist.php:36
$ini
$ini
Definition: ezmessage/user/messagelist.php:35
$message
$message
Definition: ezmessage/user/messagelist.php:86
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.