Merge branch 'master' of dev.sourcefabric.org:campcaster
This commit is contained in:
commit
d5efcac452
56 changed files with 1166 additions and 510 deletions
|
@ -8,7 +8,8 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
|
|||
//Add type select
|
||||
$this->addElement('select', 'add_show_repeat_type', array(
|
||||
'required' => true,
|
||||
'label' => 'Repeat Type:',
|
||||
'label' => 'Repeat Type:',
|
||||
'class' => ' input_select',
|
||||
'multiOptions' => array(
|
||||
"0" => "weekly",
|
||||
"1" => "bi-weekly",
|
||||
|
|
|
@ -5,56 +5,78 @@ class Application_Form_AddUser extends Zend_Form
|
|||
|
||||
public function init()
|
||||
{
|
||||
// Add login element
|
||||
$this->addElement('text', 'login', array(
|
||||
'label' => 'Username:',
|
||||
'required' => true,
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array('NotEmpty')
|
||||
));
|
||||
|
||||
// Add password element
|
||||
$this->addElement('text', 'password', array(
|
||||
'label' => 'Password:',
|
||||
'required' => true,
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array('NotEmpty')
|
||||
));
|
||||
|
||||
// Add first name element
|
||||
$this->addElement('text', 'first_name', array(
|
||||
'label' => 'Firstname:',
|
||||
'required' => true,
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array('NotEmpty')
|
||||
));
|
||||
|
||||
// Add last name element
|
||||
$this->addElement('text', 'last_name', array(
|
||||
'label' => 'Lastname:',
|
||||
'required' => true,
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array('NotEmpty')
|
||||
));
|
||||
|
||||
//Add type select
|
||||
$this->addElement('select', 'type', array(
|
||||
'required' => true,
|
||||
'multiOptions' => array(
|
||||
"A" => "admin",
|
||||
/*
|
||||
$this->addElementPrefixPath('Application_Validate',
|
||||
'../application/validate',
|
||||
'validate');
|
||||
* */
|
||||
|
||||
$hidden = new Zend_Form_Element_Hidden('user_id');
|
||||
$hidden->setAttrib('style', 'display: none;');
|
||||
$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->setRequired(true);
|
||||
$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->setRequired(true);
|
||||
$lastName->addFilter('StringTrim');
|
||||
$lastName->addValidator('NotEmpty');
|
||||
$this->addElement($lastName);
|
||||
|
||||
$select = new Zend_Form_Element_Select('type');
|
||||
$select->setAttrib('class', 'input_select');
|
||||
$select->setAttrib('style', 'width: 40%');
|
||||
$select->setMultiOptions(array(
|
||||
"A" => "admin",
|
||||
"H" => "host",
|
||||
"G" => "guest",
|
||||
),
|
||||
));
|
||||
|
||||
// Add the submit button
|
||||
$this->addElement('submit', 'submit', array(
|
||||
'ignore' => true,
|
||||
'label' => 'Submit',
|
||||
));
|
||||
|
||||
"G" => "guest",
|
||||
));
|
||||
$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('submit');
|
||||
$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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue