ja mam tak u siebie zrobione
PostsController
public function admin_index(){
'order' => 'Post.published DESC',
'limit' => '10',
)
);
if($this->RequestHandler->isAjax()){
$this->paginate['conditions'] = Set::merge(
$this->paginate['conditions'],
'Post.modified BETWEEN ? AND ?' => array($this->request->data['Post']['from'], $this->request->data['Post']['to']) )
);
}
$Posts = $this->paginate('Post');
if($this->RequestHandler->isAjax()){
$this->render('ajax/admin_indexUpdate');
}
}
admin_index.ctp
<?php
'plugin' => false,
'controller' => 'posts',
'admin' => true,
'prefix' => 'admin'
);
$this->Html->addCrumb('Blog', array( 'plugin' => false,
'controller' => 'posts',
'action' => 'index',
'admin' => true,
'prefix' => 'admin'
));
?>
<section class="row">
<?php
echo $this->Form->create(null, array('id' => 'dateUpdate')); 'class' => 'input-append date',
'id' => 'dp',
));
'class' => 'input-append date',
'id' => 'dp2',
));
$data = $this->Js->get('#dateUpdate')->serializeForm(array( 'isForm' => true,
'inline' => true
));
$this->Js->get('#dateUpdate')->event('change',
$this->Js->request(
'controller' => 'posts',
'action' => 'index',
'admin' => true // or false //
)),
'update' => '#update',
'async' => true,
'dataExpression'=>true,
'method' => 'POST',
'data' => $data
)
));
echo $this->Html->scriptBlock(" $('#dp').datepicker({dateFormat: 'yy-mm-dd'});
$('#dp2').datepicker({dateFormat: 'yy-mm-dd'});
");
?>
<section class="span8" id="update">
<?php echo $this->element('BootstrapPagination', array('update' => 'update')); ?> <table class="table table-bordered">
$this->Paginator->sort('id'),
$this->Paginator->sort('status'),
$this->Paginator->sort('modified'),
$this->Paginator->sort('title'),
$this->Paginator->sort('author'),
'Actions'
)); ?>
<?php foreach($Posts as $k => $Post): ?>
<?php
switch($Post['Post']['status']){
case '0':
break;
case '1':
}
?>
h($Post['Post']['id']),
h($Post['status']),
h(
$this->Time->format('Y-m-d H:i:s', $Post['Post']['modified'], false, $_SESSION['timezone'])
),
h($Post['Post']['title']),
h($Post['User']['name']),
$this->Html->Link('',
array('class' => 'icon-trash'), __('Are you sure?'), false
),
$this->Html->Link('',
array('class' => 'icon-eye-open') ),
$this->Html->Link('',
array('class' => 'icon-edit') )
)); ?>
<?php endforeach; ?>
</table>
<?php echo $this->element('BootstrapPagination'); ?> </section>
<aisde class="span3 offset1">
<ul class="nav nav-list">
<li class="nav-header actions">
Blog Actions
</li>
<li class="divider"></li>
$url, array('action' => 'index') )); ?></li>
$url, array('action' => 'add') )); ?></li>
</ul>
</aside>
</section>
i śmiga