Example #1
0
 /** {@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);
 }
Example #2
0
 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $displayBlacklistedSoftware = new \Zend\Form\Element\Checkbox('displayBlacklistedSoftware');
     $displayBlacklistedSoftware->setLabel('Display ignored software');
     $this->get('Preferences')->add($displayBlacklistedSoftware);
 }
 /** {@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);
 }
 public function indexAction()
 {
     $sl = $this->getServiceLocator();
     $filters = $sl->get('FormElementManager')->get('\\Application\\Form\\LeadFilterForm');
     $page = (int) $this->params()->fromRoute('page') ?: 1;
     $order = $this->params()->fromRoute('order') ?: 'desc';
     $rorder = $order == 'desc' ? 'asc' : 'desc';
     $sort = $this->params()->fromRoute('sort') ?: 'lead.id';
     $action = $this->params()->fromRoute('action') ?: 'index';
     $fields = array();
     $fields['form.source'] = 'Referrer';
     $fields['timecreated'] = 'Created';
     $fields['submitted'] = 'Submitted';
     $fields['lastresponse'] = 'API Response';
     $request = $this->getRequest();
     $data = $request->getQuery();
     $fdata = array();
     if ($data) {
         $filters->setData($data);
         if (!$filters->isValid()) {
             $message = array("Invalid Search Paramters.");
             $this->errorResponse->addMessages(null, $message, $filters->getMessages());
             $page = 1;
             $order = 'desc';
             $rorder = $order == 'desc' ? 'asc' : 'desc';
             $sort = 'lead.id';
         } else {
             $fdata = $filters->getData();
         }
     }
     // grab the paginator from the LeadTable
     $paginator = $this->getLeadMapper()->fetchAll(true, $sort, $order, $fdata);
     // set the current page to what has been passed in query string, or to 1
     // if none set
     $paginator->setCurrentPageNumber($page);
     // set the number of items per page to 10
     $paginator->setItemCountPerPage(10);
     // Batch Form
     $batchForm = new LeadFilterBatchForm('leadbatchform');
     if (count($paginator) == 0) {
         $message = "No Results.";
         $this->errorResponse->addMessage($message, "info");
     }
     foreach ($paginator as $lead) {
         $cbx = new \Zend\Form\Element\Checkbox("sel[" . $lead->getId() . "]");
         if ($lead->getSubmitted()) {
             $cbx->setAttribute('disabled', 'disabled');
         }
         $batchForm->add($cbx);
     }
     return new ViewModel(array('leads' => $paginator, 'page' => $page, 'order' => $order, 'sort' => $sort, 'rorder' => $rorder, 'filters' => $filters, 'fields' => $fields, 'batchForm' => $batchForm, 'query' => $data->toArray()));
 }
Example #5
0
 /**
  * Set available packages
  *
  * The "Packages" fieldset is (re)created with checkboxes for each package.
  *
  * @param string[] $packages Package names
  */
 public function setPackages(array $packages)
 {
     if ($this->has('Packages')) {
         $this->remove('Packages');
     }
     $fieldset = new \Zend\Form\Fieldset('Packages');
     $this->add($fieldset);
     foreach ($packages as $package) {
         $element = new \Zend\Form\Element\Checkbox($package);
         $element->setLabel($package);
         $fieldset->add($element);
     }
 }
 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $deleteInterfaces = new \Zend\Form\Element\Checkbox('DeleteInterfaces');
     $deleteInterfaces->setLabel('Delete interfaces from network listing')->setChecked($this->getOption('config')->defaultDeleteInterfaces);
     $this->add($deleteInterfaces);
     $yes = new \Library\Form\Element\Submit('yes');
     $yes->setLabel('Yes');
     $this->add($yes);
     $no = new \Library\Form\Element\Submit('no');
     $no->setLabel('No');
     $this->add($no);
 }
Example #7
0
 public function __construct($name = null, array $parent = null)
 {
     parent::__construct('roles');
     $this->parent = $parent;
     $this->setAttribute('method', 'post');
     $id = new \Zend\Form\Element\Hidden('id');
     $this->add($id);
     $this->add(['name' => 'name', 'options' => ['type' => 'text', 'label' => 'Nome: ', 'label_attributes' => ['class' => 'control-label']], 'attributes' => ['id' => 'name', 'placeholder' => 'Digite seu Usuário', 'class' => 'form-control']]);
     $allParent = array_merge(array(0 => 'Nenhum'), $this->parent);
     $parent = new Select();
     $parent->setLabel("Herda: ")->setName("parent")->setOptions(array('value_options' => $allParent));
     $this->add($parent);
     $isAdmin = new \Zend\Form\Element\Checkbox("isAdmin");
     $isAdmin->setLabel("Admin?: ");
     $this->add($isAdmin);
     $this->add(['name' => 'submit', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => ['value' => 'Salvar', 'class' => 'btn alert-success']]);
 }
Example #8
0
 /** {@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);
 }
 public function __construct($name = null, array $parent = null)
 {
     parent::__construct('roles');
     $this->parent = $parent;
     $this->setAttribute('method', 'post');
     $id = new \Zend\Form\Element\Hidden('id');
     $this->add($id);
     $nome = new \Zend\Form\Element\Text("nome");
     $nome->setLabel("Nome: ")->setAttribute('placeholder', "Entre com o nome");
     $this->add($nome);
     $allParent = array_merge(array(0 => 'Nenhum'), $this->parent);
     $parent = new Select();
     $parent->setLabel("Herda: ")->setName("parent")->setOptions(array('value_options' => $allParent));
     $this->add($parent);
     $isAdmin = new \Zend\Form\Element\Checkbox("isAdmin");
     $isAdmin->setLabel("Admin?: ");
     $this->add($isAdmin);
     $this->add(array('name' => 'submit', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('value' => 'Salvar', 'class' => 'btn-success')));
 }
Example #10
0
 /** {@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);
 }
Example #11
0
 /** {@inheritdoc} */
 public function init()
 {
     $fieldset = new \Zend\Form\Fieldset('Deploy');
     $fieldset->setLabel('Deploy to computers which have existing package assigned');
     $deployNonnotified = new \Zend\Form\Element\Checkbox('Nonnotified');
     $deployNonnotified->setLabel('Not notified');
     $fieldset->add($deployNonnotified);
     $deploySuccess = new \Zend\Form\Element\Checkbox('Success');
     $deploySuccess->setLabel('Success');
     $fieldset->add($deploySuccess);
     $deployNotified = new \Zend\Form\Element\Checkbox('Notified');
     $deployNotified->setLabel('Running');
     $fieldset->add($deployNotified);
     $deployError = new \Zend\Form\Element\Checkbox('Error');
     $deployError->setLabel('Error');
     $fieldset->add($deployError);
     $deployGroups = new \Zend\Form\Element\Checkbox('Groups');
     $deployGroups->setLabel('Groups');
     $fieldset->add($deployGroups);
     $this->add($fieldset);
     parent::init();
 }
Example #12
0
 /** {@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);
 }
Example #13
0
 /** {@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);
 }
Example #14
0
 /** {@inheritdoc} */
 public function init()
 {
     $fieldset = new \Zend\Form\Fieldset('Deploy');
     $fieldset->setLabel('Deploy to clients which have existing package assigned');
     $deployPending = new \Zend\Form\Element\Checkbox('Pending');
     $deployPending->setLabel('Pending');
     $fieldset->add($deployPending);
     $deployRunning = new \Zend\Form\Element\Checkbox('Running');
     $deployRunning->setLabel('Running');
     $fieldset->add($deployRunning);
     $deploySuccess = new \Zend\Form\Element\Checkbox('Success');
     $deploySuccess->setLabel('Success');
     $fieldset->add($deploySuccess);
     $deployError = new \Zend\Form\Element\Checkbox('Error');
     $deployError->setLabel('Error');
     $fieldset->add($deployError);
     $deployGroups = new \Zend\Form\Element\Checkbox('Groups');
     $deployGroups->setLabel('Groups');
     $fieldset->add($deployGroups);
     $this->add($fieldset);
     parent::init();
 }
Example #15
0
 /** {@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);
 }
Example #16
0
 /** {@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);
 }
Example #17
0
 public function __construct()
 {
     parent::__construct();
     //Form Attribute
     $this->setName("my-form")->setAttribute("action", "#")->setAttributes(array("enctype" => "multipart/form-data", "class" => "my-form", "novalidate" => "true"));
     //create TextBox
     // $textBox = new \Zend\Form\Element\Text("my-textbox");
     // //$textBox->setName("my-textbox");
     // $textBox->setLabel("input_text : ")
     // 		->setLabelAttributes(array(
     // 			"id"=>"my-label",
     // 			"class"=>"my-label"
     // 		))
     // 		->setAttributes(array(
     // 			"placeholder" => "this is a textbox",
     // 			"required"    => "required"
     // 		));
     //text box cách 2
     $this->add(array("type" => "text", "name" => "my-textbox", "attributes" => array("class" => "my-class", "id" => "my-id", "placeholder" => " this is a textbox", "style" => "margin-left:5px", "required" => "required", "pattern" => "[a-zA-Z]{3}-[\\d]{2}", "title" => "XXX-XX"), "options" => array("label" => "textbox : ", "label_attributes" => array("class" => "my-class-od-label"))));
     //submit
     $this->add(array("type" => "submit", "name" => "my-submit", "attributes" => array("value" => "Gửi")));
     //number
     $this->add(array("type" => "number", "name" => "my-number", "attributes" => array("min" => 0, "max" => 100), "options" => array("label" => "My number : ")));
     //password
     $this->add(array("type" => "password", "name" => "my-password", "options" => array("label" => "My password : "******"type" => "textarea", "name" => "my-area", "attributes" => array("cols" => 50, "rows" => 5, "style" => "resize:none"), "options" => array("label" => "My textarea : ")));
     //button
     $this->add(array("type" => "button", "name" => "my-button", "attributes" => array(), "options" => array("label" => "Button")));
     //file
     $this->add(array("type" => "file", "name" => "my-file", "attributes" => array("multiple" => true), "options" => array("label" => "My file : ")));
     //checkbox
     $checkbox = new \Zend\Form\Element\Checkbox("my-checkbox");
     $checkbox->setLabel("my checkbox")->setCheckedValue("checked")->setUnCheckedValue("unchecked")->setChecked(true);
     $this->add($checkbox);
     // $this->add(array(
     // 	"type" => "checkbox",
     // 	"name" => "my-checkbox",
     // 	"attributes" => array(
     // 		"checked" => true,
     // 	),
     // 	"options" => array(
     // 		"checked_value"   => "checked",
     // 		"unchecked_value" => "unchecked",
     // 		"label"           => "My Checkbox"
     // 	),
     // ));
     //multy checkbox
     // $multicheckbox = new \Zend\Form\Element\MultiCheckbox("my-multycheckbox");
     // $multicheckbox->setLabel("my checkbox")
     // 			  	->setAttributes(array(
     // 			  		"value" => array("php","zend"),//thiết lập checked mặc định
     // 			  		"class" => "abc"
     // 			  	))
     // 			  	->setOptions(array(
     // 			  		"value_options" => array(
     // 						"php"  => "lập trình PHP",
     // 						"zend" => "framework Zend",
     // 						"CI"   => "framework CodeIgniter"
     // 			  		),
     // 			  	));
     // $this->add($multicheckbox);
     //multy checkbox(2)
     // $this->add(array(
     // 	"type" => "multicheckbox",
     // 	"name" => "my-multycheckbox",
     // 	"attributes" => array(
     // 		"value" => array("php","zend"),//thiết lập checked mặc định
     // 	),
     // 	"options" => array(
     // 		"value_options" => array(
     // 			"php"  => "lập trình PHP",
     // 			"zend" => "framework Zend",
     // 			"CI"   => "framework CodeIgniter"
     //   		),
     // 	)
     // ));
     //multy checkbox(3)
     $this->add(array("type" => "multicheckbox", "name" => "my-multycheckbox", "attributes" => array("class" => "abc"), "options" => array("value_options" => array(array("value" => "php", "label" => "lập trình PHP", "selected" => false, "attributes" => array("class" => "not abc")), array("value" => "zend", "label" => "framework Zend", "selected" => false), array("value" => "CI", "label" => "framework CodeIgniter", "selected" => true)))));
 }