public function ImportFromClientForm() {
        if(!Permission::check('ADMIN')) {
            Security::permissionFailure($this);
            return;
        }
        
        $uploadField=new FileField('ImportFile', _t('CodeBank.EXPORT_FILE', '_Client Export File'));
        $uploadField->getValidator()->setAllowedExtensions(array('cbexport'));
        File::config()->allowed_extensions=array('cbexport');
        
        
        $fields=new FieldList(
                            new LiteralField('ImportWarning', '<p class="message warning">'._t('CodeBank.IMPORT_DATA_WARNING', '_Warning clicking import will erase all snippets in the database, it is recommended you backup your database before proceeding').'</p>'),
                            new TabSet('Root',
                                                new Tab('Main',
                                                                $uploadField,
                                                                new CheckboxField('AppendData', _t('CodeBank.APPEND_IMPORT', '_Import and Append Data (keep your existing data however appending may cause duplicates)'))
                                                            )
                                            )
                        );
        
        $actions=new FieldList(
                            FormAction::create('doImportData', _t('CodeBank.IMPORT', '_Import'))->addExtraClass('ss-ui-button ss-ui-action-constructive')->setAttribute('data-icon', 'accept')->setUseButtonTag(true)
                        );
        
        
        $validator=new RequiredFields(
                                    'ImportFile'
                                );
        
        
        $form=new Form($this, 'ImportFromClientForm', $fields, $actions, $validator);
        $form->addExtraClass('member-profile-form');
        
        return $form;
    }
public function ImportFromClientForm() {
        if(!Permission::check('ADMIN')) {
            Security::permissionFailure($this);
            return;
        }
        
        $uploadField=new FileField('ImportFile', _t('CodeBank.EXPORT_FILE', '_Client Export File'));
        $uploadField->getValidator()->setAllowedExtensions(array('cbexport'));
        File::config()->allowed_extensions=array('cbexport');
        
        
        $fields=new FieldList(
                            new LiteralField('ImportWarning', '<p class="message warning">'._t('CodeBank.IMPORT_DATA_WARNING', '_Warning clicking import will erase all snippets in the database, it is recommended you backup your database before proceeding').'</p>'),
                            new TabSet('Root',
                                                new Tab('Main',
                                                                $uploadField,
                                                                new CheckboxField('AppendData', _t('CodeBank.APPEND_IMPORT', '_Import and Append Data (keep your existing data however appending may cause duplicates)'))
                                                            )
                                            )
                        );
        
        $actions=new FieldList(
                            FormAction::create('doImportData', _t('CodeBank.IMPORT', '_Import'))->addExtraClass('ss-ui-button ss-ui-action-constructive')->setAttribute('data-icon', 'accept')->setUseButtonTag(true)
                        );
        
        
        $validator=new RequiredFields(
                                    'ImportFile'
                                );
        
        
        $form=new Form($this, 'ImportFromClientForm', $fields, $actions, $validator);
        $form->addExtraClass('member-profile-form');
        
        return $form;
    }
public function ImportFromClientForm ( ) { if ( ! Permission :: check ( 'ADMIN' ) ) { Security :: permissionFailure ( $ this ) ; return ; } $ uploadField = new FileField ( 'ImportFile' , _t ( 'CodeBank.EXPORT_FILE' , '_Client Export File' ) ) ; $ uploadField -> getValidator ( ) -> setAllowedExtensions ( array ( 'cbexport' ) ) ; File :: config ( ) -> allowed_extensions = array ( 'cbexport' ) ; $ fields = new FieldList ( new LiteralField ( 'ImportWarning' , '<p class="message warning">' . _t ( 'CodeBank.IMPORT_DATA_WARNING' , '_Warning clicking import will erase all snippets in the database, it is recommended you backup your database before proceeding' ) . '</p>' ) , new TabSet ( 'Root' , new Tab ( 'Main' , $ uploadField , new CheckboxField ( 'AppendData' , _t ( 'CodeBank.APPEND_IMPORT' , '_Import and Append Data (keep your existing data however appending may cause duplicates)' ) ) ) ) ) ; $ actions = new FieldList ( FormAction :: create ( 'doImportData' , _t ( 'CodeBank.IMPORT' , '_Import' ) ) -> addExtraClass ( 'ss-ui-button ss-ui-action-constructive' ) -> setAttribute ( 'data-icon' , 'accept' ) -> setUseButtonTag ( true ) ) ; $ validator = new RequiredFields ( 'ImportFile' ) ; $ form = new Form ( $ this , 'ImportFromClientForm' , $ fields , $ actions , $ validator ) ; $ form -> addExtraClass ( 'member-profile-form' ) ; return $ form ; }
Form used for importing data from the client
@return {Form} Form to be used in the popup
Form used for importing data from the client