コード例 #1
0
ファイル: LoiReminder.php プロジェクト: Newman101/affiliation
 /**
  * @param Affiliation    $affiliation
  * @param ContactService $contactService
  */
 public function __construct(Affiliation $affiliation, ContactService $contactService)
 {
     parent::__construct();
     $this->setAttribute('method', 'post');
     $this->setAttribute('class', 'form-horizontal');
     $contactService->findContactsInAffiliation($affiliation);
     $this->add(['type' => 'Zend\\Form\\Element\\Select', 'name' => 'receiver', 'options' => ['value_options' => $contactService->toFormValueOptions(), 'label' => _("txt-contact-name")], 'attributes' => ['class' => 'form-control', 'id' => 'receiver', 'required' => true]]);
     $this->add(['type' => EntitySelect::class, 'name' => 'deeplinkTarget', 'attributes' => ['label' => _("txt-deeplink-target")], 'options' => ['object_manager' => $contactService->getEntityManager(), 'target_class' => "Deeplink\\Entity\\Target", 'find_method' => ['name' => 'findBy', 'params' => ['criteria' => [], 'orderBy' => ['route' => 'ASC']]], 'label_generator' => function (Target $targetEntity) {
         return sprintf("%s (%s)", $targetEntity->getTarget(), $targetEntity->getRoute());
     }]]);
     $this->add(['type' => 'Zend\\Form\\Element\\Text', 'name' => 'subject', 'attributes' => ['label' => _("txt-subject"), 'class' => 'form-control']]);
     $this->add(['type' => 'Zend\\Form\\Element\\Textarea', 'name' => 'message', 'attributes' => ['label' => _("txt-message"), 'rows' => 15, 'class' => 'form-control']]);
     $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'submit', 'attributes' => ['class' => "btn btn-primary", 'value' => _("txt-send")]]);
     $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'cancel', 'attributes' => ['class' => "btn btn-warning", 'value' => _("txt-cancel")]]);
 }
コード例 #2
0
ファイル: DoaApproval.php プロジェクト: Newman101/affiliation
 /**
  * @param Doa[] $doa
  */
 public function __construct(array $doa, ContactService $contactService)
 {
     parent::__construct();
     $this->setAttribute('method', 'post');
     $this->setAttribute('class', 'form-horizontal');
     /**
      * Create a fieldSet per DOA (and affiliation)
      */
     foreach ($doa as $doa) {
         $affiliationFieldset = new Fieldset('affiliation_' . $doa->getAffiliation()->getId());
         $contactService->findContactsInAffiliation($doa->getAffiliation());
         $affiliationFieldset->add(['type' => 'Zend\\Form\\Element\\Select', 'name' => 'contact', 'options' => ['value_options' => $contactService->toFormValueOptions(), 'label' => _("txt-contact-name")], 'attributes' => ['class' => 'form-control', 'id' => 'contact-' . $doa->getId(), 'required' => true]]);
         $affiliationFieldset->add(['type' => 'Zend\\Form\\Element\\Text', 'name' => 'dateSigned', 'attributes' => ['class' => 'form-control', 'id' => 'dateSigned-' . $doa->getId(), 'required' => true]]);
         $this->add($affiliationFieldset);
     }
     $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'submit', 'attributes' => ['class' => "btn btn-primary", 'value' => _("txt-update")]]);
     $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'cancel', 'attributes' => ['class' => "btn btn-warning", 'value' => _("txt-cancel")]]);
 }