/** * form field elements * * @see \ContentinumComponents\Forms\AbstractForms::elements() */ public function elements() { $sl = $this->getServiceLocator(); $pageOptions = $sl->get('contentinum_pages'); $configuration = $pageOptions->getParameter('categoryvalue'); $con = new Worker($sl->get('doctrine.entitymanager.orm_default')); $result = $con->fetchRow("SELECT * FROM mcevent_dates_config WHERE id = {$configuration};"); if (isset($result['settings_formular']) && strlen($result['settings_formular']) > 1) { $mcSerialize = new HandleSerializeDatabase(); $formSettings = $mcSerialize->execUnserialize($result['settings_formular']); $onlysingle = false; $fields = array(); $fields[] = array('spec' => array('name' => 'mceventIdent', 'required' => true, 'options' => array('label' => 'Termin wählen', 'empty_option' => 'Please select', 'value_options' => $this->getServiceLocator()->get('mcevent_options_eventdatepublic'), 'deco-row' => $this->getDecorators(self::DECO_ELM_ROW)), 'type' => 'Select', 'attributes' => array('required' => 'required', 'id' => 'mceventIdent'))); foreach ($formSettings as $setting) { if ('onlysingle' == $setting) { $onlysingle = true; } if ('fieldname' == $setting) { $field = ''; $field['name'] = 'name'; $field['required'] = true; $field['options'] = array(); $field['options']['label'] = 'Name'; $field['options']['deco-row'] = $this->getDecorators(self::DECO_ELM_ROW); $field['type'] = 'Text'; $field['attributes'] = array(); $field['attributes']['id'] = 'name'; $field['attributes']['required'] = 'required'; $fields[] = array('spec' => $field); } if ('fieldphone' == $setting) { $field = ''; $field['name'] = 'phone'; $field['required'] = true; $field['options'] = array(); $field['options']['label'] = 'Telefon'; $field['options']['deco-row'] = $this->getDecorators(self::DECO_ELM_ROW); $field['type'] = 'ContentinumComponents\\Forms\\Elements\\Tel'; $field['attributes'] = array(); $field['attributes']['id'] = 'phone'; $field['attributes']['required'] = 'required'; $fields[] = array('spec' => $field); } if ('fieldemail' == $setting) { $field = ''; $field['name'] = 'email'; $field['required'] = true; $field['options'] = array(); $field['options']['label'] = 'E-Mailadresse'; $field['options']['deco-row'] = $this->getDecorators(self::DECO_ELM_ROW); $field['type'] = 'Email'; $field['attributes'] = array(); $field['attributes']['id'] = 'email'; $field['attributes']['required'] = 'required'; $fields[] = array('spec' => $field); } if ('fielddescription' == $setting) { $field = ''; $field['name'] = 'description'; $field['required'] = false; $field['options'] = array(); $field['options']['label'] = 'Bemerkung'; $field['options']['deco-row'] = $this->getDecorators(self::DECO_ELM_ROW); $field['options']['description'] = 'Bemerkung zur Anmeldung, Nachricht an Organisator'; $field['type'] = 'Textarea'; $field['attributes'] = array(); $field['attributes']['id'] = 'description'; $field['attributes']['row'] = '2'; $fields[] = array('spec' => $field); } if ('fieldstayOvernight' == $setting) { $field = ''; $field['name'] = 'stayOvernight'; $field['required'] = true; $field['options'] = array(); $field['options']['label'] = 'Übernachtung bestätigen'; $field['options']['value_options'] = array('yes' => 'Ja, ich nutze das Übernachtungsangebot', 'no' => 'Nein, keine Übernachtung', 'perhaps' => 'Noch unentschlossen'); $field['options']['deco-row'] = $this->getDecorators(self::DECO_ELM_ROW); $field['options']['description'] = 'Bestätigen Sie Bitte ob Sie übernachten möchten'; $field['type'] = 'Select'; $field['attributes'] = array(); $field['attributes']['id'] = 'stayOvernight'; $field['attributes']['required'] = 'required'; $field['attributes']['value'] = 'yes'; $fields[] = array('spec' => $field); } } $fields[] = array('spec' => array('name' => 'send', 'type' => 'Submit', 'attributes' => array('class' => 'button expand', 'value' => 'Absenden', 'id' => 'sendbutton'))); return $fields; } else { print '<p><strong>Formularfehler, wenden Sie sich Bitte an den Administrator</strong></p>'; exit; } }