Example #1
0
 /**
  * @param ServiceManager $serviceManager
  */
 public function __construct(ServiceManager $serviceManager)
 {
     $financial = new Entity\Financial();
     parent::__construct($financial->get('underscore_entity_name'));
     $this->setAttribute('method', 'post');
     $this->setAttribute('action', '');
     $this->serviceManager = $serviceManager;
     $entityManager = $this->serviceManager->get('Doctrine\\ORM\\EntityManager');
     $organisationFieldset = new ObjectFieldset($entityManager, $financial);
     $organisationFieldset->setUseAsBaseFieldset(true);
     $this->add($organisationFieldset);
     //Vat enforcement
     /**
      * @var $generalService GeneralService
      */
     $generalService = $serviceManager->get(GeneralService::class);
     $vatTypes = [0 => '-- No enforcement'];
     /**
      * @var $vatType VatType
      */
     foreach ($generalService->findAll('vatType') as $vatType) {
         $vatTypes[$vatType->getId()] = $vatType->getType();
     }
     $this->add(['type' => 'Zend\\Form\\Element\\Select', 'name' => 'vatType', 'options' => ['value_options' => $vatTypes, 'help-block' => _("txt-vat-type-help-block")], 'attributes' => ['label' => _("txt-vat-type")]]);
     $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'submit', 'attributes' => ['class' => "btn btn-primary", 'value' => _("txt-submit")]]);
     $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'cancel', 'attributes' => ['class' => "btn btn-warning", 'value' => _("txt-cancel")]]);
     $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'delete', 'attributes' => ['class' => "btn btn-danger", 'value' => _("txt-delete")]]);
 }
Example #2
0
 /**
  * @param ServiceManager $serviceManager
  */
 public function __construct(ServiceManager $serviceManager)
 {
     $organisation = new Entity\Organisation();
     parent::__construct($organisation->get('underscore_entity_name'));
     $this->setAttribute('method', 'post');
     $this->setAttribute('action', '');
     $this->serviceManager = $serviceManager;
     $entityManager = $this->serviceManager->get('Doctrine\\ORM\\EntityManager');
     $organisationFieldset = new ObjectFieldset($entityManager, $organisation);
     $organisationFieldset->setUseAsBaseFieldset(true);
     $this->add($organisationFieldset);
     $this->add(['type' => '\\Zend\\Form\\Element\\Textarea', 'name' => 'description', 'attributes' => ['rows' => 12], 'options' => ["label" => "txt-description", "help-block" => _("txt-organisation-description-help-block")]]);
     $this->add(['type' => '\\Zend\\Form\\Element\\File', 'name' => 'file', 'options' => ["label" => "txt-logo", "help-block" => _("txt-organisation-logo-requirements")]]);
     $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'submit', 'attributes' => ['class' => "btn btn-primary", 'value' => _("txt-submit")]]);
     $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'cancel', 'attributes' => ['class' => "btn btn-warning", 'value' => _("txt-cancel")]]);
     $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'delete', 'attributes' => ['class' => "btn btn-danger", 'value' => _("txt-delete")]]);
 }
Example #3
0
 /**
  * Class constructor.
  */
 public function __construct(ServiceManager $serviceManager, EntityAbstract $object)
 {
     parent::__construct($object->get('underscore_entity_name'));
     $this->serviceManager = $serviceManager;
     $entityManager = $this->serviceManager->get('Doctrine\\ORM\\EntityManager');
     $objectSpecificFieldset = '\\Content\\Form\\' . ucfirst($object->get('entity_name')) . 'Fieldset';
     /*
      * Load a specific fieldSet when present
      */
     if (class_exists($objectSpecificFieldset)) {
         $objectFieldset = new $objectSpecificFieldset($entityManager, $object);
     } else {
         $objectFieldset = new ObjectFieldset($entityManager, $object);
     }
     $objectFieldset->setUseAsBaseFieldset(true);
     $this->add($objectFieldset);
     $this->setAttribute('method', 'post');
     $this->setAttribute('action', '');
     $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'submit', 'attributes' => ['class' => "btn btn-primary", 'value' => _("txt-submit")]]);
     $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'cancel', 'attributes' => ['class' => "btn btn-warning", 'value' => _("txt-cancel")]]);
     $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'delete', 'attributes' => ['class' => "btn btn-danger", 'value' => _("txt-delete")]]);
 }