Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

admin/pollist.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: pollist.php 6304 2001-07-29 23:31:17Z kaid $
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 // include_once( "classes/ezcachefile.php" );
30
31 $ini =& eZINI::instance( 'site.ini' );
32 $Language = $ini->variable( "eZPollMain", "Language" );
33 $errorIni = new eZINI( "kernel/ezpoll/admin/intl/" . $Language . "/pollist.php.ini", false );
34
35 // include_once( "ezpoll/classes/ezpoll.php" );
36
37 require( "kernel/ezuser/admin/admincheck.php" );
38
39 // Language
40 $LangaugeIni = new eZINI( "kernel/ezpoll/admin/" . "intl/" . $Language . "/pollist.php.ini", false );
41 $yes = $LangaugeIni->variable( "strings", "yes" );
42 $no = $LangaugeIni->variable( "strings", "no" );
43 $closed = $LangaugeIni->variable( "strings", "closed" );
44 $notClosed = $LangaugeIni->variable( "strings", "not_closed" );
45
46 if ( isset( $Action ) && $Action == "StoreMainPoll" )
47 {
48 // clear the menu cache
49 $files =& eZCacheFile::files( "kernel/ezpoll/cache/",
50 array( "menubox",
51 NULL ),
52 "cache", "," );
53 foreach( $files as $file )
54 {
55 $file->delete();
56 }
57
58
59 $mainPoll = new eZPoll( $MainPollID );
60 if ( $mainPoll->isClosed() )
61 {
62 $errorMsg = $errorIni->variable( "strings", "poll_closed" );
63 }
64 else if ( !$mainPoll->isEnabled() )
65 {
66 $errorMsg = $errorIni->variable( "strings", "poll_not_enabled" );
67 }
68 else
69 {
70 $mainPoll->setMainPoll( $mainPoll );
71 }
72 }
73
74 if ( isset( $Action ) && $Action == "Delete" )
75 {
76 // clear the menu cache
77 $files =& eZCacheFile::files( "ezpoll/cache/",
78 array( "menubox",
79 NULL ),
80 "cache", "," );
81 foreach( $files as $file )
82 {
83 $file->delete();
84 }
85
86 if( count( $PollArrayID ) > 0 )
87 {
88 foreach( $PollArrayID as $doomedPoll )
89 {
90 $poll = new eZPoll( $doomedPoll );
91 $poll->delete();
92 }
93 }
94 // clear the menu cache
95 if ( file_exists("kernel/ezpoll/cache/menubox.cache" ) )
96 eZPBFile::unlink( "kernel/ezpoll/cache/menubox.cache" );
97 }
98
99 $t = new eZTemplate( "kernel/ezpoll/admin/" . $ini->variable( "eZPollMain", "AdminTemplateDir" ),
100 "kernel/ezpoll/admin/intl/", $Language, "pollist.php" );
101
102 $t->setAllStrings();
103
104 $t->set_file( array(
105 "poll_list_page" => "pollist.tpl"
106 ) );
107
108 $t->set_block( "poll_list_page", "poll_item_tpl", "poll_item" );
109
110 $t->set_var( "site_style", $SiteDesign );
111
112 $nopolls = "";
113
114 $poll = new eZPoll();
115
116 $pollList = $poll->getAll( );
117
118 if ( !$pollList )
119 {
120 $languageIni = new eZINI( "kernel/ezpoll/" . "/admin/" . "intl/" . $Language . "/pollist.php.ini", false );
121 $nopolls = $languageIni->variable( "strings", "nopolls" );
122 $t->set_var( "poll_item", "" );
123 }
124
125 $mainPoll = $poll->mainPoll();
126
127 if ( $mainPoll )
128 {
129 $mainPollID = $mainPoll->id();
130 }
131
132 $i=0;
133 foreach( $pollList as $pollItem )
134 {
135 if ( ( $i %2 ) == 0 )
136 $t->set_var( "td_class", "bgdark" );
137 else
138 $t->set_var( "td_class", "bglight" );
139
140 if ( $pollItem->isEnabled() == "true" )
141 $t->set_var( "poll_is_enabled", $yes );
142 else
143 $t->set_var( "poll_is_enabled", $no );
144
145 // if ( $pollItem->anonymous() == "true" )
146 // $t->set_var( "anonymous", "Ja" );
147 // else
148 // $t->set_var( "anonymous", "Nei" );
149
150
151 if ( $pollItem->id() == $mainPollID )
152 $t->set_var( "is_checked", "checked" );
153 else
154 $t->set_var( "is_checked", "" );
155
156 if ( $pollItem->isClosed() == "true" )
157 {
158 $t->set_var( "poll_is_closed", $closed );
159 }
160 else
161 {
162 $t->set_var( "poll_is_closed", $notClosed );
163 }
164 $t->set_var( "poll_id", $pollItem->id() );
165 $t->set_var( "poll_name", $pollItem->name() );
166 $t->set_var( "poll_description", $pollItem->description() );
167
168 $t->parse( "poll_item", "poll_item_tpl", true );
169 $i++;
170 }
171
172 $t->set_var( "error_msg", isset( $errorMsg ) ? $errorMsg : false );
173 $t->set_var( "nopolls", $nopolls );
174
175 $t->pparse( "output", "poll_list_page" );
176
177 ?>
$LangaugeIni
$LangaugeIni
Definition: admin/pollist.php:40
$no
$no
Definition: admin/pollist.php:42
$pollList
$pollList
Definition: admin/pollist.php:116
$errorIni
$errorIni
Definition: admin/pollist.php:33
$closed
$closed
Definition: admin/pollist.php:43
$poll
$poll
Definition: admin/pollist.php:114
$Language
$Language
Definition: admin/pollist.php:32
$ini
$ini
Definition: admin/pollist.php:31
$yes
$yes
Definition: admin/pollist.php:41
$t
if(isset( $Action) && $Action=="StoreMainPoll") if(isset( $Action) && $Action=="Delete") $t
Definition: admin/pollist.php:99
$notClosed
$notClosed
Definition: admin/pollist.php:44
$i
if( $mainPoll) $i
Definition: admin/pollist.php:132
$mainPoll
if(! $pollList) $mainPoll
Definition: admin/pollist.php:125
$nopolls
$nopolls
Definition: admin/pollist.php:112
$files
$files
Definition: articlepreview.php:91
eZINI
Reads and writes .ini style configuration files.
eZPBFile\unlink
static unlink( $filename)
Definition: ezpbfile.php:352
eZPoll
Definition: ezpoll.php:64
eZTemplate
Definition: eztemplate.php:107
$Action
$Action
Definition: companysearch.php:80
file_exists
static file_exists( $inifilename)
Definition: eZPBINIFile.php:195
$SiteDesign
$SiteDesign
Definition: ezbulkmail/user/datasupplier.php:31
$file
$file
Definition: ezfilemanager/user/filedownload.php:35
$languageIni
$languageIni
Definition: pendinglist.php:43
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.