je n'arrice décidement pas a trouver le problème de mon code je vais le reposter au cas ou.
bootstrap
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| protected function _initView() {
// Initialisation de la vue et des helpers de vue
$view = new Zend_View();
$view->addHelperPath('Zend/Dojo/View/Helper/','Zend_Dojo_View_Helper');
$view->Dojo() ->addStyleSheetModule('dijit.themes.tundra')
-> setDjConfigOption('usePlainJson',true)
-> setDjConfigOption('parseOnLoad', true)
-> enable();
// On ajoute le dossier des helpers
// On charge l'helper qui va se charger de la vue
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$viewRenderer->setView($view);
return $view;
}
} |
layout
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
| <?php echo $this->doctype() ?> <!-- This Line will output the doctype we set inside the bootstrap file -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<title> Projet de test du Framework ZEND !</title>
<!--
The line below demonstrates usage of the headLink() view helper
@see http://framework.zend.com/manual/en/zend.view.helpers.html
-->
<?php echo $this->headLink()->appendStylesheet('/css/global.css') ?>
<?php echo $this -> dojo(); ?><?php echo $this->dojo()->addStylesheetModule('dijit.themes.tundra'); ?>
</head>
<body>
<div id="welcome">
<center style="font-size: 20pt;">
Projet de test du <span id="zf-name" style="font-size: 40pt;">Framework ZEND !</span>
</center>
</div>
<h1><?php echo $this->title; ?></h1>
<!-- This next call will now include any content that was generated in the
dispatching of a controllers action (or series of actions). -->
<?php echo $this->layout()->content ?>
<!-- if your application requires it, this would be a great place to put a
footer for all pages. -->
</body>
</html> |
controller
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
| <?php
/**
* Index controller
*
* Default controller for this application.
*
* @uses Zend_Controller_Action
* @package QuickStart
* @subpackage Controller
*/
class RechercheController extends Zend_Controller_Action {
/**
* The "index" action is the default action for all controllers -- the
* landing page of the site.
*
* Assuming the default route and default router, this action is dispatched
* via the following urls:
* - /
* - /index/
* - /index/index
*
* @return vonom_prenom
*/
public function indexAction() {
$form = $this->getForm();
if ($this->_request->isPost()) {
if ($form->isValid($_POST)) {
/*
* Process data
*/
$userId = $this->_getParam('userId');
//$userId contains the userId input by the user
} else {
$form->populate($_POST);
$this->view->form = $form;
}
} else {
$this->view->form = $form;
}
}
function userlistAction() {
$dbUtilisateur = new Model_DbTable_Utilisateur();
$result = $dbUtilisateur->getDefaultAdapter()->fetchAll("SELECT * FROM utilisateur");
$data = new Zend_Dojo_Data('id', $result);
$this -> _helper -> autoCompleteDojo($data);
}
function getForm() {
$form = new Zend_Form;
$user= new Zend_Form_Element_Hidden('nom_prenom');
$userId = new Zend_Dojo_Form_Element_FilteringSelect('userId');
$userId -> setLabel('choisir un utilisateur :')
-> setStoreId('userStore')
-> setStoreType('dojo.data.ItemFileReadStore')
-> setAutoComplete(true)
-> setStoreParams(array('url' => '/recherche/userlist'))
-> setAttrib('searchAttr', 'nom_prenom');
$submit = $form->createElement('submit', 'submit');
$form->addElements(array($userId, $submit));
return $form;
}
function resultatAction() {
$form = new Form_RechercheForm();
$this->view->form = $form;
$nom_prenom = $form->getValue('nom_prenom');
var_dump($form);
$dbSalle = new Model_DbTable_Salle();
/*$result = $dbSalle->getDefaultAdapter()->fetchAll("SELECT nom_salle FROM utilisateur,reservation,salle where nom_prenom=".$nom_prenom." and utilisateur.id=reservation.id and reservation.salle_id=salle.salle_id");
foreach($result as $resultat)
{
echo $resultat['nom_salle'].'</br>';
}*/
var_dump("SELECT nom_salle FROM utilisateur,reservation,salle where nom_prenom=".$nom_prenom." and utilisateur.id=reservation.id and reservation.salle_id=salle.salle_id");
}
} |
de plus la page recherche/userlist me donne un fichier avec ces données
{"identifier":"id","items":[{"id":1,"nom_prenom":"DUJARDIN Jean","email":"dujardin.jean@test.fr"},{"id":2,"nom_prenom":null,"email":"departdieu.gerad@test.fr"},{"id":3,"nom_prenom":"KAVANAGH Anthony","email":"kavanagh.anthony@test.fr"},{"id":4,"nom_prenom":"DELON Alain","email":"delon.alain@test.fr"}]}
En vous remerciant
Partager