sintonia/airtime_mvc/application/forms/AddUser.php
Yuchen Wang 5d741d84ee CC-3001: Preferences->"Submit" button renamed to "Save", and should be at the top and the bottom of the screen
Changed all other buttons that says "Submit" to "Save.
Also added some CSS stuff so that the "Save" button at the top of Preference page
have some space between itself and the form below.
2011-11-09 16:03:32 -05:00

102 lines
3.5 KiB
PHP

<?php
class Application_Form_AddUser extends Zend_Form
{
public function init()
{
/*
$this->addElementPrefixPath('Application_Validate',
'../application/validate',
'validate');
* */
$hidden = new Zend_Form_Element_Hidden('user_id');
$hidden->setDecorators(array('ViewHelper'));
$this->addElement($hidden);
$login = new Zend_Form_Element_Text('login');
$login->setLabel('Username:');
$login->setAttrib('class', 'input_text');
$login->setRequired(true);
$login->addFilter('StringTrim');
//$login->addValidator('UserNameValidate');
$this->addElement($login);
$password = new Zend_Form_Element_Password('password');
$password->setLabel('Password:');
$password->setAttrib('class', 'input_text');
$password->setRequired(true);
$password->addFilter('StringTrim');
$password->addValidator('NotEmpty');
$this->addElement($password);
$firstName = new Zend_Form_Element_Text('first_name');
$firstName->setLabel('Firstname:');
$firstName->setAttrib('class', 'input_text');
$firstName->addFilter('StringTrim');
$firstName->addValidator('NotEmpty');
$this->addElement($firstName);
$lastName = new Zend_Form_Element_Text('last_name');
$lastName->setLabel('Lastname:');
$lastName->setAttrib('class', 'input_text');
$lastName->addFilter('StringTrim');
$lastName->addValidator('NotEmpty');
$this->addElement($lastName);
$email = new Zend_Form_Element_Text('email');
$email->setLabel('Email:');
$email->setAttrib('class', 'input_text');
$email->addFilter('StringTrim');
$email->addValidator('EmailAddress');
$this->addElement($email);
$skype = new Zend_Form_Element_Text('skype');
$skype->setLabel('Skype:');
$skype->setAttrib('class', 'input_text');
$skype->addFilter('StringTrim');
$this->addElement($skype);
$jabber = new Zend_Form_Element_Text('jabber');
$jabber->setLabel('Jabber:');
$jabber->setAttrib('class', 'input_text');
$jabber->addFilter('StringTrim');
$jabber->addValidator('EmailAddress');
$this->addElement($jabber);
$select = new Zend_Form_Element_Select('type');
$select->setLabel('User Type:');
$select->setAttrib('class', 'input_select');
$select->setAttrib('style', 'width: 40%');
$select->setMultiOptions(array(
"G" => "Guest",
"H" => "DJ",
"P" => "Program Manager",
"A" => "Admin"
));
$select->setRequired(true);
$this->addElement($select);
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('class', 'ui-button ui-state-default right-floated');
$submit->setIgnore(true);
$submit->setLabel('Save');
$this->addElement($submit);
}
public function validateLogin($data){
if (strlen($data['user_id']) == 0){
$count = CcSubjsQuery::create()->filterByDbLogin($data['login'])->count();
if ($count != 0){
$this->getElement('login')->setErrors(array("login name is not unique."));
return false;
}
}
return true;
}
}