1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
| <?php
class Default_RechercheavanceeController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
}
public function avanceAction()
{
$etat_article = new Default_Model_EtatarticleMapper();
$this->view->aEtat_articles = $etat_article->fetchAll();
$mode_payement = new Default_Model_ModepayementMapper();
$this->view->aMode_payements = $mode_payement->fetchAll();
$sous_categorie = new Default_Model_SouscategorieMapper();
$this->view->aSous_categories= $sous_categorie->fetchAll();
$type_vente = new Default_Model_TypeventeMapper();
//var_dump($type_vente->fetchAll());exit();
$this->view->aType_ventes= $type_vente->fetchAll();
$request = $this->getRequest();
$form = new Default_Form_Rechercheavance();
if ($this->getRequest()->isPost()) {
if ($form->isValid($request->getPost())) {
return $this->_helper->redirector('/recherche');
//return $this->_helper->redirector('rechercheavancee/recherche');
}
}
$this->view->form = $form;
}
public function rechercheAction()
{
$annonce = new Default_Model_AnnonceMapper();
$request = $this->getRequest();
$form = new Default_Form_Rechercheavance();
if ($this->getRequest()->isPost()) {
//getRequest() peut être utilisé pour récupérer l'objet de requête utilisé pour appeler l'action.
if ($form->isValid($request->getPost())) {
$tab = $request->getPost();
//var_dump($tab["Dateinsertion"]); exit();
//var_dump($tab["prix"]); exit();
//var_dump($tab["Mot_cle"]); exit();
//$this->view->resultat= $annonce->search($tab["cp"]);
$this->view->resultat= $annonce->search($tab["Mot_cle"],$tab["prix"],$tab["Designation_etat_art"],$tab["designation_mp"],$tab["designation_sous_categorie"],$tab["designation_type_vente"],$tab["Ville"],$tab["Cp"]);
var_dump($this->resultat);
//var_dump(foreach());
}}}
}
t en gros je voudrais afficher mes résultats sous forme de tableau avec donc un code dans mon .phtml dans le style :
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Page d'accueil</title>
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen, projection">
</head>
<body>
<div id="corps_depann">
<article>
<section>
<div id="section_depann">
<h1>Recherche avancée </h1>
<div id="form_depann">
<div id="form_tete_depann">
<h2>Critére de recherche</h2>
</div>
<div id="form_corps_depann">
<form action="" method="POST" id="">
<table>
<?php foreach ($this->resultat as $annonce): ?>
<tr>
<tr><td><h2>Mot clé:</h2></td><td><?php echo $this-> escape ($annonce ['Mot_cle']);?></td></tr>
<tr><td><h2>Prix:</h2></td><td><?php echo $this-> escape ($annonce ['prix']);?></td></tr>
<tr><td><h2>Etat de l'article:</h2></td><td><?php echo $this-> escape ($annonce ['Designation_etat_art']);?><td></tr>
<tr><td><h2>Condition de paiement:</h2></td><td><?php echo $this-> escape ($annonce ['designation_mp']);?></td></tr>
<tr><td><h2>Sous_categorie:</h2></td><td><?php echo $this-> escape ($annonce ['designation_sous_categorie']);?></td></tr>
<tr><td><h2>Type de vente:</h2></td><td><?php echo $this-> escape ($annonce ['designation_type_vente']);?></td></tr>
<tr><td><h2>Ville:</h2></td><td><?php echo $this-> escape ($annonce ['Ville']);?></td></tr>
<tr><td><h2>Code postal:</h2></td><td><?php echo $this-> escape ($annonce ['Cp']);?></td></tr>
<tr><td><h2>Date insertion:</h2></td><td><?php echo $this-> escape ($annonce ['Dateinsertion']);?></td></tr></td></tr>
<tr><td><h2>Distance géographique:</h2></td><td><?php echo $this-> escape ($annonce ['Distancegeographique']);?></td></tr>
<tr><td></td>
</div>
</td></tr>
</tr>
<?php endforeach ?>
</table>
</form>
</div>
</div>
</div>
</section>
</article>
</div>
</body> |
Partager