Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

votepage.php
Go to the documentation of this file.
1 <?php
3 //
4 // $id$
5 //
6 // Created on: <26-Oct-2000 14:26:18 ce>
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 // include_once( "classes/eztemplate.php" );
29 // include_once( "classes/ezhttptool.php" );
30
31 $ini =& eZINI::instance( 'site.ini' );
32 $Language = $ini->variable( "eZPollMain", "Language" );
33
34 // include_once( "ezpoll/classes/ezpoll.php" );
35 // include_once( "ezpoll/classes/ezpollchoice.php" );
36
37 $t = new eZTemplate( "kernel/ezpoll/user/" . $ini->variable( "eZPollMain", "TemplateDir" ),
38 "kernel/ezpoll/user/intl/", $Language, "votepage.php" );
39
40 $t->setAllStrings();
41
42 $poll = new eZPoll( $PollID );
43
44 if ( $poll->isClosed() )
45 {
46 eZHTTPTool::header( "Location: /poll/result/$PollID" );
47 exit();
48 }
49
50 $t->set_file( array(
51 "vote_box" => "votepage.tpl"
52 ) );
53
54 $t->set_block( "vote_box", "vote_item_tpl", "vote_item" );
55 $t->set_block( "vote_box", "vote_buttons_tpl", "vote_buttons" );
56 $t->set_block( "vote_box", "no_items_tpl", "no_items" );
57
58 $choice = new eZPollChoice();
59
60 $choiceList = $choice->getAll( $PollID );
61
62 foreach( $choiceList as $choiceItem )
63 {
64 $t->set_var( "choice_name", $choiceItem->name() );
65 $t->set_var( "choice_id", $choiceItem->id() );
66
67 $t->set_var( "no_items", "" );
68 $t->parse( "vote_item", "vote_item_tpl", true );
69
70 }
71
72 if ( count ( $choiceList ) == 0 )
73 {
74 $t->set_var( "vote_buttons", "" );
75 $t->parse( "no_items", "no_items_tpl" );
76 $t->set_var( "vote_item", "" );
77 }
78 else
79 {
80 $t->parse( "vote_buttons", "vote_buttons_tpl");
81 }
82
83
84 $poll = new eZPoll();
85 $poll->get( $PollID );
86 $t->set_var( "head_line", $poll->name() );
87 $t->set_var( "description", $poll->description() );
88 $t->set_var( "poll_id", $PollID );
89
90
91 $t->pparse( "output", "vote_box" );
92
93 ?>
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZPollChoice
Definition: ezpollchoice.php:45
eZPoll
Definition: ezpoll.php:64
eZTemplate
Definition: eztemplate.php:107
exit
exit
Definition: folder.php:81
$t
$t
Definition: votepage.php:37
$poll
$poll
Definition: votepage.php:42
$Language
$Language
Definition: votepage.php:32
$ini
$ini
Definition: votepage.php:31
$choice
$choice
Definition: votepage.php:58
$choiceList
$choiceList
Definition: votepage.php:60
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.