芝麻web文件管理V1.00
编辑当前文件:/home/p/r/i/prismawe/www/resupres/application/classes/controller/ville.php
template->menuActif = 'region'; if ($this->request->param('id') != '') { $ville = ORM::factory('ville', $this->request->param("id")); if($ville->loaded()) { $urlville = URL::title($ville->nom, '_', true); if($this->request->param("ville") != $urlville) { $this->request->redirect('ville/resultat_election/'.$ville->id.'-'.$urlville); } $resultats = ORM::factory('resultat') ->where_open() ->and_where("ville_id", "=", $this->request->param("id")) ->and_where("candidat_id", "!=", 0) ->where_close() ->order_by("tauxvotes", "DESC") ->find_all(); $regions = ORM::factory('regionrslt')->find_all(); $this->template->content = View::factory('ville/carte'); $this->template->content->ville = $ville; $this->template->content->resultats = $resultats; $this->template->content->regions = $regions; } } else if($_SERVER['REQUEST_METHOD'] == 'POST') { $this->request->redirect('ville/resultat_election/' . $this->request->post("insee")); } else { //on redirige sur la ville de Paris $this->request->redirect('ville/resultat_election/75056'); } } public function action_departement() { $this->auto_render = FALSE; $departements = ORM::factory('departement')->where('regionrslt_id', "=", $this->request->post('region'))->find_all(); foreach($departements as $dep) { echo $dep->id.";".$dep->nom."|"; } } public function action_ville() { $this->auto_render = FALSE; $villes = ORM::factory('ville') ->where("departement_id", "=", $this->request->post('dept')) ->and_where("nom", "LIKE", $this->request->post('search')."%") ->find_all(); foreach($villes as $ville) { echo $ville->nom."/".$ville->id."|"; } } }