Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

trustees.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: trustees.php 7815 2001-10-12 12:25:13Z jhe $
5 //
6 // Created on: <26-Jul-2001 14:26:26 jhe>
7 //
8 // This source file is part of Exponential Basic, publishing software.
9 // Copyright (C) 1999-2001 eZ systems as
10 //
11 // This program is free software; you can redistribute it and/or
12 // modify it under the terms of the GNU General Public License
13 // as published by the Free Software Foundation; either version 2
14 // of the License, or (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
24 //
25
26 // include_once( "classes/INIFile.php" );
27 // include_once( "classes/eztemplate.php" );
28 // include_once( "classes/ezlocale.php" );
29 // include_once( "ezuser/classes/ezuser.php" );
30
31 $ini =& eZINI::instance( 'site.ini' );
32
33 $Language = $ini->variable( "eZCalendarMain", "Language" );
34 $locale = new eZLocale( $Language );
35
36 $user =& eZUser::currentUser();
37
38 if ( !$user )
39 {
40 $text = "You do not have permission to trustees";
41 $info = urlencode( $text );
42 eZHTTPTool::header( "Location: /error/403?Info=$info" );
43 exit();
44 }
45
46 $session =& eZSession::globalSession();
47 $session->fetch();
48 if ( isset( $Action ) && $Action == "edit" )
49 {
50 $trustees = $user->trustees();
51 if ( !isset( $TrusteesList ) )
52 $TrusteesList = array();
53 $remove_trustees = array_diff( $trustees, $TrusteesList );
54 $add_trustees = array_diff( $TrusteesList, $trustees );
55 foreach ( $remove_trustees as $remove )
56 {
57 $user->removeTrustee( $remove );
58 }
59 foreach ( $add_trustees as $add )
60 {
61 $user->addTrustee( $add );
62 }
63 // include_once( "classes/ezhttptool.php" );
64 eZHTTPTool::header( "Location: " . $_SERVER["HTTP_REFERER"] );
65 exit();
66 }
67
68 $t = new eZTemplate( "kernel/ezcalendar/user/" . $ini->variable( "eZCalendarMain", "TemplateDir" ),
69 "kernel/ezcalendar/user/intl/", $Language, "trustees.php" );
70
71 $t->set_file( "trustees_tpl", "trustees.tpl" );
72
73 $t->setAllStrings();
74
75 $t->set_block( "trustees_tpl", "user_item_tpl", "user_item" );
76
77 $t->set_var( "current_user_name", $user->name() );
78 $t->set_var( "current_user_id", $user->ID() );
79
80 $userList = $user->getAll();
81 $trustees = $user->trustees();
82 foreach ( $userList as $oneUser )
83 {
84 if ( $oneUser->ID != $user->ID() )
85 {
86 $t->set_var( "user_id", $oneUser->ID() );
87 $t->set_var( "user_name", $oneUser->name() );
88 if ( in_array( $oneUser->ID(), $trustees ) )
89 $t->set_var( "selected", "selected" );
90 else
91 $t->set_var( "selected", "" );
92
93 $t->parse( "user_item", "user_item_tpl", true );
94 }
95 }
96
97 $t->pparse( "output", "trustees_tpl" );
98
99 ?>
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZLocale
Definition: ezlocale.php:119
eZSession\globalSession
static & globalSession( $id="", $fetch=true)
Definition: kernel/ezsession/classes/ezsession.php:614
eZTemplate
Definition: eztemplate.php:107
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
$Action
$Action
Definition: companysearch.php:80
exit
exit
Definition: folder.php:81
$t
if(isset( $Action) && $Action=="edit") $t
Definition: trustees.php:68
$locale
$locale
Definition: trustees.php:34
$user
$user
Definition: trustees.php:36
$userList
$userList
Definition: trustees.php:80
$session
if(! $user) $session
Definition: trustees.php:46
$Language
$Language
Definition: trustees.php:33
$ini
$ini
Definition: trustees.php:31
$trustees
$trustees
Definition: trustees.php:81
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.