Beispiel #1
0
 /**
  * Import constructor.
  *
  * @param ContactService   $contactService
  * @param SelectionService $selectionService
  */
 public function __construct(ContactService $contactService, SelectionService $selectionService)
 {
     parent::__construct();
     $this->setAttribute('method', 'post');
     $this->setAttribute('action', '');
     $this->setAttribute('class', 'form-horizontal');
     $selections = [];
     foreach ($selectionService->findAll('selection') as $selection) {
         /** @var $selection Selection */
         if (is_null($selection->getSql())) {
             $selections[$selection->getId()] = $selection->getSelection();
         }
     }
     asort($selections);
     $this->add(['type' => '\\Zend\\Form\\Element\\Select', 'name' => 'selection_id', 'options' => ["value_options" => $selections, 'empty_option' => '-- Append to existing selection', "label" => "txt-append-to-selection", "help-block" => _("txt-contact-import-append-to-selection-name-help-block")]]);
     $optins = [];
     foreach ($contactService->findAll('optIn') as $optin) {
         /** @var $optin OptIn */
         $optins[$optin->getId()] = $optin->getOptIn();
     }
     asort($optins);
     $this->add(['type' => '\\Zend\\Form\\Element\\MultiCheckbox', 'name' => 'optIn', 'options' => ["value_options" => $optins, "label" => "txt-select-opt-in", "help-block" => _("txt-contact-import-select-opt-in-help-block")]]);
     $this->add(['type' => '\\Zend\\Form\\Element\\Text', 'name' => 'selection', 'options' => ["label" => "txt-selection", "help-block" => _("txt-contact-import-selection-name-help-block")]]);
     $this->add(['type' => '\\Zend\\Form\\Element\\File', 'name' => 'file', 'options' => ["label" => "txt-file", "help-block" => _("txt-contact-import-file-requirements")]]);
     $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'upload', 'attributes' => ['class' => "btn btn-primary", 'value' => _("txt-verify-data")]]);
     $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'import', 'attributes' => ['class' => "btn btn-primary", 'value' => _("txt-import")]]);
 }
 /**
  * CalendarContacts constructor.
  *
  * @param SelectionService $selectionService
  */
 public function __construct(SelectionService $selectionService)
 {
     parent::__construct();
     $this->setAttribute('method', 'post');
     $this->setAttribute('action', '');
     $this->setAttribute("onsubmit", "return storeChanges();");
     $selections = [];
     foreach ($selectionService->findAll('selection') as $selection) {
         $selections[$selection->getId()] = $selection->getSelection();
     }
     asort($selections);
     $this->add(['type' => 'Zend\\Form\\Element\\Select', 'name' => 'selection', 'options' => ['inline' => true, 'value_options' => $selections], 'attributes' => ['id' => 'selection', 'class' => 'form-control']]);
     $this->add(['type' => 'Zend\\Form\\Element\\Hidden', 'name' => 'added', 'attributes' => ['id' => 'added']]);
     $this->add(['type' => 'Zend\\Form\\Element\\Hidden', 'name' => 'removed', 'attributes' => ['id' => 'removed']]);
     $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'submit', 'attributes' => ['id' => 'submit', 'class' => 'btn btn-primary', 'value' => _('txt-submit')]]);
     $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'cancel', 'attributes' => ['id' => 'cancel', 'class' => 'btn btn-warning', 'value' => _('txt-cancel')]]);
 }
 /**
  * SelectionFilter constructor.
  * @param SelectionService $selectionService
  */
 public function __construct(SelectionService $selectionService)
 {
     parent::__construct();
     $this->setAttribute('method', 'post');
     $this->setAttribute('action', '');
     $this->setAttribute("onsubmit", "return storeChanges();");
     $selections = [];
     foreach ($selectionService->findAll('selection') as $selection) {
         $selections[$selection->getId()] = $selection->getSelection();
     }
     asort($selections);
     $this->add(['type' => 'Zend\\Form\\Element\\Select', 'name' => 'selection', 'options' => ['inline' => true, 'value_options' => $selections], 'attributes' => ['id' => 'selection', 'class' => 'form-control']]);
     $this->add(['type' => 'Zend\\Form\\Element\\Hidden', 'name' => 'added', 'attributes' => ['id' => 'added']]);
     $this->add(['type' => 'Zend\\Form\\Element\\Hidden', 'name' => 'removed', 'attributes' => ['id' => 'removed']]);
     $this->add(['type' => 'Zend\\Form\\Element\\Radio', 'name' => 'type', 'options' => ['value_options' => [Selection::TYPE_SQL => 'SQL', Selection::TYPE_FIXED => 'Fixed selection']], 'attributes' => ['label' => _("txt-selection-type")]]);
     $this->add(['type' => 'Zend\\Form\\Element\\Textarea', 'name' => 'sql', 'options' => [], 'attributes' => ['label' => _("txt-sql-query"), 'rows' => 20]]);
     $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'submit', 'attributes' => ['id' => 'submit', 'class' => 'btn btn-primary', 'value' => _('txt-submit')]]);
     $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'cancel', 'attributes' => ['id' => 'cancel', 'class' => 'btn btn-warning', 'value' => _('txt-cancel')]]);
 }