Browse Source
- added Admin/Users Controller - added Language/en/Admin - updated Libraries/Aauth - updated Account Views - added Admin Views - added Pagers/bootstrap_full.php - updatd HeaderAdmin Template - added assets/css/admin/users/index.cssv3-dev
16 changed files with 318 additions and 17 deletions
@ -0,0 +1,72 @@ |
|||||||
|
<?php |
||||||
|
/** |
||||||
|
* CodeIgniter-Aauth |
||||||
|
* |
||||||
|
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make |
||||||
|
* easy some essential jobs such as login, permissions and access operations. |
||||||
|
* Despite ease of use, it has also very advanced features like groupping, |
||||||
|
* access management, public access etc.. |
||||||
|
* |
||||||
|
* @package CodeIgniter-Aauth |
||||||
|
* @author Magefly Team |
||||||
|
* @copyright 2014-2017 Emre Akay |
||||||
|
* @copyright 2018 Magefly |
||||||
|
* @license https://opensource.org/licenses/MIT MIT License |
||||||
|
* @link https://github.com/magefly/CodeIgniter-Aauth |
||||||
|
*/ |
||||||
|
|
||||||
|
namespace App\Controllers\Admin; |
||||||
|
|
||||||
|
use CodeIgniter\Controller; |
||||||
|
use Config\Aauth as AauthConfig; |
||||||
|
use App\Libraries\Aauth; |
||||||
|
|
||||||
|
/** |
||||||
|
* Aauth Admin/Users Controller |
||||||
|
* |
||||||
|
* @package CodeIgniter-Aauth |
||||||
|
*/ |
||||||
|
class Users extends Controller |
||||||
|
{ |
||||||
|
/** |
||||||
|
* Constructor |
||||||
|
*/ |
||||||
|
public function __construct() |
||||||
|
{ |
||||||
|
$this->aauth = new Aauth(); |
||||||
|
helper('form'); |
||||||
|
helper('aauth'); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Index |
||||||
|
* |
||||||
|
* @return void |
||||||
|
*/ |
||||||
|
public function index() |
||||||
|
{ |
||||||
|
$data = $this->aauth->listUsersPaginated(); |
||||||
|
|
||||||
|
$data['cssFiles'] = [ |
||||||
|
'/assets/css/admin/users/index.css' |
||||||
|
]; |
||||||
|
|
||||||
|
echo view('Templates/HeaderAdmin', $data); |
||||||
|
echo view('Admin/Users/Home', $data); |
||||||
|
echo view('Templates/FooterAdmin'); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* New |
||||||
|
* |
||||||
|
* @return void |
||||||
|
*/ |
||||||
|
public function new() |
||||||
|
{ |
||||||
|
$data = $this->aauth->listUsersPaginated(); |
||||||
|
|
||||||
|
echo view('Templates/HeaderAdmin'); |
||||||
|
echo view('Admin/Users/New', $data); |
||||||
|
echo view('Templates/FooterAdmin'); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,53 @@ |
|||||||
|
<?php |
||||||
|
/** |
||||||
|
* CodeIgniter-Aauth |
||||||
|
* |
||||||
|
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make |
||||||
|
* easy some essential jobs such as login, permissions and access operations. |
||||||
|
* Despite ease of use, it has also very advanced features like groupping, |
||||||
|
* access management, public access etc.. |
||||||
|
* |
||||||
|
* @package CodeIgniter-Aauth |
||||||
|
* @author Magefly Team |
||||||
|
* @copyright 2014-2017 Emre Akay |
||||||
|
* @copyright 2018 Magefly |
||||||
|
* @license https://opensource.org/licenses/MIT MIT License |
||||||
|
* @link https://github.com/magefly/CodeIgniter-Aauth |
||||||
|
*/ |
||||||
|
|
||||||
|
/** |
||||||
|
* Admin language strings. |
||||||
|
* |
||||||
|
* Language English |
||||||
|
* |
||||||
|
* @package CodeIgniter-Aauth |
||||||
|
* |
||||||
|
* @codeCoverageIgnore |
||||||
|
*/ |
||||||
|
return [ |
||||||
|
'homeHeader' => 'Admin Area', |
||||||
|
'homeText' => 'Welcome to CodeIgniter-Aauth\'s Admin Area', |
||||||
|
'homeBreadcrumbTitle' => 'Home', |
||||||
|
|
||||||
|
'breadcrumbCommonNew' => 'New', |
||||||
|
'breadcrumbCommonEdit' => 'Edit', |
||||||
|
'breadcrumbCommonShow' => 'Show', |
||||||
|
'breadcrumbCommonDelete' => 'Delete', |
||||||
|
|
||||||
|
'usersIndexHeader' => 'Users', |
||||||
|
'usersNewHeader' => 'New user', |
||||||
|
'usersEditHeader' => 'Edit user', |
||||||
|
'usersShowHeader' => 'Show user', |
||||||
|
'usersDeleteHeader' => 'Delete user', |
||||||
|
'usersBreadcrumbTitle' => 'Users', |
||||||
|
'usersLabelId' => 'Id', |
||||||
|
'usersLabelEmail' => 'Email address', |
||||||
|
'usersLabelUsername' => 'Username', |
||||||
|
'usersLabelBanned' => 'Banned', |
||||||
|
'usersLabelCreatedAt' => 'Created at', |
||||||
|
'usersLabelUpdatedAt' => 'Updated at', |
||||||
|
'usersLabelLastIPAddress' => 'Last IP-Address', |
||||||
|
'usersLabelLastActivity' => 'Last Activity', |
||||||
|
'usersLabelLastLogin' => 'Last Login', |
||||||
|
'usersLinkNew' => 'Create new user', |
||||||
|
]; |
@ -0,0 +1,11 @@ |
|||||||
|
<ol class="breadcrumb"> |
||||||
|
<li class="breadcrumb-item active"><?= lang('Admin.homeBreadcrumbTitle') ?></li>
|
||||||
|
</ol> |
||||||
|
<div class="card mb-3"> |
||||||
|
<div class="card-header"> |
||||||
|
<?= lang('Admin.homeHeader') ?> |
||||||
|
</div> |
||||||
|
<div class="card-body"> |
||||||
|
<p class="lead"><?= lang('Admin.homeText') ?></p>
|
||||||
|
</div> |
||||||
|
</div> |
@ -0,0 +1,57 @@ |
|||||||
|
<ol class="breadcrumb"> |
||||||
|
<li class="breadcrumb-item"> |
||||||
|
<a href="<?= site_url('admin') ?>"><?= lang('Admin.homeBreadcrumbTitle') ?></a>
|
||||||
|
</li> |
||||||
|
<li class="breadcrumb-item active"><?= lang('Admin.usersBreadcrumbTitle') ?></li>
|
||||||
|
</ol> |
||||||
|
<div class="card mb-3"> |
||||||
|
<div class="card-header"> |
||||||
|
<a href="<?= site_url('admin/users/new') ?>" class="btn btn-sm btn-success float-right"><?= lang('Admin.usersLinkNew') ?></a>
|
||||||
|
<div class="pt-1"><?= lang('Admin.usersIndexHeader') ?></div>
|
||||||
|
</div> |
||||||
|
<div class="card-body p-0"> |
||||||
|
<div class="table-responsive"> |
||||||
|
<table class="table mb-0"> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th scope="col"><?= lang('Admin.usersLabelId') ?></th>
|
||||||
|
<th scope="col"><?= lang('Admin.usersLabelEmail') ?></th>
|
||||||
|
<th scope="col"><?= lang('Admin.usersLabelUsername') ?></th>
|
||||||
|
<th scope="col"><?= lang('Admin.usersLabelBanned') ?></th>
|
||||||
|
<th scope="col"><?= lang('Admin.usersLabelCreatedAt') ?></th>
|
||||||
|
<th scope="col"><?= lang('Admin.usersLabelUpdatedAt') ?></th>
|
||||||
|
<th scope="col"><?= lang('Admin.usersLabelLastIPAddress') ?></th>
|
||||||
|
<th scope="col"><?= lang('Admin.usersLabelLastActivity') ?></th>
|
||||||
|
<th scope="col"><?= lang('Admin.usersLabelLastLogin') ?></th>
|
||||||
|
<th scope="col"></th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<? foreach ($users as $user): ?> |
||||||
|
<tr> |
||||||
|
<th scope="row"><?= $user['id'] ?></th>
|
||||||
|
<td><?= $user['email'] ?></td>
|
||||||
|
<td><?= $user['username'] ?></td>
|
||||||
|
<td><?= $user['banned'] == 1 ? 'Yes' : 'No' ?></td>
|
||||||
|
<td><?= $user['created_at'] ?></td>
|
||||||
|
<td><?= $user['updated_at'] ?></td>
|
||||||
|
<td><?= $user['last_ip_address'] ?></td>
|
||||||
|
<td><?= $user['last_activity'] ?></td>
|
||||||
|
<td><?= $user['last_login'] ?></td>
|
||||||
|
<td class="text-right p-1"> |
||||||
|
<div class="btn-group"> |
||||||
|
<a href="<?= site_url('admin/users/show/' . $user['id']) ?>" class="btn btn-info"><i class="fa fa-fw fa-info-circle"></i></a>
|
||||||
|
<a href="<?= site_url('admin/users/edit/' . $user['id']) ?>" class="btn btn-warning"><i class="fa fa-fw fa-pencil-alt"></i></a>
|
||||||
|
<a href="<?= site_url('admin/users/delete/' . $user['id']) ?>" class="btn btn-danger"><i class="fa fa-fw fa-times"></i></a>
|
||||||
|
</div> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
<? endforeach; ?> |
||||||
|
</tbody> |
||||||
|
</table> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="card-footer"> |
||||||
|
<?= $pager->links() ?> |
||||||
|
</div> |
||||||
|
</div> |
@ -0,0 +1,18 @@ |
|||||||
|
<ol class="breadcrumb"> |
||||||
|
<li class="breadcrumb-item"> |
||||||
|
<a href="<?= site_url('admin') ?>"><?= lang('Admin.homeBreadcrumbTitle') ?></a>
|
||||||
|
</li> |
||||||
|
<li class="breadcrumb-item"> |
||||||
|
<a href="<?= site_url('admin/users') ?>"><?= lang('Admin.usersBreadcrumbTitle') ?></a>
|
||||||
|
</li> |
||||||
|
<li class="breadcrumb-item active"><?= lang('Admin.breadcrumbCommonNew') ?></li>
|
||||||
|
</ol> |
||||||
|
<div class="card mb-3"> |
||||||
|
<?= form_open('admin/users/create') ?> |
||||||
|
<div class="card-body p-0"> |
||||||
|
</div> |
||||||
|
<div class="card-footer"> |
||||||
|
|
||||||
|
</div> |
||||||
|
</form> |
||||||
|
</div> |
@ -0,0 +1,37 @@ |
|||||||
|
<nav aria-label="<?= lang('Pager.pageNavigation') ?>">
|
||||||
|
<ul class="pagination justify-content-center mb-0"> |
||||||
|
<?php if ($pager->hasPrevious()) : ?> |
||||||
|
<li class="page-item"> |
||||||
|
<a href="<?= $pager->getFirst() ?>" class="page-link" aria-label="<?= lang('Pager.first') ?>">
|
||||||
|
<span aria-hidden="true"><?= lang('Pager.first') ?></span>
|
||||||
|
</a> |
||||||
|
</li> |
||||||
|
<li class="page-item"> |
||||||
|
<a href="<?= $pager->getPrevious() ?>" class="page-link" aria-label="<?= lang('Pager.previous') ?>">
|
||||||
|
<span aria-hidden="true">«</span> |
||||||
|
</a> |
||||||
|
</li> |
||||||
|
<?php endif ?> |
||||||
|
|
||||||
|
<?php foreach ($pager->links() as $link) : ?> |
||||||
|
<li <?= $link['active'] ? 'class="page-item active"' : 'class="page-item"' ?>>
|
||||||
|
<a href="<?= $link['uri'] ?>" class="page-link">
|
||||||
|
<?= $link['title'] ?> |
||||||
|
</a> |
||||||
|
</li> |
||||||
|
<?php endforeach ?> |
||||||
|
|
||||||
|
<?php if ($pager->hasNext()) : ?> |
||||||
|
<li class="page-item"> |
||||||
|
<a href="<?= $pager->getNext() ?>" class="page-link" aria-label="<?= lang('Pager.next') ?>">
|
||||||
|
<span aria-hidden="true">»</span> |
||||||
|
</a> |
||||||
|
</li> |
||||||
|
<li class="page-item"> |
||||||
|
<a href="<?= $pager->getLast() ?>" class="page-link" aria-label="<?= lang('Pager.last') ?>">
|
||||||
|
<span aria-hidden="true"><?= lang('Pager.last') ?></span>
|
||||||
|
</a> |
||||||
|
</li> |
||||||
|
<?php endif ?> |
||||||
|
</ul> |
||||||
|
</nav> |
Loading…
Reference in new issue