Mini Shell
<?PHP
class DepoimentosController extends DepoimentosAppController{
public $paginate = array('limit'=>16,'order'=>array('Depoimento.order_depoimento' => 'ASC', 'Depoimento.created' => 'DESC'));
// public function index(){
// $this->Seo->title('Depoimentos');
// $this->Seo->description('Depoimentos');
// $posts = $this->Depoimento->find('all',array('order' => array('Depoimento.order_depoimento' => 'ASC', 'Depoimento.created' => 'DESC')));
// $this->set('posts',$posts);
// }
public function admin_index(){
$this->layout = 'Painel.admin';
$this->paginate['order'] = array('Depoimento.order_depoimento' => 'ASC', 'Depoimento.created' => 'DESC');
$posts = $this->paginate('Depoimento');
$this->set('posts',$posts);
}
public function admin_add(){
$this->layout="Painel.admin";
$this->view="admin_editor";
if($this->request->data && ($this->request->is('post') || $this->request->is('put'))){
if($this->Depoimento->save($this->request->data)){
$this->redirect(array('action'=>'index'));
}
}
}
public function admin_edit($id){
$this->layout="Painel.admin";
$this->view="admin_editor";
$this->data=$this->Depoimento->read('*',$id);
}
public function admin_delete($id){
$this->autoRender=false;
if($this->Depoimento->delete($id)){
$this->redirect(array('action'=>'index'));
}
}
public function admin_order($id,$order){
$this->autoRender = false;
$this->Depoimento->query('UPDATE tb_depoimentos SET order_depoimento = "'.$order.'" WHERE id = "'.$id.'";');
}
}
Zerion Mini Shell 1.0