-
Notifications
You must be signed in to change notification settings - Fork 0
/
User.php
110 lines (95 loc) · 3.03 KB
/
User.php
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
/**
* CORE Conference Manager
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://www.terena.org/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to webmaster@terena.org so we can send you a copy immediately.
*
* @copyright Copyright (c) 2011 TERENA (http://www.terena.org)
* @license http://www.terena.org/license/new-bsd New BSD License
* @revision $Id: User.php 38 2011-10-18 14:19:19Z gijtenbeek@terena.org $
*/
/**
*
* @package Core_Forms
*/
class Core_Form_User extends TA_Form_Abstract
{
public function init()
{
$this->setAction('/core/user/new');
$this->setAttrib('enctype', 'multipart/form-data');
$fname = new Zend_Form_Element_Text('fname');
$fname->setLabel('First Name')
->setRequired(true)
->setAttrib('class', 'medium')
->setDecorators(array('Composite'));
$lname = new Zend_Form_Element_Text('lname');
$lname->setLabel('Last Name')
->setRequired(true)
->setAttrib('class', 'medium')
->setDecorators(array('Composite'));
$organisation = new Zend_Form_Element_Text('organisation');
$organisation->setLabel('Organisation')
->setAttrib('class', 'medium')
->setDecorators(array('Composite'));
$country = new TA_Form_Element_Country('country');
$country->setLabel('Country')
->setDecorators(array('Composite'));
$jobtitle = new Zend_Form_Element_Text('jobtitle');
$jobtitle->setLabel('Job title')
->setAttrib('class', 'medium')
->setDecorators(array('Composite'));
$profile = new Zend_Form_Element_Textarea('profile');
$profile->setLabel('Biography')
->setAttrib('class', 'medium')
->setDecorators(array('Composite'));
$email = new Zend_Form_Element_Text('email');
$email->setLabel('Email')
->setRequired(true)
->setAttrib('class', 'medium')
->setDescription('the invitation will be sent to this address')
->addValidators(array(
array('EmailAddress', true),
))
->setDecorators(array('Composite'));
$resize = new TA_Filter_ImageResize();
$resize->setWidth(170)
->setHeight(212);
$image = new TA_Form_Element_MagicFile('file');
$image->setLabel('Picture')
->setDescription('Image should be at least 500 pixels wide and 600 pixels high, and not be over 5Mb')
->addDecorators($this->_magicFileElementDecorator)
->addFilter($resize)
->addValidators(array(
array('Count', true, 1),
array('IsImage', true),
array('Size', true, array('max' => '5Mb')),
array('ImageSize', true, array(
'minwidth' => 500,
'minheight' => 600
))
));
$this->addElements(array(
$fname,
$lname,
$organisation,
$email,
$country,
$jobtitle,
$profile,
$image
));
$this->addElement('submit', 'submit', array(
'label' => 'Submit',
'decorators' => $this->_buttonElementDecorator
));
}
}