Started index page ; connect/disconnect working ; started edit password page

This commit is contained in:
Phyks 2013-08-09 23:35:20 +02:00
parent 33e43a6baf
commit 399f1bd09f
5 changed files with 81 additions and 36 deletions

View File

@ -8,9 +8,14 @@
$tpl = new raintpl();
$tpl->assign('instance_title', INSTANCE_TITLE);
$tpl->assign('connection', false);
$tpl->assign('notice', '');
session_start();
$current_user = (isset($_SESSION['current_user']) ? unserialize($_SESSION['current_user']) : false);
$tpl->assign('admin', ($current_user !== false) ? (int) $current_user['admin'] : 0);
$usersManager = new User();
if($current_user === false && (empty($_GET['do']) OR $_GET['do'] != 'connect')) { //If not connected, go to connection page
header('location: index.php?do=connect');
@ -35,6 +40,7 @@
$error = "Unknown username/password.";
}
}
$tpl->assign('connection', true);
$tpl->draw('connexion');
break;
@ -43,8 +49,16 @@
session_destroy();
header('location: index.php?do=connect');
exit();
break;
case 'password':
$tpl->draw('edit_users');
break;
default:
$tpl->assign('users', array(0=>array("name"=>"truc")));
$tpl->assign('bill', array(0=>array()));
$tpl->draw('index');
break;
}

View File

@ -1,9 +1,9 @@
{include="header"}
<h1>{$instance_title} - Connexion</h1>
<h1 id="title">{$instance_title} - Connexion</h1>
<form method="post" action="index.php?do=connect">
<p><label for="login">Username : </label><input type="text" name="login" id="login"/></p>
<p><label for="password">Password : </label><input type="password" name="password" id="password"/></p>
<form method="post" action="index.php?do=connect" id="connexion_form">
<p><label for="login" class="label-block">Username : </label><input type="text" name="login" id="login"/></p>
<p><label for="password" class="label-block">Password : </label><input type="password" name="password" id="password"/></p>
<p><input type="submit" value="Connect"/></p>
</form>

8
tpl/edit_users.html Normal file
View File

@ -0,0 +1,8 @@
{include="header"}
<h2>Edit your password</h2>
<form method="post" action="index.php?do=password" id="edit_password_form">
<p><label for="password" class="label-block">New password : </label><input type="password" id="password" name="password"/></p>
<p><label for="password_confirm" class="label-block">Confirm new password : </label><input type="password" id="password_confirm" name="password_confirm"/></p>
<p class="center"><input type="submit" value="Update"/></p>
</form>

View File

@ -3,7 +3,30 @@
<head>
<meta charset="utf-8">
<title>{$instance_title}</title>
<link rel="stylesheet" media="screen" type="text/css" href="misc/style.css" />
<link rel="stylesheet" media="screen" type="text/css" href="css/style.css" />
<link rel="icon" href="favicon.ico" />
</head>
<body>
{if condition="!$connection"}
<h1 id="title">{$instance_title}</h1>
{if condition="$notice != ''"}
<p>{$notice}</p>
{/if}
<div id="menu">
<ul>
<li><a href="index.php?do=new_invoice">Add a bill</a></li>
<li><a href="index.php?do=password">Change your password</a></li>
<li><a href="index.php?do=paybacks">See paybacks</a></li>
</ul>
{if condition="$admin == 1"}
<ul>
<li><a href="index.php?do=manage_paybacks">Manage paybacks</a></li>
<li><a href="index.php?do=edit_users">Edit users</a></li>
<li><a href="index.php?do=edit_notics">Edit notice on homepage</a></li>
<li><a href="index.php?do=disconnect">Disconnect</a></li>
</ul>
{/if}
</div>
{/if}

View File

@ -1,45 +1,45 @@
{include="header"}
<h1>{$instance_title}</h1>
{$notice}
<div id="menu">
<ul>
<li><a href="modif.php">Ajouter une dépense</a></li>
<li><a href="modif_password.php">Modifier le mot de passe</a></li>
<li><a href="rbmt.php">Consulter les remboursements</a></li>
</ul>
{if condition="$admin"}
<ul>
<li><a href="rbmt_admin.php">Gérer les rembourements</a></li>
<li><a href="copains.php">Modifier les copains</a></li>
<li><a href="modif_annonce.php">Modifier l'annonce d'accueil</a></li>
<li><a href="connexion.php?deco=1">Déconnexion</a></li>
</ul>
{/if}
</div>
<div id="quick_summary">
<h2>Qui doit quoi ?</h2>
<p>Lire <em>ligne</em> doit <em>case</em>€ à <em>colonne</em>. Les liens permettent de confirmer le paiement des dettes.</p>
<h2>Balance</h2>
<p class="center">Read <em>line</em> owes <em>case</em>€ to <em>column</em>. You can click on links to confirm the payback.
<table>
<tr>
<th>Doit\À</th>
<th>Owes\To</th>
{loop="users"}
<th>{$value.name}</th>
{/loop}
</tr>
{loop="users"}
<tr>
<th>{$value.name}</th>
</tr>
{/loop}
</table>
</div>
<div id="detailed_summary">
<h2>Dépenses détaillées du mois actuel</h2>
<h2>Detailed list of bills for last month</h2>
<table>
<tr>
<th>Date</th>
<th>Payé par</th>
<th>Participants</th>
<th>Montant</th>
<th>Menu</th>
<th>Modifier</th>
<th>Supprimer</th>
<th>Paid by</th>
<th>Users in</th>
<th>Amount</th>
<th>What ?</th>
<th>Edit</th>
<th>Delete</th>
</tr>
{loop="bill"}
<tr>
<td>{$value.date}</td>
<td>{$value.buyer}</td>
<td>{$value.users_in}</td>
<td>{$value.amount}</td>
<td>{$value.what}</td>
<td><a href="index.php?do=edit_bill&id=">Edit</a></td>
<td><a href="index.php?do=delete_bill&id=">Delete</a></td>
</tr>
{/loop}
</table>
</div>