Code: Alles auswählen
<?php
$func = rex_request ( 'func', 'string' );
$field_id = rex_request ( 'field_id', 'int' );
$rec_id = rex_request ( 'id', 'int' );
$list = rex_request ( 'list', 'string' );
$table = rex_request ( 'table', 'string' );
$editor = rex_request ( 'editor', 'array' );
$event = '';
if (rex_request ( 'editor_save', 'int' ) == 1) {
$event = ($rec_id ? 'update' : 'insert');
} elseif (rex_request ( 'editor_abort', 'int' ) == 1) {
$event = 'abort';
} elseif (rex_request ( 'editor_apply', 'int' ) == 1) {
$event = 'apply';
} elseif (rex_request ( 'editor_delete', 'int' ) == 1) {
$event = 'delete';
}
$content = '';
$listen = array ();
if ($func == '') {
$list = rex_list::factory ( 'SELECT id,name,pattern FROM rex_pattern' );
$listen [$list->getName ()] = 'rex_pattern';
$list->addTableAttribute ( 'class', 'table-striped' );
$tdIcon = '<i class="rex-icon rex-icon-metainfo"></i>';
$thIcon = '<a href="' . $list->getUrl ( [
'func' => 'add',
'table' => 'rex_pattern'
] ) . '"><i class="rex-icon rex-icon-add-metainfo"></i></a>';
$list->addColumn ( $thIcon, $tdIcon, 0, [
'<th class="rex-table-icon">###VALUE###</th>',
'<td class="rex-table-icon">###VALUE###</td>'
] );
$list->setColumnParams ( $thIcon, [
'func' => 'edit',
'field_id' => '###id###',
'table' => 'rex_pattern'
] );
$list->removeColumn ( 'id' );
$list->setColumnLabel ( 'name', 'Name' );
$list->setColumnParams ( 'name', [
'func' => 'edit',
'field_id' => '###id###',
'table' => 'rex_pattern'
] );
$list->setColumnLabel ( 'pattern', 'Search-Pattern' );
$list->setColumnSortable ( 'name' );
$list->addColumn ( rex_i18n::msg ( 'minfo_field_label_functions' ), '<i class="rex-icon rex-icon-edit"></i> ' . rex_i18n::msg ( 'edit' ) );
$list->setColumnLayout ( rex_i18n::msg ( 'minfo_field_label_functions' ), [
'<th class="rex-table-action" colspan="2">###VALUE###</th>',
'<td class="rex-table-action">###VALUE###</td>'
] );
$list->setColumnParams ( rex_i18n::msg ( 'minfo_field_label_functions' ), [
'func' => 'edit',
'field_id' => '###id###',
'table' => 'rex_pattern'
] );
$list->addLinkAttribute ( rex_i18n::msg ( 'minfo_field_label_functions' ), 'class', 'rex-edit' );
$list->addColumn ( 'delete', '<i class="rex-icon rex-icon-delete"></i> ' . rex_i18n::msg ( 'delete' ) );
$list->setColumnLayout ( 'delete', [
'',
'<td class="rex-table-action">###VALUE###</td>'
] );
$list->setColumnParams ( 'delete', [
'func' => 'delete',
'field_id' => '###id###',
'table' => 'rex_pattern'
] );
$list->addLinkAttribute ( 'delete', 'data-confirm', rex_i18n::msg ( 'delete' ) . ' ?' );
$list->addLinkAttribute ( 'delete', 'class', 'rex-delete' );
$list->setNoRowsMessage ( rex_i18n::msg ( 'minfo_metainfos_not_found' ) );
$liste = $list->get ();
$fragment = new rex_fragment ();
$fragment->setVar ( 'class', 'edit' );
$fragment->setVar ( 'title', 'regex pattern' );
$fragment->setVar ( 'body', $liste, false );
echo $fragment->parse ( 'core/page/section.php' );
/**
* *****************************************
*/
$list = rex_list::factory ( 'SELECT `id`,`group`,`element`,`new_element`,`option` FROM rex_mapping' );
$listen [$list->getName ()] = 'rex_mapping';
$list->addTableAttribute ( 'class', 'table-striped' );
$tdIcon = '<i class="rex-icon rex-icon-metainfo"></i>';
$thIcon = '<a href="' . $list->getUrl ( [
'func' => 'add',
'table' => 'rex_mapping'
] ) . '"><i class="rex-icon rex-icon-add-metainfo"></i></a>';
$list->addColumn ( $thIcon, $tdIcon, 0, [
'<th class="rex-table-icon">###VALUE###</th>',
'<td class="rex-table-icon">###VALUE###</td>'
] );
$list->setColumnParams ( $thIcon, [
'func' => 'edit',
'field_id' => '###id###',
'table' => 'rex_mapping'
] );
$list->removeColumn ( 'id' );
$list->setColumnLabel ( 'group', 'Gruppe' );
$list->setColumnLabel ( 'element', 'Suchen' );
$list->setColumnParams ( 'element', [
'func' => 'edit',
'field_id' => '###id###',
'table' => 'rex_mapping'
] );
$list->setColumnLabel ( 'new_element', 'Ersetzen' );
$list->setColumnLabel ( 'option', 'Option' );
$list->setColumnSortable ( 'group' );
$list->addColumn ( rex_i18n::msg ( 'minfo_field_label_functions' ), '<i class="rex-icon rex-icon-edit"></i> ' . rex_i18n::msg ( 'edit' ) );
$list->setColumnLayout ( rex_i18n::msg ( 'minfo_field_label_functions' ), [
'<th class="rex-table-action" colspan="2">###VALUE###</th>',
'<td class="rex-table-action">###VALUE###</td>'
] );
$list->setColumnParams ( rex_i18n::msg ( 'minfo_field_label_functions' ), [
'func' => 'edit',
'field_id' => '###id###',
'table' => 'rex_mapping'
] );
$list->addLinkAttribute ( rex_i18n::msg ( 'minfo_field_label_functions' ), 'class', 'rex-edit' );
$list->addColumn ( 'delete', '<i class="rex-icon rex-icon-delete"></i> ' . rex_i18n::msg ( 'delete' ) );
$list->setColumnLayout ( 'delete', [
'',
'<td class="rex-table-action">###VALUE###</td>'
] );
$list->setColumnParams ( 'delete', [
'func' => 'delete',
'field_id' => '###id###',
'table' => 'rex_mapping'
] );
$list->addLinkAttribute ( 'delete', 'data-confirm', rex_i18n::msg ( 'delete' ) . ' ?' );
$list->addLinkAttribute ( 'delete', 'class', 'rex-delete' );
$list->setNoRowsMessage ( rex_i18n::msg ( 'minfo_metainfos_not_found' ) );
$liste = $list->get ();
$fragment = new rex_fragment ();
$fragment->setVar ( 'class', 'edit' );
$fragment->setVar ( 'title', 'mapping' );
$fragment->setVar ( 'body', $liste, false );
echo $fragment->parse ( 'core/page/section.php' );
/**
* *****************************************
*/
$list = rex_list::factory ( 'SELECT `id`,`search`,`replace` FROM rex_simple_mapping' );
$listen [$list->getName ()] = 'rex_simple_mapping';
$list->addTableAttribute ( 'class', 'table-striped' );
$tdIcon = '<i class="rex-icon rex-icon-metainfo"></i>';
$thIcon = '<a href="' . $list->getUrl ( [
'func' => 'add',
'table' => 'rex_simple_mapping'
] ) . '"><i class="rex-icon rex-icon-add-metainfo"></i></a>';
$list->addColumn ( $thIcon, $tdIcon, 0, [
'<th class="rex-table-icon">###VALUE###</th>',
'<td class="rex-table-icon">###VALUE###</td>'
] );
$list->setColumnParams ( $thIcon, [
'func' => 'edit',
'field_id' => '###id###',
'table' => 'rex_simple_mapping'
] );
$list->removeColumn ( 'id' );
$list->setColumnLabel ( 'search', 'Suchen' );
$list->setColumnParams ( 'search', [
'func' => 'edit',
'field_id' => '###id###',
'table' => 'rex_simple_mapping'
] );
$list->setColumnLabel ( 'replace', 'Ersetzen' );
$list->setColumnSortable ( 'search' );
$list->addColumn ( rex_i18n::msg ( 'minfo_field_label_functions' ), '<i class="rex-icon rex-icon-edit"></i> ' . rex_i18n::msg ( 'edit' ) );
$list->setColumnLayout ( rex_i18n::msg ( 'minfo_field_label_functions' ), [
'<th class="rex-table-action" colspan="2">###VALUE###</th>',
'<td class="rex-table-action">###VALUE###</td>'
] );
$list->setColumnParams ( rex_i18n::msg ( 'minfo_field_label_functions' ), [
'func' => 'edit',
'field_id' => '###id###',
'table' => 'rex_simple_mapping'
] );
$list->addLinkAttribute ( rex_i18n::msg ( 'minfo_field_label_functions' ), 'class', 'rex-edit' );
$list->addColumn ( 'delete', '<i class="rex-icon rex-icon-delete"></i> ' . rex_i18n::msg ( 'delete' ) );
$list->setColumnLayout ( 'delete', [
'',
'<td class="rex-table-action">###VALUE###</td>'
] );
$list->setColumnParams ( 'delete', [
'func' => 'delete',
'field_id' => '###id###',
'table' => 'rex_simple_mapping'
] );
$list->addLinkAttribute ( 'delete', 'data-confirm', rex_i18n::msg ( 'delete' ) . ' ?' );
$list->addLinkAttribute ( 'delete', 'class', 'rex-delete' );
$list->setNoRowsMessage ( rex_i18n::msg ( 'minfo_metainfos_not_found' ) );
$liste = $list->get ();
$fragment = new rex_fragment ();
$fragment->setVar ( 'class', 'edit' );
$fragment->setVar ( 'title', 'one to one mapping' );
$fragment->setVar ( 'body', $liste, false );
echo $fragment->parse ( 'core/page/section.php' );
} elseif ($func == 'edit' || $func == 'add') {
if (! $event) {
switch ($table) {
case 'rex_pattern' :
$fs = 'search_pattern';
$form = rex_form::factory ( $table, "Editor", '`id`=' . $field_id );
$field = $form->addTextField ( 'name' );
$field->setLabel ( 'Name' );
$field = $form->addTextField ( 'pattern' );
$field->setLabel ( 'Pattern' );
$form->addParam ( 'table', $table );
if ($func == 'edit') {
$form->addParam ( 'id', $field_id );
}
$formular = $form->get ();
break;
case 'rex_mapping':
/*`group`,`element`,`new_element`,`option`*/
$fs = 'mapping';
$form = rex_form::factory ( $table, "Editor", '`id`=' . $field_id );
$field = $form->addTextField ( 'group' );
$field->setLabel ( 'Gruppe' );
$field = $form->addTextField ( 'element' );
$field->setLabel ( 'Suchen' );
$field = $form->addTextField ( 'new_element' );
$field->setLabel ( 'Ersetzen' );
$field = $form->addTextField ( 'option' );
$field->setLabel ( 'Option' );
$form->addParam ( 'table', $table );
if ($func == 'edit') {
$form->addParam ( 'id', $field_id );
}
$formular = $form->get ();
break;
case 'rex_simple_mapping' :
$fs = 'simple_mapping';
$form = rex_form::factory ( $table, "Editor", '`id`=' . $field_id );
$field = $form->addTextField ( 'search' );
$field->setLabel ( 'Suchen' );
$field = $form->addTextField ( 'replace' );
$field->setLabel ( 'Ersetzen' );
$form->addParam ( 'table', $table );
if ($func == 'edit') {
$form->addParam ( 'id', $field_id );
}
$formular = $form->get ();
break;
default :
}
} else {
$fs = 'debugger';
$formular = "<pre>";
$formular .= "List-Id: " . $list . "\n";
$formular .= "Field-Id: " . $field_id . "\n";
$formular .= "Rec-Id: " . $rec_id . "\n";
$formular .= "Table: " . $table . "\n";
$formular .= "Event: " . $event . "\n";
$formular .= print_r ( $editor, TRUE );
$formular .= "</pre>";
}
$fragment = new rex_fragment ();
$fragment->setVar ( 'class', 'edit' );
$fragment->setVar ( 'title', $fs );
$fragment->setVar ( 'body', $formular, false );
echo $fragment->parse ( 'core/page/section.php' );
}
so sieht's derzeit aus.