Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. public function createAction() {
  2. $form = new Zend_Form;
  3. $form->setAction($this->view->baseUrl().'/galerie/save')
  4. ->setMethod('post');
  5. if ($this->getRequest()->isGet()) {
  6. $reiseId = (int)$this->getRequest()->getParam('id_reise');
  7.  
  8. }
  9. $form->addElement('text', 'name', array('label' => 'Name'));
  10. $form->addElement('textarea', 'beschreibung', array('label' => 'Beschreibung'));
  11.  
  12.  
  13. $image = new Zend_Form_Element_File('image');
  14. $image
  15. ->setLabel('Lad dein Foto hoch')
  16. ->setRequired(true)
  17. ->addValidator('Count', false, 1)
  18. ->addValidator('Size', false, 102400)
  19. ->addValidator('Extension', false, 'jpg,png,gif')
  20. ->addFilter('Rename',
  21. array(
  22. 'target' => $this->view->startUrl() . '/images/',
  23. 'overwrite' => true
  24. )
  25. );
  26.  
  27. $form->addElement($image);
  28.  
  29. $form->addElement('submit', 'save', array('label' => 'Speichern'));
  30. $form->addElement('hidden', 'id_reise', array('value' => $reiseId));
  31. $this->view->form = $form;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement