Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezmail/user/menubox.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: menubox.php 6931 2001-09-04 13:20:16Z fh $
5 //
6 // Created on: <23-Mar-2001 10:57:04 fh>
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 $Language = $ini->variable( "eZMailMain", "Language" );
32
33
34 // include_once( "classes/eztemplate.php" );
35 // include_once( "classes/ezdb.php" );
36 // include_once( "ezmail/classes/ezmailfolder.php" );
37 // include_once( "ezsession/classes/ezpreferences.php" );
38
39 $user =& eZUser::currentUser();
40 if( $user )
41 {
42 $t = new eZTemplate( "kernel/ezmail/user/" . $ini->variable( "eZMailMain", "TemplateDir" ),
43 "kernel/ezmail/user/intl", $Language, "menubox.php" );
44
45 $t->setAllStrings();
46
47 $t->set_file( array(
48 "menu_box_tpl" => "menubox.tpl"
49 ) );
50
51 $t->set_block( "menu_box_tpl", "mail_folder_tpl", "mail_folder" );
52 $t->set_block( "menu_box_tpl", "mail_check_tpl", "mail_check" );
53 $t->set_var( "mail_check", "" );
54
55 // auto check mail if enabled.
56 if( eZPreferences::variable( "eZMail_AutoCheckMail" ) == "true" )
57 {
58 // include_once( "ezmail/classes/ezmailaccount.php" );
59 $accounts = eZMailAccount::getByUser( $user->id() );
60 foreach( $accounts as $account )
61 {
62 if( $account->isActive() )
63 $account->checkMail();
64 }
65 }
66 else
67 {
68 $t->parse( "mail_check", "mail_check_tpl", false );
69 }
70
71 $showUnread = eZPreferences::variable( "eZMail_ShowUnread" ) == "true" ? true : false;
72 $folderNames = array( 'INBOX', 'SENT', 'DRAFTS', 'TRASH' );
73 foreach( array( '1', '2', '3', '4' ) as $specialfolder )
74 {
75 $folderItem = eZMailFolder::getSpecialFolder( $specialfolder );
76
77 if( $folderItem )
78 {
79 $t->set_var( "folder_id", $folderItem->id() );
80 $t->set_var( "folder_name", htmlspecialchars( $folderItem->name() ) );
81 $t->set_var( "indent", "");
82 $t->set_var( "unread", "" );
83
84 if( $showUnread )
85 {
86 $num = $folderItem->count( true );
87 if( $num > 0 )
88 $t->set_var( "unread", "($num)" );
89 }
90 $t->parse( "mail_folder", "mail_folder_tpl", true );
91 }
92 else
93 {
94 $t->set_var('mail_folder','');
95 }
96 }
97
98 $userFolders = eZMailFolder::getTree( 0, -1);
99 foreach( $userFolders as $folderItem )
100 {
101 $t->set_var( "folder_id", $folderItem[0] );
102 $t->set_var( "folder_name", htmlspecialchars( $folderItem[1] ) );
103 $t->set_var( "indent", str_repeat( "&nbsp;", 2 * $folderItem[2] ) );
104 $t->set_var( "unread", "" );
105 if( $showUnread )
106 {
107 $num = $folderItem->count( true );
108 if( $num > 0 )
109 $t->set_var( "unread", "($num)" );
110 }
111 $t->parse( "mail_folder", "mail_folder_tpl", true );
112 }
113
114 $t->set_var( "sitedesign", $GlobalSiteDesign );
115
116 $t->pparse( "output", "menu_box_tpl" );
117 }
118
119 ?>
eZMailAccount\getByUser
static getByUser( $user)
Definition: ezmailaccount.php:372
eZMailFolder\getSpecialFolder
static getSpecialFolder( $specialType, $user=false)
Definition: ezmailfolder.php:477
eZMailFolder\getTree
static & getTree( $parentID=0, $level=0)
Definition: ezmailfolder.php:360
eZPreferences\variable
static variable( $name, $group=false)
Definition: ezpreferences.php:95
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
$accounts
if( $user) $accounts
Definition: configure.php:161
$user
$user
Definition: ezmail/user/menubox.php:39
$Language
$Language
Definition: ezmail/user/menubox.php:31
$ini
$ini
Definition: ezmail/user/menubox.php:29
$userFolders
foreach(array(1, 2, 3, 4) as $specialfolder) $userFolders
Definition: folderlist.php:110
$GlobalSiteDesign
global $GlobalSiteDesign
Definition: latestmessages.php:52
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.