Пример #1
0
 public function __construct()
 {
     parent::__construct();
     $this->setAttribute('method', 'POST');
     $Controller = new Text('Controller');
     $Controller->setLabel("Controller: ");
     $Controller->setAttributes(array("class" => 'form-control'));
     $this->add($Controller);
     $nome = new Text('nome');
     $nome->setLabel("Nome: ");
     $nome->setAttributes(array("class" => 'form-control'));
     $this->add($nome);
     $label = new Text('label');
     $label->setLabel("Label: ");
     $label->setAttributes(array("class" => 'form-control'));
     $this->add($label);
     $route = new Text('route');
     $route->setLabel("Route: ");
     $route->setAttributes(array("class" => 'form-control'));
     $this->add($route);
     $select = new \Zend\Form\Element\Select('parentView');
     $select->setLabel('Parente View');
     $select->setAttributes(array("class" => 'form-control'));
     $select->setValueOptions(array('0' => 'French', '1' => 'English', '2' => 'Japanese', '3' => 'Chinese'));
     $this->add($select);
     $status = new \Zend\Form\Element\Select('Status');
     $status->setLabel('Status');
     $status->setAttributes(array("class" => 'form-control'));
     $status->setValueOptions(array('0' => '', '1' => 'Ativo', '2' => 'Inativo'));
     $this->add($status);
     $submit = new \Zend\Form\Element\Submit('Salvar');
     $submit->setValue('Salvar')->setAttributes(array("class" => 'btn btn-primary btn-lg btn-block'));
     $this->add($submit);
 }
Пример #2
0
 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $this->setAttribute('method', 'GET');
     $filter = new \Zend\Form\Element\Select('filter');
     $filter->setLabel('Filter')->setValueOptions(array('accepted' => $this->_('selected for display'), 'ignored' => $this->_('ignored for display'), 'new' => $this->_('new or not categorized'), 'all' => $this->_('all')))->setAttribute('onchange', 'this.form.submit();');
     $this->add($filter);
 }
Пример #3
0
 protected function getOutputSelect($name)
 {
     $select = new \Zend\Form\Element\Select($name);
     $select->setAttributes(array('id' => $name));
     $select->setLabel('Output Type');
     $select->setEmptyOption('-- Select Output Type --');
     $opt = array('binary' => 'Binary', 'base64' => 'Base 64 Encoded');
     $select->setValueOptions($opt);
     $select->setValue('base64');
     return $select;
 }
Пример #4
0
 public function __construct($author, $project)
 {
     parent::__construct('reference');
     $this->add(array('name' => 'name', 'type' => 'text', 'attributes' => array('placeholder' => 'Ticket name')));
     $this->add(array('name' => 'desc', 'type' => 'textarea', 'attributes' => array('placeholder' => 'Brief description (optional)')));
     $select = new \Zend\Form\Element\Select('importance');
     $select->setLabel('Set importance of this ticket');
     $select->setValueOptions(array('1' => 'Very low', '2' => 'Low', '3' => 'Medium', '4' => 'High', '5' => 'Very high'));
     $this->add($select);
     $this->add(array('name' => 'author_id', 'type' => 'hidden', 'attributes' => array('value' => $author)));
     $this->add(array('name' => 'project_id', 'type' => 'hidden', 'attributes' => array('value' => $project)));
     $this->add(array('name' => 'submit', 'attributes' => array('class' => 'hvr-grow')));
 }
Пример #5
0
 protected function getKeySizeSelect($name)
 {
     $select = new \Zend\Form\Element\Select($name);
     $select->setAttributes(array('id' => $name));
     $select->setLabel('Key Size');
     $select->setEmptyOption('-- Select Key Size --');
     $opt = array();
     for ($pow = 10; $pow <= 13; $pow++) {
         $v = pow(2, $pow);
         $opt[$v] = number_format($v) . ' Bytes';
     }
     $select->setValueOptions($opt);
     $select->setValue(\Zend\Crypt\PublicKey\Rsa\PrivateKey::DEFAULT_KEY_SIZE);
     return $select;
 }
Пример #6
0
 public function setKeyStorage(KeyStorageInterface $storage)
 {
     parent::setKeyStorage($storage);
     $this->add($this->getKeyListSelect('keyName'));
     $this->add(array('name' => 'keyPassPhrase', 'type' => 'password', 'options' => array('label' => 'Pass Phrase'), 'attributes' => array('id' => 'keyPassPhrase', 'title' => 'Provide the password associated with your private key')));
     $dir = new \Zend\Form\Element\Select('direction');
     $dir->setAttributes(array('id' => 'direction'));
     $opt = array('encrypt' => 'Encrypt', 'decrypt' => 'Decrypt');
     $dir->setValueOptions($opt);
     $dir->setLabel('Encrypt or Decrypt');
     $this->add($dir);
     $out = $this->getOutputSelect('outputType');
     $out->setLabel('Set encrypted output format');
     $this->add($out);
     $this->add(array('name' => 'sourceText', 'type' => 'textarea', 'options' => array('label' => 'Input Text'), 'attributes' => array('id' => 'sourceText')));
     $this->add(array('name' => 'processText', 'type' => 'button', 'attributes' => array('id' => 'processText', 'type' => 'submit'), 'options' => array('label' => 'Encrypt/Decrypt')));
 }
Пример #7
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);
 }
Пример #8
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);
 }
Пример #9
0
 private function getFormAntennaModel($id)
 {
     $objectManager = $this->getServiceLocator()->get('Doctrine\\ORM\\EntityManager');
     $datas = array();
     $form = null;
     if ($id) {
         $antenna = $objectManager->getRepository('Application\\Entity\\Antenna')->find($id);
         if ($antenna) {
             $datas['antenna'] = $antenna;
             $qb = $objectManager->createQueryBuilder();
             $qb->select(array('p', 'c'))->from('Application\\Entity\\PredefinedEvent', 'p')->leftJoin('p.category', 'c')->andWhere('c INSTANCE OF Application\\Entity\\AntennaCategory');
             $models = array();
             foreach ($qb->getQuery()->getResult() as $model) {
                 foreach ($model->getCustomFieldsValues() as $value) {
                     if ($value->getCustomField()->getID() == $model->getCategory()->getAntennaField()->getId()) {
                         if ($value->getValue() == $id) {
                             $models[] = $model;
                         }
                     }
                 }
             }
             $form = new \Zend\Form\Form("model");
             $hidden = new \Zend\Form\Element\Hidden("id");
             $hidden->setValue($id);
             $form->add($hidden);
             $select = new \Zend\Form\Element\Select("models");
             $optionsModels = array();
             foreach ($models as $model) {
                 $optionsModels[$model->getId()] = $model->getName();
             }
             $select->setValueOptions($optionsModels);
             if (count($optionsModels) == 0) {
                 $select->setEmptyOption("Aucun modèle à associer");
             } else {
                 $select->setEmptyOption("Choisir le modèle à associer.");
             }
             $select->setLabel("Modèle : ");
             $form->add($select);
             $datas['form'] = $form;
         }
     }
     return $datas;
 }