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,12 +61,20 @@ echo $this->Form->inputs(array(
|
||||||
<?php echo $this->Paginator->numbers(array('tag' => 'li', 'separator' => false, 'currentClass' => 'active', 'currentTag' => 'span')); ?>
|
<?php echo $this->Paginator->numbers(array('tag' => 'li', 'separator' => false, 'currentClass' => 'active', 'currentTag' => 'span')); ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<?
|
||||||
|
echo $this->Form->create('Events', array('action' => 'deleteSelected'));
|
||||||
|
?>
|
||||||
|
|
||||||
<table class="table table-condensed table-striped" id="Events">
|
<table class="table table-condensed table-striped" id="Events">
|
||||||
<?php
|
<?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) {
|
foreach ($events as $key => $value) {
|
||||||
echo $this->Html->tableCells(array(
|
echo $this->Html->tableCells(array(
|
||||||
|
$this->Form->checkbox('delete.', array(
|
||||||
|
'value' => $value['Event']['Id'],
|
||||||
|
'hiddenField' => false
|
||||||
|
)),
|
||||||
$this->Html->link($this->Html->image('/events/'.$thumbData[$key]['Path'], array(
|
$this->Html->link($this->Html->image('/events/'.$thumbData[$key]['Path'], array(
|
||||||
'alt' => $thumbData[$key]['Frame']['FrameId'].'/'.$thumbData[$key]['Event']['MaxScore'],
|
'alt' => $thumbData[$key]['Frame']['FrameId'].'/'.$thumbData[$key]['Event']['MaxScore'],
|
||||||
'width' => $thumbData[$key]['Width'],
|
'width' => $thumbData[$key]['Width'],
|
||||||
|
@ -82,16 +90,16 @@ foreach ($events as $key => $value) {
|
||||||
$value['Event']['AlarmFrames'],
|
$value['Event']['AlarmFrames'],
|
||||||
$value['Event']['TotScore'],
|
$value['Event']['TotScore'],
|
||||||
$value['Event']['AvgScore'],
|
$value['Event']['AvgScore'],
|
||||||
$value['Event']['MaxScore'],
|
$value['Event']['MaxScore']
|
||||||
$this->Form->postLink(
|
|
||||||
'Delete',
|
|
||||||
array('action' => 'delete', $value['Event']['Id']),
|
|
||||||
array('confirm' => 'Are you sure?'))
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<?
|
||||||
|
echo $this->Form->end('Delete Selected');
|
||||||
|
?>
|
||||||
|
|
||||||
<ul class="pagination">
|
<ul class="pagination">
|
||||||
<?php echo $this->Paginator->numbers(array('tag' => 'li', 'separator' => false, 'currentClass' => 'active', 'currentTag' => 'span')); ?>
|
<?php echo $this->Paginator->numbers(array('tag' => 'li', 'separator' => false, 'currentClass' => 'active', 'currentTag' => 'span')); ?>
|
||||||
</ul>
|
</ul>
|
Loading…
Reference in New Issue