Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

quizopen.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: quizopen.php 6226 2001-07-20 11:24:09Z jakobn $
5 //
6 // Created on: <28-May-2001 11:24:41 pkej>
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/ezlist.php" );
29 // include_once( "classes/ezlocale.php" );
30 // include_once( "classes/eztemplate.php" );
31
32 // include_once( "ezquiz/classes/ezquizgame.php" );
33
34 $ini =& eZINI::instance( 'site.ini' );
35
36 $Language = $ini->variable( "eZQuizMain", "Language" );
37 $ListLimit = $ini->variable( "eZQuizMain", "ListLimit" );
38
39 $Limit = $ListLimit;
40
41 $t = new eZTemplate( "kernel/ezquiz/user/" . $ini->variable( "eZQuizMain", "TemplateDir" ),
42 "kernel/ezquiz/user/intl/", $Language, "quiz.php" );
43
44 $t->setAllStrings();
45
46 $t->set_file( array(
47 "quiz_list_page_tpl" => "quizlist.tpl"
48 ) );
49
50 $t->set_block( "quiz_list_page_tpl", "game_list_item_tpl", "game_list_item" );
51 $t->set_block( "game_list_item_tpl", "game_item_tpl", "game_item" );
52 $t->set_block( "quiz_list_page_tpl", "no_game_list_item_tpl", "no_game_list_item" );
53
54 $game = new eZQuizGame();
55 $games = $game->openGames( $Offset, $Limit );
56 $count = count( $games );
57 $locale = new eZLocale( $Language );
58
59 $t->set_var( "game_start", "" );
60 $t->set_var( "game_stop", "" );
61 $t->set_var( "game_list_item", "" );
62 $t->set_var( "no_game_list_item", "" );
63
64 if( $count >= 1 )
65 {
66 $i = 0;
67 foreach( $games as $game )
68 {
69 if ( ( $i % 2 ) == 0 )
70 {
71 $t->set_var( "td_class", "bglight" );
72 }
73 else
74 {
75 $t->set_var( "td_class", "bgdark" );
76 }
77
78 $t->set_var( "game_id", $game->id() );
79 $t->set_var( "game_name", $game->name() );
80 $t->set_var( "game_description", $game->description() );
81 $t->set_var( "game_questions", $game->numberOfQuestions() );
82 $t->set_var( "game_players", $game->numberOfPlayers() );
83 $start = $game->startDate();
84 $stop = $game->stopDate();
85
86 if( $start->day() != 0 )
87 {
88 $t->set_var( "game_start", $locale->format( $start, true ) );
89 }
90
91 if( $stop->day() != 0 )
92 {
93 $t->set_var( "game_stop", $locale->format( $stop, true ) );
94 }
95
96 $t->parse( "game_item", "game_item_tpl", true );
97 $i++;
98 }
99
100 $t->parse( "game_list_item", "game_list_item_tpl" );
101 }
102 else
103 {
104 $t->parse( "no_game_list_item", "no_game_list_item_tpl" );
105 }
106
107 eZList::drawNavigator( $t, $gameCount, $Limit, $Offset, "quiz_list_page_tpl" );
108
109 $t->pparse( "output", "quiz_list_page_tpl" );
110
111 ?>
$i
$i
Definition: admin/adlist.php:91
eZList\drawNavigator
static drawNavigator(&$t, $total_types, $max_types, $index, $parent=false, $variables=false)
Definition: ezlist.php:401
eZLocale
Definition: ezlocale.php:119
eZQuizGame
Definition: ezquizgame.php:43
eZTemplate
Definition: eztemplate.php:107
$Offset
$Offset
Definition: ezarticle/user/search.php:110
$Limit
$Limit
Definition: quizopen.php:39
$locale
$locale
Definition: quizopen.php:57
$t
$t
Definition: quizopen.php:41
$ListLimit
$ListLimit
Definition: quizopen.php:37
$game
$game
Definition: quizopen.php:54
$Language
$Language
Definition: quizopen.php:36
$games
$games
Definition: quizopen.php:55
$ini
$ini
Definition: quizopen.php:34
$count
$count
Definition: quizopen.php:56
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.