summaryrefslogtreecommitdiff
path: root/includes/sys_menu.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/sys_menu.php')
-rw-r--r--includes/sys_menu.php22
1 files changed, 13 insertions, 9 deletions
diff --git a/includes/sys_menu.php b/includes/sys_menu.php
index f160441c..f809be0b 100644
--- a/includes/sys_menu.php
+++ b/includes/sys_menu.php
@@ -1,28 +1,32 @@
<?php
+
use Engelsystem\UserHintsRenderer;
/**
* @param string $page
+ * @param array $parameters get parameters
* @return string
*/
-function page_link_to($page = '')
+function page_link_to($page = '', $parameters = [])
{
- if ($page == '') {
- return '?';
- }
- return '?p=' . $page;
+ $parameters = http_build_query($parameters);
+ $page = ltrim($page, '/');
+ $page = str_replace('_', '-', $page);
+ return '/' . $page . (!empty($parameters) ? '?' . $parameters : '');
}
/**
+ * @TODO: remove?
* @param string $page
+ * @param array $parameters get parameters
* @return string
*/
-function page_link_to_absolute($page)
+function page_link_to_absolute($page, $parameters = [])
{
return (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://'
. $_SERVER['HTTP_HOST']
. preg_replace("/\?.*$/", '', $_SERVER['REQUEST_URI'])
- . page_link_to($page);
+ . page_link_to($page, $parameters);
}
/**
@@ -65,7 +69,7 @@ function header_toolbar()
if (isset($user)) {
$toolbar_items[] = toolbar_item_link(
- page_link_to('shifts') . '&amp;action=next',
+ page_link_to('shifts', ['action' => 'next']),
'time',
User_shift_state_render($user)
);
@@ -86,7 +90,7 @@ function header_toolbar()
$toolbar_items[] = header_render_hints();
if (in_array('user_myshifts', $privileges)) {
$toolbar_items[] = toolbar_item_link(
- page_link_to('users') . '&amp;action=view',
+ page_link_to('users', ['action' => 'view']),
' icon-icon_angel',
$user['Nick'],
$page == 'users'