Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

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