0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ProfileForm.php
Go to the documentation of this file.
1 <?
24 class ProfileForm extends Zend_Form
25 {
26  public function init() {
27  $user=Zend_Auth::getInstance()->getIdentity();
28  $username = $this->addElement('text', 'username', array(
29  'filters' => array('StringTrim', 'StringToLower'),
30  'validators' => array(
31  'Alnum',
32  array('StringLength', false, array(3, 20)),
33  ),
34  'required' => true,
35  'label' => 'Your username:',
36  'readonly' => 'true',
37  'value' => $user->getId(),
38  ));
39 
40  $display_name = $this->addElement('text', 'display_name', array(
41  'filters' => array('StringTrim'),
42  'required' => false,
43  'label' => 'Display Name:',
44  'value' => $user->getDisplayName(),
45  ));
46 
47  $password = $this->addElement('password', 'password', array(
48  'filters' => array('StringTrim'),
49  'required' => false,
50  'label' => 'Password:',
51  ));
52 
53  $email = $this->addElement('text', 'email', array(
54  'filters' => array('StringTrim'),
55  'validators' => array('emailAddress'),
56  'required' => false,
57  'label' => 'Email:',
58  'value' => $user->getEmail(),
59  ));
60 
61  $email = $this->addElement('text', 'location', array(
62  'filters' => array('StringTrim'),
63  'required' => false,
64  'label' => 'Location:',
65  'value' => $user->getLocation(),
66  ));
67 
68  $email = $this->addElement('text', 'webpage', array(
69  'filters' => array('StringTrim'),
70  'required' => false,
71  'label' => 'Webpage:',
72  'value' => $user->getWebpage(),
73  ));
74 
75  $email = $this->addElement('text', 'avatar', array(
76  'filters' => array('StringTrim'),
77  'required' => false,
78  'label' => 'Avatar (URL):',
79  'value' => $user->getAvatar(),
80  ));
81 
82  $login = $this->addElement('submit', 'save', array(
83  'required' => false,
84  'ignore' => true,
85  'label' => 'Save',
86  ));
87 
88  // We want to display a 'failed to save' message if necessary;
89  // we'll do that with the form 'description', so we need to add that
90  // decorator.
91  $this->setDecorators(array(
92  'FormElements',
93  array('HtmlTag', array('tag' => 'dl', 'class' => 'zend_form')),
94  array('Description', array('placement' => 'prepend')),
95  'Form'
96  ));
97  }
98 }
99 
100 ?>
101 
Copyright (C) 2007-2015 Hypertable, Inc.
Definition: ProfileForm.php:24