public function configure()
 {
     $backup_methods = array('none' => sfContext::getInstance()->getI18N()->__('No backup'), 'ftp' => sfContext::getInstance()->getI18N()->__('FTP'));
     $this->widgetSchema['backup_method'] = new sfWidgetFormChoice(array('choices' => $backup_methods));
     $this->validatorSchema['backup_method'] = new sfValidatorChoice(array('choices' => array_keys($backup_methods), 'required' => true));
     $this->widgetSchema->setLabel('backup_method', 'Backup method');
     $this->widgetSchema['ftp_host'] = new sfWidgetFormInput();
     $this->validatorSchema['ftp_host'] = new sfValidatorString(array('required' => false));
     $this->widgetSchema->setLabel('ftp_host', 'FTP host');
     $this->widgetSchema['ftp_service'] = new sfWidgetFormInput();
     $this->validatorSchema['ftp_service'] = new sfValidatorInteger(array('min' => 1, 'max' => 65535, 'required' => false));
     $this->widgetSchema->setLabel('ftp_service', 'FTP port');
     $this->widgetSchema['ftp_username'] = new sfWidgetFormInput();
     $this->validatorSchema['ftp_username'] = new sfValidatorString(array('required' => false));
     $this->widgetSchema->setLabel('ftp_username', 'Username');
     $this->widgetSchema['ftp_password'] = new sfWidgetFormInputPassword();
     $this->validatorSchema['ftp_password'] = new sfValidatorString(array('required' => false));
     $this->widgetSchema->setLabel('ftp_password', 'Password');
     if (!ConfigurationHelper::hasParameter('Backup', 'backup_method')) {
         ConfigurationHelper::setParameter('Backup', 'backup_method', 'none');
     }
     if (!ConfigurationHelper::hasParameter('Backup', 'ftp_host')) {
         ConfigurationHelper::setParameter('Backup', 'ftp_host', 'ftp');
     }
     if (!ConfigurationHelper::hasParameter('Backup', 'ftp_service')) {
         ConfigurationHelper::setParameter('Backup', 'ftp_service', '21');
     }
     $this->setDefaults(ConfigurationHelper::getNamespace('Backup'));
     $this->widgetSchema->setNameFormat('backupConfiguration[%s]');
     $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
 }
 public function configure()
 {
     $this->widgetSchema['allow_registration'] = new sfWidgetFormInputCheckbox();
     $this->validatorSchema['allow_registration'] = new sfValidatorBoolean(array('required' => false));
     $this->widgetSchema->setLabel('allow_registration', 'Allow registration');
     $this->widgetSchema['registration_granted_message'] = new sfWidgetFormTextarea();
     $this->validatorSchema['registration_granted_message'] = new sfValidatorString(array('required' => false));
     $this->widgetSchema->setLabel('registration_granted_message', 'Registration granted message');
     $this->widgetSchema['subtitle'] = new sfWidgetFormInput();
     $this->validatorSchema['subtitle'] = new sfValidatorString(array('required' => false));
     $this->widgetSchema->setLabel('subtitle', 'Subtitle');
     $this->widgetSchema['auth_ldap_choice'] = new sfWidgetFormInputCheckbox();
     $this->validatorSchema['auth_ldap_choice'] = new sfValidatorBoolean(array('required' => false));
     $this->widgetSchema->setLabel('auth_ldap_choice', 'Use LDAP authentication');
     $this->widgetSchema['auth_ldap_host'] = new sfWidgetFormInput();
     $this->validatorSchema['auth_ldap_host'] = new sfValidatorString(array('required' => false));
     $this->widgetSchema->setLabel('auth_ldap_host', 'LDAP Host');
     $this->widgetSchema['auth_ldap_domain'] = new sfWidgetFormInput();
     $this->validatorSchema['auth_ldap_domain'] = new sfValidatorString(array('required' => false));
     $this->widgetSchema->setLabel('auth_ldap_domain', 'LDAP Domain name');
     // Enabled by default
     if (!ConfigurationHelper::hasParameter('General', 'allow_registration')) {
         ConfigurationHelper::setParameter('General', 'allow_registration', true);
     }
     // Disabled by default
     if (!ConfigurationHelper::hasParameter('General', 'auth_ldap_choice')) {
         ConfigurationHelper::setParameter('General', 'auth_ldap_choice', false);
     }
     $this->setDefaults(ConfigurationHelper::getNamespace('General'));
     $this->widgetSchema->setNameFormat('generalConfiguration[%s]');
     $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
 }
 public function configure()
 {
     $encryption_methods = array('none' => sfContext::getInstance()->getI18N()->__('No encryption'), 'ssl' => sfContext::getInstance()->getI18N()->__('SSL'), 'tls' => sfContext::getInstance()->getI18N()->__('TLS'));
     $this->widgetSchema['use_mail'] = new sfWidgetFormInputCheckbox();
     $this->validatorSchema['use_mail'] = new sfValidatorBoolean(array('required' => false));
     $this->widgetSchema->setLabel('use_mail', 'Use mail');
     $this->widgetSchema['smtp_host'] = new sfWidgetFormInput();
     $this->validatorSchema['smtp_host'] = new sfValidatorString(array('required' => false));
     $this->widgetSchema->setLabel('smtp_host', 'SMTP host');
     $this->widgetSchema['smtp_service'] = new sfWidgetFormInput();
     $this->validatorSchema['smtp_service'] = new sfValidatorInteger(array('min' => 1, 'max' => 65535, 'required' => false));
     $this->widgetSchema->setLabel('smtp_service', 'SMTP port');
     $this->widgetSchema['from'] = new sfWidgetFormInput();
     $this->validatorSchema['from'] = new sfValidatorString(array('required' => false));
     $this->widgetSchema->setLabel('from', 'From');
     $this->widgetSchema['override_from'] = new sfWidgetFormInputCheckbox();
     $this->validatorSchema['override_from'] = new sfValidatorBoolean(array('required' => false));
     $this->widgetSchema->setLabel('override_from', 'Always override from ?');
     $this->widgetSchema['smtp_encryption_method'] = new sfWidgetFormChoice(array('choices' => $encryption_methods));
     $this->validatorSchema['smtp_encryption_method'] = new sfValidatorChoice(array('choices' => array_keys($encryption_methods), 'required' => true));
     $this->widgetSchema->setLabel('smtp_encryption_method', 'Encryption method');
     $this->widgetSchema['smtp_use_authentication'] = new sfWidgetFormInputCheckbox();
     $this->validatorSchema['smtp_use_authentication'] = new sfValidatorBoolean(array('required' => false));
     $this->widgetSchema->setLabel('smtp_use_authentication', 'Use authentication');
     $this->widgetSchema['smtp_username'] = new sfWidgetFormInput();
     $this->validatorSchema['smtp_username'] = new sfValidatorString(array('required' => false));
     $this->widgetSchema->setLabel('smtp_username', 'Username');
     $this->widgetSchema['smtp_password'] = new sfWidgetFormInputPassword();
     $this->validatorSchema['smtp_password'] = new sfValidatorString(array('required' => false));
     $this->widgetSchema->setLabel('smtp_password', 'Password');
     $this->widgetSchema['signature'] = new sfWidgetFormTextarea();
     $this->validatorSchema['signature'] = new sfValidatorString(array('required' => false));
     $this->widgetSchema->setLabel('signature', 'Signature');
     $this->validatorSchema['from'] = new sfValidatorAnd(array($this->validatorSchema['from'], new sfValidatorEmail()));
     if (!ConfigurationHelper::hasParameter('Email', 'use_mail')) {
         ConfigurationHelper::setParameter('Email', 'use_mail', false);
     }
     if (!ConfigurationHelper::hasParameter('Email', 'smtp_host')) {
         ConfigurationHelper::setParameter('Email', 'smtp_host', 'smtp');
     }
     if (!ConfigurationHelper::hasParameter('Email', 'smtp_service')) {
         ConfigurationHelper::setParameter('Email', 'smtp_service', '25');
     }
     if (!ConfigurationHelper::hasParameter('Email', 'from')) {
         ConfigurationHelper::setParameter('Email', 'from', '*****@*****.**');
     }
     if (!ConfigurationHelper::hasParameter('Email', 'signature')) {
         ConfigurationHelper::setParameter('Email', 'signature', "\n\n--------------------\n\nThis message was sent to you from the Tempo's system.\n\nGo to http://tempos.islog-services.eu to get more information.");
     }
     $this->setDefaults(ConfigurationHelper::getNamespace('Email'));
     $this->widgetSchema->setNameFormat('emailConfiguration[%s]');
     $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
 }
 protected function execute($arguments = array(), $options = array())
 {
     $this->configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', true);
     $this->context = sfContext::createInstance($this->configuration);
     ConfigurationHelper::load();
     if (ConfigurationHelper::getParameter('Network', '_need_update', false)) {
         $this->logSection('tempos', 'Update required.', 1024);
         if ($this->writeInterfaces()) {
             ConfigurationHelper::setParameter('Network', '_need_update', false);
             ConfigurationHelper::save();
         }
     } else {
         $this->logSection('tempos', 'No update required.', 1024);
     }
 }
 public function configure()
 {
     $this->widgetSchema['print_reserved_by'] = new sfWidgetFormInputCheckbox();
     $this->validatorSchema['print_reserved_by'] = new sfValidatorBoolean(array('required' => false));
     $this->widgetSchema->setLabel('print_reserved_by', 'Display "Reserved by"');
     if (!ConfigurationHelper::hasParameter('Print', 'print_reserved_by')) {
         ConfigurationHelper::setParameter('Print', 'print_reserved_by', true);
     }
     $this->widgetSchema['print_reserved_for'] = new sfWidgetFormInputCheckbox();
     $this->validatorSchema['print_reserved_for'] = new sfValidatorBoolean(array('required' => false));
     $this->widgetSchema->setLabel('print_reserved_for', 'Display "Reserved for"');
     if (!ConfigurationHelper::hasParameter('Print', 'print_reserved_for')) {
         ConfigurationHelper::setParameter('Print', 'print_reserved_for', true);
     }
     $this->widgetSchema['print_reason'] = new sfWidgetFormInputCheckbox();
     $this->validatorSchema['print_reason'] = new sfValidatorBoolean(array('required' => false));
     $this->widgetSchema->setLabel('print_reason', 'Display "Reason"');
     $this->widgetSchema['print_time'] = new sfWidgetFormInputCheckbox();
     $this->validatorSchema['print_time'] = new sfValidatorBoolean(array('required' => false));
     $this->widgetSchema->setLabel('print_time', 'Display "Time"');
     $this->widgetSchema['print_duration'] = new sfWidgetFormInputCheckbox();
     $this->validatorSchema['print_duration'] = new sfValidatorBoolean(array('required' => false));
     $this->widgetSchema->setLabel('print_duration', 'Display "Duration"');
     $this->widgetSchema['print_custom_field1'] = new sfWidgetFormInputCheckbox();
     $this->validatorSchema['print_custom_field1'] = new sfValidatorBoolean(array('required' => false));
     $this->widgetSchema->setLabel('print_custom_field1', 'Display "Custom field 1"');
     $this->widgetSchema['print_custom_field2'] = new sfWidgetFormInputCheckbox();
     $this->validatorSchema['print_custom_field2'] = new sfValidatorBoolean(array('required' => false));
     $this->widgetSchema->setLabel('print_custom_field2', 'Display "Custom field 2"');
     $this->widgetSchema['print_custom_field3'] = new sfWidgetFormInputCheckbox();
     $this->validatorSchema['print_custom_field3'] = new sfValidatorBoolean(array('required' => false));
     $this->widgetSchema->setLabel('print_custom_field3', 'Display "Custom field 3"');
     $this->widgetSchema['print_status'] = new sfWidgetFormInputCheckbox();
     $this->validatorSchema['print_status'] = new sfValidatorBoolean(array('required' => false));
     $this->widgetSchema->setLabel('print_status', 'Display "Status"');
     $this->widgetSchema['print_profile'] = new sfWidgetFormInputCheckbox();
     $this->validatorSchema['print_profile'] = new sfValidatorBoolean(array('required' => false));
     $this->widgetSchema->setLabel('print_profile', 'Display "Physical access"');
     $this->widgetSchema['print_title'] = new sfWidgetFormInputCheckbox();
     $this->validatorSchema['print_title'] = new sfValidatorBoolean(array('required' => false));
     $this->widgetSchema->setLabel('print_title', 'Display titles');
     $this->setDefaults(ConfigurationHelper::getNamespace('Print'));
     $this->widgetSchema->setNameFormat('printConfiguration[%s]');
     $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
 }