GcConfig\Form\Config::initSystem PHP Method

initSystem() public method

Initialize System sub form
public initSystem ( ) : Config
return Config
    public function initSystem()
    {
        //Session settings
        $sessionFieldset = new Fieldset('session');
        $sessionFieldset->setLabel('Session');
        $cookieDomain = new Element\Text('cookie_domain');
        $cookieDomain->setLabel('Cookie domain')->setLabelAttributes(array('class' => 'required control-label col-lg-2'))->setAttribute('id', 'cookie_domain')->setAttribute('class', 'form-control');
        $sessionFieldset->add($cookieDomain);
        $this->getInputFilter()->add(array('name' => 'cookie_domain', 'required' => true, 'validators' => array(array('name' => 'not_empty'))), 'cookie_domain');
        $cookiePath = new Element\Text('cookie_path');
        $cookiePath->setLabel('Cookie path')->setLabelAttributes(array('class' => 'required control-label col-lg-2'))->setAttribute('id', 'cookie_path')->setAttribute('class', 'form-control');
        $sessionFieldset->add($cookiePath);
        $this->getInputFilter()->add(array('name' => 'cookie_path', 'required' => true, 'validators' => array(array('name' => 'not_empty'))), 'cookie_path');
        $sessionHandler = new Element\Select('session_handler');
        $sessionHandler->setLabel('Session handler')->setLabelAttributes(array('class' => 'required control-label col-lg-2'))->setAttribute('class', 'form-control')->setAttribute('id', 'session_handler')->setValueOptions(array('0' => 'Files', '1' => 'Database'));
        $sessionFieldset->add($sessionHandler);
        $this->getInputFilter()->add(array('name' => 'session_handler', 'required' => true, 'validators' => array(array('name' => 'not_empty'))), 'session_handler');
        $sessionPath = new Element\Text('session_path');
        $sessionPath->setLabel('Session path')->setLabelAttributes(array('class' => 'required control-label col-lg-2'))->setAttribute('id', 'session_path')->setAttribute('class', 'form-control');
        $sessionFieldset->add($sessionPath);
        $this->getInputFilter()->add(array('name' => 'session_path', 'required' => false), 'session_path');
        $sessionLifetime = new Element\Text('session_lifetime');
        $sessionLifetime->setLabel('Session lifetime')->setLabelAttributes(array('class' => 'required control-label col-lg-2'))->setAttribute('id', 'session_lifetime')->setAttribute('class', 'form-control');
        $sessionFieldset->add($sessionLifetime);
        $this->getInputFilter()->add(array('name' => 'session_lifetime', 'required' => true, 'validators' => array(array('name' => 'not_empty'), array('name' => 'digits'))), 'session_lifetime');
        $this->add($sessionFieldset);
        //Debug settings
        $debugFieldset = new Fieldset('debug');
        $debugFieldset->setLabel('Debug');
        $debugIsActive = new Element\Checkbox('debug_is_active');
        $debugIsActive->setLabel('Debug is active')->setLabelAttributes(array('class' => 'required control-label col-lg-2'))->setAttribute('id', 'debug_is_active')->setAttribute('id', 'input-checkbox')->setAttribute('class', 'input-checkbox');
        $debugFieldset->add($debugIsActive);
        $this->getInputFilter()->add(array('name' => 'debug_is_active', 'required' => false, 'validators' => array(array('name' => 'not_empty'))), 'debug_is_active');
        $this->add($debugFieldset);
        //Cache settings
        $cacheFieldset = new Fieldset('cache');
        $cacheFieldset->setLabel('Cache');
        $cacheIsActive = new Element\Checkbox('cache_is_active');
        $cacheIsActive->setLabel('Cache is active')->setLabelAttributes(array('class' => 'required control-label col-lg-2'))->setAttribute('id', 'cache_is_active')->setAttribute('class', 'input-checkbox')->setAttribute('id', 'cache-active');
        $cacheFieldset->add($cacheIsActive);
        $this->getInputFilter()->add(array('name' => 'cache_is_active', 'required' => false, 'validators' => array(array('name' => 'not_empty'))), 'cache_is_active');
        $cacheHandler = new Element\Select('cache_handler');
        $cacheHandler->setAttribute('class', 'form-control')->setAttribute('id', 'cache_handler')->setLabel('Cache handler')->setLabelAttributes(array('class' => 'required control-label col-lg-2'));
        $handlerWhitelist = array('filesystem' => 'FileSystem');
        if (extension_loaded('apc')) {
            $handlerWhitelist['apc'] = 'Apc';
        }
        if (extension_loaded('memcached')) {
            $handlerWhitelist['memcached'] = 'Memcached';
        }
        $cacheHandler->setValueOptions($handlerWhitelist);
        $cacheFieldset->add($cacheHandler);
        $this->getInputFilter()->add(array('name' => 'cache_handler', 'required' => true, 'validators' => array(array('name' => 'not_empty'))), 'cache_handler');
        $cacheLifetime = new Element\Text('cache_lifetime');
        $cacheLifetime->setLabel('Cache lifetime')->setLabelAttributes(array('class' => 'required control-label col-lg-2'))->setAttribute('id', 'cache_lifetime')->setAttribute('class', 'form-control');
        $cacheFieldset->add($cacheLifetime);
        $this->getInputFilter()->add(array('name' => 'cache_lifetime', 'required' => true, 'validators' => array(array('name' => 'not_empty'), array('name' => 'digits'))), 'cache_lifetime');
        $this->add($cacheFieldset);
        return $this;
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Test
  *
  * @return void
  */
 public function testInitSystem()
 {
     $this->assertInstanceOf('GcConfig\\Form\\Config', $this->object->initSystem());
 }
All Usage Examples Of GcConfig\Form\Config::initSystem