Refactored a div class tag to be more general.

Added site style to the secure pages. Renamed LoginController
to SecureLoginController.
This commit is contained in:
Sean Joseph 2017-10-30 11:01:59 -04:00
parent 9a073edded
commit 2628cc8b80
10 changed files with 107 additions and 39 deletions

View File

@ -13,8 +13,7 @@ class AboutView extends View
public function page() public function page()
{ {
$body = <<<HTML $body = <<<HTML
<div class="team"> <div class="content">
<h1>Roster:</h1>
<div class="card"> <div class="card">
<h2>James Murray - Project Manager</h2> <h2>James Murray - Project Manager</h2>
<img src="assets/james_murray.jpg" height="1365" width="1372" alt="James Murray"> <img src="assets/james_murray.jpg" height="1365" width="1372" alt="James Murray">

22
lib/MinutesView.php Normal file
View File

@ -0,0 +1,22 @@
<?php
require_once "View.php";
/**
* Created by PhpStorm.
* User: sean
* Date: 10/30/17
* Time: 10:37 AM
*/
class MinutesView extends View
{
public function page(){
$body = <<<HTML
HTML;
return $body;
}
}

View File

@ -6,7 +6,7 @@
* Date: 10/29/17 * Date: 10/29/17
* Time: 6:59 PM * Time: 6:59 PM
*/ */
class LoginController class SecureLoginController
{ {
public function __construct($get, $post, $logins) public function __construct($get, $post, $logins)
{ {

33
lib/SecureLoginView.php Normal file
View File

@ -0,0 +1,33 @@
<?php
require_once "View.php";
class SecureLoginView extends View
{
public function page()
{
$body = <<<HTML
<div class="content">
<div class="card">
<form action="../post/login.php" method="post">
<fieldset>
<p>
<label for="username">Username:</label>
<input type="text" id="username" name="username" placeholder="Username">
</p>
<p>
<label for="password">Password:</label>
<input type="password" id="password" name="password" placeholder="Password">
</p>
<p><input type="submit" name="Submit" value="Submit"></p>
</fieldset>
</form>
</div>
</div>
HTML;
return $body;
}
}

View File

@ -1,4 +1,5 @@
<?php <?php
require_once "prelude.inc.php";
/** /**
* Created by PhpStorm. * Created by PhpStorm.
@ -10,19 +11,18 @@ class View
{ {
public function __construct() { public function __construct() {
$this->addNav("Home", "./"); $this->addNav("Home", ROOT);
$this->addNav("Progress", "./"); $this->addNav("Meet The Team", ROOT . "about.php");
$this->addNav("Meet The Team", "./about.php"); $this->addNav("Secure", ROOT ."secure");
$this->addNav("Course Site", "https://cse.msu.edu/~cse435/"); $this->addNav("Course Site", "https://cse.msu.edu/~cse435/");
$this->addNav("Secure", "./secure");
} }
public function head(){ public function head(){
$root = ROOT;
$html = <<<HTML $html = <<<HTML
<meta charset="utf-8"> <meta charset="UTF-8">
<title>$this->title</title> <title>$this->title</title>
<link href="./style/default.css" rel="stylesheet" type="text/css"> <link href="{$root}style/default.css" rel="stylesheet" type="text/css">
HTML; HTML;
return $html; return $html;
@ -80,6 +80,6 @@ HTML;
} }
private $links = array(); private $links = array();
private $title = "Not Set!"; protected $title = "Not Set!";
} }

View File

@ -7,9 +7,10 @@
*/ */
require_once "prelude.inc.php"; require_once "prelude.inc.php";
if(!$open){ if(!$open){
if(!isset($_SESSION[LOGIN])){ if(!isset($_SESSION[LOGIN])){
header("Location: ../secure/index.php"); header("Location: " . ROOT . "secure/index.php");
} }
} }

View File

@ -7,9 +7,9 @@
*/ */
require_once "../lib/prelude.inc.php"; require_once "../lib/prelude.inc.php";
require_once "../lib/logins.inc.php"; require_once "../lib/logins.inc.php";
require_once "../lib/LoginController.php"; require_once "../lib/SecureLoginController.php";
$controller = new LoginController($_GET,$_POST,$logins); $controller = new SecureLoginController($_GET,$_POST,$logins);
if($controller->validLogin()){ if($controller->validLogin()){

View File

@ -1,28 +1,21 @@
<!DOCTYPE html> <!DOCTYPE html>
<?php <?php
require_once "../lib/prelude.inc.php"; require_once "../lib/prelude.inc.php";
require_once "../lib/SecureLoginView.php";
$view = new SecureLoginView();
$view->setTitle("Secure Pages Login");
?> ?>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <?php
<title>Secure Pages Login</title> echo $view->head();
<link href="../style/default.css" type="text/css" rel="stylesheet"> ?>
</head> </head>
<body> <body>
<h1>Secure Pages Login</h1> <?php
<form action="../post/login.php" method="post"> echo $view->header();
<fieldset> echo $view->page();
<legend>Login</legend> echo $view->footer();
<p> ?>
<label for="username">Username:</label>
<input type="text" id="username" name="username" placeholder="Username">
</p>
<p>
<label for="password">Password:</label>
<input type="password" id="password" name="password" placeholder="Password">
</p>
<input type="submit" name="Submit" value="Submit">
</fieldset>
</form>
</body> </body>
</html> </html>

View File

@ -2,14 +2,21 @@
<?php <?php
require_once "../lib/prelude.inc.php"; require_once "../lib/prelude.inc.php";
require_once "../lib/protected.inc.php"; require_once "../lib/protected.inc.php";
require_once "../lib/MinutesView.php";
$view = new MinutesView();
$view->setTitle("Meeting Minutes");
?> ?>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <?php
<link href="../style/default.css" rel="stylesheet" type="text/css"> echo $view->head();
<title>Meeting Minutes</title> ?>
</head> </head>
<body> <body>
<h1>Meeting Minutes</h1> <?php
echo $view->header();
echo $view->page();
echo $view->footer();
?>
</body> </body>
</html> </html>

View File

@ -30,6 +30,7 @@ body {
*/ */
body{ body{
background: darkgreen; background: darkgreen;
font-family: Serif;
} }
header { header {
@ -37,6 +38,7 @@ header {
background : rgba(255,255,255,1); background : rgba(255,255,255,1);
text-align: center; text-align: center;
line-height: 3em; line-height: 3em;
border-bottom: 20px solid gray;
} }
header h1 { header h1 {
@ -74,6 +76,7 @@ div.card img{
height:400px; height:400px;
width:300px; width:300px;
border:thick solid black; border:thick solid black;
border-radius: 10px;
display:block; display:block;
padding: 5px; padding: 5px;
margin: auto; margin: auto;
@ -81,8 +84,8 @@ div.card img{
} }
div.card p{ div.card p{
padding: 0 4em; width: 400px;
margin: 0.75em 0; margin: 0.75em auto;
} }
div.card ul{ div.card ul{
@ -91,9 +94,19 @@ div.card ul{
display: block; display: block;
} }
div.team h1{ div.content h1{
font-size: 3em; font-size: 3em;
text-align: center; text-align: center;
margin: 0.75em 0; margin: 0.75em 0;
color: white; color: white;
} }
div.card form{
padding: 25px;
}
div.card form fieldset{
border: thin solid black;
text-align: center;
}