2 /* This file is part of Syj, Copyright (c) 2010 Arnaud Renevier,
3 and is published under the AGPL license. */
5 class Syj_Form_User extends Syj_Form_TableAbstract
7 public function init() {
8 $translator = $this->getTranslator();
10 $name = array('Text', 'user_pseudo', array(
11 'label' => __("user name"),
12 'attribs' => array('maxlength' => '20'),
13 'validators' => array(new Zend_Validate_StringLength(0, 20),
14 new Zend_Validate_Regex('/^[a-zA-Z0-9_\.]+$/')),
18 $desc = $translator->translate("At least %d characters");
19 $desc = vsprintf($desc, 6);
20 $pass = array('Password', 'user_password', array(
21 'label' => __("password"),
23 'description' => $desc,
24 'validators' => array(new Zend_Validate_StringLength(6))
27 $pass_confirm = array('Password', 'user_password_confirm', array(
28 'label' => __("confirm password"),
29 'validators' => array(new Zend_Validate_Identical('user_password')),
33 $email = array('Text', 'user_email', array(
34 'label' => __("email"),
35 'description' => __("After creating your account, you will receive a confirmation email. You have 7 days to confirm otherwise, your account and your routes will all be deleted."),
39 $this->setMainElements(array($name, $pass, $pass_confirm, $email));
41 $anchor = $this->getView()->Anchor("termsofuse", $translator->translate("terms of use"), array('id' => 'user_termsofuse_anchor'));
42 $text = $translator->translate("I've read and accepted %s");
43 $text = vsprintf($text, $anchor);
44 $this->addElement('Checkbox', 'user_accept', array("label" => $text,
45 'decorators' => array(
48 array('HtmlTag', array('tag' => 'div'))),
49 'validators' => array(new Zend_Validate_Identical('1'))));
51 $decorator = $this->user_accept->getDecorator('Zend_Form_Decorator_Label');
52 $decorator->setOption('escape', false);
54 $this->addElement('Submit', 'user_submit', array('label' => __("create account")));