EmailServerPreferences.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php
  2. require_once 'customvalidators/ConditionalNotEmpty.php';
  3. require_once 'customvalidators/PasswordNotEmpty.php';
  4. class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
  5. {
  6. public function init()
  7. {
  8. $this->setDecorators(array(
  9. array('ViewScript', array('viewScript' => 'form/preferences_email_server.phtml'))
  10. ));
  11. // Enable system emails
  12. $this->addElement('checkbox', 'enableSystemEmail', array(
  13. 'label' => _('Enable System Emails (Password Reset)'),
  14. 'required' => false,
  15. 'value' => Application_Model_Preference::GetEnableSystemEmail(),
  16. 'decorators' => array(
  17. 'ViewHelper'
  18. )
  19. ));
  20. $this->addElement('text', 'systemEmail', array(
  21. 'class' => 'input_text',
  22. 'label' => _("Reset Password 'From' Email"),
  23. 'value' => Application_Model_Preference::GetSystemEmail(),
  24. 'readonly' => true,
  25. 'decorators' => array('viewHelper')
  26. ));
  27. $this->addElement('checkbox', 'configureMailServer', array(
  28. 'label' => _('Configure Mail Server'),
  29. 'required' => false,
  30. 'value' => Application_Model_Preference::GetMailServerConfigured(),
  31. 'decorators' => array (
  32. 'viewHelper'
  33. )
  34. ));
  35. $this->addElement('checkbox', 'msRequiresAuth', array(
  36. 'label' => _('Requires Authentication'),
  37. 'required' => false,
  38. 'value' => Application_Model_Preference::GetMailServerRequiresAuth(),
  39. 'decorators' => array(
  40. 'viewHelper'
  41. )
  42. ));
  43. $this->addElement('text', 'mailServer', array(
  44. 'class' => 'input_text',
  45. 'label' => _('Mail Server'),
  46. 'value' => Application_Model_Preference::GetMailServer(),
  47. 'readonly' => true,
  48. 'decorators' => array('viewHelper'),
  49. 'allowEmpty' => false,
  50. 'validators' => array(
  51. new ConditionalNotEmpty(array(
  52. 'configureMailServer' => '1'
  53. ))
  54. )
  55. ));
  56. $this->addElement('text', 'email', array(
  57. 'class' => 'input_text',
  58. 'label' => _('Email Address'),
  59. 'value' => Application_Model_Preference::GetMailServerEmailAddress(),
  60. 'readonly' => true,
  61. 'decorators' => array('viewHelper'),
  62. 'allowEmpty' => false,
  63. 'validators' => array(
  64. new ConditionalNotEmpty(array(
  65. 'configureMailServer' => '1',
  66. 'msRequiresAuth' => '1'
  67. ))
  68. )
  69. ));
  70. $this->addElement('password', 'ms_password', array(
  71. 'class' => 'input_text',
  72. 'label' => _('Password'),
  73. 'value' => Application_Model_Preference::GetMailServerPassword(),
  74. 'readonly' => true,
  75. 'decorators' => array('viewHelper'),
  76. 'allowEmpty' => false,
  77. 'validators' => array(
  78. new ConditionalNotEmpty(array(
  79. 'configureMailServer' => '1',
  80. 'msRequiresAuth' => '1'
  81. ))
  82. ),
  83. 'renderPassword' => true
  84. ));
  85. $port = new Zend_Form_Element_Text('port');
  86. $port->class = 'input_text';
  87. $port->setRequired(false)
  88. ->setValue(Application_Model_Preference::GetMailServerPort())
  89. ->setLabel(_('Port'))
  90. ->setAttrib('readonly', true)
  91. ->setDecorators(array('viewHelper'));
  92. $this->addElement($port);
  93. }
  94. }