Mini Shell

Direktori : /home/brasafestival/www/old/bkp_2023/app/Plugin/Espacos/Controller/
Upload File :
Current File : /home/brasafestival/www/old/bkp_2023/app/Plugin/Espacos/Controller/EspacosController.php

<?PHP
class EspacosController extends EspacosAppController{

    public $paginate = array('limit'=>16,'order'=>array('Espaco.order_depoimento' => 'ASC', 'Espaco.created' => 'DESC'));
    
    public function admin_index(){
        $this->layout = 'Painel.admin';
        $this->paginate['order'] = array('Espaco.order_registro' => 'ASC', 'Espaco.created' => 'DESC');
        $posts = $this->paginate('Espaco');
        $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->Espaco->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->Espaco->read('*',$id); 
    }
    
    public function admin_delete($id){
        $this->autoRender = false;
        if($this->Espaco->delete($id)){
            $this->redirect(array('action'=>'index'));
        }
    }   
    
    public function admin_order($id,$order){
        $this->autoRender = false;
        $this->Espaco->query('UPDATE tb_estacoes SET order_registro = "'.$order.'" WHERE id = "'.$id.'";');
    }
    
}

Zerion Mini Shell 1.0