summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/controller/angeltypes_controller.php8
-rw-r--r--includes/sys_template.php5
-rw-r--r--includes/view/AngelTypes_view.php24
3 files changed, 24 insertions, 13 deletions
diff --git a/includes/controller/angeltypes_controller.php b/includes/controller/angeltypes_controller.php
index 5c3bd859..a47c1340 100644
--- a/includes/controller/angeltypes_controller.php
+++ b/includes/controller/angeltypes_controller.php
@@ -192,6 +192,11 @@ function angeltype_controller()
$shiftsFilterRenderer->enableDaySelection($days);
$shiftCalendarRenderer = shiftCalendarRendererByShiftFilter($shiftsFilter);
+ $request = request();
+ $tab = 0;
+ if($request->has('shifts_filter_day')) {
+ $tab = 1;
+ }
return [
sprintf(_('Team %s'), $angeltype['name']),
@@ -205,7 +210,8 @@ function angeltype_controller()
$user_driver_license,
$user,
$shiftsFilterRenderer,
- $shiftCalendarRenderer
+ $shiftCalendarRenderer,
+ $tab
)
];
}
diff --git a/includes/sys_template.php b/includes/sys_template.php
index 96290062..819b7d1c 100644
--- a/includes/sys_template.php
+++ b/includes/sys_template.php
@@ -4,15 +4,16 @@
* Renders tabs from the array. Array key is tab name, array value is tab content.
*
* @param array $tabs
+ * @param int $selected The selected tab, default 0
* @return string HTML
*/
-function tabs($tabs)
+function tabs($tabs, $selected = 0)
{
$tab_header = [];
$tab_content = [];
foreach($tabs as $header => $content) {
$class = '';
- if(count($tab_header) == 0) {
+ if(count($tab_header) == $selected) {
$class = 'active';
}
$tab_header[] = '<li role="presentation" class="' . $class . '">
diff --git a/includes/view/AngelTypes_view.php b/includes/view/AngelTypes_view.php
index e42321af..122241a0 100644
--- a/includes/view/AngelTypes_view.php
+++ b/includes/view/AngelTypes_view.php
@@ -304,14 +304,17 @@ function AngelType_view_table_headers($angeltype, $supporter, $admin_angeltypes)
/**
* Render an angeltype page containing the member lists.
*
- * @param array $angeltype
- * @param array[] $members
- * @param array $user_angeltype
- * @param bool $admin_user_angeltypes
- * @param bool $admin_angeltypes
- * @param bool $supporter
- * @param array $user_driver_license
- * @param array $user
+ * @param array $angeltype
+ * @param array[] $members
+ * @param array $user_angeltype
+ * @param bool $admin_user_angeltypes
+ * @param bool $admin_angeltypes
+ * @param bool $supporter
+ * @param array $user_driver_license
+ * @param array $user
+ * @param ShiftsFilterRenderer $shiftsFilterRenderer
+ * @param ShiftCalendarRenderer $shiftCalendarRenderer
+ * @param int $tab The selected tab
* @return string
*/
function AngelType_view(
@@ -324,7 +327,8 @@ function AngelType_view(
$user_driver_license,
$user,
ShiftsFilterRenderer $shiftsFilterRenderer,
- ShiftCalendarRenderer $shiftCalendarRenderer
+ ShiftCalendarRenderer $shiftCalendarRenderer,
+ $tab
) {
return page_with_title(sprintf(_('Team %s'), $angeltype['name']), [
AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, $supporter, $user_driver_license, $user),
@@ -342,7 +346,7 @@ function AngelType_view(
$shiftsFilterRenderer,
$shiftCalendarRenderer
)
- ])
+ ], $tab)
]);
}