]> dev.renevier.net Git - syj.git/blob - application/forms/Login.php
version 0.1
[syj.git] / application / forms / Login.php
1 <?php
2 /*  This file is part of Syj, Copyright (c) 2010 Arnaud Renevier,
3     and is published under the AGPL license. */
4
5 class Syj_Form_Login extends Syj_Form_TableAbstract
6 {
7
8     public function init() {
9         $user = array('Text', 'login_user', array( 'label' => __("user"), 'required' => true));
10         $pass = array('Password', 'login_password', array( 'label' => __("password")));
11
12
13         $this->setMainElements(array($user, $pass))
14              ->addElement('Hidden', 'login_geom_id', array( 'decorators' => array('ViewHelper')));
15
16         $currentUri = Zend_Controller_Front::getInstance()->getRequest()->getRequestUri();
17         if (strpos($currentUri, '?') !== false) {
18             $currentUri = strstr($currentUri, '?', true);
19         }
20         $href = $this->getView()->addParamToUrl('newpwd', 'redirect', $currentUri, true);
21
22         $anchor = $this->getView()->Anchor($href,
23                                     $this->getTranslator()->translate("I forgot my password"),
24                                     array('id' => 'newpwd_control_anchor'));
25
26         $this->addElement('Submit', 'login_submit', array('label' => __("login"), 'description' => $anchor));
27         $decorator = $this->login_submit->getDecorator('Description');
28         $decorator->setOption('escape', false);
29     }
30
31 }