Пример #1
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->_msg = $this->conf->msg->auth->toArray();
     $this->setName('login');
     $this->setMethod('POST');
     $this->setAction('/auth/login/');
     $e['username'] = new Zend_Form_Element_Text('username');
     $e['username']->setLabel($this->conf->msg->auth->login)->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $e['password'] = new Zend_Form_Element_Password('password');
     $e['password']->setLabel($this->conf->msg->auth->password)->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     /*
     		$referer = Zend_Controller_Front::getInstance()->getRequest()->getServer('HTTP_REFERER');
     		$host = Zend_Controller_Front::getInstance()->getRequest()->getServer('HTTP_HOST');
     		if ($referer && (strpos($referer, 'http://' . $host) !== false) )
     		{
     			l($referer, 'referer', Zend_Log::DEBUG);
     			$e['referer'] = new Zend_Form_Element_Hidden('referer');
     			$e['referer']->setValue($referer);
     		}
     */
     $e['referer'] = $this->elementHidden('referer');
     $e['submit'] = new Zend_Form_Element_Submit('submit');
     $e['submit']->setAttrib('id', 'submitbutton')->setLabel('Войти')->removeDecorator('Label');
     $this->addElements($e);
 }
Пример #2
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setName('form_contacts');
     $this->setMethod('post');
     $this->addElement($this->elementHidden('id'));
     if (empty($options['skip_person'])) {
         $e['person'] = $this->elementText('person', array('required' => true, 'decorators' => $this->elementDecorators['table'], 'label' => $this->conf->msg->feedback->person));
     }
     /* 		if (empty($options['skip_address']))
     		{
     			$e['address'] = $this->elementText('address', array(
     				'required' => true,
                     'decorators' => $this->elementDecorators['table'],
                     'label' => $this->conf->msg->feedback->address,
                 ));
     		}
     */
     if (empty($options['skip_email'])) {
         $e['email'] = $this->elementText('email', array('required' => true, 'decorators' => $this->elementDecorators['table'], 'label' => $this->conf->msg->feedback->email));
     }
     if (empty($options['skip_phone'])) {
         $e['phone'] = $this->elementText('phone', array('decorators' => $this->elementDecorators['table'], 'label' => $this->conf->msg->feedback->phone));
     }
     if (empty($options['skip_subject'])) {
         $e['subject'] = $this->elementText('subject', array('decorators' => $this->elementDecorators['table'], 'label' => $this->conf->msg->feedback->subject));
     }
     // message (textarea)
     $e['txt'] = $this->elementTextarea('txt', $this->conf->msg->feedback->txt)->setAttrib('rows', 5)->setAttrib('cols', 50)->setDecorators($this->elementDecorators['table']);
     // submit
     $element = new Zend_Form_Element_Submit('submit');
     $element->setAttrib('id', 'submitbutton')->setLabel($this->conf->msg->feedback->submit)->setDecorators($this->buttonDecorators['table']);
     $e['submit'] = $element;
     $this->_addElements($e);
 }
Пример #3
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setName('form_register');
     $this->setAction('/auth/register');
     $this->setMethod('post');
     #$ru = array('Value is empty, but a non-empty value is required' => 'message1');
     #$translate = new Zend_Translate('array', $ru, 'ru');
     #$translate = include(APP_DIR . DIRECTORY_SEPARATOR . 'translation.php');
     #$translator = new Zend_Translate_Adapter_Array($translate);
     $a = array();
     #$a['username'] = $this->elementText('username', 'Логин');
     $a['surname'] = $this->elementText('surname', 'Фамилия');
     #$a['surname']->setTranslator($translate);
     $a['name'] = $this->elementText('name', 'Имя');
     $a['middlename'] = $this->elementText('middlename', 'Отчество');
     $a['password'] = $this->elementPassword('password', 'Пароль');
     $password2 = $this->elementPassword('password2', 'Подтверждение пароля');
     $password2->addValidator(new Zx_Validate_PasswordConfirmation('password'));
     #echo "DEBUG:<br><textarea rows=10 cols=100>" . print_r($password2, 1) . "</textarea><br>";die;
     $a['password2'] = $password2;
     #$captcha	 = new Zend_Form_Element_Captcha();
     /*
     		$a['captcha'] = new Zend_Form_Element_Captcha('captcha', array(
     				'label' => 'Пожалуйста, введите символы на иллюстрации:',
     				'captcha' => array(
     					'captcha' => 'Image',
     					'wordLen' => 6,
     					'timeout' => 300,
     					'font' => FrontEnd::getFont(),
     					#'font' => $this->'arial', // must be in GDFONTPATH $_ENV
     					'imgurl' => '/images/captcha',
     				),
     		));
     */
     $id = $this->elementHidden('id');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Зарегистрироваться');
     #$this->addElement('submit', 'login', array('label' => 'Login'));
     $aa = array_values($a);
     $aaa = array($id, $submit);
     $this->addElements(array_merge($aa, $aaa));
 }