From 9c281511fa1e09c8a27f134b87863fd97da61e27 Mon Sep 17 00:00:00 2001 From: slawkens1 Date: Sat, 6 Jan 2018 01:52:59 +0100 Subject: [PATCH] * added "Edit" option for admins in characters page --- TODO | 1 - common.php | 1 + system/pages/characters.php | 3 ++- system/templates/characters.html.twig | 10 ++++++++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index befd3b34..fa0b3501 100644 --- a/TODO +++ b/TODO @@ -16,7 +16,6 @@ * hooks * fieldExist and tableExist functions * Menus in templates - * characters: edit in admin panel option * move highscores to twig * $db->hasTable(table) + $db->hasColumn(table, column) * migrations: option to downgrade the database diff --git a/common.php b/common.php index be083d63..9e8f9ce8 100644 --- a/common.php +++ b/common.php @@ -46,6 +46,7 @@ define('FLAG_CONTENT_GALLERY', 512); define('FLAG_CONTENT_VIDEOS', 1024); define('FLAG_CONTENT_FAQ', 2048); define('FLAG_CONTENT_MENUS', 4096); +define('FLAG_CONTENT_PLAYERS', 8192); // news define('NEWS', 1); diff --git a/system/pages/characters.php b/system/pages/characters.php index ec49e20f..8c121c6a 100644 --- a/system/pages/characters.php +++ b/system/pages/characters.php @@ -403,7 +403,8 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil 'bannedUntil' => isset($bannedUntil) ? $bannedUntil : null, 'characters_link' => getLink('characters'), 'account_players' => isset($account_players) ? $account_players : null, - 'search_form' => generate_search_form() + 'search_form' => generate_search_form(), + 'canEdit' => hasFlag(FLAG_CONTENT_PLAYERS) || superAdmin() )); } else diff --git a/system/templates/characters.html.twig b/system/templates/characters.html.twig index bf2c06a5..37e6f7b7 100644 --- a/system/templates/characters.html.twig +++ b/system/templates/characters.html.twig @@ -10,6 +10,11 @@ {{ hook(constant('HOOK_CHARACTERS_BEFORE_INFORMATIONS')) }} + {% if canEdit %} + + Edit + + {% endif %} {% if config.characters.outfit %}
player outfit
@@ -406,6 +411,11 @@ {% endif %} {{ hook(constant('HOOK_CHARACTERS_AFTER_CHARACTERS')) }} + {% if canEdit %} + + Edit + + {% endif %}