本文整理汇总了PHP中AbstractForm::init方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractForm::init方法的具体用法?PHP AbstractForm::init怎么用?PHP AbstractForm::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AbstractForm
的用法示例。
在下文中一共展示了AbstractForm::init方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/** {@inheritdoc} */
public function init()
{
parent::init();
$displayBlacklistedSoftware = new \Zend\Form\Element\Checkbox('displayBlacklistedSoftware');
$displayBlacklistedSoftware->setLabel('Display ignored software');
$this->get('Preferences')->add($displayBlacklistedSoftware);
}
示例2: init
/** {@inheritdoc} */
public function init()
{
parent::init();
$preferences = $this->get('Preferences');
$inputFilter = new \Zend\InputFilter\InputFilter();
$communicationServerUri = new \Zend\Form\Element\Text('communicationServerUri');
$communicationServerUri->setLabel('Communication server URI');
$preferences->add($communicationServerUri);
$inputFilter->add(array('name' => 'communicationServerUri', 'validators' => array(array('name' => 'Uri', 'options' => array('uriHandler' => 'Zend\\Uri\\Http', 'allowRelative' => false)))));
$lockValidity = new \Zend\Form\Element\Text('lockValidity');
$lockValidity->setLabel('Maximum seconds to lock a computer')->setAttribute('size', 5);
$preferences->add($lockValidity);
$inputFilter->add($this->_getIntegerFilter('lockValidity'));
$sessionValidity = new \Zend\Form\Element\Text('sessionValidity');
$sessionValidity->setLabel('Maximum duration of an agent session in seconds')->setAttribute('size', 5);
$preferences->add($sessionValidity);
$inputFilter->add($this->_getIntegerFilter('sessionValidity'));
$sessionCleanupInterval = new \Zend\Form\Element\Text('sessionCleanupInterval');
$sessionCleanupInterval->setLabel('Interval in seconds to cleanup sessions')->setAttribute('size', 5);
$preferences->add($sessionCleanupInterval);
$inputFilter->add($this->_getIntegerFilter('sessionCleanupInterval'));
$sessionRequired = new \Zend\Form\Element\Checkbox('sessionRequired');
$sessionRequired->setLabel('Session required for inventory');
$preferences->add($sessionRequired);
$logLevel = new \Library\Form\Element\SelectSimple('logLevel');
$logLevel->setLabel('Log level')->setValueOptions(array(0, 1, 2));
$preferences->add($logLevel);
$autoMergeDuplicates = new \Zend\Form\Element\Checkbox('autoMergeDuplicates');
$autoMergeDuplicates->setLabel('Merge duplicates automatically (not recommended)');
$preferences->add($autoMergeDuplicates);
$parentFilter = new \Zend\InputFilter\InputFilter();
$parentFilter->add($inputFilter, 'Preferences');
$this->setInputFilter($parentFilter);
}
示例3: init
/** {@inheritdoc} */
public function init()
{
parent::init();
$preferences = $this->get('Preferences');
$inputFilter = new \Zend\InputFilter\InputFilter();
$integerFilter = array('name' => 'Callback', 'options' => array('callback' => array($this, 'normalize'), 'callback_params' => 'integer'));
$integerValidator = new \Zend\Validator\Callback(array('callback' => array($this, 'validateType'), 'callbackOptions' => 'integer'));
$contactInterval = new \Zend\Form\Element\Text('contactInterval');
$contactInterval->setLabel('Agent contact interval (in hours)')->setAttribute('size', 5);
$preferences->add($contactInterval);
$validatorChain = new \Zend\Validator\ValidatorChain();
$validatorChain->attach($integerValidator, true)->attachByName('GreaterThan', array('min' => 0));
$inputFilter->add(array('name' => 'contactInterval', 'filters' => array($integerFilter), 'validators' => $validatorChain));
$inventoryInterval = new \Zend\Form\Element\Text('inventoryInterval');
$inventoryInterval->setLabel('Inventory interval (in days, 0 = always, -1 = never)')->setAttribute('size', 5);
$preferences->add($inventoryInterval);
$validatorChain = new \Zend\Validator\ValidatorChain();
$validatorChain->attach($integerValidator, true)->attachByName('GreaterThan', array('min' => -2));
$inputFilter->add(array('name' => 'inventoryInterval', 'filters' => array($integerFilter), 'validators' => $validatorChain));
$agentWhitelistFile = new \Zend\Form\Element\Text('agentWhitelistFile');
$agentWhitelistFile->setLabel('File with allowed non-OCS agents (FusionInventory etc.)');
$preferences->add($agentWhitelistFile);
$inputFilter->add(array('name' => 'agentWhitelistFile', 'required' => false, 'validators' => array(array('name' => 'Library\\Validator\\FileReadable'))));
$parentFilter = new \Zend\InputFilter\InputFilter();
$parentFilter->add($inputFilter, 'Preferences');
$this->setInputFilter($parentFilter);
}
示例4: init
/** {@inheritdoc} */
public function init()
{
parent::init();
$preferences = $this->get('Preferences');
$inputFilter = new \Zend\InputFilter\InputFilter();
$scannersPerSubnet = new \Zend\Form\Element\Text('scannersPerSubnet');
$scannersPerSubnet->setLabel('Number of scanning computers per subnet')->setAttribute('size', 5);
$preferences->add($scannersPerSubnet);
$inputFilter->add($this->_getIntegerFilter('scannersPerSubnet', -1));
$scanSnmp = new \Zend\Form\Element\Checkbox('scanSnmp');
$scanSnmp->setLabel('Use SNMP');
$preferences->add($scanSnmp);
$scannerMinDays = new \Zend\Form\Element\Text('scannerMinDays');
$scannerMinDays->setLabel('Minimum days before a scanning computer is replaced')->setAttribute('size', 5);
$preferences->add($scannerMinDays);
$inputFilter->add($this->_getIntegerFilter('scannerMinDays', 0));
$scannerMaxDays = new \Zend\Form\Element\Text('scannerMaxDays');
$scannerMaxDays->setLabel('Maximum days before a scanning computer is replaced')->setAttribute('size', 5);
$preferences->add($scannerMaxDays);
$inputFilter->add($this->_getIntegerFilter('scannerMaxDays', 0));
$scanArpDelay = new \Zend\Form\Element\Text('scanArpDelay');
$scanArpDelay->setLabel('Delay (in milliseconds) between ARP requests')->setAttribute('size', 5);
$preferences->add($scanArpDelay);
$inputFilter->add($this->_getIntegerFilter('scanArpDelay', 9));
$parentFilter = new \Zend\InputFilter\InputFilter();
$parentFilter->add($inputFilter, 'Preferences');
$this->setInputFilter($parentFilter);
}
示例5: init
public function init()
{
$this->setName('usuario');
$this->addElement('hidden', 'id', array('label' => 'id', 'value' => '', 'validators' => array(), 'required' => false));
$this->addElement('text', 'email', array('label' => 'email', 'maxlength' => '100', 'class' => 'text text-email required', 'value' => '', 'validators' => array(array('StringLength', false, array(0, 200))), 'required' => true));
$this->addElement('text', 'senha', array('label' => 'senha', 'maxlength' => '32', 'class' => 'text text-senha required', 'value' => '', 'validators' => array(array('StringLength', false, array(0, 32))), 'required' => true));
parent::init();
}
示例6: init
public function init()
{
$this->setName('produto');
$this->addElement('hidden', 'id', array('label' => 'id', 'value' => '', 'validators' => array(), 'required' => false));
$this->addElement('text', 'nome', array('label' => 'nome', 'maxlength' => '45', 'class' => 'text text-nome required', 'value' => '', 'validators' => array(array('StringLength', false, array(0, 45))), 'required' => true));
$this->addElement('text', 'chave', array('label' => 'chave', 'maxlength' => '100', 'class' => 'text text-chave', 'value' => '', 'validators' => array(array('StringLength', false, array(0, 100))), 'required' => false));
$this->addElement('textarea', 'descricao', array('label' => 'Descriçao', 'cols' => '35', 'rows' => '10', 'class' => 'textarea textarea-descricao', 'value' => '', 'validators' => array(), 'required' => false));
$this->addElement('text', 'preco', array('label' => 'Preço', 'maxlength' => '13', 'class' => 'text required', 'value' => '', 'validators' => array(array('StringLength', false, array(0, 13))), 'required' => true));
$this->addElement('select', 'tributo_id', array('label' => 'Tributo', 'class' => 'select select-tributo required', 'value' => '', 'validators' => array('int'), 'required' => true, 'multiOptions' => $this->getDbOptions('tributo', 'Selecione')));
$this->addElement('select', 'publicado', array('label' => 'Publicado', 'class' => 'select select-publicado required', 'value' => '', 'validators' => array('int'), 'required' => true, 'multiOptions' => array('' => 'Seleciona', 0 => 'Não', 1 => 'Sim')));
parent::init();
}
示例7: init
/** {@inheritdoc} */
public function init()
{
// Required to keep track of original ID if this gets changed.
// This must be added before getInputFilter() is called.
$originalId = new \Zend\Form\Element\Hidden('OriginalId');
$this->add($originalId);
parent::init();
$inputFilter = $this->getInputFilter();
$inputFilter->add(array('name' => 'Id', 'validators' => array(array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateId'))))));
// Password can remain empty - in that case, it is left untouched.
$inputFilter->get('Password')->setAllowEmpty(true);
$this->get('Submit')->setLabel('Change');
}
示例8: init
/** {@inheritdoc} */
public function init()
{
parent::init();
$preferences = $this->get('Preferences');
$inputFilter = new \Zend\InputFilter\InputFilter();
$packageDeployment = new \Zend\Form\Element\Checkbox('packageDeployment');
$packageDeployment->setLabel('Enable package download');
$preferences->add($packageDeployment);
$packagePath = new \Zend\Form\Element\Text('packagePath');
$packagePath->setLabel('Package storage directory');
$preferences->add($packagePath);
$inputFilter->add(array('name' => 'packagePath', 'validators' => array(array('name' => 'Library\\Validator\\DirectoryWritable'))));
$packageBaseUriHttp = new \Zend\Form\Element\Text('packageBaseUriHttp');
$packageBaseUriHttp->setLabel('HTTP package base URL');
$preferences->add($packageBaseUriHttp);
$inputFilter->add(array('name' => 'packageBaseUriHttp', 'filters' => array(array('name' => 'StringTrim'), array('name' => 'PregReplace', 'options' => array('pattern' => '#(.*://|/$)#', 'replacement' => ''))), 'validators' => array(array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateUri'))))));
$packageBaseUriHttps = new \Zend\Form\Element\Text('packageBaseUriHttps');
$packageBaseUriHttps->setLabel('HTTPS package base URL');
$preferences->add($packageBaseUriHttps);
$inputFilter->add(array('name' => 'packageBaseUriHttps', 'filters' => array(array('name' => 'StringTrim'), array('name' => 'PregReplace', 'options' => array('pattern' => '#(.*://|/$)#', 'replacement' => ''))), 'validators' => array(array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateUri'))))));
$downloadPeriodDelay = new \Zend\Form\Element\Text('downloadPeriodDelay');
$downloadPeriodDelay->setLabel('Delay (in seconds) between periods')->setAttribute('size', 5);
$preferences->add($downloadPeriodDelay);
$inputFilter->add($this->_getIntegerFilter('downloadPeriodDelay'));
$downloadCycleDelay = new \Zend\Form\Element\Text('downloadCycleDelay');
$downloadCycleDelay->setLabel('Delay (in seconds) between cycles')->setAttribute('size', 5);
$preferences->add($downloadCycleDelay);
$inputFilter->add($this->_getIntegerFilter('downloadCycleDelay'));
$downloadFragmentDelay = new \Zend\Form\Element\Text('downloadFragmentDelay');
$downloadFragmentDelay->setLabel('Delay (in seconds) between fragments')->setAttribute('size', 5);
$preferences->add($downloadFragmentDelay);
$inputFilter->add($this->_getIntegerFilter('downloadFragmentDelay'));
$downloadMaxPriority = new \Library\Form\Element\SelectSimple('downloadMaxPriority');
$downloadMaxPriority->setLabel('Maximum package priority (packages with higher value will not be downloaded)')->setValueOptions(range(0, 10));
$preferences->add($downloadMaxPriority);
$downloadTimeout = new \Zend\Form\Element\Text('downloadTimeout');
$downloadTimeout->setLabel('Timeout (in days)')->setAttribute('size', 5);
$preferences->add($downloadTimeout);
$inputFilter->add($this->_getIntegerFilter('downloadTimeout'));
$parentFilter = new \Zend\InputFilter\InputFilter();
$parentFilter->add($inputFilter, 'Preferences');
$this->setInputFilter($parentFilter);
}
示例9: init
/** {@inheritdoc} */
public function init()
{
parent::init();
$preferences = $this->get('Preferences');
$inspectRegistry = new \Zend\Form\Element\Checkbox('inspectRegistry');
$inspectRegistry->setLabel('Inspect registry');
$preferences->add($inspectRegistry);
$defaultMergeCustomFields = new \Zend\Form\Element\Checkbox('defaultMergeCustomFields');
$defaultMergeCustomFields->setLabel('Merge user supplied information by default');
$preferences->add($defaultMergeCustomFields);
$defaultMergeGroups = new \Zend\Form\Element\Checkbox('defaultMergeGroups');
$defaultMergeGroups->setLabel('Merge manual group assignments by default');
$preferences->add($defaultMergeGroups);
$defaultMergePackages = new \Zend\Form\Element\Checkbox('defaultMergePackages');
$defaultMergePackages->setLabel('Merge missing package assignments by default');
$preferences->add($defaultMergePackages);
$defaultDeleteInterfaces = new \Zend\Form\Element\Checkbox('defaultDeleteInterfaces');
$defaultDeleteInterfaces->setLabel('Delete interfaces from network listing by default');
$preferences->add($defaultDeleteInterfaces);
}
示例10: init
/** {@inheritdoc} */
public function init()
{
parent::init();
$preferences = $this->get('Preferences');
$inputFilter = new \Zend\InputFilter\InputFilter();
$saveRawData = new \Zend\Form\Element\Checkbox('saveRawData');
$saveRawData->setLabel('Save incoming raw inventory data');
$preferences->add($saveRawData);
$saveDir = new \Zend\Form\Element\Text('saveDir');
$saveDir->setLabel('Target directory');
$preferences->add($saveDir);
$saveFormat = new \Zend\Form\Element\Select('saveFormat');
$saveFormat->setLabel('File format')->setValueOptions(array('XML' => $this->_('uncompressed XML'), 'OCS' => $this->_('zlib compressed XML')));
$preferences->add($saveFormat);
$inputFilter->add(array('name' => 'saveDir', 'validators' => array(array('name' => 'Library\\Validator\\DirectoryWritable'))));
$saveOverwrite = new \Zend\Form\Element\Checkbox('saveOverwrite');
$saveOverwrite->setLabel('Overwrite existing files');
$preferences->add($saveOverwrite);
$parentFilter = new \Zend\InputFilter\InputFilter();
$parentFilter->add($inputFilter, 'Preferences');
$this->setInputFilter($parentFilter);
}
示例11: init
/** {@inheritdoc} */
public function init()
{
parent::init();
$preferences = $this->get('Preferences');
$inputFilter = new \Zend\InputFilter\InputFilter();
$trustedNetworksOnly = new \Zend\Form\Element\Checkbox('trustedNetworksOnly');
$trustedNetworksOnly->setLabel('Limit agent connections to trusted networks');
$preferences->add($trustedNetworksOnly);
$inventoryFilter = new \Zend\Form\Element\Checkbox('inventoryFilter');
$inventoryFilter->setLabel('Limit inventory frequency');
$preferences->add($inventoryFilter);
$limitInventoryInterval = new \Zend\Form\Element\Text('limitInventoryInterval');
$limitInventoryInterval->setLabel('Seconds between inventory processing')->setAttribute('size', 5);
$preferences->add($limitInventoryInterval);
$validatorChain = new \Zend\Validator\ValidatorChain();
$validatorChain->attachByName('Callback', array('callback' => array($this, 'validateType'), 'callbackOptions' => 'integer'), true);
$validatorChain->attachByName('GreaterThan', array('min' => 0));
$inputFilter->add(array('name' => 'limitInventoryInterval', 'required' => false, 'filters' => array(array('name' => 'Callback', 'options' => array('callback' => array($this, 'normalize'), 'callback_params' => 'integer'))), 'validators' => $validatorChain));
$parentFilter = new \Zend\InputFilter\InputFilter();
$parentFilter->add($inputFilter, 'Preferences');
$this->setInputFilter($parentFilter);
}
示例12: init
/** {@inheritdoc} */
public function init()
{
parent::init();
$preferences = $this->get('Preferences');
$inputFilter = new \Zend\InputFilter\InputFilter();
$integerFilter = array('name' => 'Callback', 'options' => array('callback' => array($this, 'normalize'), 'callback_params' => 'integer'));
$validatorChain = new \Zend\Validator\ValidatorChain();
$validatorChain->attachByName('Callback', array('callback' => array($this, 'validateType'), 'callbackOptions' => 'integer'), true);
$validatorChain->attachByName('GreaterThan', array('min' => 0));
$groupCacheExpirationInterval = new \Zend\Form\Element\Text('groupCacheExpirationInterval');
$groupCacheExpirationInterval->setLabel('Minimum seconds between group cache rebuilds')->setAttribute('size', 5);
$preferences->add($groupCacheExpirationInterval);
$inputFilter->add(array('name' => 'groupCacheExpirationInterval', 'filters' => array($integerFilter), 'validators' => $validatorChain));
$groupCacheExpirationFuzz = new \Zend\Form\Element\Text('groupCacheExpirationFuzz');
$groupCacheExpirationFuzz->setLabel('Maximum seconds added to above value')->setAttribute('size', 5);
$preferences->add($groupCacheExpirationFuzz);
$inputFilter->add(array('name' => 'groupCacheExpirationFuzz', 'filters' => array($integerFilter), 'validators' => $validatorChain));
$setGroupPackageStatus = new \Zend\Form\Element\Checkbox('setGroupPackageStatus');
$setGroupPackageStatus->setLabel('Set package status on clients for group-assigned packages');
$preferences->add($setGroupPackageStatus);
$parentFilter = new \Zend\InputFilter\InputFilter();
$parentFilter->add($inputFilter, 'Preferences');
$this->setInputFilter($parentFilter);
}
示例13: init
/** {@inheritdoc} */
public function init()
{
parent::init();
$preferences = $this->get('Preferences');
$inputFilter = new \Zend\InputFilter\InputFilter();
$integerFilter = array('name' => 'Callback', 'options' => array('callback' => array($this, 'normalize'), 'callback_params' => 'integer'));
$integerValidator = array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateType'), 'callbackOptions' => 'integer'));
$deploy = new \Zend\Form\Fieldset('Deploy');
$deploy->setLabel('Defaults for deploying updated packages');
$deployNonnotified = new \Zend\Form\Element\Checkbox('defaultDeployNonnotified');
$deployNonnotified->setLabel('Not notified');
$deploy->add($deployNonnotified);
$deploySuccess = new \Zend\Form\Element\Checkbox('defaultDeploySuccess');
$deploySuccess->setLabel('Success');
$deploy->add($deploySuccess);
$deployNotified = new \Zend\Form\Element\Checkbox('defaultDeployNotified');
$deployNotified->setLabel('Running');
$deploy->add($deployNotified);
$deployError = new \Zend\Form\Element\Checkbox('defaultDeployError');
$deployError->setLabel('Error');
$deploy->add($deployError);
$deployGroups = new \Zend\Form\Element\Checkbox('defaultDeployGroups');
$deployGroups->setLabel('Groups');
$deploy->add($deployGroups);
$preferences->add($deploy);
$defaultPlatform = new \Zend\Form\Element\Select('defaultPlatform');
$defaultPlatform->setLabel('Default platform')->setAttribute('type', 'select_untranslated')->setValueOptions(array('windows' => 'Windows', 'linux' => 'Linux', 'mac' => 'MacOS'));
$preferences->add($defaultPlatform);
$defaultAction = new \Zend\Form\Element\Select('defaultAction');
$defaultAction->setLabel('Default action')->setValueOptions(array('launch' => $this->_('Download package, execute command, retrieve result'), 'execute' => $this->_('Optionally download package, execute command'), 'store' => $this->_('Just download package to target path')));
$preferences->add($defaultAction);
$defaultActionParam = new \Zend\Form\Element\Text('defaultActionParam');
$defaultActionParam->setLabel('Default action parameter');
$preferences->add($defaultActionParam);
$defaultPackagePriority = new \Library\Form\Element\SelectSimple('defaultPackagePriority');
$defaultPackagePriority->setValueOptions(range(0, 10))->setLabel('Default priority (0: exclusive, 10: lowest)');
$preferences->add($defaultPackagePriority);
$defaultMaxFragmentSize = new \Zend\Form\Element\Text('defaultMaxFragmentSize');
$defaultMaxFragmentSize->setAttribute('size', '8')->setLabel('Default maximum fragment size (kB)');
$preferences->add($defaultMaxFragmentSize);
$inputFilter->add(array('name' => 'defaultMaxFragmentSize', 'required' => false, 'filters' => array($integerFilter), 'validators' => array($integerValidator)));
$defaultWarn = new \Zend\Form\Element\Checkbox('defaultWarn');
$defaultWarn->setLabel('Warn user by default');
$preferences->add($defaultWarn);
$defaultWarnMessage = new \Zend\Form\Element\Textarea('defaultWarnMessage');
$defaultWarnMessage->setLabel('Default warn message');
$preferences->add($defaultWarnMessage);
$defaultWarnCountdown = new \Zend\Form\Element\Text('defaultWarnCountdown');
$defaultWarnCountdown->setAttribute('size', '5')->setLabel('Default warn countdown (seconds)');
$preferences->add($defaultWarnCountdown);
$inputFilter->add(array('name' => 'defaultWarnCountdown', 'required' => false, 'filters' => array($integerFilter), 'validators' => array($integerValidator)));
$defaultWarnAllowAbort = new \Zend\Form\Element\Checkbox('defaultWarnAllowAbort');
$defaultWarnAllowAbort->setLabel('Allow user abort by default');
$preferences->add($defaultWarnAllowAbort);
$defaultWarnAllowDelay = new \Zend\Form\Element\Checkbox('defaultWarnAllowDelay');
$defaultWarnAllowDelay->setLabel('Allow user delay by default');
$preferences->add($defaultWarnAllowDelay);
$defaultPostInstMessage = new \Zend\Form\Element\Textarea('defaultPostInstMessage');
$defaultPostInstMessage->setLabel('Default post-installation message');
$preferences->add($defaultPostInstMessage);
$parentFilter = new \Zend\InputFilter\InputFilter();
$parentFilter->add($inputFilter, 'Preferences');
$this->setInputFilter($parentFilter);
}