Skip to content

Commit

Permalink
changing the name of controller to prevent conflicts
Browse files Browse the repository at this point in the history
adding the user's index
neutralizing view files
  • Loading branch information
mohamnag committed Jan 22, 2014
1 parent 7329726 commit 38b2796
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @property User $User
*/
class UsersController extends CakeUserAppController {
class CakeUserUsersController extends CakeUserAppController {

public $uses = array('CakeUser.User');

Expand Down Expand Up @@ -49,4 +49,11 @@ public function logout() {
$this->redirect($this->Auth->logout());
}

public function index() {
$this->User->contain('UserGroup');

$users = $this->paginate('User');
$this->set(compact('users'));
}

}
32 changes: 32 additions & 0 deletions View/CakeUserUsers/index.ctp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<h1><?php echo __('List of all users') ?></h1>

<table>
<thead>
<tr>
<th colspan="3">
<?php echo $this->Paginator->pager(); ?>
</th>
</tr>
<tr>
<th><?php echo __('User name')?></th>
<th><?php echo __('Status')?></th>
<th><?php echo __('Group')?></th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="3">
<?php echo $this->Paginator->pagination(array('ul' => 'pagination pagination-large')); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php foreach ($users as $user): ?>
<tr>
<td><?php echo $user['User']['username'] ?></td>
<td><?php echo $user['User']['is_active'] ? __('activated') : __('not activated') ?></td>
<td><?php echo $user['UserGroup']['title'] ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
7 changes: 4 additions & 3 deletions View/Users/login.ctp → View/CakeUserUsers/login.ctp
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<h1><?php echo __('Log in')?></h1>

<div class="col-md-8 col-md-offset-2">
<div>

<?php echo $this->Session->flash('auth'); ?>

<?php
echo $this->Form->create(array('class' => 'well'));
echo $this->Form->create();
echo $this->Form->input('username', array('label' => __('User name')));
echo $this->Form->input('password', array('label' => __('Password')));
echo $this->Form->submit('Login');
echo $this->Form->submit(__('Log in'));
echo $this->Form->end();
?>
</div>
5 changes: 3 additions & 2 deletions View/Users/register.ctp → View/CakeUserUsers/register.ctp
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<h1><?php echo __('Register a new user')?></h1>

<div class="col-md-8 col-md-offset-2">
<div>

<?php echo $this->Session->flash('auth'); ?>

<?php
echo $this->Form->create(array('class' => 'well'));
echo $this->Form->create();
echo $this->Form->input('username', array('label' => __('User name')));
echo $this->Form->input('password', array('label' => __('Password')));
echo $this->Form->input('password2', array('type' => 'password', 'label' => __('Repeat password')));
Expand Down

0 comments on commit 38b2796

Please sign in to comment.