Minor improvements

This commit is contained in:
Frédéric Guillot
2014-02-16 18:19:15 -05:00
parent 4fd4180d1c
commit e155edd1bd
4 changed files with 24 additions and 20 deletions

View File

@@ -2,16 +2,16 @@
namespace Model; namespace Model;
require 'vendor/SimpleValidator/Validator.php'; require __DIR__.'/../vendor/SimpleValidator/Validator.php';
require 'vendor/SimpleValidator/Base.php'; require __DIR__.'/../vendor/SimpleValidator/Base.php';
require 'vendor/SimpleValidator/Validators/Required.php'; require __DIR__.'/../vendor/SimpleValidator/Validators/Required.php';
require 'vendor/SimpleValidator/Validators/Unique.php'; require __DIR__.'/../vendor/SimpleValidator/Validators/Unique.php';
require 'vendor/SimpleValidator/Validators/MaxLength.php'; require __DIR__.'/../vendor/SimpleValidator/Validators/MaxLength.php';
require 'vendor/SimpleValidator/Validators/MinLength.php'; require __DIR__.'/../vendor/SimpleValidator/Validators/MinLength.php';
require 'vendor/SimpleValidator/Validators/Integer.php'; require __DIR__.'/../vendor/SimpleValidator/Validators/Integer.php';
require 'vendor/SimpleValidator/Validators/Equals.php'; require __DIR__.'/../vendor/SimpleValidator/Validators/Equals.php';
require 'vendor/SimpleValidator/Validators/AlphaNumeric.php'; require __DIR__.'/../vendor/SimpleValidator/Validators/AlphaNumeric.php';
require 'vendor/PicoDb/Database.php'; require __DIR__.'/../vendor/PicoDb/Database.php';
require __DIR__.'/schema.php'; require __DIR__.'/schema.php';
abstract class Base abstract class Base

View File

@@ -1,9 +1,11 @@
<section id="main"> <section id="main">
<div class="page-header"> <div class="page-header">
<h2><?= t('Projects') ?><span id="page-counter"> (<?= $nb_projects ?>)</span></h2> <h2><?= t('Projects') ?><span id="page-counter"> (<?= $nb_projects ?>)</span></h2>
<?php if ($_SESSION['user']['is_admin'] == 1): ?>
<ul> <ul>
<li><a href="?controller=project&amp;action=create"><?= t('New project') ?></a></li> <li><a href="?controller=project&amp;action=create"><?= t('New project') ?></a></li>
</ul> </ul>
<?php endif ?>
</div> </div>
<section> <section>
<?php if (empty($projects)): ?> <?php if (empty($projects)): ?>

View File

@@ -2,7 +2,7 @@
<div class="page-header"> <div class="page-header">
<h2><?= t('Edit user') ?></h2> <h2><?= t('Edit user') ?></h2>
<ul> <ul>
<li><a href="?action=users"><?= t('All users') ?></a></li> <li><a href="?controller=user"><?= t('All users') ?></a></li>
</ul> </ul>
</div> </div>
<section> <section>

View File

@@ -1,9 +1,11 @@
<section id="main"> <section id="main">
<div class="page-header"> <div class="page-header">
<h2><?= t('Users') ?><span id="page-counter"> (<?= $nb_users ?>)</span></h2> <h2><?= t('Users') ?><span id="page-counter"> (<?= $nb_users ?>)</span></h2>
<?php if ($_SESSION['user']['is_admin'] == 1): ?>
<ul> <ul>
<li><a href="?controller=user&amp;action=create"><?= t('New user') ?></a></li> <li><a href="?controller=user&amp;action=create"><?= t('New user') ?></a></li>
</ul> </ul>
<?php endif ?>
</div> </div>
<section> <section>
<?php if (empty($users)): ?> <?php if (empty($users)): ?>
@@ -14,9 +16,7 @@
<th><?= t('Username') ?></th> <th><?= t('Username') ?></th>
<th><?= t('Administrator') ?></th> <th><?= t('Administrator') ?></th>
<th><?= t('Default Project') ?></th> <th><?= t('Default Project') ?></th>
<?php if ($_SESSION['user']['is_admin'] == 1): ?> <th><?= t('Actions') ?></th>
<th><?= t('Actions') ?></th>
<?php endif ?>
</tr> </tr>
<?php foreach ($users as $user): ?> <?php foreach ($users as $user): ?>
<tr> <tr>
@@ -29,15 +29,17 @@
<td> <td>
<?= $projects[$user['default_project_id']] ?> <?= $projects[$user['default_project_id']] ?>
</td> </td>
<?php if ($_SESSION['user']['is_admin'] == 1): ?>
<td> <td>
<a href="?controller=user&amp;action=edit&amp;user_id=<?= $user['id'] ?>"><?= t('edit') ?></a> <?php if ($_SESSION['user']['is_admin'] == 1 || $_SESSION['user']['id'] == $user['id']): ?>
<?php if (count($users) > 1): ?> <a href="?controller=user&amp;action=edit&amp;user_id=<?= $user['id'] ?>"><?= t('edit') ?></a>
<?= t('or') ?> <?php endif ?>
<a href="?controller=user&amp;action=confirm&amp;user_id=<?= $user['id'] ?>"><?= t('remove') ?></a> <?php if ($_SESSION['user']['is_admin'] == 1): ?>
<?php if (count($users) > 1): ?>
<?= t('or') ?>
<a href="?controller=user&amp;action=confirm&amp;user_id=<?= $user['id'] ?>"><?= t('remove') ?></a>
<?php endif ?>
<?php endif ?> <?php endif ?>
</td> </td>
<?php endif ?>
</tr> </tr>
<?php endforeach ?> <?php endforeach ?>
</table> </table>