Skip to content

Instantly share code, notes, and snippets.

@dakota
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save dakota/5ba883d9c7bbf5d6e8df to your computer and use it in GitHub Desktop.

Select an option

Save dakota/5ba883d9c7bbf5d6e8df to your computer and use it in GitHub Desktop.
<div class="users index">
<h2><?php echo __('Users'); ?></h2>
<?php
echo "<table cellpadding='0' cellspacing='0'>
<tr>
<th>No</th>
<th>ID</th>
<th>Username</th>
<th>Role</th>
<th>Status</th>
<th>Actions</th>
</tr>";
$count = 1;
foreach($users as $index => $user) {
// Output a row 1 column 1 - count
echo "<tr><td>";
echo sprintf($count,$index,$user)."</td><td>";
// Output a row 1 column 2 - id
echo h($user['User']['id']);
echo "</td><td>";
// Output a row 1 column 3 - username
echo $this->Html->link( $user['User']['username'] , array('action'=>'view', $user['User']['id']),array('escape' => false) );
echo "</td><td>";
// Output a row 1 column 4 - role
echo h($user['User']['role']);
echo "</td><td>";
// Output a row 1 column 5 - status
if($user['User']['status']==1){
echo "Active";
} else {
echo "Inactive";
};
echo "</td><td class='actions'>";
// Output a row 1 column 6 - actions
echo $this->Html->link(__('View'), array('action' => 'view', $user['User']['id']));
echo $this->Html->link(__('Edit'), array('action' => 'edit', $user['User']['id']));
echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $user['User']['id']), array(), __('Are you sure you want to delete # %s?', $user['User']['id']));
echo "</td>";
$count++;
}
echo "</table>";
?>
<?php unset($user); ?>
<p>
<?php
echo $this->Paginator->counter(array(
'format' => __('Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}')
));
?> </p>
<div class="paging">
<?php
echo $this->Paginator->prev('< ' . __('previous'), array(), null, array('class' => 'prev disabled'));
echo $this->Paginator->numbers(array('separator' => ''));
echo $this->Paginator->next(__('next') . ' >', array(), null, array('class' => 'next disabled'));
?>
</div>
</div>
<div class="actions">
<h3><?php echo __('Actions'); ?></h3>
<ul>
<li><?php echo $this->Html->link(__('New User'), array('action' => 'add')); ?></li>
<li><?php echo $this->Html->link(__('Search Users'), array('controller' => 'users', 'action' => 'search')); ?> </li>
<li><?php echo $this->Html->link(__('List Announcements'), array('controller' => 'announcements', 'action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(__('New Announcement'), array('controller' => 'announcements', 'action' => 'add')); ?> </li>
<li><?php echo $this->Html->link(__('List Documents'), array('controller' => 'documents', 'action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(__('New Document'), array('controller' => 'documents', 'action' => 'add')); ?> </li>
<li><?php echo $this->Html->link(__('List Requests'), array('controller' => 'requests', 'action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(__('New Request'), array('controller' => 'requests', 'action' => 'add')); ?> </li>
<li><?php echo $this->Html->link(__('FAQ'), array('controller' => 'pages', 'action' => 'faq')); ?> </li>
<li><?php echo $this->Html->link(__('Logout'), array('controller' => 'users', 'action' => 'logout')); ?> </li>
</ul>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment