Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

user/pollist.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: pollist.php 6225 2001-07-20 11:22:30Z jakobn $
5 //
6 // Created on: <20-Sep-2000 13:32:11 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
30 $ini =& eZINI::instance( 'site.ini' );
31
32 $Language = $ini->variable( "eZPollMain", "Language" );
33 $DOC_ROOT = $ini->variable( "eZPollMain", "DocumentRoot" );
34 $errorIni = new eZINI( "kernel/ezpoll/user/intl/" . $Language . "/pollist.php.ini", false );
35
36 $noItem = $errorIni->variable( "strings", "noitem" );
37
38 // include_once( $DOC_ROOT . "/classes/ezpoll.php" );
39
40
41 $t = new eZTemplate( "kernel/ezpoll/user/" . $ini->variable( "eZPollMain", "TemplateDir" ),
42 "kernel/ezpoll/user/intl/", $Language, "pollist.php" );
43
44 $t->setAllStrings();
45
46 $t->set_file( array(
47 "poll_list_page" => "pollist.tpl"
48 ) );
49
50 $t->set_block( "poll_list_page", "poll_item_tpl", "poll_item" );
51
52 $poll = new eZPoll();
53 $pollList = $poll->getAllActive( );
54
55 $languageIni = new eZINI( "kernel/ezpoll/user/intl/" . $Language . "/pollist.php.ini", false );
56 $nonActive = $languageIni->variable( "strings", "non_active" );
57 $active = $languageIni->variable( "strings", "active" );
58
59 if ( !$pollList )
60 {
61 $t->set_var( "poll_item", $noItem );
62 }
63
64 $i=0;
65 foreach( $pollList as $pollItem )
66 {
67 if ( ( $i % 2 ) == 0 )
68 {
69 $t->set_var( "td_class", "bglight" );
70 }
71 else
72 {
73 $t->set_var( "td_class", "bgdark" );
74 }
75
76 $t->set_var( "poll_id", $pollItem->id() );
77 $t->set_var( "poll_name", $pollItem->name() );
78 $t->set_var( "poll_description", $pollItem->description() );
79 if ( $pollItem->IsClosed() )
80 {
81 $t->set_var( "action", "result" );
82 $t->set_var( "poll_is_closed", $nonActive );
83 }
84 else
85 {
86 $t->set_var( "action", "votepage" );
87 $t->set_var( "poll_is_closed", $active );
88 }
89 $i++;
90 $t->parse( "poll_item", "poll_item_tpl", true );
91 }
92
93 $t->set_var( "document_root", $DOC_ROOT );
94
95 $t->pparse( "output", "poll_list_page" );
96
97 ?>
eZINI
Reads and writes .ini style configuration files.
eZPoll
Definition: ezpoll.php:64
eZTemplate
Definition: eztemplate.php:107
$DOC_ROOT
$DOC_ROOT
Definition: user/pollist.php:33
$pollList
$pollList
Definition: user/pollist.php:53
$languageIni
$languageIni
Definition: user/pollist.php:55
$t
$t
Definition: user/pollist.php:41
$errorIni
$errorIni
Definition: user/pollist.php:34
$poll
$poll
Definition: user/pollist.php:52
$Language
$Language
Definition: user/pollist.php:32
$ini
$ini
Definition: user/pollist.php:30
$i
if(! $pollList) $i
Definition: user/pollist.php:64
$active
$active
Definition: user/pollist.php:57
$noItem
$noItem
Definition: user/pollist.php:36
$nonActive
$nonActive
Definition: user/pollist.php:56
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.