File indexing completed on 2024-12-22 05:33:35

0001 <?php
0002 /**
0003  *  ocs-webserver
0004  *
0005  *  Copyright 2016 by pling GmbH.
0006  *
0007  *    This file is part of ocs-webserver.
0008  *
0009  *    This program is free software: you can redistribute it and/or modify
0010  *    it under the terms of the GNU Affero General Public License as
0011  *    published by the Free Software Foundation, either version 3 of the
0012  *    License, or (at your option) any later version.
0013  *
0014  *    This program is distributed in the hope that it will be useful,
0015  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
0016  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017  *    GNU Affero General Public License for more details.
0018  *
0019  *    You should have received a copy of the GNU Affero General Public License
0020  *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
0021  **/
0022 class Default_Form_ProjectConfirm extends Zend_Form
0023 {
0024     public function __construct($options = null)
0025     {
0026         parent::__construct($options);
0027 
0028         $this->setAction('');
0029         $this->setAttrib('enctype', 'multipart/form-data');
0030         $this->addElementPrefixPath('Local', 'Local/');
0031 
0032     }
0033 
0034     public function init()
0035     {
0036 
0037         $this->setAttrib('class', 'standard-form');
0038 
0039         $mailValidCheck = new Zend_Validate_EmailAddress();
0040         $mailValidCheck->setMessage('RegisterFormEmailErrNotValid', Zend_Validate_EmailAddress::INVALID)
0041             ->setMessage('RegisterFormEmailErrNotValid', Zend_Validate_EmailAddress::INVALID_FORMAT)
0042             ->setMessage('RegisterFormEmailErrNotValid', Zend_Validate_EmailAddress::INVALID_LOCAL_PART)
0043             ->setMessage("RegisterFormEmailErrWrongHost", Zend_Validate_EmailAddress::INVALID_HOSTNAME)
0044             ->setMessage("RegisterFormEmailErrWrongHost2", Zend_Validate_Hostname::INVALID_HOSTNAME)
0045             ->setMessage("RegisterFormEmailErrHostLocal", Zend_Validate_Hostname::LOCAL_NAME_NOT_ALLOWED)
0046             ->setOptions(array('domain' => TRUE));
0047 
0048         $mailEmpty = new Zend_Validate_NotEmpty();
0049         $mailEmpty->setMessage('RegisterFormEmailErrEmpty', Zend_Validate_NotEmpty::IS_EMPTY);
0050 
0051         $mailValidatorChain = new Zend_Validate();
0052         $mailValidatorChain->addValidator($mailEmpty, true)
0053             ->addValidator($mailValidCheck, true);
0054 
0055         $paypal_mail = $this->createElement('text', 'paypal_mail')
0056             ->setLabel('PayPal-Account: *')
0057             ->addValidator($mailEmpty, true)
0058             ->addValidator($mailValidCheck, true)
0059             ->setRequired(false)
0060             ->setDecorators(
0061                 array(
0062                     'ViewHelper',
0063                     'Errors'
0064                 ))
0065             ->setAttrib('class', 'left preview-input')
0066             ->setAttrib('placeholder', $this->getView()->translate('Email Address'));
0067         $paypal_mail->addValidator(new Local_Validate_Paypal('firstname', 'lastname'));
0068         $this->addElement($paypal_mail);
0069 
0070         $firstName = $this->createElement('text', 'firstname')
0071             ->setLabel("Firstname: *")
0072             ->setRequired(false)
0073             ->addErrorMessage("Please enter your Firstname.")
0074             ->setDecorators(
0075                 array(
0076                     'ViewHelper',
0077                     'Errors'
0078                 ))
0079             ->setAttrib('class', 'left preview-input')
0080             ->setAttrib('placeholder', $this->getView()->translate('First Name'));
0081         $this->addElement($firstName);
0082 
0083 
0084         $lastName = $this->createElement('text', 'lastname')
0085             ->setLabel("Lastname: *")
0086             ->setRequired(false)
0087             ->addErrorMessage("Please enter your Lastname.")
0088             ->setDecorators(
0089                 array(
0090                     'ViewHelper',
0091                     'Errors'
0092                 ))
0093             ->setAttrib('class', 'left preview-input')
0094             ->setAttrib('placeholder', $this->getView()->translate('Last Name'));
0095         $this->addElement($lastName);
0096 
0097         $save = $this->createElement('button', 'save');
0098         $save->setLabel('Save');
0099         $save->setDecorators(array('ViewHelper'));
0100         $save->setAttrib('class', 'btn btn-submit right preview-button');
0101         $save->setAttrib('type', 'submit');
0102 
0103         $back = $this->createElement('button', 'back');
0104         $back->setLabel('Back');
0105         $back->setDecorators(array('ViewHelper'));
0106         $back->setAttrib('class', 'btn btn-grey left preview-button');
0107         $back->setAttrib('type', 'submit');
0108 //        $back->setAttrib('onclick', 'javascript:history.back();return false;');
0109 
0110         $publish = $this->createElement('button', 'publish');
0111         $publish->setLabel('Save & Publish');
0112         $publish->setDecorators(array('ViewHelper'));
0113         $publish->setAttrib('class', 'btn btn-purple right preview-button');
0114         $publish->setAttrib('type', 'submit');
0115 
0116         $this->addElement($back)
0117             ->addElement($save)
0118             ->addElement($publish);
0119 
0120     }
0121 
0122 }
0123