Example #1
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;
 }
 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;
 }
Example #3
0
 /**
  * Rendering filters
  *
  * @return string
  */
 public function renderFilters()
 {
     $headers = $this->getTable()->getHeaders();
     $render = '';
     foreach ($headers as $name => $params) {
         if (isset($params['filters'])) {
             $value = $this->getTable()->getParamAdapter()->getValueOfFilter($name);
             $id = 'zff_' . $name;
             if (is_string($params['filters'])) {
                 $element = new \Zend\Form\Element\Text($id);
             } else {
                 $element = new \Zend\Form\Element\Select($id);
                 $element->setValueOptions($params['filters']);
             }
             $element->setAttribute('class', 'filter form-control');
             $element->setValue($value);
             $render .= sprintf('<td>%s</td>', $this->getRenderer()->formRow($element));
         } else {
             $render .= '<td></td>';
         }
     }
     return sprintf('<tr>%s</tr>', $render);
 }
Example #4
0
 /**
  * Return form element config
  * @return array
  * @implements FormElementProviderInterface
  */
 public function getFormElementConfig()
 {
     return array('factories' => array('NetgluePrismic\\Form\\Element\\SelectPrismicRef' => function ($manager) {
         $element = new \Zend\Form\Element\Select('ref');
         $services = $manager->getServiceLocator();
         $context = $services->get('Prismic\\Context');
         $api = $context->getPrismicApi();
         $options = array();
         foreach ($api->refs() as $ref) {
             if ($ref->isMasterRef()) {
                 $options[$ref->getRef()] = 'Current Live Website';
             } else {
                 $options[$ref->getRef()] = $ref->getLabel();
             }
         }
         $element->setValueOptions($options);
         $element->setValue($context->getRefAsString());
         return $element;
     }));
 }
Example #5
0
 /**
  * Rendering filters
  *
  * @return string
  */
 public function renderFiltersInHeader()
 {
     $headers = $this->getTable()->getHeaders();
     $render = '';
     foreach ($headers as $name => $params) {
         if (isset($params['filters'])) {
             $value = $this->getTable()->getParamAdapter()->getValueOfFilter($name);
             $id = 'zff_' . $name;
             if (!isset($params['placeholder'])) {
                 $params['placeholder'] = $params['title'];
             }
             if (!is_array($params['filters']) && class_exists($params['filters'])) {
                 $element = new $params['filters']($id);
             } else {
                 if (is_string($params['filters'])) {
                     $element = new \Zend\Form\Element\Text($id);
                 } else {
                     $element = new \Zend\Form\Element\Select($id);
                     $element->setValueOptions($params['filters']);
                 }
             }
             $element->setAttribute('class', 'filter form-control input-sm');
             $element->setAttribute('placeholder', $params['placeholder']);
             $element->setAttribute('data-placeholder', $params['placeholder']);
             $element->setValue($value);
             $render .= sprintf('<div class="form-group">%s</div>', $this->getRenderer()->formRow($element));
         } else {
             //                $render .= '<div></div>';
         }
     }
     return sprintf('<div class="form-body">%s</div>', $render);
 }
Example #6
0
 /**
  * Rendering filters
  *
  * @return string
  */
 public function renderFilters()
 {
     $headers = $this->getTable()->getHeaders();
     $render = '';
     $options = $this->getTable()->getOptions();
     $tableName = strtolower($options->getName());
     $session = new Container();
     foreach ($headers as $name => $params) {
         if (isset($params['filters'])) {
             $value = $this->getTable()->getParamAdapter()->getValueOfFilter($name);
             $id = 'zff_' . $tableName . '_' . $name;
             if (is_string($params['filters'])) {
                 $element = new \Zend\Form\Element\Text($id);
                 $element->setAttribute('placeholder', 'Pesquisar ' . strtolower($params['title']));
             } else {
                 $element = new \Zend\Form\Element\Select($id);
                 $element->setValueOptions($params['filters']);
             }
             $class = '';
             if (isset($params['filter_class'])) {
                 $class = trim($params['filter_class']);
             }
             $element->setAttribute('class', 'filter form-control ' . $class);
             // $value = $session->offsetGet($id);
             $element->setValue($value);
             $session->offsetSet($id, $value);
             $render .= sprintf('<td>%s</td>', $this->getRenderer()->formRow($element));
         } else {
             $render .= '<td></td>';
         }
     }
     return sprintf('<tfoot><tr>%s</tr><tfoot>', $render);
 }