Exemplo n.º 1
0
 function getFieldPage()
 {
     // ********************************************* FIELD ADD/EDIT/LIST
     $func = rex_request('func', 'string', 'list');
     $type_id = rex_request('type_id', 'string');
     $type_name = rex_request('type_name', 'string');
     $field_id = rex_request('field_id', 'int');
     $link_vars = '';
     foreach ($this->getLinkVars() as $k => $v) {
         $link_vars .= '&' . urlencode($k) . '=' . urlencode($v);
     }
     $TYPE = array('value' => rex_i18n::msg('yform_values'), 'validate' => rex_i18n::msg('yform_validates'), 'action' => rex_i18n::msg('yform_action'));
     // ********************************** TABELLE HOLEN
     $table = $this->table;
     $table_info = '<b>' . rex_i18n::translate($table->getName()) . ' [' . $table->getTableName() . ']</b> ';
     echo rex_view::info($table_info);
     // ********************************************* Missing Fields
     $mfields = $table->getMissingFields();
     // ksort($mfields);
     $type_real_field = rex_request('type_real_field', 'string');
     if ($type_real_field != '' && !array_key_exists($type_real_field, $mfields)) {
         $type_real_field = '';
     }
     if ($type_real_field != '') {
         $panel = '';
         $panel .= '<dl class="dl-horizontal text-left">';
         $rfields = $this->table->getColumns();
         foreach ($rfields[$type_real_field] as $k => $v) {
             $panel .= '<dt>' . ucfirst($k) . ':</dt><dd>' . $v . '</dd>';
         }
         $panel .= '</dl>';
         $fragment = new rex_fragment();
         $fragment->setVar('class', 'info');
         $fragment->setVar('title', 'Folgendes Feld wird verwendet: ' . $type_real_field);
         $fragment->setVar('body', $panel, false);
         echo $fragment->parse('core/page/section.php');
     }
     // ********************************************* CHOOSE FIELD
     $types = rex_yform::getTypeArray();
     if ($func == 'choosenadd') {
         $link = 'index.php?' . $link_vars . '&table_name=' . $table->getTableName() . '&func=add&';
         $content = [];
         $panels = [];
         if (!$table->hasId()) {
             $content[] = rex_i18n::msg('yform_id_is_missing') . '' . rex_i18n::msg('yform_id_missing_info');
         } else {
             if ($type_real_field == '' && count($mfields) > 0) {
                 $tmp = '';
                 $d = 0;
                 foreach ($mfields as $k => $v) {
                     $d++;
                     $l = 'index.php?' . $link_vars . '&table_name=' . $table->getTableName() . '&func=choosenadd&type_real_field=' . $k . '&type_layout=t';
                     $tmp .= '<a class="btn btn-default" href="' . $l . '">' . $k . '</a> ';
                 }
                 $fragment = new rex_fragment();
                 $fragment->setVar('class', 'info');
                 $fragment->setVar('title', 'Es gibt noch Felder in der Tabelle welche nicht zugewiesen sind.');
                 $fragment->setVar('body', $tmp, false);
                 echo $fragment->parse('core/page/section.php');
             }
             $tmp = '';
             if (isset($types['value'])) {
                 ksort($types['value']);
                 $tmp .= '<table class="table table-hover">';
                 foreach ($types['value'] as $k => $v) {
                     $tmp .= '<tr><th><a class="btn btn-default btn-block" href="' . $link . 'type_id=value&type_name=' . $k . '&type_real_field=' . $type_real_field . '"><code>' . $k . '</code></a></th><td class="vertical-middle">' . $v['description'] . '</td></tr>';
                 }
                 $tmp .= '</table>';
             }
             $fragment = new rex_fragment();
             $fragment->setVar('title', $TYPE['value']);
             $fragment->setVar('content', $tmp, false);
             $panels[] = $fragment->parse('core/page/section.php');
             $tmp = '';
             if (isset($types['validate'])) {
                 ksort($types['validate']);
                 $tmp .= '<table class="table table-hover">';
                 foreach ($types['validate'] as $k => $v) {
                     $tmp .= '<tr><th><a class="btn btn-default btn-block" href="' . $link . 'type_id=validate&type_name=' . $k . '"><code>' . $k . '</code></a></th><td class="vertical-middle">' . $v['description'] . '</td></tr>';
                 }
                 $tmp .= '</table>';
             }
             $fragment = new rex_fragment();
             $fragment->setVar('title', $TYPE['validate']);
             $fragment->setVar('content', $tmp, false);
             $panels[] = $fragment->parse('core/page/section.php');
         }
         $fragment = new rex_fragment();
         $fragment->setVar('title', rex_i18n::msg('yform_choosenadd'));
         $fragment->setVar('body', rex_i18n::msg('yform_choosenadd_description'), false);
         echo $fragment->parse('core/page/section.php');
         $fragment = new rex_fragment();
         $fragment->setVar('content', $panels, false);
         echo $fragment->parse('core/page/grid.php');
         $table_echo = '<a class="btn btn-default" href="index.php?' . $link_vars . '&amp;table_name=' . $table->getTableName() . '">' . rex_i18n::msg('yform_back_to_overview') . '</a>';
         $fragment = new rex_fragment();
         $fragment->setVar('footer', $table_echo, false);
         echo $fragment->parse('core/page/section.php');
     }
     // ********************************************* FORMULAR
     if (($func == 'add' || $func == 'edit') && isset($types[$type_id][$type_name])) {
         $yform = new rex_yform();
         $yform->setDebug(false);
         foreach ($this->getLinkVars() as $k => $v) {
             $yform->setHiddenField($k, $v);
         }
         $yform->setHiddenField('func', $func);
         $yform->setHiddenField('table_name', $table->getTableName());
         $yform->setHiddenField('type_real_field', $type_real_field);
         $yform->setHiddenField('list', rex_request('list', 'string'));
         $yform->setHiddenField('sort', rex_request('sort', 'string'));
         $yform->setHiddenField('sorttype', rex_request('sorttype', 'string'));
         $yform->setHiddenField('start', rex_request('start', 'string'));
         $yform->setValueField('hidden', array('table_name', $table->getTableName()));
         $yform->setValueField('hidden', array('type_name', $type_name, 'REQUEST'));
         $yform->setValueField('hidden', array('type_id', $type_id, 'REQUEST'));
         $yform->setValueField('prio', array('prio', 'Prioritaet', array('name', 'type_id', 'type_name'), array('table_name')));
         $selectFields = array();
         $i = 1;
         foreach ($types[$type_id][$type_name]['values'] as $k => $v) {
             $field = $this->getFieldName($k, $type_id);
             $selectFields['f' . $i] = $field;
             $i++;
             switch ($v['type']) {
                 case 'name':
                     if ($func == 'edit') {
                         $yform->setValueField('showvalue', array($field, 'Name'));
                     } else {
                         if (!isset($v['value']) && $type_real_field != '') {
                             $v['value'] = $type_real_field;
                         } elseif (!isset($v['value'])) {
                             $v['value'] = '';
                         }
                         $yform->setValueField('text', array($field, 'Name', $v['value']));
                         $yform->setValidateField('empty', array($field, rex_i18n::msg('yform_validatenamenotempty')));
                         $yform->setValidateField('preg_match', array($field, "/(([a-zA-Z])+([a-zA-Z0-9\\_])*)/", rex_i18n::msg('yform_validatenamepregmatch')));
                         $yform->setValidateField('customfunction', array($field, 'rex_yform_manager_checkField', array('table_name' => $table->getTableName()), rex_i18n::msg('yform_validatenamecheck')));
                     }
                     break;
                 case 'no_db':
                     if (!isset($v['default']) || $v['default'] != 1) {
                         $v['default'] = 0;
                     }
                     $yform->setValueField('checkbox', array($field, rex_i18n::msg('yform_donotsaveindb'), 'no_db', $v['default']));
                     break;
                 case 'boolean':
                     // checkbox|check_design|Bezeichnung|Value|1/0|[no_db]
                     if (!isset($v['default'])) {
                         $v['default'] = '';
                     }
                     $yform->setValueField('checkbox', array($field, $v['label'], '', $v['default']));
                     break;
                 case 'select':
                     // select|gender|Geschlecht *|Frau=w;Herr=m|[no_db]|defaultwert|multiple=1
                     $yform->setValueField('select', array($field, $v['label'], $v['options'], '', $v['default'], 0));
                     break;
                 case 'table':
                     // ist fest eingetragen, damit keine Dinge durcheinandergehen
                     if ($func == 'edit') {
                         $yform->setValueField('showvalue', array($field, $v['label']));
                     } else {
                         $_tables = rex_yform_manager_table::getAll();
                         $_options = array();
                         if (isset($v['empty_option']) && $v['empty_option']) {
                             $_options[0] = '–=';
                         }
                         foreach ($_tables as $_table) {
                             $_options[$_table['table_name']] = str_replace('=', '-', rex_i18n::translate($_table['name']) . ' [' . $_table['table_name'] . ']') . '=' . $_table['table_name'];
                             $_options[$_table['table_name']] = str_replace(',', '.', $_options[$_table['table_name']]);
                         }
                         if (!isset($v['default'])) {
                             $v['default'] = '';
                         }
                         $yform->setValueField('select', array($field, $v['label'], implode(',', $_options), '', $v['default'], 0));
                     }
                     break;
                 case 'textarea':
                     $yform->setValueField('textarea', array($field, $v['label']));
                     break;
                 case 'table.field':
                     // Todo:
                 // Todo:
                 case 'select_name':
                     $_fields = array();
                     foreach ($table->getValueFields() as $_k => $_v) {
                         $_fields[] = $_k;
                     }
                     $yform->setValueField('select', array($field, $v['label'], implode(',', $_fields), '', '', 0));
                     break;
                 case 'select_names':
                     $_fields = array();
                     foreach ($table->getValueFields() as $_k => $_v) {
                         $_fields[] = $_k;
                     }
                     $yform->setValueField('select', array($field, $v['label'], implode(',', $_fields), '', '', 1, 5));
                     break;
                 default:
                     // nur beim "Bezeichnungsfeld"
                     if ($field == 'label' && $type_real_field != '' && !isset($v['value'])) {
                         $v['value'] = $type_real_field;
                     } elseif (!isset($v['value'])) {
                         $v['value'] = '';
                     }
                     $yform->setValueField('text', array($field, $v['label'], $v['value']));
             }
         }
         $yform->setActionField('showtext', array('', '<p>' . rex_i18n::msg('yform_thankyouforentry') . '</p>'));
         $yform->setObjectparams('main_table', rex_yform_manager_field::table());
         if ($func == 'edit') {
             $yform->setObjectparams('submit_btn_label', rex_i18n::msg('yform_save'));
             $yform->setHiddenField('field_id', $field_id);
             $yform->setActionField('manage_db', array(rex_yform_manager_field::table(), "id={$field_id}"));
             $yform->setObjectparams('main_id', $field_id);
             $yform->setObjectparams('main_where', "id={$field_id}");
             $sql = rex_sql::factory();
             $sql->setQuery('SELECT * FROM ' . rex_yform_manager_field::table() . " WHERE id={$field_id}");
             foreach ($selectFields as $alias => $field) {
                 if ($alias != $field) {
                     if ((!$sql->hasValue($field) || null === $sql->getValue($field) || '' === $sql->getValue($field)) && $sql->hasValue($alias)) {
                         $sql->setValue($field, $sql->getValue($alias));
                     }
                     $yform->setValueField('hidden', array($alias, ''));
                 }
             }
             $yform->setObjectparams('sql_object', $sql);
             $yform->setObjectparams('getdata', true);
         } elseif ($func == 'add') {
             $yform->setObjectparams('submit_btn_label', rex_i18n::msg('yform_add'));
             $yform->setActionField('manage_db', array(rex_yform_manager_field::table()));
         }
         if ($type_id == 'value') {
             $yform->setValueField('checkbox', array('list_hidden', rex_i18n::msg('yform_hideinlist'), 1, '1'));
             $yform->setValueField('checkbox', array('search', rex_i18n::msg('yform_useassearchfieldalidatenamenotempty'), 1, '1'));
         } elseif ($type_id == 'validate') {
             $yform->setValueField('hidden', array('list_hidden', 1));
         }
         $form = $yform->getForm();
         if ($yform->objparams['form_show']) {
             if ($func == 'add') {
                 $title = rex_i18n::msg('yform_addfield') . ' "' . $type_name . '"';
             } else {
                 $title = rex_i18n::msg('yform_editfield') . ' "' . $type_name . '"';
             }
             $fragment = new rex_fragment();
             $fragment->setVar('class', 'edit', false);
             $fragment->setVar('title', $title);
             $fragment->setVar('body', $form, false);
             // $fragment->setVar('buttons', $buttons, false);
             $form = $fragment->parse('core/page/section.php');
             echo $form;
             $table_echo = '<a class="btn btn-default" href="index.php?' . $link_vars . '&amp;table_name=' . $table->getTableName() . '">' . rex_i18n::msg('yform_back_to_overview') . '</a>';
             $fragment = new rex_fragment();
             $fragment->setVar('footer', $table_echo, false);
             echo $fragment->parse('core/page/section.php');
             $func = '';
         } else {
             if ($func == 'edit') {
                 $this->generateAll();
                 echo rex_view::success(rex_i18n::msg('yform_thankyouforupdate'));
             } elseif ($func == 'add') {
                 $this->generateAll();
                 echo rex_view::success(rex_i18n::msg('yform_thankyouforentry'));
             }
             $func = 'list';
         }
     }
     // ********************************************* LOESCHEN
     if ($func == 'delete') {
         $sf = rex_sql::factory();
         $sf->debugsql = self::$debug;
         $sf->setQuery('select * from ' . rex_yform_manager_field::table() . ' where table_name="' . $table->getTableName() . '" and id=' . $field_id);
         $sfa = $sf->getArray();
         if (count($sfa) == 1) {
             $query = 'delete from ' . rex_yform_manager_field::table() . ' where table_name="' . $table->getTableName() . '" and id=' . $field_id;
             $delsql = rex_sql::factory();
             $delsql->debugsql = self::$debug;
             $delsql->setQuery($query);
             echo rex_view::success(rex_i18n::msg('yform_tablefielddeleted'));
             $this->generateAll();
         } else {
             echo rex_view::warning(rex_i18n::msg('yform_tablefieldnotfound'));
         }
         $func = 'list';
     }
     // ********************************************* CREATE/UPDATE FIELDS
     if ($func == 'updatetable') {
         $this->generateAll();
         echo rex_view::info(rex_i18n::msg('yform_tablesupdated'));
         $func = 'list';
     }
     if ($func == 'updatetablewithdelete') {
         $this->generateAll(array('delete_fields' => true));
         echo rex_view::info(rex_i18n::msg('yform_tablesupdated'));
         $func = 'list';
     }
     if ($func == 'show_form_notation') {
         $formbuilder_fields = $table->getFields();
         $notation_php = '';
         $notation_pipe = '';
         $notation_email = '';
         $notation_php_pre = array('$yform = new rex_yform();', '$yform->setObjectparams(\'form_skin\', \'default\');', '$yform->setObjectparams(\'form_showformafterupdate\', 0);', '$yform->setObjectparams(\'real_field_names\', true);');
         $notation_php .= implode("\n", $notation_php_pre) . "\n";
         $notation_pipe_pre = array('objparams|form_skin|bootstrap', 'objparams|form_showformafterupdate|0', 'objparams|real_field_names|true');
         $notation_pipe .= implode("\n", $notation_pipe_pre) . "\n";
         foreach ($formbuilder_fields as $field) {
             $class = 'rex_yform_' . $field->getType() . '_' . $field->getTypeName();
             $cl = new $class();
             $definitions = $cl->getDefinitions();
             $values = array();
             $i = 1;
             foreach ($definitions['values'] as $key => $_) {
                 $key = $this->getFieldName($key, $field['type_id']);
                 if (isset($field[$key])) {
                     $values[] = $field[$key];
                 } elseif (isset($field['f' . $i])) {
                     $values[] = $field['f' . $i];
                 } else {
                     $values[] = '';
                 }
                 $i++;
             }
             if ($field['type_id'] == 'value') {
                 $notation_php .= "\n" . '$yform->setValueField(\'' . $field['type_name'] . '\', array("' . rtrim(implode('","', $values), '","') . '"));';
                 $notation_pipe .= "\n" . $field['type_name'] . '|' . rtrim(implode('|', $values), '|') . '|';
                 $notation_email .= "\n" . $field['label'] . ': ###' . $field['name'] . '###';
             } elseif ($field['type_id'] == 'validate') {
                 $notation_php .= "\n" . '$yform->setValidateField(\'' . $field['type_name'] . '\', array("' . rtrim(implode('","', $values), '","') . '"));';
                 $notation_pipe .= "\n" . $field['type_id'] . '|' . $field['type_name'] . '|' . rtrim(implode('|', $values), '|') . '|';
             } elseif ($field['type_id'] == 'action') {
                 $notation_php .= "\n" . '$yform->setActionField(\'' . $field['type_name'] . '\', array("' . rtrim(implode('","', $values), '","') . '"));';
                 $notation_pipe .= "\n" . $field['type_id'] . '|' . $field['type_name'] . '|' . rtrim(implode('|', $values), '|') . '|';
             }
         }
         $notation_php .= "\n\n" . '$yform->setActionField(\'email\', array(\'emailtemplate\', \'emaillabel\', \'email@domain.de\'));';
         $notation_php .= "\n" . 'echo $yform->getForm();';
         $notation_pipe .= "\n\n" . 'action|email|emailtemplate|emaillabel|email@domain.de';
         $fragment = new rex_fragment();
         $fragment->setVar('title', 'PHP');
         $fragment->setVar('body', '<pre class="pre-scrollable">' . $notation_php . '</pre>', false);
         $content = $fragment->parse('core/page/section.php');
         echo $content;
         $fragment = new rex_fragment();
         $fragment->setVar('title', 'Pipe');
         $fragment->setVar('body', '<pre class="pre-scrollable">' . $notation_pipe . '</pre>', false);
         $content = $fragment->parse('core/page/section.php');
         echo $content;
         $fragment = new rex_fragment();
         $fragment->setVar('title', 'E-Mail');
         $fragment->setVar('body', '<pre class="pre-scrollable">' . $notation_email . '</pre>', false);
         $content = $fragment->parse('core/page/section.php');
         echo $content;
         $func = 'list';
     }
     // ********************************************* LIST
     if ($func == 'list') {
         $show_list = true;
         $show_list = rex_extension::registerPoint(new rex_extension_point('YFORM_MANAGER_TABLE_FIELD_FUNC', $show_list, ['table' => $table, 'link_vars' => $this->getLinkVars()]));
         if ($show_list) {
             function rex_yform_list_format($p, $value = '')
             {
                 if ($value != '') {
                     $p['value'] = $value;
                 }
                 switch ($p['list']->getValue('type_id')) {
                     case 'validate':
                         $style = 'color:#aaa;';
                         // background-color:#cfd9d9;
                         break;
                     case 'action':
                         $style = 'background-color:#cfd9d9;';
                         break;
                     default:
                         $style = 'background-color:#eff9f9;';
                         break;
                 }
                 return '<td style="' . $style . '">' . $p['value'] . '</td>';
             }
             function rex_yform_list_edit_format($p)
             {
                 return rex_yform_list_format($p, $p['list']->getColumnLink(rex_i18n::msg('yform_function'), '<i class="rex-icon rex-icon-edit"></i> ' . rex_i18n::msg('yform_edit')));
             }
             function rex_yform_list_delete_format($p)
             {
                 return rex_yform_list_format($p, $p['list']->getColumnLink(rex_i18n::msg('yform_delete'), '<i class="rex-icon rex-icon-delete"></i> ' . rex_i18n::msg('yform_delete')));
             }
             $context = new rex_context($this->getLinkVars());
             $items = [];
             $item = [];
             $item['label'] = rex_i18n::msg('yform_manager_show_form_notation');
             $item['url'] = $context->getUrl(['table_name' => $table->getTableName(), 'func' => 'show_form_notation']);
             $item['attributes']['class'][] = 'btn-default';
             if (rex_request('func', 'string') == 'show_form_notation') {
                 $item['attributes']['class'][] = 'active';
             }
             $items[] = $item;
             $item = [];
             $item['label'] = rex_i18n::msg('yform_updatetable');
             $item['url'] = $context->getUrl(['table_name' => $table->getTableName(), 'func' => 'updatetable']);
             $item['attributes']['class'][] = 'btn-default';
             if (rex_request('func', 'string') == 'updatetable') {
                 $item['attributes']['class'][] = 'active';
             }
             $items[] = $item;
             $item = [];
             $item['label'] = rex_i18n::msg('yform_updatetable_with_delete');
             $item['url'] = $context->getUrl(['table_name' => $table->getTableName(), 'func' => 'updatetablewithdelete']);
             $item['attributes']['class'][] = 'btn-default';
             if (rex_request('func', 'string') == 'updatetablewithdelete') {
                 $item['attributes']['class'][] = 'active';
             }
             $item['attributes']['onclick'][] = 'return confirm(\'' . rex_i18n::msg('yform_updatetable_with_delete_confirm') . '\')';
             $items[] = $item;
             $fragment = new rex_fragment();
             $fragment->setVar('buttons', $items, false);
             $fragment->setVar('size', 'xs', false);
             $panel_options = $fragment->parse('core/buttons/button_group.php');
             $sql = 'select id, prio, type_id, type_name, name from ' . rex_yform_manager_field::table() . ' where table_name="' . $table->getTableName() . '" order by prio';
             $list = rex_list::factory($sql, 30);
             // $list->debug = 1;
             // $list->setColumnFormat('id', 'Id');
             $tdIcon = '<i class="rex-icon rex-icon-table"></i>';
             $thIcon = '<a href="' . $list->getUrl(['table_name' => $table->getTableName(), 'func' => 'choosenadd']) . '"' . rex::getAccesskey(rex_i18n::msg('add'), 'add') . '><i class="rex-icon rex-icon-add"></i></a>';
             $list->addColumn($thIcon, $tdIcon, 0, ['<th class="rex-table-icon">###VALUE###</th>', '<td class="rex-table-icon">###VALUE###</td>']);
             $list->setColumnParams($thIcon, ['field_id' => '###id###', 'func' => 'edit', 'type_name' => '###type_name###', 'type_id' => '###type_id###']);
             foreach ($this->getLinkVars() as $k => $v) {
                 $list->addParam($k, $v);
             }
             $list->addParam('start', rex_request('start', 'int'));
             $list->addParam('table_name', $table->getTableName());
             $list->removeColumn('id');
             $list->setColumnLabel('prio', rex_i18n::msg('yform_manager_table_prio_short'));
             //$list->setColumnLayout('prio', ['<th class="rex-table-priority">###VALUE###</th>', '<td class="rex-table-priority" data-title="' . rex_i18n::msg('yform_manager_table_prio_short') . '">###VALUE###</td>']);
             $list->setColumnLayout('prio', array('<th>###VALUE###</th>', '###VALUE###'));
             $list->setColumnFormat('prio', 'custom', 'rex_yform_list_format');
             $list->setColumnLabel('type_id', rex_i18n::msg('yform_manager_type_id'));
             $list->setColumnLayout('type_id', array('<th>###VALUE###</th>', '###VALUE###'));
             $list->setColumnFormat('type_id', 'custom', 'rex_yform_list_format');
             $list->setColumnLabel('type_name', rex_i18n::msg('yform_manager_type_name'));
             $list->setColumnLayout('type_name', array('<th>###VALUE###</th>', '###VALUE###'));
             $list->setColumnFormat('type_name', 'custom', 'rex_yform_list_format');
             $list->setColumnLabel('name', rex_i18n::msg('yform_manager_name'));
             $list->setColumnLayout('name', array('<th>###VALUE###</th>', '###VALUE###'));
             // ###VALUE###
             $list->setColumnFormat('name', 'custom', 'rex_yform_list_format');
             $list->addColumn(rex_i18n::msg('yform_function'), '<i class="rex-icon rex-icon-edit"></i> ' . rex_i18n::msg('yform_edit'));
             $list->setColumnParams(rex_i18n::msg('yform_function'), array('field_id' => '###id###', 'func' => 'edit', 'type_name' => '###type_name###', 'type_id' => '###type_id###'));
             $list->setColumnLayout(rex_i18n::msg('yform_function'), array('<th class="rex-table-action" colspan="2">###VALUE###</th>', '###VALUE###'));
             $list->setColumnFormat(rex_i18n::msg('yform_function'), 'custom', 'rex_yform_list_edit_format');
             $list->addColumn(rex_i18n::msg('yform_delete'), '<i class="rex-icon rex-icon-delete"></i> ' . rex_i18n::msg('yform_delete'));
             $list->setColumnParams(rex_i18n::msg('yform_delete'), array('field_id' => '###id###', 'func' => 'delete'));
             $list->setColumnLayout(rex_i18n::msg('yform_delete'), array('', '###VALUE###'));
             $list->setColumnFormat(rex_i18n::msg('yform_delete'), 'custom', 'rex_yform_list_delete_format');
             $list->addLinkAttribute(rex_i18n::msg('yform_delete'), 'onclick', 'return confirm(\' [###type_id###, ###type_name###, ###name###] ' . rex_i18n::msg('yform_delete') . ' ?\')');
             $content = $list->get();
             $fragment = new rex_fragment();
             $fragment->setVar('title', rex_i18n::msg('yform_manager_tablefield_overview'));
             $fragment->setVar('options', $panel_options, false);
             $fragment->setVar('content', $content, false);
             $content = $fragment->parse('core/page/section.php');
             echo $content;
         }
     }
 }
Exemplo n.º 2
0
<?php

/**
 * yform
 * @author jan.kristinus[at]redaxo[dot]org Jan Kristinus
 * @author <a href="http://www.yakamara.de">www.yakamara.de</a>
 */
echo rex_view::title(rex_i18n::msg('yform'));
// ********************************************* TABLE ADD/EDIT/LIST
$func = rex_request('func', 'string', '');
$page = rex_request('page', 'string', '');
$table_id = rex_request('table_id', 'int');
$show_list = true;
if ($func == 'tableset_import' && rex::getUser()->isAdmin()) {
    $yform = new rex_yform();
    $yform->setDebug(true);
    $yform->setHiddenField('page', $page);
    $yform->setHiddenField('func', $func);
    $yform->setObjectparams('real_field_names', true);
    $yform->setValueField('upload', array('name' => 'importfile', 'label' => rex_i18n::msg('yform_manager_table_import_jsonimportfile'), 'max_size' => '1000', 'types' => '.json', 'required' => 1, 'messages' => array(rex_i18n::msg('yform_manager_table_import_warning_min'), rex_i18n::msg('yform_manager_table_import_warning_max'), rex_i18n::msg('yform_manager_table_import_warning_type'), rex_i18n::msg('yform_manager_table_import_warning_selectfile')), 'modus' => 'no_save', 'no_db' => 'no_db'));
    $form = $yform->getForm();
    if ($yform->objparams['form_show']) {
        $fragment = new rex_fragment();
        $fragment->setVar('class', 'edit', false);
        $fragment->setVar('title', rex_i18n::msg('yform_manager_tableset_import'));
        $fragment->setVar('body', $form, false);
        // $fragment->setVar('buttons', $buttons, false);
        $form = $fragment->parse('core/page/section.php');
        echo $form;
        echo rex_view::info('<a href="index.php?page=' . $page . '"><b>&laquo; ' . rex_i18n::msg('yform_back_to_overview') . '</b></a>');
        $show_list = false;