Remove Logs views, ouput log json via _serialize

This commit is contained in:
Kyle Johnson 2014-12-01 16:13:08 +00:00
parent 682190c186
commit dd9188b7cd
5 changed files with 14 additions and 157 deletions

View File

@ -13,7 +13,11 @@ class LogsController extends AppController {
*
* @var array
*/
public $components = array('Paginator');
public $components = array('Paginator', 'RequestHandler');
public $paginate = array(
'limit' => 100,
'order' => array( 'Log.TimeKey' => 'asc' )
);
/**
* index method
@ -21,8 +25,15 @@ class LogsController extends AppController {
* @return void
*/
public function index() {
$this->Log->recursive = 0;
$this->set('logs', $this->Paginator->paginate());
$this->Log->recursive = -1;
$this->Paginator->settings = $this->paginate;
$logs = $this->Paginator->paginate('Log');
$this->set(array(
'logs' => $logs,
'_serialize' => array('logs')
));
}
/**

View File

@ -1,23 +0,0 @@
<div class="logs form">
<?php echo $this->Form->create('Log'); ?>
<fieldset>
<legend><?php echo __('Add Log'); ?></legend>
<?php
echo $this->Form->input('Component');
echo $this->Form->input('Pid');
echo $this->Form->input('Level');
echo $this->Form->input('Code');
echo $this->Form->input('Message');
echo $this->Form->input('File');
echo $this->Form->input('Line');
?>
</fieldset>
<?php echo $this->Form->end(__('Submit')); ?>
</div>
<div class="actions">
<h3><?php echo __('Actions'); ?></h3>
<ul>
<li><?php echo $this->Html->link(__('List Logs'), array('action' => 'index')); ?></li>
</ul>
</div>

View File

@ -1,25 +0,0 @@
<div class="logs form">
<?php echo $this->Form->create('Log'); ?>
<fieldset>
<legend><?php echo __('Edit Log'); ?></legend>
<?php
echo $this->Form->input('TimeKey');
echo $this->Form->input('Component');
echo $this->Form->input('Pid');
echo $this->Form->input('Level');
echo $this->Form->input('Code');
echo $this->Form->input('Message');
echo $this->Form->input('File');
echo $this->Form->input('Line');
?>
</fieldset>
<?php echo $this->Form->end(__('Submit')); ?>
</div>
<div class="actions">
<h3><?php echo __('Actions'); ?></h3>
<ul>
<li><?php echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $this->Form->value('Log.TimeKey')), null, __('Are you sure you want to delete # %s?', $this->Form->value('Log.TimeKey'))); ?></li>
<li><?php echo $this->Html->link(__('List Logs'), array('action' => 'index')); ?></li>
</ul>
</div>

View File

@ -1,52 +0,0 @@
<div class="logs index">
<h2><?php echo __('Logs'); ?></h2>
<table cellpadding="0" cellspacing="0">
<tr>
<th><?php echo $this->Paginator->sort('TimeKey'); ?></th>
<th><?php echo $this->Paginator->sort('Component'); ?></th>
<th><?php echo $this->Paginator->sort('Pid'); ?></th>
<th><?php echo $this->Paginator->sort('Level'); ?></th>
<th><?php echo $this->Paginator->sort('Code'); ?></th>
<th><?php echo $this->Paginator->sort('Message'); ?></th>
<th><?php echo $this->Paginator->sort('File'); ?></th>
<th><?php echo $this->Paginator->sort('Line'); ?></th>
<th class="actions"><?php echo __('Actions'); ?></th>
</tr>
<?php foreach ($logs as $log): ?>
<tr>
<td><?php echo h($log['Log']['TimeKey']); ?>&nbsp;</td>
<td><?php echo h($log['Log']['Component']); ?>&nbsp;</td>
<td><?php echo h($log['Log']['Pid']); ?>&nbsp;</td>
<td><?php echo h($log['Log']['Level']); ?>&nbsp;</td>
<td><?php echo h($log['Log']['Code']); ?>&nbsp;</td>
<td><?php echo h($log['Log']['Message']); ?>&nbsp;</td>
<td><?php echo h($log['Log']['File']); ?>&nbsp;</td>
<td><?php echo h($log['Log']['Line']); ?>&nbsp;</td>
<td class="actions">
<?php echo $this->Html->link(__('View'), array('action' => 'view', $log['Log']['TimeKey'])); ?>
<?php echo $this->Html->link(__('Edit'), array('action' => 'edit', $log['Log']['TimeKey'])); ?>
<?php echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $log['Log']['TimeKey']), array(), __('Are you sure you want to delete # %s?', $log['Log']['TimeKey'])); ?>
</td>
</tr>
<?php endforeach; ?>
</table>
<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 Log'), array('action' => 'add')); ?></li>
</ul>
</div>

View File

@ -1,54 +0,0 @@
<div class="logs view">
<h2><?php echo __('Log'); ?></h2>
<dl>
<dt><?php echo __('TimeKey'); ?></dt>
<dd>
<?php echo h($log['Log']['TimeKey']); ?>
&nbsp;
</dd>
<dt><?php echo __('Component'); ?></dt>
<dd>
<?php echo h($log['Log']['Component']); ?>
&nbsp;
</dd>
<dt><?php echo __('Pid'); ?></dt>
<dd>
<?php echo h($log['Log']['Pid']); ?>
&nbsp;
</dd>
<dt><?php echo __('Level'); ?></dt>
<dd>
<?php echo h($log['Log']['Level']); ?>
&nbsp;
</dd>
<dt><?php echo __('Code'); ?></dt>
<dd>
<?php echo h($log['Log']['Code']); ?>
&nbsp;
</dd>
<dt><?php echo __('Message'); ?></dt>
<dd>
<?php echo h($log['Log']['Message']); ?>
&nbsp;
</dd>
<dt><?php echo __('File'); ?></dt>
<dd>
<?php echo h($log['Log']['File']); ?>
&nbsp;
</dd>
<dt><?php echo __('Line'); ?></dt>
<dd>
<?php echo h($log['Log']['Line']); ?>
&nbsp;
</dd>
</dl>
</div>
<div class="actions">
<h3><?php echo __('Actions'); ?></h3>
<ul>
<li><?php echo $this->Html->link(__('Edit Log'), array('action' => 'edit', $log['Log']['TimeKey'])); ?> </li>
<li><?php echo $this->Form->postLink(__('Delete Log'), array('action' => 'delete', $log['Log']['TimeKey']), null, __('Are you sure you want to delete # %s?', $log['Log']['TimeKey'])); ?> </li>
<li><?php echo $this->Html->link(__('List Logs'), array('action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(__('New Log'), array('action' => 'add')); ?> </li>
</ul>
</div>