-
Notifications
You must be signed in to change notification settings - Fork 1
/
index_code.php
53 lines (51 loc) · 2.45 KB
/
index_code.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
$index = new Website("index","","Sokoban - A man's tale","default.css");
include "hyperlinks.php";
//------Creating the table for the rightContentDiv
$rightTable = new Table("contentRight");
$rightTable->addData("Username: ");
$rightTable->addData($_SESSION['valid_user']);
$rightTable->commitData();
$rightTable->addData("Levels Completed: ");
$rightTable->addData($database->getCompletedLevels($_SESSION['valid_user']));
$rightTable->commitData();
$rightTable->addData("Total Levels: ");
$rightTable->addData($database->getTotalLevels());
$rightTable->commitData();
$rightTable->addData("Total Players: ");
$rightTable->addData($database->getTotalPlayers());
$rightTable->commitData();
$rightTable->addData("Lead Player: ");
$rightTable->addData($database->getTopPlayer());
$rightTable->commitData();
$rightTable->finishTable();
//------Deciding which links to display
if (isset($_SESSION['valid_user'])){
$links = "$nav1l$nav2l$nav3l$nav4l$nav5l";
$rightContent = "<h3>Details</h3>".$rightTable->returnTable()."";
} else {
$links = "$nav10l$nav11l$nav11l$nav11l$nav9l";
$rightContent = "";
}
$leftContent = $database->returnRecentLevels();
//------Creating the divs
$index->createDiv("header","<h1>Sokoban - A man's tale</h1>",$index);
$index->createDiv("blankspace"," ",$index);
$index->createDiv("navBar","$links",$index);
$index->createDiv("leftContent","<h3>Recent Levels</h3>$leftContent",$index);
$index->createDiv("centerContent","<img class='sideImage' width='550px' src='images/sokoban_game.jpg'>",$index);
$index->createDiv("rightContent","$rightContent",$index);
//------Gets the value of the divs
$divHeader = $index->getDivContentByKey('header');
$divBlankSpace = $index->getDivContentByKey('blankspace');
$divNavBar = $index->getDivContentByKey('navBar');
$divLeftContainer = $index->getDivContentByKey('leftContent');
$divCenterContainer = $index->getDivContentByKey('centerContent');
$divRightContainer = $index->getDivContentByKey('rightContent');
//------Adds the links to the page
$index->createDiv("bodyContainer","$divLeftContainer$divCenterContainer$divRightContainer",$index);
$divBodyContainer = $index->getDivContentByKey('bodyContainer');
$index->createDiv("container","$divHeader$divBlankSpace$divNavBar$divBodyContainer",$index);
$divContainer = $index->getDivContentByKey('container');
$index->addContent($divContainer);
?>