CommunityID/modules/install/forms/Install.php

82 lines
3.3 KiB
PHP
Raw Normal View History

2019-07-17 20:16:19 +00:00
<?php
/*
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
2019-07-17 20:16:19 +00:00
* @license http://creativecommons.org/licenses/BSD/ BSD License
* @author Keyboard Monkeys Ltd.
* @since CommunityID 0.9
* @package CommunityID
* @packager Keyboard Monkeys
*/
class Install_Form_Install extends Zend_Form
{
public function init()
{
2019-07-17 20:19:00 +00:00
$hostname = new Monkeys_Form_Element_Text('hostname');
translate('Hostname');
translate('usually localhost');
2019-07-17 20:19:00 +00:00
$hostname->setLabel('Hostname')
2019-07-17 20:16:19 +00:00
->setDescription('usually localhost')
->setRequired(true)
2019-07-17 20:19:00 +00:00
->setDecoratorOptions(array('dontMarkRequired' => true))
2019-07-17 20:16:19 +00:00
->setValue('localhost');
2019-07-17 20:19:00 +00:00
$dbname = new Monkeys_Form_Element_Text('dbname');
translate('Database name');
2019-07-17 20:19:00 +00:00
$dbname->setLabel('Database name')
2019-07-17 20:16:19 +00:00
->setRequired(true)
2019-07-17 20:19:00 +00:00
->setDecoratorOptions(array('dontMarkRequired' => true))
2019-07-17 20:16:19 +00:00
->setValue(Zend_Registry::get('config')->database->params->dbname);
2019-07-17 20:19:00 +00:00
$dbusername = new Monkeys_Form_Element_Text('dbusername');
translate('Database username');
2019-07-17 20:19:00 +00:00
$dbusername->setLabel('Database username')
->setRequired(true)
->setDecoratorOptions(array('dontMarkRequired' => true));
2019-07-17 20:16:19 +00:00
2019-07-17 20:19:00 +00:00
$dbpassword = new Monkeys_Form_Element_Password('dbpassword');
translate('Database password');
2019-07-17 20:19:00 +00:00
$dbpassword->setLabel('Database password');
2019-07-17 20:16:19 +00:00
2019-07-17 20:19:00 +00:00
$supportemail = new Monkeys_Form_Element_Text('supportemail');
translate('Support E-mail');
translate('Will be used as the sender for any message sent by the system, and as the recipient for user feedback');
2019-07-17 20:19:00 +00:00
$supportemail->setLabel('Support E-mail')
2019-07-17 20:16:19 +00:00
->setDescription('Will be used as the sender for any message sent by the system, and as the recipient for user feedback')
->addFilter('StringToLower')
->addValidator('EmailAddress')
2019-07-17 20:19:00 +00:00
->setRequired(true)
->setDecoratorOptions(array('dontMarkRequired' => true));
2019-07-17 20:16:19 +00:00
$username = new Monkeys_Form_Element_Text('username');
$username->setLabel('Username')
->setRequired(true)
->setDecoratorOptions(array('dontMarkRequired' => true));
2019-07-17 20:19:00 +00:00
$password1 = new Monkeys_Form_Element_Password('password1');
translate('Enter password');
$passwordValidator = new Monkeys_Validate_Password();
2019-07-17 20:19:00 +00:00
$password1->setLabel('Enter password')
->setRequired(true)
->setDecoratorOptions(array('dontMarkRequired' => true))
->addValidator(new Monkeys_Validate_PasswordConfirmation())
->addValidator($passwordValidator);
if ($restrictions = $passwordValidator->getPasswordRestrictionsDescription()) {
$password1->setDescription($restrictions);
}
2019-07-17 20:19:00 +00:00
$password2 = new Monkeys_Form_Element_Password('password2');
translate('Enter password again');
2019-07-17 20:19:00 +00:00
$password2->setLabel('Enter password again')
->setRequired(true)
->setDecoratorOptions(array('dontMarkRequired' => true));
$this->addElements(array($hostname, $dbname, $dbusername, $dbpassword, $supportemail,
$username, $password1, $password2));
2019-07-17 20:16:19 +00:00
}
}