Skip to content

Commit

Permalink
Merge pull request #33 from alexplusde/pages
Browse files Browse the repository at this point in the history
Umbau auf neue Pages-Struktur
  • Loading branch information
alxndr-w authored Dec 16, 2023
2 parents b6fc05d + 1d88d86 commit bfd003f
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 1 deletion.
29 changes: 29 additions & 0 deletions pages/neues.author.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
echo rex_view::title(rex_addon::get('neues')->getProperty('page')['title']);

$currentPage = rex_be_controller::getCurrentPageObject();
$wrapper = '';
if ($table_name = 'rex_neues_author') {
if (!rex_request('table_name', 'string', '')) {
$_REQUEST['table_name'] = $table_name;
}

if (true !== $currentPage->getItemAttr('show_title', false)) {
rex_extension::register('YFORM_MANAGER_DATA_PAGE_HEADER', static function ($ep) {
if ($ep->getParam('yform')->table->getTableName() !== $ep->getParam('table_name')) {
return;
}
return '';
}, rex_extension::EARLY, ['table_name' => $table_name]);
}

if ($wrapper = $currentPage->getItemAttr('wrapper_class', '')) {
echo "<div class=\"$wrapper\">";
}
}

include rex_path::plugin('yform', 'manager', 'pages/data_edit.php');

if ($wrapper) {
echo '</div>';
}
29 changes: 29 additions & 0 deletions pages/neues.category.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
echo rex_view::title(rex_addon::get('neues')->getProperty('page')['title']);

$currentPage = rex_be_controller::getCurrentPageObject();
$wrapper = '';
if ($table_name = 'rex_neues_category') {
if (!rex_request('table_name', 'string', '')) {
$_REQUEST['table_name'] = $table_name;
}

if (true !== $currentPage->getItemAttr('show_title', false)) {
rex_extension::register('YFORM_MANAGER_DATA_PAGE_HEADER', static function ($ep) {
if ($ep->getParam('yform')->table->getTableName() !== $ep->getParam('table_name')) {
return;
}
return '';
}, rex_extension::EARLY, ['table_name' => $table_name]);
}

if ($wrapper = $currentPage->getItemAttr('wrapper_class', '')) {
echo "<div class=\"$wrapper\">";
}
}

include rex_path::plugin('yform', 'manager', 'pages/data_edit.php');

if ($wrapper) {
echo '</div>';
}
48 changes: 48 additions & 0 deletions pages/neues.docs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

/**
* @var rex_addon $this
* @psalm-scope-this rex_addon
*/

$mdFiles = [];
foreach (glob(rex_addon::get('neues')->getPath('docs').'/*.md') ?: [] as $file) {
$mdFiles[mb_substr(basename($file), 0, -3)] = $file;
}

$currenMDFile = rex_request('mdfile', 'string', '01_a_intro');
if (!array_key_exists($currenMDFile, $mdFiles)) {
$currenMDFile = '01_a_intro';
}

$page = rex_be_controller::getPageObject('neues/docs');

if (null !== $page) {
foreach ($mdFiles as $key => $mdFile) {
$keyWithoudPrio = mb_substr($key, 3);
$currenMDFileWithoudPrio = mb_substr($currenMDFile, 3);
$page->addSubpage(
(new rex_be_page($key, rex_i18n::msg('neues_docs_'.$keyWithoudPrio)))
->setSubPath($mdFile)
->setHref('index.php?page=neues/docs&mdfile='.$key)
->setIsActive($key == $currenMDFile)
);
}
}

echo rex_view::title($this->i18n('neues_title'));

[$Toc, $Content] = rex_markdown::factory()->parseWithToc(rex_file::require($mdFiles[$currenMDFile]), 2, 3, [
rex_markdown::SOFT_LINE_BREAKS => false,
rex_markdown::HIGHLIGHT_PHP => true,
]);

$fragment = new rex_fragment();
$fragment->setVar('content', $Content, false);
$fragment->setVar('toc', $Toc, false);
$content = $fragment->parse('core/page/docs.php');

$fragment = new rex_fragment();
$fragment->setVar('title', rex_i18n::msg('package_help') . ' ', false);
$fragment->setVar('body', $content, false);
echo $fragment->parse('core/page/section.php');
29 changes: 29 additions & 0 deletions pages/neues.entry.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
echo rex_view::title(rex_addon::get('neues')->getProperty('page')['title']);

$currentPage = rex_be_controller::getCurrentPageObject();
$wrapper = '';
if ($table_name = 'rex_neues_entry') {
if (!rex_request('table_name', 'string', '')) {
$_REQUEST['table_name'] = $table_name;
}

if (true !== $currentPage->getItemAttr('show_title', false)) {
rex_extension::register('YFORM_MANAGER_DATA_PAGE_HEADER', static function ($ep) {
if ($ep->getParam('yform')->table->getTableName() !== $ep->getParam('table_name')) {
return;
}
return '';
}, rex_extension::EARLY, ['table_name' => $table_name]);
}

if ($wrapper = $currentPage->getItemAttr('wrapper_class', '')) {
echo "<div class=\"$wrapper\">";
}
}

include rex_path::plugin('yform', 'manager', 'pages/data_edit.php');

if ($wrapper) {
echo '</div>';
}
29 changes: 29 additions & 0 deletions pages/neues.lang.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
echo rex_view::title(rex_addon::get('neues')->getProperty('page')['title']);

$currentPage = rex_be_controller::getCurrentPageObject();
$wrapper = '';
if ($table_name = 'rex_neues_entry_Lang') {
if (!rex_request('table_name', 'string', '')) {
$_REQUEST['table_name'] = $table_name;
}

if (true !== $currentPage->getItemAttr('show_title', false)) {
rex_extension::register('YFORM_MANAGER_DATA_PAGE_HEADER', static function ($ep) {
if ($ep->getParam('yform')->table->getTableName() !== $ep->getParam('table_name')) {
return;
}
return '';
}, rex_extension::EARLY, ['table_name' => $table_name]);
}

if ($wrapper = $currentPage->getItemAttr('wrapper_class', '')) {
echo "<div class=\"$wrapper\">";
}
}

include rex_path::plugin('yform', 'manager', 'pages/data_edit.php');

if ($wrapper) {
echo '</div>';
}
1 change: 0 additions & 1 deletion pages/neues.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?php

echo rex_view::title(rex_addon::get('neues')->getProperty('page')['title']);
rex_be_controller::includeCurrentPageSubPath();
1 change: 1 addition & 0 deletions pages/neues.settings.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
echo rex_view::title(rex_addon::get('neues')->getProperty('page')['title']);

$addon = rex_addon::get('neues');

Expand Down

0 comments on commit bfd003f

Please sign in to comment.