/** * Create a new Datafield * * @param $type static types for datafields */ public function new_action($type = null) { if (Request::submitted('anlegen')) { if (Request::get('datafield_name')) { $datafield = new DataField(); $datafield->name = Request::get('datafield_name'); $datafield->object_type = $type; $datafield->object_class = array_sum(Request::getArray('object_class')); $datafield->edit_perms = Request::get('edit_perms'); $datafield->view_perms = Request::get('visibility_perms'); $datafield->system = Request::int('system') ?: 0; $datafield->priority = Request::int('priority') ?: 0; $datafield->type = Request::get('datafield_typ'); $datafield->is_userfilter = Request::int('is_userfilter') ?: 0; if ($type === 'sem') { $datafield->description = Request::get('description', ''); $datafield->is_required = Request::int('is_required') ?: 0; } else { $datafield->description = ''; $datafield->is_required = Request::int('is_required') ?: 0; } $datafield->store(); PageLayout::postSuccess(_('Das neue generische Datenfeld wurde angelegt.')); $this->redirect('admin/datafields/index/' . $datafield->object_type . '#item_' . $datafield->id); return; } else { PageLayout::postError(_('Es wurde keine Bezeichnung eingetragen!')); } } $type = $type ?: Request::get('datafield_typ'); $this->type_name = $this->allclasses[$type]; $this->object_typ = $type; if (!$this->object_typ) { $this->render_action('type_select'); } }