Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kjg #1

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,31 @@
UiS DAT310 project
==================

This is a mini-project that we tried to work on together during one of the lab sessions.
The focus is not so much on the functionality but on how to collaborate using github.

Git HowTo
---------

* Setting up (once)
* Fork the project
* Clone the forked repo on your desktop
* Contributing
* Select an issue to work on
* Make changes
* Commit and push
* Create a pull request to the main repo
* Keeping up with changes in the main repo
* Click "compare" on github
* *base fork* is your repo, *head fork* is the main repo
* Create a pull request
* Merge pull request


Project setup
-------------

To set it up locally:

* Copy `inc/config.sample.inc.php` as `inc/config.inc.php`
* Edit the settings in `inc/config.inc.php`
Binary file added images/room_types/1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/room_types/3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/room_types/4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/room_types/5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
$smarty->setCacheDir(PROJECT_DIR . "/smarty/cache");
$smarty->setConfigDir(PROJECT_DIR . "/smarty/configs");

$step = 1;
$step = isset($_REQUEST['step']) ? $_REQUEST['step'] : 1;

$smarty->assign("step", $step);

Expand Down
14 changes: 11 additions & 3 deletions smarty/templates/index.tpl
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
<html>
<head>
<title>Booking project</title>
<!-- jQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<!-- Bootstrap -->
<link rel="stylesheet" href="//cdn.jsdelivr.net/bootstrap/3.3.0/css/bootstrap.min.css">
<script src="//cdn.jsdelivr.net/bootstrap/3.3.0/js/bootstrap.min.js"></script>
</head>
<body>
{if $step == 1}
{include file="step1.tpl"}
{/if}
<div class="container">
<h1>Cabin Booking (header)</h1>

{include file="step{$step}.tpl"}
</div>
</body>
</html>
20 changes: 20 additions & 0 deletions smarty/templates/info_cabin.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{* setting values manually -- this will come from PHP *}
{assign var="date_from" value="2014-11-14"}
{assign var="date_to" value="2014-11-17"}
{assign var="nights" value="3"}

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Selected cabin</h3>
</div>
<div class="panel-body">
<table class="table">
<tr>
<td><img src="images/room_types/1.jpg" /></td>
<td>Room type 1</td>
<td>XX beds</td>
<td>XX NOK</td>
</tr>
</table>
</div>
</div>
13 changes: 13 additions & 0 deletions smarty/templates/info_dates.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{* setting values manually -- this will come from PHP *}
{assign var="date_from" value="2014-11-14"}
{assign var="date_to" value="2014-11-17"}
{assign var="nights" value="3"}

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Selected dates</h3>
</div>
<div class="panel-body">
<span>Period: <span class="date">{$date_from}</span> - <span class="date">{$date_to}</span> ({$nights} night{if $nights > 1}s{/if})</span>
</div>
</div>
32 changes: 32 additions & 0 deletions smarty/templates/info_user.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{* setting values manually -- this will come from PHP *}
{assign var="name" value="John Smith"}
{assign var="address" value="123 Street Alabama"}
{assign var="email" value="[email protected]"}
{assign var="phone" value="12 3456 789"}

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Personal details</h3>
</div>
<div class="panel-body">

<table class="table">
<tr>
<td><label>Name:</label></td>
<td>{$name}</td>
</tr>
<tr>
<td><label>Address:</label></td>
<td>{$address}</input></td>
</tr>
<tr>
<td><label>e-Mail:</label></td>
<td>{$email}</td>
</tr>
<tr>
<td><label>Phone nr.:</label></td>
<td>{$phone}</td>
</tr>
</table>
</div>
</div>
26 changes: 26 additions & 0 deletions smarty/templates/input_user.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Personal details</h3>
</div>
<div class="panel-body">

<table class="table">
<tr>
<td><label>Name:</label></td>
<td><input type="text" name="name" placeholder="full name"></input></td>
</tr>
<tr>
<td><label>Address:</label></td>
<td><input type="text" name="addr" placeholder="address"></input></td>
</tr>
<tr>
<td><label>e-Mail:</label></td>
<td><input type="email" name="mail" placeholder="e-mail"></input></td>
</tr>
<tr>
<td><label>Phone nr.:</label></td>
<td><input type="text" name="phon" placeholder="phone"></input></td>
</tr>
</table>
</div>
</div>
44 changes: 43 additions & 1 deletion smarty/templates/step1.tpl
Original file line number Diff line number Diff line change
@@ -1 +1,43 @@
<h2>Step 1</h2>
<h2>Select dates and property</h2>

<form role="form" action="index.php" method="POST">
<div class="form-group">
<label for="arrival">Arrival date</label>
<input type="date" class="form-control" id="arrival" name="arrival">
</div>


<div class="form-group">
<label for="nights">Number of nights</label>
<select class="form-control" name="nights" id="nights">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</div>

<h3>Select property</h3>
<table class="table">
<tr>
<td><input type="radio" name="room_type_id" value="1" /></td>
<td><img src="images/room_types/1.jpg" /></td>
<td>Room type 1</td>
<td>XX beds</td>
<td>XX NOK</td>
</tr>
<tr>
<td><input type="radio" name="room_type_id" value="3" /></td>
<td><img src="images/room_types/3.jpg" /></td>
<td>Room type 3</td>
<td>XX beds</td>
<td>XX NOK</td>
</tr>
</table>

<input type="hidden" name="step" value="2" />

<input type="submit" class="btn btn-default" value="Next">

</form>
14 changes: 14 additions & 0 deletions smarty/templates/step2.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<h2>Personal info</h2>
<form role="form" action="index.php" method="POST">

{* info selected dates *}
{include file="info_dates.tpl"}
{* info selected cabin *}
{include file="info_cabin.tpl"}
{* input personal details *}
{include file="input_user.tpl"}

<input type="hidden" name="step" value="3" />
<input type="submit" class="btn btn-default" value="Next">

</form>
19 changes: 19 additions & 0 deletions smarty/templates/step3.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<h2>Confirmation</h2>

<form role="form" action="index.php" method="POST">

{* info selected dates *}
{include file="info_dates.tpl"}
{* info selected cabin *}
{include file="info_cabin.tpl"}
{* info personal details *}
{include file="info_user.tpl"}

<div>
<input type="checkbox" /> Yes, I want to go ahead and make the booking
</div>

<input type="hidden" name="step" value="4" />
<input type="submit" class="btn btn-default" value="Confirm">

</form>
5 changes: 5 additions & 0 deletions smarty/templates/step4.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<h3>Thank you for you booking!</h3>

<p> Your booking reference number is: 33382</p>

<p><a class="btn btn-primary btn-lg" href="index.php?" role="button">Back to mainpage</a></p>