Refactored project structure.

This commit is contained in:
Dmitry Khomutov 2018-03-04 18:04:15 +07:00
commit c015d8c58b
No known key found for this signature in database
GPG key ID: EC19426474B37AAC
308 changed files with 39 additions and 47 deletions

9
src/View/User/edit.phtml Normal file
View file

@ -0,0 +1,9 @@
<div class="row">
<div class="col-sm-12">
<div class="box">
<div class="box-body">
<?php print $form; ?>
</div>
</div>
</div>
</div>

76
src/View/User/index.phtml Normal file
View file

@ -0,0 +1,76 @@
<?php
use PHPCensor\Helper\Lang;
$user = $this->getUser();
?>
<div class="clearfix" style="margin-bottom: 20px;">
<div class="pull-right btn-group">
<a class="btn btn-success" href="<?php print APP_URL; ?>user/add"><?php Lang::out('add_user'); ?></a>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="box">
<table class="table table-hover">
<thead>
<tr>
<th><?php Lang::out('email_address'); ?></th>
<th><?php Lang::out('name'); ?></th>
<th><?php Lang::out('is_admin'); ?></th>
<th></th>
</tr>
</thead>
<tbody id="users">
<?php foreach($users['items'] as $user): ?>
<?php
switch($user->getIsAdmin())
{
case 0:
$cls = '';
$status = Lang::get('no');
break;
case 1:
$cls = 'warning';
$status = Lang::get('yes');
break;
}
?>
<tr class="<?php print $cls; ?>">
<td><a href="<?php echo APP_URL ?>user/edit/<?php print $user->getId(); ?>"><?php print $user->getEmail(); ?></a></td>
<td><?php print htmlspecialchars($user->getName()); ?></td>
<td><?php print $status; ?></td>
<td>
<?php if($user->getIsAdmin()): ?>
<div class="btn-group btn-group-right">
<a class="btn btn-default btn-sm" href="<?php echo APP_URL ?>user/edit/<?php print $user->getId(); ?>"><?php Lang::out('edit'); ?></a>
<button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="<?php echo APP_URL ?>user/delete/<?php print $user->getId(); ?>" class="delete-user"><?php Lang::out('delete_user'); ?></a></li>
</ul>
</div>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
<script>
$(document).ready(function() {
$('.delete-user').on('click', function (e) {
e.preventDefault();
confirmDelete(e.target.href)
.onCloseConfirmed = function () {window.location = window.location.href};
});
});
</script>

View file

@ -0,0 +1,14 @@
<?php use PHPCensor\Helper\Lang; ?>
<?php if (isset($updated)): ?>
<p class="alert alert-success"><?php Lang::out('your_details_updated'); ?></p>
<?php endif; ?>
<div class="box">
<div class="box-header">
<h3 class="box-title"><?php Lang::out('update_your_details'); ?></h3>
</div>
<div class="box-body">
<?php print $form; ?>
</div>
</div>