Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
SeenSeens committed Feb 25, 2019
1 parent 3d87610 commit d4f3f3a
Show file tree
Hide file tree
Showing 9 changed files with 215 additions and 0 deletions.
9 changes: 9 additions & 0 deletions private/functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
function url_for($script_path) {
// add the leading '/' if not present
if($script_path[0] != '/') {
$script_path = "/" . $script_path;
}
return WWW_ROOT . $script_path;
}
?>
22 changes: 22 additions & 0 deletions private/initialize.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
// Assign file paths to PHP constants
// __FILE__ returns the current path to this file
// dirname() returns the path to the parent directory
define("PRIVATE_PATH", dirname(__FILE__));
define("PROJECT_PATH", dirname(PRIVATE_PATH));
define("PUBLIC_PATH", PROJECT_PATH . '/public');
define("SHARED_PATH", PRIVATE_PATH . '/shared');

// Assign the root URL to a PHP constant
// * Do not need to include the domain
// * Use same document root as webserver
// * Can set a hardcoded value:
// define("WWW_ROOT", '/globe_bank/public');
// define("WWW_ROOT", '');
// * Can dynamically find everything in URL up to "/public"
$public_end = strpos($_SERVER['SCRIPT_NAME'], '/public') + 7;
$doc_root = substr($_SERVER['SCRIPT_NAME'], 0, $public_end);
define("WWW_ROOT", $doc_root);

require_once 'functions.php';
?>
5 changes: 5 additions & 0 deletions private/shared/staff_footer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<footer>
&copy; <?= date('Y');?> Globe Bank
</footer>
</body>
</html>
18 changes: 18 additions & 0 deletions private/shared/staff_header.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php if(!isset($page_title)) {$page_title = 'Staff Area'; } ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>GBI - <?= $page_title; ?></title>
<link rel="stylesheet" href="<?= url_for('/stylesheets/staff.css'); ?> " media="all">
</head>
<body>
<header>
<h1>GBI Staff Area</h1>
</header>

<navigation>
<ul>
<li><a href="<?= url_for('/staff/index.php'); ?>">Menu</a></li>
</ul>
</navigation>
12 changes: 12 additions & 0 deletions public/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Globe Bank</title>
</head>
<body>
<h1>Globe Bank: Coming Soon</h1>
</body>
</html>
14 changes: 14 additions & 0 deletions public/staff/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php require_once '../../private/initialize.php'; ?>
<?php $page_title = 'Staff Menu';?>
<?php include SHARED_PATH.'/staff_header.php'; ?>
<div id="content">
<div id="main-menu">
<h2>Main Menu</h2>
<ul>
<li><a href="subjects/index.php">Subjects</a></li>
</ul>
</div>
</div>
<?php include SHARED_PATH.'/staff_footer.php'; ?>


Empty file added public/staff/pages/indexs.php
Empty file.
5 changes: 5 additions & 0 deletions public/staff/subjects/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php require_once '../../../private/initialize.php'; ?>
<?php $page_title = 'Subjects'; ?>
<?php include SHARED_PATH.'/staff_header.php'; ?>
<div id="content"></div>
<?php include SHARED_PATH.'/staff_footer.php'; ?>
130 changes: 130 additions & 0 deletions public/stylesheets/staff.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
html {
height: 100%;
width: 100%;
}

body {
height: 980px;
width: 100%;
margin: 0;
padding: 0;
}

header {
width: 980px;
height: 40px;
margin: 0 0 10px 0;
padding: 0;
background: #0055DD;
color: white;
}

header h1 {
margin: 0;
padding: 5px;
font-size: 20px;
font-family: Verdana, Arial, Helvetica, sans-serif;
text-align: center;
}

navigation {
width: 980px;
margin: 0;
padding: 0;
text-align: center;
}

navigation ul {
width: 980px;
list-style: none;
padding: 0;
margin: 0;
}

navigation ul li {
display: inline;
margin-right: 1em;
}

#content {
width: 920px;
min-height: 500px;
padding: 0 30px;
}

footer {
width: 940px;
height: 20px;
margin: 0 0 10px 0;
padding: 10px 20px;
background: #0055DD;
color: white;
}

/* Actions */

.actions {
margin-bottom: 1em;
}


/* Lists */

table {
border-collapse: collapse;
vertical-align: top;
}

table.list {
width: 100%;
}

table.list tr td {
border: 1px solid #999999;
}

table.list tr th {
border: 1px solid #0055DD;
background: #0055DD;
color: white;
text-align: left;
}

/* Forms */

dl {
clear: both;
overflow: hidden;
margin: 0.5em 0;
}

dt {
float: left;
font-weight: bold;
width: 125px;
}

dd {
float: left;
margin-left: 1em;
}

#operations {
clear: both;
margin: 1em 0 1em 75px;
}

/* Errors */

.errors {
display: inline-block;
border: 2px solid red;
color: red;
padding: 1em;
margin-bottom: 1em;
}

.errors ul {
margin-bottom: 0;
padding-left: 1em;
}

0 comments on commit d4f3f3a

Please sign in to comment.