Added ability to delete multiple events at once
This commit is contained in:
parent
0f25bec1d6
commit
c6bbdac0d7
|
@ -70,6 +70,13 @@ public function index() {
|
|||
}
|
||||
}
|
||||
|
||||
public function deleteSelected() {
|
||||
$this->log(print_r($this->data['Events'], true));
|
||||
foreach($this->data['Events'] as $key => $value) {
|
||||
$this->Event->delete($value);
|
||||
}
|
||||
$this->redirect($this->referer());
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -61,13 +61,21 @@ echo $this->Form->inputs(array(
|
|||
<?php echo $this->Paginator->numbers(array('tag' => 'li', 'separator' => false, 'currentClass' => 'active', 'currentTag' => 'span')); ?>
|
||||
</ul>
|
||||
|
||||
<?
|
||||
echo $this->Form->create('Events', array('action' => 'deleteSelected'));
|
||||
?>
|
||||
|
||||
<table class="table table-condensed table-striped" id="Events">
|
||||
<?php
|
||||
echo $this->Html->tableHeaders(array( 'Thumbnail', 'Id', 'Name', 'Monitor', 'Cause', 'Time', 'Duration', 'Alarm Frames', 'Total Score', 'Avg. Score', 'Max Score', '' ));
|
||||
echo $this->Html->tableHeaders(array('', 'Thumbnail', 'Id', 'Name', 'Monitor', 'Cause', 'Time', 'Duration', 'Alarm Frames', 'Total Score', 'Avg. Score', 'Max Score'));
|
||||
|
||||
foreach ($events as $key => $value) {
|
||||
echo $this->Html->tableCells(array(
|
||||
$this->Html->link($this->Html->image('/events/'.$thumbData[$key]['Path'], array(
|
||||
$this->Form->checkbox('delete.', array(
|
||||
'value' => $value['Event']['Id'],
|
||||
'hiddenField' => false
|
||||
)),
|
||||
$this->Html->link($this->Html->image('/events/'.$thumbData[$key]['Path'], array(
|
||||
'alt' => $thumbData[$key]['Frame']['FrameId'].'/'.$thumbData[$key]['Event']['MaxScore'],
|
||||
'width' => $thumbData[$key]['Width'],
|
||||
'height' => $thumbData[$key]['Height']
|
||||
|
@ -82,16 +90,16 @@ foreach ($events as $key => $value) {
|
|||
$value['Event']['AlarmFrames'],
|
||||
$value['Event']['TotScore'],
|
||||
$value['Event']['AvgScore'],
|
||||
$value['Event']['MaxScore'],
|
||||
$this->Form->postLink(
|
||||
'Delete',
|
||||
array('action' => 'delete', $value['Event']['Id']),
|
||||
array('confirm' => 'Are you sure?'))
|
||||
$value['Event']['MaxScore']
|
||||
));
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
|
||||
<?
|
||||
echo $this->Form->end('Delete Selected');
|
||||
?>
|
||||
|
||||
<ul class="pagination">
|
||||
<?php echo $this->Paginator->numbers(array('tag' => 'li', 'separator' => false, 'currentClass' => 'active', 'currentTag' => 'span')); ?>
|
||||
</ul>
|
Loading…
Reference in New Issue