First Local Commit - After Clean up.

Signed-off-by: Rick Hays <rhays@haysgang.com>
This commit is contained in:
2019-12-02 14:54:38 -06:00
commit 10412ab7f6
486 changed files with 123242 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
<?php
use CodeIgniter\CLI\CLI;
CLI::error('ERROR: ' . $code);
CLI::write($message);
CLI::newLine();

View File

@@ -0,0 +1,17 @@
An uncaught Exception was encountered
Type: <?= get_class($exception), "\n"; ?>
Message: <?= $message, "\n"; ?>
Filename: <?= $exception->getFile(), "\n"; ?>
Line Number: <?= $exception->getLine(); ?>
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === true): ?>
Backtrace:
<?php foreach ($exception->getTrace() as $error): ?>
<?php if (isset($error['file'])): ?>
<?= trim('-' . $error['line'] . ' - ' . $error['file'] . '::' . $error['function']) . "\n" ?>
<?php endif ?>
<?php endforeach ?>
<?php endif ?>

View File

@@ -0,0 +1,5 @@
<?php
// On the CLI, we still want errors in productions
// so just use the exception template.
include __DIR__ . '/error_exception.php';

View File

@@ -0,0 +1,176 @@
body {
height: 100%;
background: #fafafa;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #777;
font-weight: 300;
margin: 0;
padding: 0;
}
h1 {
font-weight: lighter;
letter-spacing: 0.8;
font-size: 3rem;
color: #222;
margin: 0;
}
h1.headline {
margin-top: 20%;
font-size: 5rem;
}
.text-center {
text-align: center;
}
p.lead {
font-size: 1.6rem;
}
.container {
max-width: 75rem;
margin: 0 auto;
padding: 1rem;
}
.header {
background: #85271f;
color: #fff;
}
.header h1 {
color: #fff;
}
.header p {
font-size: 1.2rem;
margin: 0;
line-height: 2.5;
}
.header a {
color: rgba(255,255,255,0.5);
margin-left: 2rem;
display: none;
text-decoration: none;
}
.header:hover a {
display: inline;
}
.footer .container {
border-top: 1px solid #e7e7e7;
margin-top: 1rem;
text-align: center;
}
.source {
background: #333;
color: #c7c7c7;
padding: 0.5em 1em;
border-radius: 5px;
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
margin: 0;
}
.source span.line {
line-height: 1.4;
}
.source span.line .number {
color: #666;
}
.source .line .highlight {
display: block;
background: #555;
color: #fff;
}
.source span.highlight .number {
color: #fff;
}
.tabs {
list-style: none;
list-style-position: inside;
margin: 0;
padding: 0;
margin-bottom: -1px;
}
.tabs li {
display: inline;
}
.tabs a:link,
.tabs a:visited {
padding: 0rem 1rem;
line-height: 2.7;
text-decoration: none;
color: #a7a7a7;
background: #f1f1f1;
border: 1px solid #e7e7e7;
border-bottom: 0;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
display: inline-block;
}
.tabs a:hover {
background: #e7e7e7;
border-color: #e1e1e1;
}
.tabs a.active {
background: #fff;
}
.tab-content {
background: #fff;
border: 1px solid #efefef;
}
.content {
padding: 1rem;
}
.hide {
display: none;
}
.alert {
margin-top: 2rem;
display: block;
text-align: center;
line-height: 3.0;
background: #d9edf7;
border: 1px solid #bcdff1;
border-radius: 5px;
color: #31708f;
}
ul, ol {
line-height: 1.8;
}
table {
width: 100%;
overflow: hidden;
}
th {
text-align: left;
border-bottom: 1px solid #e7e7e7;
padding-bottom: 0.5rem;
}
td {
padding: 0.2rem 0.5rem 0.2rem 0;
}
tr:hover td {
background: #f1f1f1;
}
td pre {
white-space: pre-wrap;
}
.trace a {
color: inherit;
}
.trace table {
width: auto;
}
.trace tr td:first-child {
min-width: 5em;
font-weight: bold;
}
.trace td {
background: #e7e7e7;
padding: 0 1rem;
}
.trace td pre {
margin: 0;
}
.args {
display: none;
}

View File

@@ -0,0 +1,127 @@
//--------------------------------------------------------------------
// Tabs
//--------------------------------------------------------------------
var tabLinks = new Array();
var contentDivs = new Array();
function init ()
{
// Grab the tab links and content divs from the page
var tabListItems = document.getElementById('tabs').childNodes;
console.log(tabListItems);
for (var i = 0; i < tabListItems.length; i ++)
{
if (tabListItems[i].nodeName == "LI")
{
var tabLink = getFirstChildWithTagName(tabListItems[i], 'A');
var id = getHash(tabLink.getAttribute('href'));
tabLinks[id] = tabLink;
contentDivs[id] = document.getElementById(id);
}
}
// Assign onclick events to the tab links, and
// highlight the first tab
var i = 0;
for (var id in tabLinks)
{
tabLinks[id].onclick = showTab;
tabLinks[id].onfocus = function () { this.blur() };
if (i == 0)
{
tabLinks[id].className = 'active';
}
i ++;
}
// Hide all content divs except the first
var i = 0;
for (var id in contentDivs)
{
if (i != 0)
{
console.log(contentDivs[id]);
contentDivs[id].className = 'content hide';
}
i ++;
}
}
//--------------------------------------------------------------------
function showTab ()
{
var selectedId = getHash(this.getAttribute('href'));
// Highlight the selected tab, and dim all others.
// Also show the selected content div, and hide all others.
for (var id in contentDivs)
{
if (id == selectedId)
{
tabLinks[id].className = 'active';
contentDivs[id].className = 'content';
}
else
{
tabLinks[id].className = '';
contentDivs[id].className = 'content hide';
}
}
// Stop the browser following the link
return false;
}
//--------------------------------------------------------------------
function getFirstChildWithTagName (element, tagName)
{
for (var i = 0; i < element.childNodes.length; i ++)
{
if (element.childNodes[i].nodeName == tagName)
{
return element.childNodes[i];
}
}
}
//--------------------------------------------------------------------
function getHash (url)
{
var hashPos = url.lastIndexOf('#');
return url.substring(hashPos + 1);
}
//--------------------------------------------------------------------
function toggle (elem)
{
elem = document.getElementById(elem);
if (elem.style && elem.style['display'])
{
// Only works with the "style" attr
var disp = elem.style['display'];
}
else if (elem.currentStyle)
{
// For MSIE, naturally
var disp = elem.currentStyle['display'];
}
else if (window.getComputedStyle)
{
// For most other browsers
var disp = document.defaultView.getComputedStyle(elem, null).getPropertyValue('display');
}
// Toggle the state of the "display" style
elem.style.display = disp == 'block' ? 'none' : 'block';
return false;
}

View File

@@ -0,0 +1,84 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>404 Page Not Found</title>
<style>
div.logo {
height: 200px;
width: 155px;
display: inline-block;
opacity: 0.08;
position: absolute;
top: 2rem;
left: 50%;
margin-left: -73px;
}
body {
height: 100%;
background: #fafafa;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #777;
font-weight: 300;
}
h1 {
font-weight: lighter;
letter-spacing: 0.8;
font-size: 3rem;
margin-top: 0;
margin-bottom: 0;
color: #222;
}
.wrap {
max-width: 1024px;
margin: 5rem auto;
padding: 2rem;
background: #fff;
text-align: center;
border: 1px solid #efefef;
border-radius: 0.5rem;
position: relative;
}
pre {
white-space: normal;
margin-top: 1.5rem;
}
code {
background: #fafafa;
border: 1px solid #efefef;
padding: 0.5rem 1rem;
border-radius: 5px;
display: block;
}
p {
margin-top: 1.5rem;
}
.footer {
margin-top: 2rem;
border-top: 1px solid #efefef;
padding: 1em 2em 0 2em;
font-size: 85%;
color: #999;
}
a:active,
a:link,
a:visited {
color: #dd4814;
}
</style>
</head>
<body>
<div class="wrap">
<h1>404 - File Not Found</h1>
<p>
<?php if (! empty($message) && $message !== '(null)') : ?>
<?= esc($message) ?>
<?php else : ?>
Sorry! Cannot seem to find the page you were looking for.
<?php endif ?>
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,401 @@
<?php $error_id = uniqid('error', true); ?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="robots" content="noindex">
<title><?= htmlspecialchars($title, ENT_SUBSTITUTE, 'UTF-8') ?></title>
<style type="text/css">
<?= preg_replace('#[\r\n\t ]+#', ' ', file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'debug.css')) ?>
</style>
<script type="text/javascript">
<?= file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'debug.js') ?>
</script>
</head>
<body onload="init()">
<!-- Header -->
<div class="header">
<div class="container">
<h1><?= htmlspecialchars($title, ENT_SUBSTITUTE, 'UTF-8'), ($exception->getCode() ? ' #' . $exception->getCode() : '') ?></h1>
<p>
<?= $exception->getMessage() ?>
<a href="https://www.google.com/search?q=<?= urlencode($title . ' ' . preg_replace('#\'.*\'|".*"#Us', '', $exception->getMessage())) ?>"
rel="noreferrer" target="_blank">search &rarr;</a>
</p>
</div>
</div>
<!-- Source -->
<div class="container">
<p><b><?= static::cleanPath($file, $line) ?></b> at line <b><?= $line ?></b></p>
<?php if (is_file($file)) : ?>
<div class="source">
<?= static::highlightFile($file, $line, 15); ?>
</div>
<?php endif; ?>
</div>
<div class="container">
<ul class="tabs" id="tabs">
<li><a href="#backtrace">Backtrace</a></li>
<li><a href="#server">Server</a></li>
<li><a href="#request">Request</a></li>
<li><a href="#response">Response</a></li>
<li><a href="#files">Files</a></li>
<li><a href="#memory">Memory</a></li>
</li>
</ul>
<div class="tab-content">
<!-- Backtrace -->
<div class="content" id="backtrace">
<ol class="trace">
<?php foreach ($trace as $index => $row) : ?>
<li>
<p>
<!-- Trace info -->
<?php if (isset($row['file']) && is_file($row['file'])) :?>
<?php
if (isset($row['function']) && in_array($row['function'], ['include', 'include_once', 'require', 'require_once']))
{
echo $row['function'] . ' ' . static::cleanPath($row['file']);
}
else
{
echo static::cleanPath($row['file']) . ' : ' . $row['line'];
}
?>
<?php else : ?>
{PHP internal code}
<?php endif; ?>
<!-- Class/Method -->
<?php if (isset($row['class'])) : ?>
&nbsp;&nbsp;&mdash;&nbsp;&nbsp;<?= $row['class'] . $row['type'] . $row['function'] ?>
<?php if (! empty($row['args'])) : ?>
<?php $args_id = $error_id . 'args' . $index ?>
( <a href="#" onclick="return toggle('<?= $args_id ?>');">arguments</a> )
<div class="args" id="<?= $args_id ?>">
<table cellspacing="0">
<?php
$params = null;
// Reflection by name is not available for closure function
if (substr( $row['function'], -1 ) !== '}')
{
$mirror = isset( $row['class'] ) ? new \ReflectionMethod( $row['class'], $row['function'] ) : new \ReflectionFunction( $row['function'] );
$params = $mirror->getParameters();
}
foreach ($row['args'] as $key => $value) : ?>
<tr>
<td><code><?= htmlspecialchars(isset($params[$key]) ? '$' . $params[$key]->name : "#$key", ENT_SUBSTITUTE, 'UTF-8') ?></code></td>
<td><pre><?= print_r($value, true) ?></pre></td>
</tr>
<?php endforeach ?>
</table>
</div>
<?php else : ?>
()
<?php endif; ?>
<?php endif; ?>
<?php if (! isset($row['class']) && isset($row['function'])) : ?>
&nbsp;&nbsp;&mdash;&nbsp;&nbsp; <?= $row['function'] ?>()
<?php endif; ?>
</p>
<!-- Source? -->
<?php if (isset($row['file']) && is_file($row['file']) && isset($row['class'])) : ?>
<div class="source">
<?= static::highlightFile($row['file'], $row['line']) ?>
</div>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ol>
</div>
<!-- Server -->
<div class="content" id="server">
<?php foreach (['_SERVER', '_SESSION'] as $var) : ?>
<?php if (empty($GLOBALS[$var]) || ! is_array($GLOBALS[$var]))
{
continue;
} ?>
<h3>$<?= $var ?></h3>
<table>
<thead>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php foreach ($GLOBALS[$var] as $key => $value) : ?>
<tr>
<td><?= htmlspecialchars($key, ENT_IGNORE, 'UTF-8') ?></td>
<td>
<?php if (is_string($value)) : ?>
<?= htmlspecialchars($value, ENT_SUBSTITUTE, 'UTF-8') ?>
<?php else: ?>
<?= '<pre>' . print_r($value, true) ?>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endforeach ?>
<!-- Constants -->
<?php $constants = get_defined_constants(true); ?>
<?php if (! empty($constants['user'])) : ?>
<h3>Constants</h3>
<table>
<thead>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php foreach ($constants['user'] as $key => $value) : ?>
<tr>
<td><?= htmlspecialchars($key, ENT_IGNORE, 'UTF-8') ?></td>
<td>
<?php if (! is_array($value) && ! is_object($value)) : ?>
<?= htmlspecialchars($value, ENT_SUBSTITUTE, 'UTF-8') ?>
<?php else: ?>
<?= '<pre>' . print_r($value, true) ?>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
<!-- Request -->
<div class="content" id="request">
<?php $request = \Config\Services::request(); ?>
<table>
<tbody>
<tr>
<td style="width: 10em">Path</td>
<td><?= $request->uri ?></td>
</tr>
<tr>
<td>HTTP Method</td>
<td><?= $request->getMethod(true) ?></td>
</tr>
<tr>
<td>IP Address</td>
<td><?= $request->getIPAddress() ?></td>
</tr>
<tr>
<td style="width: 10em">Is AJAX Request?</td>
<td><?= $request->isAJAX() ? 'yes' : 'no' ?></td>
</tr>
<tr>
<td>Is CLI Request?</td>
<td><?= $request->isCLI() ? 'yes' : 'no' ?></td>
</tr>
<tr>
<td>Is Secure Request?</td>
<td><?= $request->isSecure() ? 'yes' : 'no' ?></td>
</tr>
<tr>
<td>User Agent</td>
<td><?= $request->getUserAgent()->getAgentString() ?></td>
</tr>
</tbody>
</table>
<?php $empty = true; ?>
<?php foreach (['_GET', '_POST', '_COOKIE'] as $var) : ?>
<?php if (empty($GLOBALS[$var]) || ! is_array($GLOBALS[$var]))
{
continue;
} ?>
<?php $empty = false; ?>
<h3>$<?= $var ?></h3>
<table style="width: 100%">
<thead>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php foreach ($GLOBALS[$var] as $key => $value) : ?>
<tr>
<td><?= htmlspecialchars($key, ENT_IGNORE, 'UTF-8') ?></td>
<td>
<?php if (! is_array($value) && ! is_object($value)) : ?>
<?= htmlspecialchars($value, ENT_SUBSTITUTE, 'UTF-8') ?>
<?php else: ?>
<?= '<pre>' . print_r($value, true) ?>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endforeach ?>
<?php if ($empty) : ?>
<div class="alert">
No $_GET, $_POST, or $_COOKIE Information to show.
</div>
<?php endif; ?>
<?php $headers = $request->getHeaders(); ?>
<?php if (! empty($headers)) : ?>
<h3>Headers</h3>
<table>
<thead>
<tr>
<th>Header</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php foreach ($headers as $name => $value) : ?>
<?php if (empty($value))
{
continue;
} ?>
<?php if (! is_array($value))
{
$value = [$value];
} ?>
<?php foreach ($value as $h) : ?>
<tr>
<td><?= esc($h->getName(), 'html') ?></td>
<td><?= esc($h->getValueLine(), 'html') ?></td>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
<!-- Response -->
<?php
$response = \Config\Services::response();
$response->setStatusCode(http_response_code());
?>
<div class="content" id="response">
<table>
<tr>
<td style="width: 15em">Response Status</td>
<td><?= $response->getStatusCode() . ' - ' . $response->getReason() ?></td>
</tr>
</table>
<?php $headers = $response->getHeaders(); ?>
<?php if (! empty($headers)) : ?>
<?php natsort($headers) ?>
<h3>Headers</h3>
<table>
<thead>
<tr>
<th>Header</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php foreach ($headers as $name => $value) : ?>
<tr>
<td><?= esc($name, 'html') ?></td>
<td><?= esc($response->getHeaderLine($name), 'html') ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
<!-- Files -->
<div class="content" id="files">
<?php $files = get_included_files(); ?>
<ol>
<?php foreach ($files as $file) :?>
<li><?= htmlspecialchars( static::cleanPath($file), ENT_SUBSTITUTE, 'UTF-8') ?></li>
<?php endforeach ?>
</ol>
</div>
<!-- Memory -->
<div class="content" id="memory">
<table>
<tbody>
<tr>
<td>Memory Usage</td>
<td><?= static::describeMemory(memory_get_usage(true)) ?></td>
</tr>
<tr>
<td style="width: 12em">Peak Memory Usage:</td>
<td><?= static::describeMemory(memory_get_peak_usage(true)) ?></td>
</tr>
<tr>
<td>Memory Limit:</td>
<td><?= ini_get('memory_limit') ?></td>
</tr>
</tbody>
</table>
</div>
</div> <!-- /tab-content -->
</div> <!-- /container -->
<div class="footer">
<div class="container">
<p>
Displayed at <?= date('H:i:sa') ?> &mdash;
PHP: <?= phpversion() ?> &mdash;
CodeIgniter: <?= \CodeIgniter\CodeIgniter::CI_VERSION ?>
</p>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,25 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="robots" content="noindex">
<title>Whoops!</title>
<style type="text/css">
<?= preg_replace('#[\r\n\t ]+#', ' ', file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'debug.css')) ?>
</style>
</head>
<body>
<div class="container text-center">
<h1 class="headline">Whoops!</h1>
<p class="lead">We seem to have hit a snag. Please try again later...</p>
</div>
</body>
</html>

40
app/Views/game.php Normal file
View File

@@ -0,0 +1,40 @@
<?php namespace App\Views;
/******************************************************************************************************************
* RPSLS - Rock, Paper, Scissors, Lizard, Spock Game
*
* @file app/views/game.php
* @package App\Views
* @description
* View - Opening (Main) Page for program.
* @author Rick Hays
* @date 11/15/2019
* @license MIT
* @copyright Copyright © 2019 - Rick Hays, All Rights Reserved.
*
* Revisions:
* YYYY-MM-DD XX Description
******************************************************************************************************************/
?>
<!-- Begin page content -->
<main role="main" class="flex-shrink-0">
<div class="container">
<h1 class="mt-5">Rock, Paper, Scissors, Lizard, Spock Game</h1>
<p class="lead">Try your luck at how many times you can beat the computer.</p>
<img src="assets/imgs/rpsls.gif">
<p>Here are the rules:</p>
<ul>
<li>Rock crushes lizard</li>
<li>Rock crushes scissors</li>
<li>Paper covers rock</li>
<li>Paper disproves Spock</li>
<li>Scissors cuts paper</li>
<li>Scissors decapitates lizard</li>
<li>Lizard poisons Spock</li>
<li>Lizard eats paper</li>
<li>Spock smashes scissors</li>
<li>Spock vaporizes rock</li>
</ul>
<p>&nbsp;</p>
<a href="play" class="btn btn-outline-dark btn-lg" role="button" aria-pressed="true">Play Game!</a>
</div>
</main>

38
app/Views/getUser.php Normal file
View File

@@ -0,0 +1,38 @@
<?php namespace App\Views;
/******************************************************************************************************************
* RPSLS - Rock, Paper, Scissors, Lizard, Spock Game
*
* @file app/views/getUser.php
* @package App\Views
* @description
* View - Form Page to get User Name.
* @author Rick Hays
* @date 11/15/2019
* @license MIT
* @copyright Copyright © 2019 - Rick Hays, All Rights Reserved.
*
* Revisions:
* YYYY-MM-DD XX Description
******************************************************************************************************************/
?>
<!-- Begin page content -->
<main role="main" class="flex-shrink-0">
<div class="container">
<h1 class="mt-5">Rock, Paper, Scissors, Lizard, Spock Game</h1>
<p class="lead">Try your luck at how many times you can beat the computer.</p>
<p>&nbsp;</p>
<div id="getuser">
<div class="boxerror bg-warning text-dark"><?=$ErrorCode?></div>
<p>&nbsp;</p>
<p> Before we start playing lets get a user name to keep track of your score and for the Top 10 list.</p>
<form class="mt-2 mt-md-0">
<input id="UserName" class="form-control mr-sm-2" type="text" value="<?=$UserName?>" placeholder="User Name - only (a-z, A-Z, 0-9, _ - @) are allowed." aria-label="User Name">
<br>
<button class="btn btn-outline-dark my-2 my-sm-0" type="button" onclick="submitUserName()">Submit</button>
</form>
</div>
</div>
</main>

28
app/Views/inc/footer.php Normal file
View File

@@ -0,0 +1,28 @@
<?php namespace App\Views\inc;
/******************************************************************************************************************
* RPSLS - Rock, Paper, Scissors, Lizard, Spock Game
*
* @file app/views/inc/footer.php
* @package App\Views\inc
* @description
* View - Footer portion of the Main View Pages. Includes Javascript Loads
* @author Rick Hays
* @date 11/15/2019
* @license MIT
* @copyright Copyright © 2019 - Rick Hays, All Rights Reserved.
*
* Revisions:
* YYYY-MM-DD XX Description
******************************************************************************************************************/
?>
<footer id="footer" class="footer mt-auto py-3">
<div class="container">
<span class="text-muted">Copywrite &copy; 2019 - Rick Hays, All Rights Reserved.</span>
<?php echo (ENVIRONMENT === 'development') ? '<br> <span class="text-muted">Page rendered in {elapsed_time} seconds. Environment: ' . ENVIRONMENT . '</span>' : ''; ?>
</div>
</footer>
<script src="assets/js/jquery/jquery-3.4.1.min.js"></script>
<script src="assets/js/bootstrap/bootstrap.bundle.min.js"></script>
<script src="assets/js/game.js"></script>
</body>
</html>

31
app/Views/inc/head.php Normal file
View File

@@ -0,0 +1,31 @@
<?php namespace App\Views\inc;
/******************************************************************************************************************
* RPSLS - Rock, Paper, Scissors, Lizard, Spock Game
*
* @file app/views/inc/head.php
* @package App\Views\inc
* @description
* View - Head portion of the Main View Pages. Includes Meta and CSS Loads.
* @author Rick Hays
* @date 11/15/2019
* @license MIT
* @copyright Copyright © 2019 - Rick Hays, All Rights Reserved.
*
* Revisions:
* YYYY-MM-DD XX Description
******************************************************************************************************************/
?>
<!DOCTYPE html>
<html lang="en" class="h-100">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Rock, Paper, Scissors, Lizard, Spock</title>
<meta name="description"
content="Simple game of Rock, Paper, Scissors, Lizard, Spock. Written in HTML and Javascript">
<meta name="author" content="Rick Hays">
<link href="assets/css/bootstrap/bootstrap.min.css" rel="stylesheet">
<link href="assets/css/sticky-footer-navbar.css" rel="stylesheet">
<link href="assets/css/game.css" rel="stylesheet">
</head>
<body class="d-flex flex-column h-100">

40
app/Views/inc/header.php Normal file
View File

@@ -0,0 +1,40 @@
<?php namespace App\Views\inc;
/******************************************************************************************************************
* RPSLS - Rock, Paper, Scissors, Lizard, Spock Game
*
* @file app/views/inc/header.php
* @package App\Views\inc
* @description
* View - Header portion of the Main View Pages. Includes Page Header with Nav Bar.
* @author Rick Hays
* @date 11/15/2019
* @license MIT
* @copyright Copyright © 2019 - Rick Hays, All Rights Reserved.
*
* Revisions:
* YYYY-MM-DD XX Description
******************************************************************************************************************/
?>
<header>
<!-- Fixed navbar -->
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
<a class="navbar-brand" href="/">R.P.S.L.S Game</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav mr-auto">
<?php echo ($page === '') ? '<li class="nav-item active">' : '<li class="nav-item">'; ?>
<a class="nav-link" href="/">Home <span class="sr-only">(current)</span></a>
</li>
<?php echo ($page === 'play') ? '<li class="nav-item active">' : '<li class="nav-item">'; ?>
<a class="nav-link" href="play">Play Game</a>
</li>
<?php echo ($page === 'top10') ? '<li class="nav-item active">' : '<li class="nav-item">'; ?>
<a class="nav-link" href="top10">Top 10 Scores</a>
</li>
</ul>
</div>
</nav>
</header>

70
app/Views/play.php Normal file
View File

@@ -0,0 +1,70 @@
<?php namespace App\Views;
/******************************************************************************************************************
* RPSLS - Rock, Paper, Scissors, Lizard, Spock Game
*
* @file app/views/play.php
* @package App\Views
* @description
* View - Main game play page, where all the action is.
* @author Rick Hays
* @date 11/15/2019
* @license MIT
* @copyright Copyright © 2019 - Rick Hays, All Rights Reserved.
*
* Revisions:
* YYYY-MM-DD XX Description
******************************************************************************************************************/
?>
<!-- Begin page content -->
<main role="main" class="flex-shrink-0">
<div class="container">
<h2 class="mt-5">Rock, Paper, Scissors, Lizard, Spock Game</h2>
<p class="lead"><?= $UserName ?>, try your luck at how many times you can beat the computer.</p>
<p>&nbsp;</p>
<div id="game">
<div class="row">
<div class="column"><span class="columnspanCountHeader bg-primary text-white">Wins</span></div>
<div class="column"><span class="columnspanCountHeader bg-primary text-white">Loses</span></div>
<div class="column"><span class="columnspanCountHeader bg-primary text-white">Ties</span></div>
</div>
<div class="row">
<div id="totalWins" class="column"><?= $Wins ?></div>
<div id="totalLoses" class="column"><?= $Loses ?></div>
<div id="totalTies" class="column"><?= $Ties ?></div>
</div>
<p>&nbsp;</p>
<button type="button" id="Rock" class="gameButton btn btn-primary btn-lg btn-block">ROCK</button>
<button type="button" id="Paper" class="gameButton btn btn-primary btn-lg btn-block">PAPER</button>
<button type="button" id="Scissors" class="gameButton btn btn-primary btn-lg btn-block">SCISSORS</button>
<button type="button" id="Lizard" class="gameButton btn btn-primary btn-lg btn-block">LIZARD</button>
<button type="button" id="Spock" class="gameButton btn btn-primary btn-lg btn-block">SPOCK</button>
</div>
<p>&nbsp;</p>
<div id="RPSLS">
<span id="textRock" style="display:none;"> <h2>Rock... </h2></span>
<span id="textPaper" style="display:none;"> <h2>Paper... </h2></span>
<span id="textScissors" style="display:none;"> <h2>Scissors... </h2></span>
<span id="textLizard" style="display:none;"> <h2>Lizard... </h2></span>
<span id="textSpock" style="display:none;"> <h2>Spock... </h2></span>
<span id="textComputerHas" style="display:none;"> <h2>... COMPUTER HAS ...</h2></span>
<span id="textComputerPick" style="display:none" class="text-primary"> <h2> </h2></span>
<p>&nbsp;</p>
<span id="textWinLoseTie" style="display:none"> <h2> </h2></span>
<p>&nbsp;</p>
<div class="row">
<div class="column">
<span class="columnspanTryAgain">
<button id="btnTryAgain" type="button" style="display:none;" class="btn btn-primary btn-block">Try Agian.</button>
</span>
</div>
<div class="column">
<span class="columnspanNoThanks">
<button id="btnNoThanks" type="button" style="display:none;" class="btn btn-primary btn-block">No Way.</button>
</span>
</div>
</div>
<p>&nbsp;</p>
</div>
</div>
</main>

193
app/Views/top10.php Normal file
View File

@@ -0,0 +1,193 @@
<?php namespace App\Views;
/******************************************************************************************************************
* RPSLS - Rock, Paper, Scissors, Lizard, Spock Game
*
* @file app/views/top10.php
* @package App\Views
* @description
* View - Score page for the game.
* @author Rick Hays
* @date 11/15/2019
* @license MIT
* @copyright Copyright © 2019 - Rick Hays, All Rights Reserved.
*
* Revisions:
* YYYY-MM-DD XX Description
******************************************************************************************************************/
?>
<!-- Begin page content -->
<main role="main" class="flex-shrink-0">
<div class="container">
<h1 class="mt-5">Rock, Paper, Scissors, Lizard, Spock Game</h1>
<h2 class="lead">Top 10 Scores</h2>
<p>&nbsp;</p>
<!-- GAME TOTALS ------------------------------------------------------------------------------------------- -->
<div class="table-responsive-sm">
<table class="table table-sm table-striped table-bordered">
<thead class="thead-dark">
<tr>
<th colspan="4" class="text-center bg-primary">Game Totals</th>
</tr>
<tr>
<th scope="col"></th>
<th scope="col">Wins</th>
<th scope="col">Loses</th>
<th scope="col">Total</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Player</th>
<td><?= $TotalWinsPlayer->Total ?> </td>
<td><?= $TotalLosesPlayer->Total ?> </td>
<td>&nbsp;</td>
</tr>
<tr>
<th scope="row">Computer</th>
<td><?= $TotalLosesPlayer->Total ?></td>
<td><?= $TotalWinsPlayer->Total ?></td>
<td>&nbsp;</td>
</tr>
<tr>
<th scope="row">Ties</th>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><?= $TotalTiesPlayer->Total ?> </td>
</tr>
<tr>
<th scope="row">Total Plays</th>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><?= $TotalPlays->Total ?> </td>
</tr>
</tbody>
</table>
</div>
<p>&nbsp;</p>
<!-- TOP 10 WINNERS ---------------------------------------------------------------------------------------- -->
<div class="table-responsive-sm">
<table class="table table-sm table-striped table-bordered">
<thead class="thead-dark">
<tr><th colspan="3" class="text-center bg-primary">Top 10 Winners</th></tr>
<tr>
<th scope="col">Rank</th>
<th scope="col">User Name</th>
<th scope="col">Points</th>
</tr>
</thead>
<tbody>
<?php foreach ($Win10 as $record => $fields):?>
<tr>
<th scope="row"><?= ($record + 1) ?></th>
<?php foreach ($fields as $field => $value):?>
<td><?= $value ?></td>
<?php endforeach;?>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
<p>&nbsp;</p>
<!-- TOP 10 LOSERS ----------------------------------------------------------------------------------------- -->
<div class="table-responsive-sm">
<table class="table table-sm table-striped table-bordered">
<thead class="thead-dark">
<tr><th colspan="3" class="text-center bg-primary">Top 10 Losers</th></tr>
<tr>
<th scope="col">Rank</th>
<th scope="col">User Name</th>
<th scope="col">Points</th>
</tr>
</thead>
<tbody>
<?php foreach ($Lose10 as $record => $fields):?>
<tr>
<th scope="row"><?= ($record + 1) ?></th>
<?php foreach ($fields as $field => $value):?>
<td><?= $value ?></td>
<?php endforeach;?>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
<p>&nbsp;</p>
<!-- TOP 10 TIES ------------------------------------------------------------------------------------------- -->
<div class="table-responsive-sm">
<table class="table table-sm table-striped table-bordered">
<thead class="thead-dark">
<tr><th colspan="3" class="text-center bg-primary">Top 10 Ties</th></tr>
<tr>
<th scope="col">Rank</th>
<th scope="col">User Name</th>
<th scope="col">Points</th>
</tr>
</thead>
<tbody>
<?php foreach ($Tie10 as $record => $fields):?>
<tr>
<th scope="row"><?= ($record + 1) ?></th>
<?php foreach ($fields as $field => $value):?>
<td><?= $value ?></td>
<?php endforeach;?>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
<p>&nbsp;</p>
<!-- TOP PLAYER PICKS -------------------------------------------------------------------------------------- -->
<div class="table-responsive-sm">
<table class="table table-sm table-striped table-bordered">
<thead class="thead-dark">
<tr><th colspan="3" class="text-center bg-primary">Top Player Picks</th></tr>
<tr>
<th scope="col">Rank</th>
<th scope="col">Pick</th>
<th scope="col">Count</th>
</tr>
</thead>
<tbody>
<?php foreach ($PlayerPicks as $record => $fields):?>
<tr>
<th scope="row"><?= ($record + 1) ?></th>
<?php foreach ($fields as $field => $value):?><td><?= $value ?></td><?php endforeach;?>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
<p>&nbsp;</p>
<!-- TOP COMPUTER PICKS ------------------------------------------------------------------------------------ -->
<div class="table-responsive-sm">
<table class="table table-sm table-striped table-bordered">
<thead class="thead-dark">
<tr><th colspan="3" class="text-center bg-primary">Top Computer Picks</th></tr>
<tr>
<th scope="col">Rank</th>
<th scope="col">Pick</th>
<th scope="col">Count</th>
</tr>
</thead>
<tbody>
<?php foreach ($ComputerPicks as $record => $fields):?>
<tr>
<th scope="row"><?= ($record + 1) ?></th>
<?php foreach ($fields as $field => $value):?>
<td><?= $value ?></td>
<?php endforeach;?>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
<p>&nbsp;</p>
<a href="play" class="btn btn-outline-dark btn-lg" role="button" aria-pressed="true">Play Game!</a>
<p>&nbsp;</p>
</div>
</main>