Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezquiz/user/menubox.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: menubox.php 8689 2001-12-06 10:22:35Z jhe $
5 //
6 // Created on: <17-Oct-2000 12:16:07 bf>
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/ezcachefile.php" );
29 // include_once( "classes/ezlocale.php" );
30
31 $ini = eZINI::instance( 'site.ini' );
32 $Language = $ini->variable( "eZQuizMain", "Language" );
33 $PageCaching = $ini->variable( "eZQuizMain", "PageCaching" );
34
35 createQuizMenu();
36
37 function createQuizMenu()
38 {
39 global $ini;
40 global $Language;
41 global $quizMenuCachedFile;
42 global $GenerateStaticPage;
43 global $GlobalSiteDesign;
44
45 // include_once( "classes/eztemplate.php" );
46 // include_once( "ezquiz/classes/ezquizgame.php" );
47 // include_once( "ezquiz/classes/ezquizscore.php" );
48
49 $t = new eZTemplate( "kernel/ezquiz/user/" . $ini->variable( "eZQuizMain", "TemplateDir" ),
50 "kernel/ezquiz/user/intl", $Language, "menubox.php" );
51
52 $t->setAllStrings();
53
54 $t->set_file( array(
55 "menu_box_tpl" => "menubox.tpl"
56 ) );
57
58 $t->set_block( "menu_box_tpl", "current_game_item_tpl", "current_game_item" );
59 $t->set_block( "menu_box_tpl", "next_game_item_tpl", "next_game_item" );
60 $t->set_block( "menu_box_tpl", "no_game_item_tpl", "no_game_item" );
61 $t->set_block( "menu_box_tpl", "quiz_menu_item_tpl", "quiz_menu_item" );
62 $t->set_block( "menu_box_tpl", "my_quiz_item_tpl", "my_quiz_item" );
63
64 $t->set_var( "current_game_item", "" );
65 $t->set_var( "next_game_item", "" );
66 $t->set_var( "quiz_menu_item", "" );
67 $t->set_var( "my_quiz_item", "" );
68 $t->set_var( "no_game_item", "" );
69
70 $t->set_var( "sitedesign", $GlobalSiteDesign );
71
72 $userMenuUp = false;
73
74 $game = new eZQuizGame();
75
76 if ( eZUser::currentUser() != false )
77 {
78
79 $t->parse( "my_quiz_item", "my_quiz_item_tpl" );
80 $userMenuUp = true;
81 $user =& eZUser::currentUser();
82 }
83
84 if ( true )
85 {
86 $t->parse( "quiz_menu_item", "quiz_menu_item_tpl" );
87 }
88
89 $games = $game->openGames( 0, 1 );
90 $count = count( $games );
91
92 if ( $count > 0 )
93 {
94 $game = $games[0];
95 $finished = false;
96
97 if ( $userMenuUp )
98 {
99 $score = new eZQuizScore();
100 $score->getUserGame( $user, $game );
101
102 if ( $score->isFinishedGame() )
103 {
104 $finished = true;
105 }
106 }
107
108 if ( $finished == false )
109 {
110 $t->set_var( "game_id", $game->id() );
111 $t->set_var( "game_name", $game->name() );
112 $t->parse( "current_game_item", "current_game_item_tpl" );
113 }
114
115
116 }
117
118 if ( $count == 0 || $finished )
119 {
120 $games = $game->opensNext( 0, 1 );
121 $count = count( $games );
122
123 if ( $count >= 1 )
124 {
125 $game = $games[0];
126 $t->set_var( "game_id", $game->id() );
127 $t->set_var( "game_name", $game->name() );
128
129 $start = $game->startDate();
130
131 $locale = new eZLocale( $Language );
132
133 if ( $start->day() != 0 )
134 {
135 $t->set_var( "game_start_date", $locale->format( $start, true ) );
136 }
137 $t->parse( "next_game_item", "next_game_item_tpl" );
138 }
139 else
140 {
141 $t->parse( "no_game_item", "no_game_item_tpl" );
142 }
143 }
144
145 if ( isset( $menuCacheFile ) and is_a( $menuCacheFile, "eZCacheFile" ) )
146 {
147 $output = $t->parse( "output", "menu_box_tpl" );
148 $menuCacheFile->store( $output );
149 print( $output );
150 }
151 else
152 {
153 $t->pparse( "output", "menu_box_tpl" );
154 }
155 }
156
157 ?>
$locale
$locale
Definition: admin/adlist.php:127
eZLocale
Definition: ezlocale.php:119
eZQuizGame
Definition: ezquizgame.php:43
eZQuizScore
Definition: ezquizscore.php:43
eZTemplate
Definition: eztemplate.php:107
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
$t
foreach( $Modules as $module) if(isset( $ItemInsert)) $t
Definition: classes/admin/linklist.php:168
createQuizMenu
createQuizMenu()
Definition: ezquiz/user/menubox.php:37
$Language
$Language
Definition: ezquiz/user/menubox.php:32
$ini
$ini
Definition: ezquiz/user/menubox.php:31
$PageCaching
$PageCaching
Definition: ezquiz/user/menubox.php:33
$output
$output
Definition: formpreview.php:81
$GlobalSiteDesign
global $GlobalSiteDesign
Definition: latestmessages.php:52
$count
$count
Definition: onlinetypelist.php:108
$game
$game
Definition: quizlist.php:60
$score
$score
Definition: quizlist.php:61
$games
$games
Definition: quizopen.php:55
$GenerateStaticPage
$GenerateStaticPage
Definition: quizscores.php:95
$user
$user
Definition: user/adlist.php:39
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.