X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=module%2FGalerie%2Fsrc%2FGalerie%2FController%2FIndexController.php;h=15455a3ce9e3e27b3b4e6880e299eaf890a154c8;hb=a00c1c030c3c6e7d2415e0bb7adb88917f9b564f;hp=babaf28575665e9c2e9f7f7036c7feb99510836f;hpb=a8a6dbc32613045bedebff292f83aedc5380c49c;p=zf2.biz%2Fgalerie.git diff --git a/module/Galerie/src/Galerie/Controller/IndexController.php b/module/Galerie/src/Galerie/Controller/IndexController.php index babaf28..15455a3 100644 --- a/module/Galerie/src/Galerie/Controller/IndexController.php +++ b/module/Galerie/src/Galerie/Controller/IndexController.php @@ -34,26 +34,50 @@ class IndexController extends AbstractActionController public function indexAction() { return new ViewModel(array( - 'Galerie_all' => $this->_getGalerieTable()->all(), - 'Galerie_one' => $this->_getGalerieTable()->get(1), - 'GalerieInfo_all' => $this->_getGalerieInfoTable()->select(), - 'GalerieInfo_one' => $this->_getGalerieInfoTable()->select(array('gallery.id' => 1))->current(), - 'GalerieInfo_usr' => $this->_getGalerieInfoTable()->select(array('gallery.id_user' => 1)), + 'galeries' => $this->_getGalerieInfoTable()->all(), )); } public function editAction() { - return array(); + // Récupération de l'objet de travail + $id = $this->params()->fromRoute('id', null); + $galerie = $this->_getGalerieTable()->any($id); + + // Récupération de l'objet requête + $request = $this->getRequest(); + if ($request->isPost()) { + // Validation des données + + if (true) {//TODO: Si les données sont valides + // Sauvegarde des données + // $this->_getGalerieTable()->save(?TODO?); + + // Redirection + return $this->redirect()->toRoute('galerie'); + } + } + return new ViewModel(array( + 'id' => $id, + 'galerie' => $galerie, + )); } public function delAction() { - return array(); + return $this->redirect()->toRoute('galerie/view', array( + 'id' => $this->params()->fromRoute('id', null), + )); } public function viewAction() - { - return array(); + { + $id = $this->params()->fromRoute('id', null); + $galerie = $this->_getGalerieInfoTable()->any($id); + return new ViewModel(array( + 'id' => $id, + 'galerie' => $galerie, + )); } + }