diff --git a/controllers/ManageAlbums.php b/controllers/ManageAlbums.php index 248e369..d5176e2 100644 --- a/controllers/ManageAlbums.php +++ b/controllers/ManageAlbums.php @@ -18,8 +18,7 @@ class ManageAlbums extends HTMLController 'form' => [ 'action' => BASEURL . '/editalbum/', 'method' => 'get', - 'class' => 'col-md-6 text-end', - 'buttons' => [ + 'controls' => [ 'add' => [ 'type' => 'submit', 'caption' => 'Add new album', @@ -58,7 +57,6 @@ class ManageAlbums extends HTMLController 'title' => 'Manage albums', 'no_items_label' => 'No albums meet the requirements of the current filter.', 'items_per_page' => 9999, - 'index_class' => 'col-md-6', 'base_url' => BASEURL . '/managealbums/', 'get_data' => function($offset, $limit, $order, $direction) { return Tag::getOffset($offset, $limit, $order, $direction, true); diff --git a/controllers/ManageAssets.php b/controllers/ManageAssets.php index 59895ff..d4461e4 100644 --- a/controllers/ManageAssets.php +++ b/controllers/ManageAssets.php @@ -23,9 +23,8 @@ class ManageAssets extends HTMLController 'form' => [ 'action' => BASEURL . '/manageassets/?' . Session::getSessionTokenKey() . '=' . Session::getSessionToken(), 'method' => 'post', - 'class' => 'col-md-6 text-end', 'is_embed' => true, - 'buttons' => [ + 'controls' => [ 'deleteChecked' => [ 'type' => 'submit', 'caption' => 'Delete checked', @@ -113,7 +112,6 @@ class ManageAssets extends HTMLController 'title' => 'Manage assets', 'no_items_label' => 'No assets meet the requirements of the current filter.', 'items_per_page' => 30, - 'index_class' => 'col-md-6', 'base_url' => BASEURL . '/manageassets/', 'get_data' => 'Asset::getOffset', 'get_count' => 'Asset::getCount', diff --git a/controllers/ManageErrors.php b/controllers/ManageErrors.php index 75186aa..f0fbb26 100644 --- a/controllers/ManageErrors.php +++ b/controllers/ManageErrors.php @@ -29,8 +29,7 @@ class ManageErrors extends HTMLController 'form' => [ 'action' => BASEURL . '/manageerrors/?' . Session::getSessionTokenKey() . '=' . Session::getSessionToken(), 'method' => 'post', - 'class' => 'col-md-6 text-end', - 'buttons' => [ + 'controls' => [ 'clear' => [ 'type' => 'submit', 'caption' => 'Delete all', @@ -95,7 +94,6 @@ class ManageErrors extends HTMLController 'sort_direction' => $_GET['dir'] ?? '', 'no_items_label' => "No errors to display -- we're all good!", 'items_per_page' => 20, - 'index_class' => 'col-md-6', 'base_url' => BASEURL . '/manageerrors/', 'get_count' => 'ErrorLog::getCount', 'get_data' => 'ErrorLog::getOffset', diff --git a/controllers/ManageTags.php b/controllers/ManageTags.php index 9dc653b..ce937e5 100644 --- a/controllers/ManageTags.php +++ b/controllers/ManageTags.php @@ -20,8 +20,7 @@ class ManageTags extends HTMLController 'form' => [ 'action' => BASEURL . '/edittag/', 'method' => 'get', - 'class' => 'col-md-6 text-end', - 'buttons' => [ + 'controls' => [ 'add' => [ 'type' => 'submit', 'caption' => 'Add new tag', @@ -70,8 +69,7 @@ class ManageTags extends HTMLController 'sort_direction' => $_GET['dir'] ?? '', 'title' => 'Manage tags', 'no_items_label' => 'No tags meet the requirements of the current filter.', - 'items_per_page' => 30, - 'index_class' => 'col-md-6', + 'items_per_page' => 9999, 'base_url' => BASEURL . '/managetags/', 'get_data' => function($offset, $limit, $order, $direction) { return Tag::getOffset($offset, $limit, $order, $direction, false); diff --git a/controllers/ManageUsers.php b/controllers/ManageUsers.php index 9e80cb9..0f7f419 100644 --- a/controllers/ManageUsers.php +++ b/controllers/ManageUsers.php @@ -20,8 +20,7 @@ class ManageUsers extends HTMLController 'form' => [ 'action' => BASEURL . '/edituser/', 'method' => 'get', - 'class' => 'col-md-6 text-end', - 'buttons' => [ + 'controls' => [ 'add' => [ 'type' => 'submit', 'caption' => 'Add new user', @@ -86,7 +85,6 @@ class ManageUsers extends HTMLController 'title' => 'Manage users', 'no_items_label' => 'No users meet the requirements of the current filter.', 'items_per_page' => 30, - 'index_class' => 'col-md-6', 'base_url' => BASEURL . '/manageusers/', 'get_data' => 'Member::getOffset', 'get_count' => 'Member::getCount', diff --git a/templates/InlineFormView.php b/templates/InlineFormView.php new file mode 100644 index 0000000..c737ff4 --- /dev/null +++ b/templates/InlineFormView.php @@ -0,0 +1,105 @@ +'; + else + echo ' +
'; + + if (!empty($form['is_group'])) + echo ' +
'; + + foreach ($form['controls'] as $name => $control) + { + if ($control['type'] === 'select') + self::renderSelectBox($control, $name); + elseif ($control['type'] === 'submit') + self::renderSubmitButton($control, $name); + else + self::renderInputBox($control, $name); + } + + echo ' + '; + + if (!empty($form['is_group'])) + echo ' +
'; + + if (!isset($form['is_embed'])) + echo ' + '; + else + echo ' +
'; + } + + private static function renderInputBox(array $field, $name) + { + echo ' + '; + } + + private static function renderSelectBox(array $field, $name) + { + echo ' + '; + } + + private static function renderSubmitButton(array $button, $name) + { + echo ' + '; + } +} diff --git a/templates/TabularData.php b/templates/TabularData.php index b6df151..5c558fa 100644 --- a/templates/TabularData.php +++ b/templates/TabularData.php @@ -3,7 +3,7 @@ * TabularData.php * Contains the template that displays tabular data. * - * Kabuki CMS (C) 2013-2023, Aaron van Geffen + * Kabuki CMS (C) 2013-2025, Aaron van Geffen *****************************************************************************/ class TabularData extends SubTemplate @@ -68,18 +68,34 @@ class TabularData extends SubTemplate } } - protected function renderPaginationForm($pager, $form, $class='row') + protected function renderPaginationForm($pager, $form) { echo ' -
'; +
'; // Page index? if (!empty($pager)) + { + echo ' +
'; + PageIndexWidget::paginate($pager); + echo ' +
'; + } + // Form controls? if (isset($form)) - $this->renderInlineForm($form); + { + echo ' +
'; + + InlineFormView::renderInlineForm($form); + + echo ' +
'; + } echo '
'; @@ -146,94 +162,4 @@ class TabularData extends SubTemplate echo ' '; } - - protected function renderInlineForm($form) - { - if (!isset($form['is_embed'])) - echo ' -
'; - else - echo ' -
'; - - if (!empty($form['is_group'])) - echo ' -
'; - - if (!empty($form['fields'])) - { - foreach ($form['fields'] as $name => $field) - { - if ($field['type'] === 'select') - { - echo ' - '; - } - else - echo ' - '; - - if (isset($field['html_after'])) - echo $field['html_after']; - } - } - - echo ' - '; - - if (!empty($form['buttons'])) - foreach ($form['buttons'] as $name => $button) - { - echo ' - '; - - if (isset($button['html_after'])) - echo $button['html_after']; - } - - if (!empty($form['is_group'])) - echo ' -
'; - - if (!isset($form['is_embed'])) - echo ' - '; - else - echo ' -
'; - } }