Skip to content

Commit

Permalink
new icon delete_24x24px, polOdmiana returns only word, added in game …
Browse files Browse the repository at this point in the history
…loging, changed #log_reg_head to #log_head and #reg_head

changes how wynik is displayed, added for test question of the day(plain text), changes in wszechwiedzacy.js
  • Loading branch information
qmmr committed May 18, 2010
1 parent 3d267df commit 7fdc376
Show file tree
Hide file tree
Showing 14 changed files with 599 additions and 462 deletions.
145 changes: 73 additions & 72 deletions gra/index.php
Original file line number Diff line number Diff line change
@@ -1,73 +1,74 @@
<?php
require_once("../includes/initialize.php");
// zeroes stats
$session->clear_stats();
// starting the game at difficulty round 1
$_SESSION['current_round'] = 1;
?>
<?php
//$results = User::find_top_scores(); // selects the lowest score needed for getting into ranking (top 30 default)
//$btm = end($results); // lowest score in the ranking table
//echo $btm;
//print_r($results);
//echo $key = array_search($btm, $results);
?>
<?php require_once(LIB_PATH.DS."header.php"); ?>
<div id="mainContent">

<div id="startWrap" class="oknoGry">
<h2 id="menu" class="resultsBlock roundCorners menu boxShadow">Menu:</h2>
<button id="wprowadzenie" type="button" name="zasadyGry" class="ui-button ui-state-default, ui-widget-content ui-state-default ui-corner-all boxShadow menu">wprowadzenie</button>
<button id="start" type="button" name="startGame" rel="zaczynamy" class="ui-button ui-state-default, ui-widget-content ui-state-default ui-corner-all boxShadow menu">rozpocznij grę</button>
</div><!--end of #startWrap -->

<div id="loaderContainer" style="display: none">
<div id="outer">
<div id="inner">
<p>Trwa ładowanie strony ...</p>
<div class="ajaxLoader"></div>
</div>
</div>
</div><!-- ajaxLoader in special container div to be shown when ajax loads pages with vertical hack see css -->

<div id="tutorialWrap" class="oknoGry">

<div class="slideContainer">

<div class="pics">
<div class="item">
<h2>Wprowadzenie</h2>
<h4 class="text">3 rundy</h4>
<h4 class="text">pierwsza runda 5 łatwych pytań</h4>
<h4 class="text">druga runda 10 trudniejszych pytań</h4>
<h4 class="text">trzecia runda odpowiadasz do końca (Twojego lub pytań)</h4>
<h4 class="text">ilość zdobywanych punktów zależna od czasu udzielenia odpowiedzi</h4>
<h4 class="text">na odpowiedź masz 10 sekund</h4>
<h3 class="center">dalej &raquo;</h3> </div>
<div class="item">
<h4 class="text">rozpoczynasz grę z trzema szansami</h4>
<h4 class="text">udzielenie złej odpowiedzi lub nie zaznaczenie odpowiedzi skutkuje utratą jednej szansy</h4>
<h4 class="text">utrata trzeciej szansy kończy grę</h4>
<h3 class="center">dalej &raquo;</h3>
</div>
<div class="item">
<h4 class="text">aby dostać się do tabeli wszechwiedzących, musisz zdobyć więcej punktów niż osoba zajmująca ostatnie miejsce</h4>
<h4 class="text">jeśli nie jesteś zarejestrowany, możesz wpisać swój nick, jeśli masz już konto wynik zostanie zapisany automatycznie</h4>
<h4 class="text">masz możliwość analizy błędnych odpowiedzi oraz oglądnięcia swoich statystyk</h4>
<button id="tut_start" class="ui-button ui-state-default, ui-widget-content ui-state-default ui-corner-all boxShadow menu">wszystko wiem, grajmy!</button>
</div>

</div>

</div>
<div class="navi"></div>
<button id="back" title="powrót do menu" type="button" name="back"></button>

</div><!-- end of #tutorialWrap -->

<div id="quit_dialog">
<p>Czy chcesz przerwać grę?</p>
</div><!-- end of div quit -->

</div><!-- end of mainContent-->
<?php
require_once("../includes/initialize.php");
// zeroes stats
$session->clear_stats();
// starting the game at difficulty round 1
$_SESSION['current_round'] = 1;
?>
<?php
//$results = User::find_top_scores(); // selects the lowest score needed for getting into ranking (top 30 default)
//$btm = end($results); // lowest score in the ranking table
//echo $btm;
//print_r($results);
//echo $key = array_search($btm, $results);
?>
<?php require_once(LIB_PATH.DS."header.php"); ?>
<div id="mainContent">

<div id="startWrap" class="oknoGry">
<h2 id="menu" class="resultsBlock roundCorners menu boxShadow">Menu:</h2>
<button id="show_tut" type="button" class="ui-button ui-state-default, ui-widget-content ui-state-default ui-corner-all boxShadow menu">wprowadzenie</button>
<button id="start" type="button" name="startWrap" class="ui-button ui-state-default, ui-widget-content ui-state-default ui-corner-all boxShadow menu">rozpocznij grę</button>
</div><!--end of #startWrap -->

<div id="loaderContainer" style="display: none">
<div id="outer">
<div id="inner">
<p>Trwa ładowanie strony ...</p>
<div class="ajaxLoader"></div>
</div>
</div>
</div><!-- ajaxLoader in special container div to be shown when ajax loads pages with vertical hack see css -->

<div id="tutorialWrap" class="oknoGry">

<div class="slideContainer">

<div class="pics">
<div class="item">
<h2>Wprowadzenie</h2>
<h4 class="text">3 rundy</h4>
<h4 class="text">pierwsza runda 5 łatwych pytań</h4>
<h4 class="text">druga runda 10 trudniejszych pytań</h4>
<h4 class="text">trzecia runda odpowiadasz do końca (Twojego lub pytań)</h4>
<h4 class="text">ilość zdobywanych punktów zależna od czasu udzielenia odpowiedzi</h4>
<h4 class="text">na odpowiedź masz 10 sekund</h4>
<h3 class="center">dalej &raquo;</h3>
</div>
<div class="item">
<h4 class="text">rozpoczynasz grę z trzema szansami</h4>
<h4 class="text">udzielenie złej odpowiedzi lub nie zaznaczenie odpowiedzi skutkuje utratą jednej szansy</h4>
<h4 class="text">utrata trzeciej szansy kończy grę</h4>
<h3 class="center">dalej &raquo;</h3>
</div>
<div class="item">
<h4 class="text">aby dostać się do tabeli wszechwiedzących, musisz zdobyć więcej punktów niż osoba zajmująca ostatnie miejsce</h4>
<h4 class="text">jeśli nie jesteś zarejestrowany, możesz wpisać swój nick, jeśli masz już konto wynik zostanie zapisany automatycznie</h4>
<h4 class="text">masz możliwość analizy błędnych odpowiedzi oraz oglądnięcia swoich statystyk</h4>
<button id="tut_end" class="ui-button ui-state-default, ui-widget-content ui-state-default ui-corner-all boxShadow menu">wszystko wiem, grajmy!</button>
</div>

</div>

</div>
<div class="navi"></div>
<button id="back" title="powrót do menu" type="button" name="back"></button>

</div><!-- end of #tutorialWrap -->

<div id="quit_dialog">
<p>Czy chcesz przerwać grę?</p>
</div><!-- end of div quit -->

</div><!-- end of mainContent-->
<?php require_once(LIB_PATH.DS."footer.php"); ?>
Binary file added images/delete_24x24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,13 +308,13 @@ function polOdmiana($word, $num) {
$a = array('2','3','4');
$b = array('12','13','14');
if($num == 1) {
return $num . " " .$word;
return $word;
} elseif(in_array($num, $b) || in_array(($num % 100), $b)){
return $num . " " . $word . "ów";
return $word . "ów";
} elseif(in_array($num,$a) || in_array(($num % 10),$a)){
return $num . " " . $word . "y";
return $word . "y";
} else {
return $num . " " . $word . "ów";
return $word . "ów";
}
} // end pol odmiana

Expand Down
2 changes: 1 addition & 1 deletion includes/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,5 @@
?>
</p>
</div>
<?php include_once( LIB_PATH . DS . "status.php" ); // shows if user is logged ?><div class="clear_float"></div>
<?php include_once( LIB_PATH . DS . "status.php" );?><div class="clear_float"></div>
</div ><!-- end #header -->
Expand Down
37 changes: 37 additions & 0 deletions includes/in_game_login.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
require_once("initialize.php");

$perc = round(($_SESSION['odp_poprawne'] * 100) / $_SESSION['ilosc_odp']); // percentage of correct answers
$score = $_SESSION['zdobyte_punkty'];
$time = $_SESSION['question_start_time'] - $_SESSION['game_start_time'];

if(isset($_SESSION['username'])) {

$username = $_SESSION['username'];

if($score != 0 && $score >= $btm) {

$id = User::insert_new_score($score, $username, $time, $perc, $_SESSION['odp_poprawne'], $_SESSION['hashed_email']);
User::update_user_stats($username);

}

}

// selects top 50 scores
$r = User::find_top_scores(50);
// finds the position based on the points player scored
$key = array_search($score, $r) + 1;
?>
<div class="badge">
<h1>Gratulacje <?php echo $username; ?>!</h1>
<h1 class="punkty"><?php echo $score; ?>
<span><?php echo polOdmiana('punkt', $score); ?></span>
</h1>
</div>
<button id="save" title="menu główne" name="save" type="button" class="ui-button ui-state-default, ui-widget-content ui-state-default ui-corner-all menu boxShadow">powrót do menu</button>
<script>
$(function(){
$("#position").text("Miejsce: <?php echo $key;?>");
});
</script>
4 changes: 3 additions & 1 deletion includes/logowanie.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
<?php
require_once("initialize.php");
$ja = array("email" => "valid", "password" => "valid");
$ja = array("email" => "valid","password" => "valid","logged" => "false","game" => "false");

if(isset($_POST['email']) && isset($_POST['password'])) {

$email = trim(mysql_prep($_POST['email']));
$password = trim(mysql_prep($_POST['password']));
$ja['game'] = $_POST['game'];
$found_user = User::authenticate($email, $password);
if($found_user) {

if($found_user->active == 1) {

// login user if he was found in database and password is correct and active is set to 1
$session->login($found_user);
$ja['logged'] = "true";

} else {

Expand Down
2 changes: 1 addition & 1 deletion includes/pytanie.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,4 @@ function check_question ($q, $a) {
<button id="submitButton" class="ui-button ui-state-default, ui-widget-content ui-state-default ui-corner-all menu" type="submit" name="submit">Zatwierdź</button>
</div><!-- end .center_div -->
</form><!-- #odpowiedzi -->
</div><!-- #pytanieWrap -->
</div>
13 changes: 13 additions & 0 deletions includes/reg_head.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php require_once("initialize.php");?>
<p id="reg_head" class="fltrt">
<span class="login_flt">Witaj,</span>
<a href="<?php echo SITE_URL; ?>gracze" target="_self" class="login_flt"><?php echo $session->username; ?></a>
<?php if($_SESSION['admin_rights'] == 1) : ?>
<span class="login_flt">|</span>
<a class="login_flt" href="<?php echo SITE_URL; ?>admin" target="_self">admin panel</a>
<?php endif; ?>
<span class="login_flt">|</span>
<a href="<?php echo SITE_URL; ?>gracze" target="_self" class="login_flt">moje konto</a>
<span class="login_flt">|</span>
<a id="logout" class="login_flt" href="#">wyloguj się</a>
</p>
4 changes: 2 additions & 2 deletions includes/status.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// if the user is not logged in
if( !isset($_SESSION['id']) ) :
?>
<p id="log_reg_head" class="fltrt">
<p id="log_head" class="fltrt">
<a id="login" class="login_flt" href="#" target="_self">Logowanie</a>
<span class="login_flt"> | </span>
<a id="register" class="login_flt" href="#">Rejestracja</a>
Expand Down Expand Up @@ -41,7 +41,7 @@
<div class="ajaxLoader" style="display: none"></div>
</div>
<?php else : ?>
<p id="log_reg_head" class="fltrt">
<p id="reg_head" class="fltrt">
<span class="login_flt">Witaj,</span>
<a href="<?php echo SITE_URL; ?>gracze" target="_self" class="login_flt"><?php echo $session->username; ?></a>
<?php if($_SESSION['admin_rights'] == 1) : ?>
Expand Down
Loading

0 comments on commit 7fdc376

Please sign in to comment.