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
| <?php
class IndexController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
$albums = new Application_Model_DbTable_Albums();
$this->view->albums = $albums->fetchAll();
}
function ajouterAction()
{
$form = new Application_Form_Album();
$form->envoyer->setLabel('Ajouter');
$this->view->form = $form;
if ($this->getRequest()->isPost()) {
$formData = $this->getRequest()->getPost();
if ($form->isValid($formData)) {
$artiste = $form->getValue('artiste');
$titre = $form->getValue('titre');
$albums = new Application_Model_DbTable_Albums();
$albums->ajouterAlbum($artiste, $titre);
$this->_helper->redirector('index');
} else {
$form->populate($formData);
}
}
}
public function editAction()
{
}
public function deleteAction()
{
}
} |
Partager