Version: current

     1 <?php
     2 /**
     3  * Настройки регистрации
     4  *
     5  * @package auth
     6  * @author inxo, dvp
     7  */
     8 class AuthSiteConfig extends SiteConfigDecorator {
     9     function extraStatics() {
    10         return array(
    11             'db' => array(
    12                 'AuthActivationRequired' => 'Boolean',
    13                 'AuthActivationTTL' => 'Int',
    14                 'AuthSenderEmail' => 'Varchar(255)',
    15                 'AuthNewUserSubject' => 'Varchar(255)',
    16                 'NotifyAdminForNewUser' => 'Boolean',
    17                 'NewUserLetterTheme' => 'Varchar(255)',
    18             ),
    19             'default' => array(
    20                 'AuthActivationRequired' => 0,
    21                 'AuthActivationTTL' => 7,
    22                 'AuthNewUserSubject' => _t('SiteConfig.DefaultAuthNewUserSubject', 'Registration confirmation'),
    23                 'NotifyAdminForNewUser' => 0,
    24                 'NewUserLetterTheme' => _t('SiteConfig.DefaultNewUserLetterTheme'),
    25             )
    26         );
    27     }
    28
    29     /**
    30      * Емайл с которого будут уходить письма клиенту
    31      *
    32      * @return string
    33      */
    34     function AuthSenderEmail() {
    35         return ($this->owner->AuthSenderEmail) ? $this->owner->AuthSenderEmail : $this->owner->SenderEmail();
    36     }
    37
    38     function AuthNewUserSubject() {
    39         return ($this->owner->AuthNewUserSubject) ? $this->owner->AuthNewUserSubject : _t('SiteConfig.DefaultAuthNewUserSubject', 'Registration confirmation');
    40     }
    41
    42     public function updateCMSFields(FieldSet &$fields) {
    43         $tab = WebylonSiteConfig::get_config_tab($fields, 'Auth');
    44
    45         $tab->push(new CheckboxField('AuthActivationRequired', $this->owner->fieldLabel('AuthActivationRequired')));
    46         $tab->push(new NumericField('AuthActivationTTL', $this->owner->fieldLabel('AuthActivationTTL')));
    47         $tab->push(new EmailField('AuthSenderEmail', $this->owner->fieldLabel('AuthSenderEmail') . sprintf(' (%s)', $this->owner->SenderEmail())));
    48         $tab->push(new TextField('AuthNewUserSubject', $this->owner->fieldLabel('AuthNewUserSubject') . sprintf(' (%s)', _t('SiteConfig.DefaultAuthNewUserSubject', 'Registration confirmation'))));
    49
    50         $tab->push(new CheckboxField('NotifyAdminForNewUser', $this->owner->fieldLabel('NotifyAdminForNewUser')));
    51         $tab->push(new TextField('NewUserLetterTheme', $this->owner->fieldLabel('NewUserLetterTheme')));
    52     }
    53 }
    54

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -