예제 #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")]]);
 }
 /**
  * @param ServiceLocatorInterface $serviceLocator
  *
  * @return SelectionService
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $selectionService = new SelectionService();
     $selectionService->setServiceLocator($serviceLocator);
     /** @var EntityManager $entityManager */
     $entityManager = $serviceLocator->get(EntityManager::class);
     $selectionService->setEntityManager($entityManager);
     /** @var ContactService $contactService */
     $contactService = $serviceLocator->get(ContactService::class);
     $selectionService->setContactService($contactService);
     return $selectionService;
 }
예제 #3
0
 /**
  * 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')]]);
 }
예제 #4
0
 /**
  * SelectionFilter constructor.
  * @param SelectionService $selectionService
  */
 public function __construct(SelectionService $selectionService)
 {
     parent::__construct();
     $this->setAttribute('method', 'get');
     $this->setAttribute('action', '');
     $filterFieldset = new Fieldset('filter');
     $filterFieldset->add(['type' => 'Zend\\Form\\Element\\Text', 'name' => 'search', 'attributes' => ['class' => 'form-control', 'placeholder' => _('txt-search')]]);
     $tags = [];
     foreach ($selectionService->findTags() as $tag) {
         if (!empty($tag['tag'])) {
             $tags[$tag['tag']] = $tag['tag'];
         }
     }
     $filterFieldset->add(['type' => 'Zend\\Form\\Element\\MultiCheckbox', 'name' => 'tags', 'options' => ['value_options' => $tags, 'inline' => true], 'attributes' => ['label' => _("txt-filter-on-tags")]]);
     $this->add($filterFieldset);
     $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'submit', 'attributes' => ['id' => 'submit', 'class' => 'btn btn-primary', 'value' => _('txt-filter')]]);
     $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'clear', 'attributes' => ['id' => 'cancel', 'class' => 'btn btn-warning', 'value' => _('txt-cancel')]]);
 }
예제 #5
0
 /**
  * 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')]]);
 }