Пример #1
0
 public function onBootstrap(MvcEvent $e)
 {
     $eventManager = $e->getApplication()->getEventManager();
     $moduleRouteListener = new ModuleRouteListener();
     $moduleRouteListener->attach($eventManager);
     $sharedManager = $eventManager->getSharedManager();
     $eventManager->attach('dispatch.error', function ($event) {
         $exception = $event->getResult()->exception;
         if ($exception) {
             $sm = $event->getApplication()->getServiceManager();
             $service = $sm->get('Application\\Service\\ErrorHandling');
             $service->logException($exception);
         }
     });
     //error_reporting(E_ALL);
     $translator = new Translator();
     $translator->addTranslationFile('phpArray', 'vendor/zendframework/zendframework/resources/languages/fr/Zend_Validate.php', 'default', '*');
     $translator->addTranslationFile('phpArray', 'vendor/zendframework/zendframework/resources/languages/fr/Zend_Captcha.php', 'default', '*');
     AbstractValidator::setDefaultTranslator($translator);
     /*
     //controller can't dispatch request action that passed to the url
     $sharedManager->attach('Zend\Mvc\Controller\AbstractActionController',
         'dispatch',
         array($this, 'handleControllerCannotDispatchRequest' ), 101);
     
     //controller not found, invalid, or route is not matched anymore
     $eventManager->attach('dispatch.error',
         array($this,
             'handleControllerNotFoundAndControllerInvalidAndRouteNotFound' ), 100);
     */
 }
Пример #2
0
 /**
  * @param Organ[] $organs
  * @param Translator $translator
  */
 public function __construct(array $organs, Translator $translator, ObjectManager $objectManager)
 {
     parent::__construct('activity');
     $this->translator = $translator;
     $this->setAttribute('method', 'post');
     $this->setHydrator(new ClassMethodsHydrator(false))->setObject(new \Activity\Model\Activity());
     // all the organs that the user belongs to in organId => name pairs
     $organOptions = [0 => $translator->translate('No organ')];
     foreach ($organs as $organ) {
         $organOptions[$organ->getId()] = $organ->getAbbr();
     }
     // Find user that wants to create an activity
     $this->add(['name' => 'language_dutch', 'type' => 'checkbox', 'uncheckedValue' => null]);
     $this->add(['name' => 'language_english', 'type' => 'checkbox', 'uncheckedValue' => null]);
     $this->add(['name' => 'name', 'attributes' => ['type' => 'text']]);
     $this->add(['name' => 'nameEn', 'attributes' => ['type' => 'text']]);
     $this->add(['name' => 'organ', 'type' => 'select', 'options' => ['value_options' => $organOptions]]);
     $this->add(['name' => 'beginTime', 'type' => 'datetime', 'options' => ['format' => 'Y/m/d H:i']]);
     $this->add(['name' => 'endTime', 'type' => 'datetime', 'options' => ['format' => 'Y/m/d H:i']]);
     $this->add(['name' => 'location', 'attributes' => ['type' => 'text']]);
     $this->add(['name' => 'locationEn', 'attributes' => ['type' => 'text']]);
     $this->add(['name' => 'costs', 'attributes' => ['type' => 'text']]);
     $this->add(['name' => 'costsEn', 'attributes' => ['type' => 'text']]);
     $this->add(['name' => 'description', 'attributes' => ['type' => 'textarea']]);
     $this->add(['name' => 'descriptionEn', 'attributes' => ['type' => 'textarea']]);
     $this->add(['name' => 'canSignUp', 'type' => 'Zend\\Form\\Element\\Checkbox', 'options' => ['checked_value' => 1, 'unchecked_value' => 0]]);
     $this->add(['name' => 'fields', 'type' => 'Zend\\Form\\Element\\Collection', 'options' => ['count' => 0, 'should_create_template' => true, 'allow_add' => true, 'target_element' => new ActivityFieldFieldset($objectManager)]]);
     $this->add(['name' => 'subscriptionDeadline', 'type' => 'datetime', 'options' => ['format' => 'Y/m/d H:i']]);
     $this->add(['name' => 'submit', 'attributes' => ['type' => 'submit', 'value' => 'Create']]);
 }
Пример #3
0
 public function __construct(Translator $translate)
 {
     parent::__construct();
     $this->add(array('name' => 'name', 'type' => 'Zend\\Form\\Element\\Text', 'options' => array('label' => $translate->translate('Album title'))));
     $this->add(array('name' => 'submit', 'type' => 'submit', 'options' => array('label' => $translate->translate('Create'))));
     $this->initFilters();
 }
 /**
  * @param Translator   $translator
  * @param UserValidator $userValidator
  */
 public function __construct(Translator $translator, UserValidator $userValidator)
 {
     parent::__construct('tasksForm');
     $userValidator->setUseAsBaseFieldset(true);
     $this->validationRules = ['csrf' => ['required', 'error_message' => $translator->translate('The form request has expired. You must resubmit the form in order to continue.')]];
     $this->setValidationGroup(['user' => ['profile' => ['fname', 'lname'], 'tasks'], 'csrf']);
     return $this->addElements([$userValidator, new Csrf('csrf')]);
 }
 /**
  * @return DashboardWidget
  */
 public function widgetAction()
 {
     $lastLoggedProcesses = $this->processLogFinder->getLastLoggedProcesses(0, 3);
     if (empty($lastLoggedProcesses)) {
         return false;
     }
     ProcessLogFormatter::formatProcessLogs($lastLoggedProcesses, $this->systemConfig, $this->translator);
     return DashboardWidget::initialize($this->widgetConfig->get('template', 'prooph/link/monitor/process-view/partial/process-list'), $this->widgetConfig->get('title', $this->translator->translate('Workflow Monitor')), $this->widgetConfig->get('cols', 12), ['processes' => $lastLoggedProcesses], $this->widgetConfig->get('group_title'));
 }
Пример #6
0
 public function __construct(Translator $translate)
 {
     parent::__construct();
     $this->add(['name' => 'name', 'type' => 'Zend\\Form\\Element\\Text', 'options' => ['label' => $translate->translate('Album title')]]);
     $this->add(['name' => 'startDateTime', 'type' => 'Zend\\Form\\Element\\DateTime', 'options' => ['label' => $translate->translate('Start date')]]);
     $this->add(['name' => 'endDateTime', 'type' => 'Zend\\Form\\Element\\DateTime', 'options' => ['label' => $translate->translate('End date')]]);
     $this->add(['name' => 'submit', 'type' => 'submit', 'options' => ['label' => $translate->translate('Save')]]);
     $this->initFilters();
 }
Пример #7
0
 public function onBootstrap(MvcEvent $e)
 {
     $eventManager = $e->getApplication()->getEventManager();
     $moduleRouteListener = new ModuleRouteListener();
     $moduleRouteListener->attach($eventManager);
     $translator = new Translator();
     $translator->addTranslationFile('phpArray', './vendor/zendframework/zendframework/resources/languages/pt_BR/Zend_Validate.php', 'default', 'pt_BR');
     \Zend\Validator\AbstractValidator::setDefaultTranslator($translator);
 }
 /**
  * @param array $processLogEntries
  */
 private function addProcessNames(array &$processLogEntries)
 {
     $processDefinitions = $this->systemConfig->getProcessDefinitions();
     foreach ($processLogEntries as &$processLogEntry) {
         if (isset($processDefinitions[$processLogEntry['start_message']])) {
             $processLogEntry['process_name'] = $processDefinitions[$processLogEntry['start_message']]['name'];
         } else {
             $processLogEntry['process_name'] = $this->translator->translate('Unknown');
         }
     }
 }
Пример #9
0
 /**
  * Returns the token parser instances to add to the existing list.
  *
  * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances
  */
 public function getTokenParsers()
 {
     // best place to set locale I could find, because of how the module loader works
     // translator is optional to facilitate extraction, use Factory to create in production
     if ($this->translator) {
         $locale = $this->translator->getLocale();
         putenv('LANG=' . $locale);
         setlocale(LC_MESSAGES, $locale . ".utf-8");
     }
     return [new TransParser($this->translator)];
 }
Пример #10
0
 public function onBootstrap(MvcEvent $e)
 {
     $eventManager = $e->getApplication()->getEventManager();
     $moduleRouteListener = new ModuleRouteListener();
     $moduleRouteListener->attach($eventManager);
     $eventManager->attach(MvcEvent::EVENT_ROUTE, [$this, 'protectPage'], -100);
     $t = new I18nTranslator();
     $t->setLocale('de_DE');
     $translator = new Translator($t);
     $translator->addTranslationFile('phpArray', 'vendor/zendframework/zend-i18n-resources/languages/de/Zend_Validate.php', 'default', 'de_DE');
     AbstractValidator::setDefaultTranslator($translator);
 }
Пример #11
0
 /**
  * @param Organ[] $organs
  * @param Translator $translator
  */
 public function __construct(array $organs, Translator $translator)
 {
     parent::__construct();
     $this->translator = $translator;
     // all the organs that the user belongs to in organId => name pairs
     $organOptions = [0 => $translator->translate('No organ')];
     foreach ($organs as $organ) {
         $organOptions[$organ->getId()] = $organ->getAbbr();
     }
     $this->add(['name' => 'name', 'attributes' => ['type' => 'text']]);
     $this->add(['name' => 'organ', 'type' => 'select', 'options' => ['value_options' => $organOptions]]);
     $this->add(['name' => 'beginTime', 'type' => 'datetime', 'options' => ['format' => 'Y/m/d H:i']]);
     $this->add(['name' => 'endTime', 'type' => 'datetime', 'options' => ['format' => 'Y/m/d H:i']]);
 }
Пример #12
0
 /**
  *
  *
  * @param string $templateName
  * @param string $to
  * @param array $params
  * @return
  */
 public function __invoke($templateName, $to, array $params = array())
 {
     // set mail language if not given
     if (!isset($params['language']) && $this->translator) {
         $params['language'] = \Locale::getPrimaryLanguage($this->translator->getLocale());
     }
     // set root url if not given
     if (!isset($params['root_url']) && $this->router) {
         $params['root_url'] = rtrim($this->router->assemble(array('language' => $params['language']), array('name' => 'frontend/index')), '/');
     }
     //
     $params['to'] = $to;
     return $this->mailer->sendMail($templateName, $to, $params);
 }
Пример #13
0
 public function __construct(Translator $translator)
 {
     parent::__construct('login');
     $this->setAttribute('method', 'post');
     $this->setAttribute('class', 'clearfix');
     $filter = new InputFilter();
     $this->setInputFilter($filter);
     $this->add((new Text('email'))->setLabel('Email address:')->setAttribute('required', 'required')->setAttribute('placeholder', $translator->translate('Email address or Username')));
     $this->add((new Password('password'))->setLabel('Password:'******'required', 'required')->setAttribute('placeholder', $translator->translate('Password')));
     $this->add((new Checkbox('remember'))->setLabel('Remember me')->setChecked(true));
     $this->add((new Submit('submit'))->setValue('Login')->setAttribute('class', 'btn btn-success pull-right'));
     $filter->add(['name' => 'email', 'required' => true]);
     $filter->add(['name' => 'password', 'required' => true]);
 }
 /**
  * @param Translator   $translator
  * @param UserValidator $userValidator
  */
 public function __construct(Translator $translator, UserValidator $userValidator)
 {
     parent::__construct('adminAccountForm');
     $that = $this;
     $userValidator->addValidationRule('email', ['name' => 'Callback', 'break_chain_on_failure' => true, 'options' => ['callback' => function ($value) use($that) {
         $count = User::where('email', $value);
         if ($that->getObject()->id) {
             $count = $count->where('id', '!=', $that->getObject()->id);
         }
         $count = $count->count();
         return !(bool) $count;
     }, 'message' => $translator->translate('The email already exists')]])->setUseAsBaseFieldset(true);
     $this->validationRules = ['csrf' => ['required', 'error_message' => $translator->translate('The form request has expired. You must resubmit the form in order to continue.')]];
     return $this->addElements([$userValidator, new Csrf('csrf')]);
 }
Пример #15
0
 /**
  * Get Memory Limit
  *
  * @return string
  * @throws \Exception
  */
 protected function getMemoryLimit()
 {
     if (!isset($this->config['mp3']['memoryLimit'])) {
         throw new \Exception($this->translate->translate('memoryLimit is not currently set', 'mp3'));
     }
     return $this->config['mp3']['memoryLimit'];
 }
Пример #16
0
 /**
  * @param MvcEvent $event
  *
  * @return MvcEvent
  */
 public function __invoke(MvcEvent $event)
 {
     if (!($result = $this->langRecognizer->recognize($event))) {
         return false;
     }
     list($lang, $newLocale, $routeMatchLang) = $result;
     if ($result = $this->langRedirector->checkRedirect($event, $lang, $routeMatchLang)) {
         return $event;
     }
     \Locale::setDefault($newLocale);
     /** @var Translator $translator */
     $translator = $this->mvcTranslator->getTranslator();
     $translator->setLocale($newLocale);
     AbstractValidator::setDefaultTranslator($this->mvcTranslator);
     return $event;
 }
Пример #17
0
 public function init()
 {
     $uom = new Select('uom');
     $uom->setAttribute('id', 'uom');
     $uom->setAttribute('title', $this->translator->translate('web.form.article.uom.title'));
     $uom->setAttribute('class', 'form-control');
     $uom->setEmptyOption($this->translator->translate('web.form.article.uom.emptyOption'));
     $uom->setValueOptions($this->getUomValues());
     $uom->setLabel($this->translator->translate('web.form.article.uom.label'));
     $this->add($uom);
     $name = new Text('name');
     $name->setAttribute('id', 'name');
     $name->setAttribute('title', $this->translator->translate('web.form.article.name.title'));
     $name->setAttribute('class', 'form-control');
     $name->setAttribute('placeholder', $this->translator->translate('web.form.article.name.placeholder'));
     $name->setLabel($this->translator->translate('web.form.article.name.label'));
     $this->add($name);
     $code = new Text('code');
     $code->setAttribute('id', 'code');
     $code->setAttribute('title', $this->translator->translate('web.form.article.code.title'));
     $code->setAttribute('class', 'form-control');
     $code->setAttribute('placeholder', $this->translator->translate('web.form.article.code.placeholder'));
     $code->setLabel($this->translator->translate('web.form.article.code.label'));
     $this->add($code);
     $salesPrice = new Text('salesPrice');
     $salesPrice->setAttribute('id', 'salesPrice');
     $salesPrice->setAttribute('class', 'form-control');
     $salesPrice->setAttribute('title', $this->translator->translate('web.form.article.salesPrice.title'));
     $salesPrice->setAttribute('placeholder', $this->translator->translate('web.form.article.salesPrice.placeholder'));
     $salesPrice->setLabel($this->translator->translate('web.form.article.salesPrice.label'));
     $this->add($salesPrice);
     $qty = new Text('qty');
     $qty->setAttribute('id', 'qty');
     $qty->setAttribute('class', 'form-control');
     $qty->setAttribute('title', $this->translator->translate('web.form.article.qty.title'));
     $qty->setAttribute('placeholder', $this->translator->translate('web.form.article.qty.placeholder'));
     $qty->setLabel($this->translator->translate('web.form.article.qty.label'));
     $this->add($qty);
     $description = new Text('description');
     $description->setAttribute('id', 'description');
     $description->setAttribute('title', $this->translator->translate('web.form.article.description.title'));
     $description->setAttribute('class', 'form-control');
     $description->setAttribute('placeholder', $this->translator->translate('web.form.article.description.placeholder'));
     $description->setLabel($this->translator->translate('web.form.article.description.label'));
     $this->add($description);
     return $this;
 }
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     // Configure the translator
     $config = $serviceLocator->get('Config');
     $trConfig = isset($config['translator']) ? $config['translator'] : array();
     $translator = Translator::factory($trConfig);
     return $translator;
 }
Пример #19
0
 public function getInputFilter()
 {
     if ($this->filter == null) {
         $this->filter = new InputFilter();
         $inputFilter = parent::getInputFilter();
         $email = new Input('email');
         $email->setRequired(true);
         $email->setAllowEmpty(false);
         $objectExists = new ObjectExists(array('object_repository' => $this->objectManager->getRepository(User::getClass()), 'fields' => 'email'));
         $objectExists->setMessage($this->translator->translate('forgotPassword.email.notExists'), ObjectExists::ERROR_NO_OBJECT_FOUND);
         $emailAddress = new EmailAddress();
         $emailAddress->setMessage($this->translator->translate('forgotPassword.email.invalidFormat'), $emailAddress::INVALID_FORMAT);
         $email->getValidatorChain()->attach($emailAddress, true)->attach($objectExists);
         $this->filter->add($email);
     }
     return $this->filter;
 }
 public function __construct(Translator $translator)
 {
     parent::__construct('task');
     $that = $this;
     $this->validationRules = ['id' => ['allowEmpty' => true, 'required' => false], 'description' => ['required', 'validators' => [['name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => ['message' => $translator->translate('You must provide the field description')]], ['name' => 'Callback', 'break_chain_on_failure' => true, 'options' => ['callback' => function ($value, $context = []) use($that) {
         /** @var CollectionInputFilter $collectionInputFilter */
         $collectionInputFilter = $that->getOption('collectionInputFilter');
         $count = 0;
         foreach ($collectionInputFilter->getContext() as $taskSpec) {
             if ($taskSpec['description'] == $value) {
                 $count++;
                 if ($count > 1) {
                     return false;
                 }
             }
         }
         return true;
     }, 'message' => $translator->translate('You cannot create two tasks with the same name')]]]]];
     return $this->addElements(['id', 'description']);
 }
 public function startAppAction()
 {
     $workflows = $this->workflowFinder->findAll();
     $viewModel = new ViewModel(['workflows' => $workflows, 'processes' => array_values(Func::map($this->systemConfig->getProcessDefinitions(), function ($definition, $message) {
         return $this->convertToClientProcess($message, $definition, $this->systemConfig->getAllAvailableProcessingTypes());
     })), 'connectors' => array_values(Func::map($this->systemConfig->getConnectors(), function ($connector, $id) {
         $connector['id'] = $id;
         if (!isset($connector['metadata']) || empty($connector['metadata'])) {
             //Force empty object
             $connector['metadata'] = new \stdClass();
         }
         return $connector;
     })), 'available_processing_types' => $this->getProcessingTypesForClient(), 'available_manipulation_scripts' => $this->scriptLocation->getScriptNames(), 'locations' => $this->locationTranslator->getLocations(), 'available_process_types' => [['value' => \Prooph\Processing\Processor\Definition::PROCESS_LINEAR_MESSAGING, 'label' => $this->i18nTranslator->translate('Linear Process')], ['value' => \Prooph\Processing\Processor\Definition::PROCESS_PARALLEL_FOR_EACH, 'label' => $this->i18nTranslator->translate('Foreach Process')]], 'available_task_types' => [['value' => \Prooph\Processing\Processor\Definition::TASK_COLLECT_DATA, 'label' => $this->i18nTranslator->translate('Collect Data')], ['value' => \Prooph\Processing\Processor\Definition::TASK_PROCESS_DATA, 'label' => $this->i18nTranslator->translate('Process Data')], ['value' => \Prooph\Processing\Processor\Definition::TASK_MANIPULATE_PAYLOAD, 'label' => $this->i18nTranslator->translate('Run Manipulation Script')]], 'available_messages' => [['value' => 'collect-data', 'label' => $this->i18nTranslator->translate('Collect Data Message')], ['value' => 'data-collected', 'label' => $this->i18nTranslator->translate('Data Collected Message')], ['value' => 'process-data', 'label' => $this->i18nTranslator->translate('Process Data Message')]]]);
     $viewModel->setTemplate('prooph.link.process-manager/process-manager/app');
     $this->layout()->setVariable('includeRiotJs', true);
     return $viewModel;
 }
Пример #22
0
 public function getInputFilter()
 {
     if ($this->filter == null) {
         $this->filter = new InputFilter();
         $password = new Input('password');
         $password->setRequired(true);
         $password->setAllowEmpty(false);
         $length = new StringLength();
         $length->setMax(20);
         $length->setMin(5);
         $length->setMessage($this->translator->translate('newPassword.password.incorrectLength'), StringLength::TOO_LONG);
         $length->setMessage($this->translator->translate('newPassword.password.incorrectLength'), StringLength::TOO_SHORT);
         $password->getValidatorChain()->attach($length);
         $this->filter->add($password);
         $passowordRepeat = new Input('passwordRepeat');
         $passowordRepeat->setRequired(true);
         $passowordRepeat->setAllowEmpty(false);
         $passowordRepeat->getValidatorChain()->attach(new Identical('password'));
         $this->filter->add($passowordRepeat);
     }
     return $this->filter;
 }
Пример #23
0
 public function __construct(Translator $translate, $type)
 {
     // we want to ignore the name passed
     parent::__construct();
     $this->setAttribute('method', 'post');
     $this->add(['name' => 'id', 'type' => 'hidden']);
     $this->add(['name' => 'startDate', 'type' => 'Zend\\Form\\Element\\Date', 'attributes' => ['required' => 'required', 'step' => '1'], 'options' => ['label' => $translate->translate('Start date')]]);
     $this->add(['name' => 'expirationDate', 'type' => 'Zend\\Form\\Element\\Date', 'attributes' => ['required' => 'required', 'step' => '1'], 'options' => ['label' => $translate->translate('Expiration date')]]);
     $this->add(['name' => 'published', 'type' => 'Zend\\Form\\Element\\Checkbox', 'attributes' => [], 'options' => ['label' => $translate->translate('Published'), 'value_options' => ['0' => 'Enabled']]]);
     if ($type === "featured") {
         $this->add(['name' => 'article', 'type' => 'Zend\\Form\\Element\\Textarea', 'options' => ['label' => $translate->translate('Article')], 'attributes' => ['type' => 'textarea']]);
         $this->add(['type' => 'Zend\\Form\\Element\\Radio', 'name' => 'language', 'options' => ['label' => 'Language', 'value_options' => ['nl' => $translate->translate('Dutch'), 'en' => $translate->translate('English')]]]);
     }
     if ($type === "banner") {
         $this->add(['name' => 'banner', 'type' => '\\Zend\\Form\\Element\\File', 'attributes' => ['type' => 'file'], 'options' => ['label' => $translate->translate('Banner')]]);
     }
     $this->add(['name' => 'submit', 'attributes' => ['type' => 'submit', 'value' => $translate->translate('Submit changes'), 'id' => 'submitbutton']]);
     $this->initFilters();
 }
Пример #24
0
 public function init()
 {
     $code = new Text('code');
     $code->setAttribute('id', 'code');
     $code->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('vatUom.form.code.placeholder'))->setLabel($this->translator->translate('vatUom.form.code.label'));
     $this->add($code);
     $value = new Text('value');
     $value->setAttribute('id', 'value');
     $value->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('vatUom.form.value.placeholder'))->setLabel($this->translator->translate('vatUom.form.value.label'));
     $this->add($value);
     $comment = new Text('comment');
     $comment->setAttribute('id', 'comment');
     $comment->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('vatUom.form.comment.placeholder'))->setLabel($this->translator->translate('vatUom.form.comment.label'));
     $this->add($comment);
     return $this;
 }
Пример #25
0
 /**
  * Sends the Notification Mail.
  *
  * @param ApplicationEvent $event
  */
 public function sendMail(ApplicationEvent $event)
 {
     if (!$event->isPostRequest()) {
         return;
     }
     $this->application = $event->getApplicationEntity();
     $status = $event->getStatus();
     $user = $event->getUser();
     $post = $event->getPostData();
     $settings = $user->getSettings('Applications');
     $recipient = $this->getRecipient($this->application, $status);
     /* @var \Applications\Mail\StatusChange $mail */
     $mail = $this->mailService->get('Applications/StatusChange');
     $mail->setSubject($post['mailSubject']);
     $mail->setBody($post['mailText']);
     $mail->setTo($recipient);
     if ($from = $this->application->getJob()->getContactEmail()) {
         $mail->setFrom($from, $this->application->getJob()->getCompany());
     }
     if ($settings->mailBCC) {
         $mail->addBcc($user->getInfo()->getEmail(), $user->getInfo()->getDisplayName());
     }
     $job = $this->application->getJob();
     $jobUser = $job->getUser();
     if ($jobUser->getId() != $user->getId()) {
         $jobUserSettings = $jobUser->getSettings('Applications');
         if ($jobUserSettings->getMailBCC()) {
             $mail->addBcc($jobUser->getInfo()->getEmail(), $jobUser->getInfo()->getDisplayName(false));
         }
     }
     $org = $job->getOrganization()->getParent(true);
     $orgUser = $org->getUser();
     if ($orgUser->getId() != $user->getId() && $orgUser->getId() != $jobUser->getId()) {
         $orgUserSettings = $orgUser->getSettings('Applications');
         if ($orgUserSettings->getMailBCC()) {
             $mail->addBcc($orgUser->getInfo()->getEmail(), $orgUser->getInfo()->getDisplayName(false));
         }
     }
     $this->mailService->send($mail);
     $historyText = sprintf($this->translator->translate('Mail was sent to %s'), key($recipient) ?: $recipient[0]);
     $this->application->changeStatus($status, $historyText);
     $event->setNotification($historyText);
 }
Пример #26
0
 public function __construct(EntityManager $entityManager, Translator $translator)
 {
     parent::__construct('signUp');
     $this->setAttribute('method', 'post');
     $this->setAttribute('class', 'clearfix');
     $filter = new RegisterFilter($entityManager);
     $this->setInputFilter($filter);
     $this->add((new Text('username'))->setLabel('Username:'******'required', 'required')->setAttribute('placeholder', $translator->translate('Enter username')));
     $this->add((new Text('email'))->setAttribute('type', 'email')->setLabel('Email:')->setAttribute('required', 'required')->setAttribute('placeholder', $translator->translate('Enter email address')));
     $this->add((new Text('emailConfirm'))->setAttribute('type', 'email')->setLabel('Confirm email:')->setAttribute('required', 'required')->setAttribute('placeholder', $translator->translate('Confirm email address')));
     $this->add((new Password('password'))->setLabel('Password:'******'required', 'required')->setAttribute('placeholder', $translator->translate('Enter password')));
     $this->add((new Password('passwordConfirm'))->setLabel('Confirm password:'******'required', 'required')->setAttribute('placeholder', $translator->translate('Confirm password')));
     $this->add((new Submit('submit'))->setValue('Sign up')->setAttribute('class', 'btn btn-success pull-right'));
 }
Пример #27
0
 /**
  * @param  Entity\Note $note
  * @param  array $users
  * @param  Entity\User $owner
  * @param  string $subject
  * @param  string $title
  * @return void
  */
 protected function sendNoteGroupMail(Entity\Note $note, array $users, Entity\User $owner, $subject, $title)
 {
     /** @var Entity\User $user */
     foreach ($users as $user) {
         if ($user->getId() != $owner->getId() && true === $user->getNotifications()) {
             $this->translator->setLocale($user->getLanguage());
             $subject = $this->translator->translate($subject);
             $content = new ViewModel();
             $content->setTemplate('mail/note.phtml')->setVariable('title', $title)->setVariable('note', $note)->setVariable('host', $this->host);
             $message = $this->SxMail->compose($content);
             $message->addTo($user->getEmail());
             $message->addFrom($this->defaultFrom);
             $message->setSubject($subject);
             $this->SxMail->send($message);
         }
     }
     // @todo this will only work, as long owner is the only one with edit permissions
     $this->translator->setLocale($owner->getLanguage());
     return;
 }
Пример #28
0
 public function init()
 {
     parent::init();
     $delayPercent = new Text('delayPercent');
     $delayPercent->setAttribute('id', 'delayPercent');
     $delayPercent->setAttribute('title', $this->translator->translate('web.form.customer.delayPercent.title'));
     $delayPercent->setAttribute('class', 'form-control');
     $delayPercent->setAttribute('placeholder', $this->translator->translate('web.form.customer.delayPercent.placeholder'));
     $delayPercent->setLabel($this->translator->translate('web.form.customer.delayPercent.label'));
     $this->add($delayPercent);
     $deadlineDays = new Text('deadlineDays');
     $deadlineDays->setAttribute('id', 'deadlineDays');
     $deadlineDays->setAttribute('title', $this->translator->translate('web.form.customer.deadlineDays.title'));
     $deadlineDays->setAttribute('class', 'form-control');
     $deadlineDays->setAttribute('placeholder', $this->translator->translate('web.form.customer.deadlineDays.placeholder'));
     $deadlineDays->setLabel($this->translator->translate('web.form.customer.deadlineDays.label'));
     $this->add($deadlineDays);
     return $this;
 }
Пример #29
0
 /**
  * @param $string
  * @return string
  */
 public function __invoke($string)
 {
     return $this->translator->translate($string);
 }
Пример #30
0
 public function __construct($mapper, Translator $translate)
 {
     // we want to ignore the name passed
     parent::__construct();
     $this->setAttribute('method', 'post');
     $this->add(['name' => 'id', 'attributes' => ['type' => 'hidden']]);
     $this->add(['name' => 'translations', 'attributes' => ['type' => 'hidden']]);
     $this->add(['name' => 'languageNeutralId', 'attributes' => ['type' => 'hidden']]);
     $this->add(['name' => 'slugName', 'attributes' => ['type' => 'text', 'required' => 'required'], 'options' => ['label' => $translate->translate('Permalink'), 'required' => 'required']]);
     $this->add(['name' => 'name', 'attributes' => ['type' => 'text', 'required' => 'required'], 'options' => ['label' => $translate->translate('Name'), 'required' => 'required']]);
     $this->add(['name' => 'languages', 'type' => 'MultiCheckbox', 'options' => ['label' => $translate->translate('Languages'), 'value_options' => ['en' => $translate->translate('English'), 'nl' => $translate->translate('Dutch')]]]);
     $this->add(['name' => 'address', 'type' => 'Zend\\Form\\Element\\Textarea', 'attributes' => ['type' => 'textarea'], 'options' => ['label' => $translate->translate('Location')]]);
     // English version
     $this->add(['name' => 'en_website', 'type' => 'Zend\\Form\\Element\\Url', 'attributes' => [], 'options' => ['label' => $translate->translate('Website')]]);
     // Dutch version
     $this->add(['name' => 'nl_website', 'type' => 'Zend\\Form\\Element\\Url', 'attributes' => [], 'options' => ['label' => $translate->translate('Website')]]);
     $this->add(['name' => 'en_slogan', 'attributes' => ['type' => 'text'], 'options' => ['label' => $translate->translate('Slogan')]]);
     $this->add(['name' => 'nl_slogan', 'attributes' => ['type' => 'text'], 'options' => ['label' => $translate->translate('Slogan')]]);
     $this->add(['name' => 'email', 'type' => 'Zend\\Form\\Element\\Email', 'attributes' => [], 'options' => ['label' => $translate->translate('Email')]]);
     $this->add(['name' => 'phone', 'attributes' => ['type' => 'text'], 'options' => ['label' => $translate->translate('Phone')]]);
     $this->add(['name' => 'nl_logo', 'type' => '\\Zend\\Form\\Element\\File', 'attributes' => ['type' => 'file'], 'options' => ['label' => $translate->translate('Logo')]]);
     $this->add(['name' => 'en_logo', 'type' => '\\Zend\\Form\\Element\\File', 'attributes' => ['type' => 'file'], 'options' => ['label' => $translate->translate('Logo')]]);
     $this->add(['name' => 'en_description', 'type' => 'Zend\\Form\\Element\\Textarea', 'options' => ['label' => $translate->translate('Description')], 'attributes' => ['type' => 'textarea']]);
     $this->add(['name' => 'nl_description', 'type' => 'Zend\\Form\\Element\\Textarea', 'options' => ['label' => $translate->translate('Description')], 'attributes' => ['type' => 'textarea']]);
     $this->add(['name' => 'hidden', 'type' => 'Zend\\Form\\Element\\Checkbox', 'attributes' => [], 'options' => ['label' => $translate->translate('Hide this company')]]);
     $this->add(['name' => 'submit', 'attributes' => ['type' => 'submit', 'value' => $translate->translate('Submit changes'), 'id' => 'submitbutton']]);
     $this->mapper = $mapper;
     $this->initFilters($translate);
 }