Пример #1
0
 /**
  * AddAffiliation constructor.
  *
  * @param OrganisationService $organisationService
  * @param ProjectService      $projectService
  */
 public function __construct(OrganisationService $organisationService, ProjectService $projectService)
 {
     parent::__construct();
     $currentProjects = [];
     /**
      * @var $projectService ProjectService
      */
     foreach ($projectService->findProjectByOrganisation($organisationService->getOrganisation(), ProjectService::WHICH_ALL) as $projectService) {
         $currentProjects[] = $projectService->getProject()->getId();
     }
     $projects = [];
     /**
      * @var $newProjectService ProjectService
      */
     foreach ($projectService->findAllProjects(ProjectService::WHICH_ALL)->getResult() as $newProject) {
         if (!in_array($newProject->getId(), $currentProjects)) {
             $projects[$newProject->getId()] = sprintf("%s", $newProject);
         }
     }
     arsort($projects);
     $this->add(['type' => 'Zend\\Form\\Element\\Select', 'name' => 'project', 'options' => ['value_options' => $projects, 'help-block' => _("txt-project-help-block")], 'attributes' => ['label' => _("txt-project")]]);
     $this->add(['type' => 'Zend\\Form\\Element\\Text', 'name' => 'branch', 'options' => ['help-block' => _("txt-branch-help-block")], 'attributes' => ['label' => _("txt-branch")]]);
     $contacts = [];
     foreach ($organisationService->getOrganisation()->getContactOrganisation() as $contactOrganisation) {
         $contacts[$contactOrganisation->getContact()->getId()] = $contactOrganisation->getContact()->getFormName();
     }
     asort($contacts);
     $this->add(['type' => 'Zend\\Form\\Element\\Select', 'name' => 'contact', 'options' => ['value_options' => $contacts, 'help-block' => _("txt-technical-contact-help-block")], 'attributes' => ['label' => _("txt-technical-contact")]]);
     $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")]]);
 }
 /**
  * @param ServiceLocatorInterface $serviceLocator
  *
  * @return OrganisationService
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $organisationService = new OrganisationService();
     /** @var EntityManager $entityManager */
     $entityManager = $serviceLocator->get(EntityManager::class);
     $organisationService->setEntityManager($entityManager);
     return $organisationService;
 }
Пример #3
0
 /**
  * @return OrganisationService
  */
 public function getOrganisationService()
 {
     if (is_null($this->organisationService)) {
         $this->organisationService = new OrganisationService();
         $organisation = new Organisation();
         $this->organisationService->setOrganisation($organisation);
     }
     return $this->organisationService;
 }
 /**
  * @param OrganisationService $organisationService
  */
 public function __construct(OrganisationService $organisationService)
 {
     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')]]);
     $types = [];
     foreach ($organisationService->findAll('type') as $type) {
         $types[$type->getId()] = $type->getType();
     }
     $filterFieldset->add(['type' => 'Zend\\Form\\Element\\MultiCheckbox', 'name' => 'type', 'options' => ['inline' => true, 'value_options' => $types], 'attributes' => ['label' => _("txt-organisation-type")]]);
     $filterFieldset->add(['type' => 'Zend\\Form\\Element\\MultiCheckbox', 'name' => 'options', 'options' => ['inline' => true, 'value_options' => [1 => _("txt-active-in-project")]], 'attributes' => ['label' => _("txt-options-type")]]);
     $filterFieldset->add(['type' => 'Zend\\Form\\Element\\MultiCheckbox', 'name' => 'vatStatus', 'options' => ['inline' => true, 'value_options' => Financial::getVatStatusTemplates()], 'attributes' => ['label' => _("txt-vat-status")]]);
     $filterFieldset->add(['type' => 'Zend\\Form\\Element\\MultiCheckbox', 'name' => 'omitContact', 'options' => ['inline' => true, 'value_options' => Financial::getOmitContactTemplates()], 'attributes' => ['label' => _("txt-omit-contact")]]);
     $filterFieldset->add(['type' => 'Zend\\Form\\Element\\MultiCheckbox', 'name' => 'requiredPurchaseOrder', 'options' => ['inline' => true, 'value_options' => Financial::getRequiredPurchaseOrderTemplates()], 'attributes' => ['label' => _("txt-required-purchase-order")]]);
     $filterFieldset->add(['type' => 'Zend\\Form\\Element\\MultiCheckbox', 'name' => 'email', 'options' => ['inline' => true, 'value_options' => Financial::getEmailTemplates()], 'attributes' => ['label' => _("txt-email")]]);
     $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
 /**
  * @param Contact $object
  *
  * @return array
  */
 public function extract($object)
 {
     $this->prepare($object);
     $values = $this->extractByValue($object);
     unset($values['phone']);
     foreach ($object->getPhone() as $phone) {
         $values['phone'][$phone->getType()->getId()]['phone'] = $phone->getPhone();
     }
     unset($values['address']);
     foreach ($object->getAddress() as $address) {
         if ($address->getType()->getId() === AddressType::ADDRESS_TYPE_MAIL) {
             $values['address']['address'] = $address->getAddress();
             $values['address']['zipCode'] = $address->getZipCode();
             $values['address']['city'] = $address->getCity();
             $values['address']['country'] = $address->getCountry();
         }
     }
     unset($values['community']);
     foreach ($object->getCommunity() as $community) {
         $values['community'][$community->getType()->getId()]['community'] = $community->getCommunity();
     }
     unset($values['profile']);
     $values['profile']['visible'] = !is_null($object->getProfile()) ? $object->getProfile()->getVisible() : null;
     $values['profile']['description'] = !is_null($object->getProfile()) ? $object->getProfile()->getDescription() : null;
     /**
      * Set the contact organisation
      */
     $contactService = new ContactService();
     $contactService->setContact($object);
     if (!is_null($object->getContactOrganisation())) {
         $organisationService = new OrganisationService();
         $organisationService->setOrganisation($object->getContactOrganisation()->getOrganisation());
         $values['contact_organisation']['organisation'] = $organisationService->parseOrganisationWithBranch($contactService->getContact()->getContactOrganisation()->getBranch());
         if (!is_null($object->getContactOrganisation())) {
             $values['contact_organisation']['country'] = $object->getContactOrganisation()->getOrganisation()->getCountry()->getId();
         }
     }
     return $values;
 }
 /**
  * @param OrganisationService $organisationService
  *
  * @return \Content\Entity\Article[]
  */
 public function parseOrganisationArticleList(OrganisationService $organisationService)
 {
     $articles = $this->getArticleService()->findArticlesByOrganisation($organisationService->getOrganisation(), $this->getLimit());
     /*
      * Parse the organisationService in to have the these functions available in the view
      */
     return $this->getRenderer()->render('organisation/partial/list/article', ['organisationService' => $organisationService, 'articles' => $articles, 'limit' => $this->getLimit()]);
 }