Esempio n. 1
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();
 }
 /**
  * @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'));
 }
Esempio n. 3
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();
 }
 /**
  * @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');
         }
     }
 }
Esempio n. 5
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]);
 }
Esempio n. 6
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'));
 }
 /**
  * @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')]);
 }
Esempio n. 8
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']]);
 }
Esempio n. 9
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'];
 }
Esempio n. 10
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;
 }
Esempio n. 11
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;
 }
 /**
  * @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')]);
 }
 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;
 }
Esempio n. 15
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;
 }
Esempio n. 16
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']]);
 }
Esempio n. 17
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();
 }
Esempio n. 18
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;
 }
Esempio n. 19
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);
 }
Esempio n. 20
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;
 }
Esempio n. 21
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;
 }
Esempio n. 22
0
 /**
  * @param $string
  * @return string
  */
 public function __invoke($string)
 {
     return $this->translator->translate($string);
 }
 /**
  * @param MvcEvent       $event
  * @param Request        $request
  * @param Response       $response
  * @param FlashMessenger $flashMessenger
  * @param RouteInterface $router
  * @param Translator     $translator
  *
  * @return bool
  */
 public function checkAcl(MvcEvent $event, Request $request, Response $response, FlashMessenger $flashMessenger, RouteInterface $router, Translator $translator)
 {
     $role = $this->guestRoleName;
     if ($this->auth->hasIdentity()) {
         $role = $this->auth->getIdentity()->getRole();
         if (!in_array($role, $this->allowedRoles)) {
             $role = $this->guestRoleName;
         }
     }
     $matchedRoute = $this->router->match($request);
     if (is_null($matchedRoute)) {
         return;
     }
     $params = $matchedRoute->getParams();
     $module = array_key_exists('__NAMESPACE__', $params) ? $params['__NAMESPACE__'] : null;
     $controller = array_key_exists('controller', $params) ? $params['controller'] : null;
     $action = array_key_exists('action', $params) ? $params['action'] : null;
     if ($module && $controller) {
         $module .= '.';
     }
     if ($action) {
         $controller .= '.';
     }
     $resource = str_replace('\\Controller', '', $module) . $controller . $action;
     $resource = strtolower(str_replace('\\', '.', $resource));
     if ($controller) {
         unset($params['controller']);
     }
     if ($action) {
         unset($params['action']);
     }
     if ($module) {
         unset($params['__NAMESPACE__']);
     }
     if (!$this->hasResource($resource)) {
         return true;
         if ($role == $this->guestRoleName) {
             $url = $router->assemble([], ['name' => 'aclGuestResourceNotFound']);
         } else {
             $url = $router->assemble([], ['name' => 'aclUserResourceNotFound']);
         }
         if (DEBUG) {
             $flashMessenger->addErrorMessage(sprintf($translator->translate('The requested resource %s does not exist'), $resource));
         } else {
             $flashMessenger->addErrorMessage($translator->translate('The requested resource does not exist'));
         }
         $response->setStatusCode(302);
         if (DEBUG) {
             echo '<div style="margin:150px auto; width: 50%; text-align:center; font-size:18px;"><h3>DEBUG IS ENABLED' . '</h3><br />Normally would auto-redirect to:<br /><br /><a style="font-size:24px;" href="' . $url . '">' . $url . '</a>';
             echo '</div>';
             die;
         }
         header('location: ' . $url);
         $event->stopPropagation();
         $event->setError('x');
         return;
     }
     if (!$this->isAllowed($role, $resource)) {
         if (DEBUG) {
             $flashMessenger->addErrorMessage(sprintf($translator->translate('You (%s) are not allowed to access this resource: %s'), $role, $resource));
         } else {
             $flashMessenger->addErrorMessage($translator->translate('You  are not allowed to access this resource'));
         }
         if ($role == $this->guestRoleName) {
             $url = $router->assemble([], ['name' => 'aclGuestNotAllowed']);
         } else {
             $url = $router->assemble([], ['name' => 'aclUserNotAllowed']);
         }
         $response->setStatusCode(302);
         if (DEBUG) {
             echo '<div style="margin:150px auto; width: 50%; text-align:center; font-size:18px;"><h3>DEBUG IS ENABLED' . '</h3><br />Normally would auto-redirect to:<br /><br /><a style="font-size:24px;" href="' . $url . '">' . $url . '</a>';
             echo '</div>';
             die;
         }
         header('location: ' . $url);
         $event->stopPropagation();
         $event->setError('x');
         return;
     }
     return true;
 }
Esempio n. 24
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);
 }
 /**
  * @param $str
  * @param null $locale
  * @return string
  */
 public function __invoke($str, $locale = null)
 {
     return $locale ? $this->translator->translate($str, $locale) : $this->translator->translate($str);
 }
Esempio n. 26
0
 /**
  * save a Job-Post either by a regular request or by an async post (AJAX)
  * a mandatory parameter is the ID of the Job
  * in case of a regular Request you can
  *
  * parameter are arbitrary elements for defaults or programming flow
  *
  * @param array $parameter
  * @return null|ViewModel
  * @throws \RuntimeException
  */
 protected function save()
 {
     $serviceLocator = $this->serviceLocator;
     $formEvents = $serviceLocator->get('Jobs/JobContainer/Events');
     $user = $this->auth->getUser();
     if (empty($user->info->email)) {
         return $this->getErrorViewModel('no-parent', array('cause' => 'noEmail'));
     }
     $userOrg = $user->getOrganization();
     if (!$userOrg->hasAssociation() || $userOrg->getOrganization()->isDraft()) {
         return $this->getErrorViewModel('no-parent', array('cause' => 'noCompany'));
     }
     try {
         $jobEntity = $this->initializeJob()->get($this->params(), true);
     } catch (NotFoundException $e) {
         $this->getResponse()->setStatusCode(Response::STATUS_CODE_404);
         return ['message' => sprintf($this->translator->translate('Job with id "%s" not found'), $e->getId()), 'exception' => $e];
     }
     /** @var \Zend\Http\Request $request */
     $request = $this->getRequest();
     $isAjax = $request->isXmlHttpRequest();
     $params = $this->params();
     $formIdentifier = $params->fromQuery('form');
     $viewModel = null;
     $this->acl($jobEntity, 'edit');
     if ($status = $params->fromQuery('status')) {
         $this->changeStatus($jobEntity, $status);
     }
     $form = $this->getFormular($jobEntity);
     $valid = true;
     $instanceForm = null;
     $formErrorMessages = array();
     if (isset($formIdentifier) && $request->isPost()) {
         // at this point the form get instantiated and immediately accumulated
         $instanceForm = $form->getForm($formIdentifier);
         if (!isset($instanceForm)) {
             throw new \RuntimeException('No form found for "' . $formIdentifier . '"');
         }
         // the id may be part of the postData, but it never should be altered
         $postData = $request->getPost();
         if (isset($postData['id'])) {
             unset($postData['id']);
         }
         unset($postData['applyId']);
         $instanceForm->setData($postData);
         $valid = $instanceForm->isValid();
         $formErrorMessages = ArrayUtils::merge($formErrorMessages, $instanceForm->getMessages());
         if ($valid) {
             /*
              * @todo This is a workaround for GeoJSON data insertion
              * until we figured out, what we really want it to be.
              */
             if ('general.locationForm' == $formIdentifier) {
                 $locElem = $instanceForm->getBaseFieldset()->get('geo-location');
                 if ($locElem instanceof \Geo\Form\GeoText) {
                     $loc = $locElem->getValue('entity');
                     $locations = $jobEntity->getLocations();
                     if (count($locations)) {
                         $locations->clear();
                     }
                     $locations->add($loc);
                     $jobEntity->setLocation($locElem->getValue());
                 }
             }
             $title = $jobEntity->getTitle();
             $templateTitle = $jobEntity->getTemplateValues()->getTitle();
             if (empty($templateTitle)) {
                 $jobEntity->getTemplateValues()->setTitle($title);
             }
             $this->repositoryService->persist($jobEntity);
         }
     }
     // validation
     $jobValid = true;
     $errorMessage = array();
     if (empty($jobEntity->getTitle())) {
         $jobValid = false;
         $errorMessage[] = $this->translator->translate('No Title');
     }
     if (empty($jobEntity->getLocation())) {
         $jobValid = false;
         $errorMessage[] = $this->translator->translate('No Location');
     }
     if (empty($jobEntity->getTermsAccepted())) {
         $jobValid = false;
         $errorMessage[] = $this->translator->translate('Accept the Terms');
     }
     $result = $formEvents->trigger('ValidateJob', $this, ['form' => $form]);
     foreach ($result as $messages) {
         if (!$messages) {
             continue;
         }
         if (!is_array($messages)) {
             $messages = [$messages];
         }
         $errorMessage = array_merge($errorMessage, $messages);
         $jobValid = false;
     }
     $errorMessage = '<br />' . implode('<br />', $errorMessage);
     if ($isAjax) {
         if ($instanceForm instanceof SummaryForm) {
             $instanceForm->setRenderMode(SummaryForm::RENDER_SUMMARY);
             $viewHelper = 'summaryform';
         } else {
             $viewHelper = 'form';
         }
         $viewHelperManager = $serviceLocator->get('ViewHelperManager');
         $content = $viewHelperManager->get($viewHelper)->__invoke($instanceForm);
         $viewModel = new JsonModel(array('content' => $content, 'valid' => $valid, 'jobvalid' => $jobValid, 'errors' => $formErrorMessages, 'errorMessage' => $errorMessage));
     } else {
         if ($jobEntity->isDraft()) {
             $form->getForm('general.nameForm')->setDisplayMode(SummaryFormInterface::DISPLAY_FORM);
             $form->getForm('general.portalForm')->setDisplayMode(SummaryFormInterface::DISPLAY_FORM);
             $locElem = $form->getForm('general.locationForm')->setDisplayMode(SummaryFormInterface::DISPLAY_FORM)->getBaseFieldset()->get('geo-location');
             if ($locElem instanceof \Geo\Form\GeoText) {
                 $loc = $jobEntity->getLocations();
                 if (count($loc)) {
                     $locElem->setValue($loc->first());
                 }
             }
         } else {
             $formEvents->trigger('DisableElements', $this, ['form' => $form, 'job' => $jobEntity]);
             // Job is deployed, some changes are now disabled
             $form->enableAll();
         }
         $completionLink = $this->url()->fromRoute('lang/jobs/completion', ['id' => $jobEntity->getId()]);
         $viewModel = $this->getViewModel($form);
         $viewModel->setVariables(array('completionLink' => $completionLink, 'title' => $jobEntity->getTitle(), 'job' => $jobEntity, 'summary' => 'this is what we charge you for your offer...', 'valid' => $valid, 'jobvalid' => $jobValid, 'errorMessage' => $errorMessage, 'isDraft' => $jobEntity->isDraft()));
     }
     return $viewModel;
 }
Esempio n. 27
0
 public function init()
 {
     $name = new Text('name');
     $name->setAttribute('id', 'name');
     $name->setAttribute('required', 'required')->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.name.placeholder'))->setLabel($this->translator->translate('company.form.name.label'));
     $this->add($name);
     $regNo = new Text('regNo');
     $regNo->setAttribute('id', 'regNo');
     $regNo->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.regNo.placeholder'))->setLabel($this->translator->translate('company.form.regNo.label'));
     $this->add($regNo);
     $kmkrNo = new Text('kmkrNo');
     $kmkrNo->setAttribute('id', 'kmkrNo');
     $kmkrNo->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.kmkrNo.placeholder'))->setLabel($this->translator->translate('company.form.kmkrNo.label'));
     $this->add($kmkrNo);
     $address = new Text('address');
     $address->setAttribute('id', 'address');
     $address->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.address.placeholder'))->setLabel($this->translator->translate('company.form.address.label'));
     $this->add($address);
     $zip = new Text('zip');
     $zip->setAttribute('id', 'zip');
     $zip->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.zip.placeholder'))->setLabel($this->translator->translate('company.form.zip.label'));
     $this->add($zip);
     $country = new Text('country');
     $country->setAttribute('id', 'country');
     $country->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.country.placeholder'))->setLabel($this->translator->translate('company.form.country.label'));
     $this->add($country);
     $city = new Text('city');
     $city->setAttribute('id', 'city');
     $city->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.city.placeholder'))->setLabel($this->translator->translate('company.form.city.label'));
     $this->add($city);
     $url = new Text('url');
     $url->setAttribute('id', 'url');
     $url->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.url.placeholder'))->setLabel($this->translator->translate('company.form.url.label'));
     $this->add($url);
     $phone = new Text('phone');
     $phone->setAttribute('id', 'phone');
     $phone->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.phone.placeholder'))->setLabel($this->translator->translate('company.form.phone.label'));
     $this->add($phone);
     $email = new Text('email');
     $email->setAttribute('id', 'email');
     $email->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.email.placeholder'))->setLabel($this->translator->translate('company.form.email.label'));
     $this->add($email);
     $mob = new Text('mob');
     $mob->setAttribute('id', 'mob');
     $mob->setAttribute('class', 'form-control')->setAttribute('placeholder', $this->translator->translate('company.form.mob.placeholder'))->setLabel($this->translator->translate('company.form.mob.label'));
     $this->add($mob);
     return $this;
 }
Esempio n. 28
0
 public function __construct($mapper, Translator $translate)
 {
     // we want to ignore the name passed
     parent::__construct();
     $this->mapper = $mapper;
     $this->setAttribute('method', 'post');
     $this->add(['name' => 'id', 'attributes' => ['type' => 'hidden']]);
     $this->add(['type' => 'Zend\\Form\\Element\\Radio', 'name' => 'language', 'options' => ['label' => 'Language', 'value_options' => ['nl' => $translate->translate('Dutch'), 'en' => $translate->translate('English')]]]);
     $this->add(['name' => 'name', 'attributes' => ['type' => 'text'], 'options' => ['label' => $translate->translate('Name')]]);
     $this->add(['name' => 'slugName', 'attributes' => ['type' => 'text'], 'options' => ['label' => $translate->translate('Permalink')]]);
     $this->add(['name' => 'active', 'type' => 'Zend\\Form\\Element\\Checkbox', 'options' => ['label' => $translate->translate('Active'), 'use_hidden_element' => true, 'checked_value' => '1', 'unchecked_value' => '0']]);
     $this->add(['name' => 'website', 'attributes' => ['type' => 'text'], 'options' => ['label' => $translate->translate('Website')]]);
     $this->add(['name' => 'attachment_file', 'type' => '\\Zend\\Form\\Element\\File', 'attributes' => ['type' => 'file'], 'options' => ['label' => $translate->translate('Attachment')]]);
     $this->add(['name' => 'email', 'type' => 'Zend\\Form\\Element\\Email', 'attributes' => ['type' => 'text'], 'options' => ['label' => $translate->translate('Email')]]);
     $this->add(['name' => 'contactName', 'attributes' => ['type' => 'text'], 'options' => ['label' => $translate->translate('Contact name')]]);
     $this->add(['name' => 'phone', 'attributes' => ['type' => 'text'], 'options' => ['label' => $translate->translate('Phone')]]);
     $this->add(['name' => 'description', 'type' => 'Zend\\Form\\Element\\Textarea', 'options' => ['label' => $translate->translate('Description')]]);
     $this->add(['name' => 'active', 'type' => 'Zend\\Form\\Element\\Checkbox', 'options' => ['label' => $translate->translate('Active')]]);
     $this->add(['name' => 'submit', 'attributes' => ['type' => 'submit', 'value' => $translate->translate('Submit changes'), 'id' => 'submitbutton']]);
     $this->initFilters($translate);
 }
Esempio n. 29
0
 /**
  * save a Job-Post either by a regular request or by an async post (AJAX)
  * a mandatory parameter is the ID of the Job
  * in case of a regular Request you can
  *
  * parameter are arbitrary elements for defaults or programming flow
  *
  * @param array $parameter
  * @return null|ViewModel
  * @throws \RuntimeException
  */
 protected function save($parameter = array())
 {
     $serviceLocator = $this->getServiceLocator();
     $user = $this->auth->getUser();
     if (empty($user->info->email)) {
         return $this->getErrorViewModel('no-parent', array('cause' => 'noEmail'));
     }
     $userOrg = $user->getOrganization();
     if (!$userOrg->hasAssociation()) {
         return $this->getErrorViewModel('no-parent', array('cause' => 'noCompany'));
     }
     /** @var \Zend\Http\Request $request */
     $request = $this->getRequest();
     $isAjax = $request->isXmlHttpRequest();
     $pageToForm = array(0 => array('locationForm', 'nameForm', 'portalForm'), 1 => array('descriptionForm'), 2 => array('previewForm'));
     $params = $this->params();
     $formIdentifier = $params->fromQuery('form');
     $pageIdentifier = (int) $params->fromQuery('page', array_key_exists('page', $parameter) ? $parameter['page'] : 0);
     $jobEntity = $this->initializeJob()->get($this->params(), true);
     $viewModel = null;
     $this->acl($jobEntity, 'edit');
     $form = $this->getFormular($jobEntity);
     $valid = true;
     $instanceForm = null;
     $formErrorMessages = array();
     if (isset($formIdentifier) && $request->isPost()) {
         // at this point the form get instantiated and immediately accumulated
         $instanceForm = $form->getForm($formIdentifier);
         if (!isset($instanceForm)) {
             throw new \RuntimeException('No form found for "' . $formIdentifier . '"');
         }
         // the id may be part of the postData, but it never should be altered
         $postData = $request->getPost();
         if (isset($postData['id'])) {
             unset($postData['id']);
         }
         unset($postData['applyId']);
         $instanceForm->setData($postData);
         $valid = $instanceForm->isValid();
         $formErrorMessages = ArrayUtils::merge($formErrorMessages, $instanceForm->getMessages());
         if ($valid) {
             /*
              * @todo This is a workaround for GeoJSON data insertion
              * until we figured out, what we really want it to be.
              */
             if ('locationForm' == $formIdentifier) {
                 $locElem = $instanceForm->getBaseFieldset()->get('geo-location');
                 if ($locElem instanceof \Geo\Form\GeoText) {
                     $loc = $locElem->getValue('entity');
                     $locations = $jobEntity->getLocations();
                     if (count($locations)) {
                         $locations->clear();
                     }
                     $locations->add($loc);
                     $jobEntity->setLocation($locElem->getValue());
                 }
             }
             $title = $jobEntity->getTitle();
             $templateTitle = $jobEntity->getTemplateValues()->getTitle();
             if (empty($templateTitle)) {
                 $jobEntity->getTemplateValues()->setTitle($title);
             }
             $this->repositoryService->persist($jobEntity);
         }
     }
     // validation
     $jobValid = true;
     $errorMessage = array();
     if (empty($jobEntity->getTitle())) {
         $jobValid = false;
         $errorMessage[] = $this->translator->translate('No Title');
     }
     if (empty($jobEntity->getLocation())) {
         $jobValid = false;
         $errorMessage[] = $this->translator->translate('No Location');
     }
     if (empty($jobEntity->getTermsAccepted())) {
         $jobValid = false;
         $errorMessage[] = $this->translator->translate('Accept the Terms');
     }
     $errorMessage = '<br />' . implode('<br />', $errorMessage);
     if ($isAjax) {
         if ($instanceForm instanceof SummaryForm) {
             $instanceForm->setRenderMode(SummaryForm::RENDER_SUMMARY);
             $viewHelper = 'summaryform';
         } else {
             $viewHelper = 'form';
         }
         $viewHelperManager = $serviceLocator->get('ViewHelperManager');
         $content = $viewHelperManager->get($viewHelper)->__invoke($instanceForm);
         $viewModel = new JsonModel(array('content' => $content, 'valid' => $valid, 'jobvalid' => $jobValid, 'errors' => $formErrorMessages, 'errorMessage' => $errorMessage));
     } else {
         if (isset($pageIdentifier)) {
             $form->disableForm();
             if (array_key_exists($pageIdentifier, $pageToForm)) {
                 foreach ($pageToForm[$pageIdentifier] as $actualFormIdentifier) {
                     $form->enableForm($actualFormIdentifier);
                     if ($jobEntity->isDraft()) {
                         $actualForm = $form->get($actualFormIdentifier);
                         if ('nameForm' != $actualFormIdentifier && $actualForm instanceof SummaryFormInterface) {
                             $form->get($actualFormIdentifier)->setDisplayMode(SummaryFormInterface::DISPLAY_FORM);
                         }
                         if ('locationForm' == $actualFormIdentifier) {
                             $locElem = $actualForm->getBaseFieldset()->get('geo-location');
                             if ($locElem instanceof \Geo\Form\GeoText) {
                                 $loc = $jobEntity->getLocations();
                                 if (count($loc)) {
                                     $locElem->setValue($loc->first());
                                 }
                             }
                         }
                     }
                 }
                 if (!$jobEntity->isDraft()) {
                     // Job is deployed, some changes are now disabled
                     $form->enableAll();
                 }
             } else {
                 throw new \RuntimeException('No form found for page ' . $pageIdentifier);
             }
         }
         $pageLinkNext = null;
         $pageLinkPrevious = null;
         if (0 < $pageIdentifier) {
             $pageLinkPrevious = $this->url()->fromRoute('lang/jobs/manage', [], ['query' => ['id' => $jobEntity->getId(), 'page' => $pageIdentifier - 1]]);
         }
         if ($pageIdentifier < count($pageToForm) - 1) {
             $pageLinkNext = $this->url()->fromRoute('lang/jobs/manage', [], ['query' => ['id' => $jobEntity->getId(), 'page' => $pageIdentifier + 1]]);
         }
         $completionLink = $this->url()->fromRoute('lang/jobs/completion', ['id' => $jobEntity->getId()]);
         $viewModel = $this->getViewModel($form);
         $viewModel->setVariables(array('pageLinkPrevious' => $pageLinkPrevious, 'pageLinkNext' => $pageLinkNext, 'completionLink' => $completionLink, 'page' => $pageIdentifier, 'title' => $jobEntity->title, 'job' => $jobEntity, 'summary' => 'this is what we charge you for your offer...', 'valid' => $valid, 'jobvalid' => $jobValid, 'errorMessage' => $errorMessage, 'isDraft' => $jobEntity->isDraft()));
     }
     return $viewModel;
 }
Esempio n. 30
0
 public function init()
 {
     $customer = new Select('customer');
     $customer->setAttribute('id', 'customer');
     $customer->setAttribute('title', $this->translator->translate('web.form.document.customer.title'));
     $customer->setAttribute('class', 'form-control');
     $customer->setEmptyOption($this->translator->translate('web.form.document.customer.emptyOption'));
     $customer->setValueOptions($this->getCustomerValues());
     $customer->setLabel($this->translator->translate('web.form.document.customer.label'));
     $this->add($customer);
     $supplier = new Select('supplier');
     $supplier->setAttribute('id', 'supplier');
     $supplier->setAttribute('title', $this->translator->translate('web.form.document.supplier.title'));
     $supplier->setAttribute('class', 'form-control');
     $supplier->setEmptyOption($this->translator->translate('web.form.document.supplier.emptyOption'));
     $supplier->setValueOptions($this->getSupplierValues());
     $supplier->setLabel($this->translator->translate('web.form.document.supplier.label'));
     $this->add($supplier);
     $paymentType = new Select('paymentType');
     $paymentType->setAttribute('id', 'paymentType');
     $paymentType->setAttribute('title', $this->translator->translate('web.form.document.paymentMethod.title'));
     $paymentType->setAttribute('class', 'form-control');
     $paymentType->setEmptyOption($this->translator->translate('web.form.document.paymentMethod.emptyOption'));
     $paymentType->setValueOptions(Document::$paymentTypes);
     $paymentType->setLabel($this->translator->translate('web.form.document.paymentMethod.label'));
     $this->add($paymentType);
     $vat = new Select('vat');
     $vat->setAttribute('id', 'vat');
     $vat->setAttribute('title', $this->translator->translate('web.form.document.vat.title'));
     $vat->setAttribute('class', 'form-control');
     $vat->setEmptyOption($this->translator->translate('web.form.document.vat.emptyOption'));
     $vat->setValueOptions($this->getVatValues());
     $vat->setLabel($this->translator->translate('web.form.document.vat.label'));
     $this->add($vat);
     $docDate = new Date('docDate');
     $docDate->setAttributes(array('id' => 'docDate', 'type' => 'text', 'class' => 'input datepicker form-control', 'data-date-weekstart' => 1, 'data-date-format' => 'dd.mm.yyyy'));
     $docDate->setAttribute('title', $this->translator->translate('web.form.document.docDate.title'));
     $docDate->setAttribute('readonly', 'readonly');
     $docDate->setAttribute('placeholder', $this->translator->translate('web.form.document.docDate.placeholder'));
     $docDate->setLabel($this->translator->translate('web.form.document.docDate.label'));
     $this->add($docDate);
     $supplierDocNumber = new Text('supplierDocNumber');
     $supplierDocNumber->setAttribute('id', 'supplierDocNumber');
     $supplierDocNumber->setAttribute('title', $this->translator->translate('web.form.document.supplierDocNumber.title'));
     $supplierDocNumber->setAttribute('class', 'form-control');
     $supplierDocNumber->setAttribute('placeholder', $this->translator->translate('web.form.document.supplierDocNumber.placeholder'));
     $supplierDocNumber->setLabel($this->translator->translate('web.form.document.supplierDocNumber.label'));
     $this->add($supplierDocNumber);
     $deadlineDays = new Text('deadlineDays');
     $deadlineDays->setAttribute('id', 'deadlineDays');
     $deadlineDays->setAttribute('title', $this->translator->translate('web.form.document.deadlineDays.title'));
     $deadlineDays->setAttribute('class', 'form-control');
     $deadlineDays->setAttribute('placeholder', $this->translator->translate('web.form.document.deadlineDays.placeholder'));
     $deadlineDays->setLabel($this->translator->translate('web.form.document.deadlineDays.label'));
     $this->add($deadlineDays);
     $delayPercent = new Text('delayPercent');
     $delayPercent->setAttribute('id', 'delayPercent');
     $delayPercent->setAttribute('class', 'form-control');
     $delayPercent->setAttribute('title', $this->translator->translate('web.form.document.delayPercent.title'));
     $delayPercent->setAttribute('placeholder', $this->translator->translate('web.form.document.delayPercent.placeholder'));
     $delayPercent->setLabel($this->translator->translate('web.form.document.delayPercent.label'));
     $this->add($delayPercent);
     $amount = new Text('amount');
     $amount->setAttribute('id', 'amount');
     $amount->setAttribute('title', $this->translator->translate('web.form.document.amount.title'));
     $amount->setAttribute('class', 'form-control');
     $amount->setAttribute('readonly', 'readonly');
     $amount->setAttribute('placeholder', $this->translator->translate('web.form.document.amount.placeholder'));
     $amount->setLabel($this->translator->translate('web.form.document.amount.label'));
     $this->add($amount);
     $taxAmount = new Text('taxAmount');
     $taxAmount->setAttribute('id', 'taxAmount');
     $taxAmount->setAttribute('title', $this->translator->translate('web.form.document.taxAmount.title'));
     $taxAmount->setAttribute('class', 'form-control');
     $taxAmount->setAttribute('readonly', 'readonly');
     $taxAmount->setAttribute('placeholder', $this->translator->translate('web.form.document.taxAmount.placeholder'));
     $taxAmount->setLabel($this->translator->translate('web.form.document.taxAmount.label'));
     $this->add($taxAmount);
     $comment = new Textarea('comment');
     $comment->setAttribute('id', 'comment');
     $comment->setAttribute('title', $this->translator->translate('web.form.document.comment.title'));
     $comment->setAttribute('class', 'form-control');
     $comment->setAttribute('cols', 15);
     $comment->setAttribute('rows', 4);
     $comment->setAttribute('placeholder', $this->translator->translate('web.form.document.comment.placeholder'));
     $comment->setLabel($this->translator->translate('web.form.document.comment.label'));
     $this->add($comment);
     $amountTax = new Text('amountTax');
     $amountTax->setAttribute('id', 'amountTax');
     $amountTax->setAttribute('title', $this->translator->translate('web.form.document.amountTax.title'));
     $amountTax->setAttribute('class', 'form-control');
     $amountTax->setAttribute('readonly', 'readonly');
     $amountTax->setAttribute('placeholder', $this->translator->translate('web.form.document.amountTax.placeholder'));
     $amountTax->setLabel($this->translator->translate('web.form.document.amountTax.label'));
     $this->add($amountTax);
     return $this;
 }