芝麻web文件管理V1.00
编辑当前文件:/home/p/r/i/prismawe/www/resupres/application/classes/controller/admin/candidats.php
order_by('nom', 'ASC') ->order_by('prenom', 'ASC') ->find_all(); $this->template->content = View::factory('admin/candidats/list'); $this->template->content->candidats = $candidats; } public function action_new(){ $partis = ORM::factory('parti') ->order_by('nom', 'ASC') ->find_all(); $this->template->content = View::factory('admin/candidats/new'); $this->template->content->partis = $partis; } public function action_newPost(){ $candidat = ORM::factory('candidat'); $candidat->nom = $this->request->post('nom'); $candidat->prenom = $this->request->post('prenom'); $candidat->dateNaissance = $this->request->post('dateNaissance'); $candidat->isCandidate = $this->request->post('isCandidate'); $candidat->parti_id = $this->request->post('parti_id'); $candidat->lienSitePerso = $this->request->post('lienSitePerso'); $candidat->description = $this->request->post('description'); $candidat->save(); $this->request->redirect('admin/candidats'); } public function action_modify(){ $candidat = ORM::factory('candidat', $this->request->param('id')); if ($candidat->loaded()){ $partis = ORM::factory('parti') ->order_by('nom', 'ASC') ->find_all(); $this->template->content = View::factory('admin/candidats/modify'); $this->template->content->candidat = $candidat; $this->template->content->partis = $partis; } else $this->request->redirect('admin/candidats'); } public function action_modifyPost(){ $candidat = ORM::factory('candidat', $this->request->param('id')); if ($candidat->loaded()){ $candidat->nom = $this->request->post('nom'); $candidat->prenom = $this->request->post('prenom'); $candidat->dateNaissance = $this->request->post('dateNaissance'); $candidat->isCandidate = $this->request->post('isCandidate'); $candidat->parti_id = $this->request->post('parti_id'); $candidat->lienSitePerso = $this->request->post('lienSitePerso'); $candidat->description = $this->request->post('description'); $candidat->save(); } $this->request->redirect('admin/candidats'); } }