From d401d0e4e3922c4601dace4e1d5b7c13c730e7c8 Mon Sep 17 00:00:00 2001 From: Nightprince Date: Mon, 14 Oct 2024 11:44:53 +0330 Subject: [PATCH] Module/Character: Clean code --- .../modules/character/css/character.css | 5 ++-- .../character/models/Character_model.php | 14 ++++----- .../modules/character/views/character.tpl | 30 +++++++++---------- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/application/modules/character/css/character.css b/application/modules/character/css/character.css index 28670610c..bcc4fb2e0 100644 --- a/application/modules/character/css/character.css +++ b/application/modules/character/css/character.css @@ -21,9 +21,8 @@ background-image: url(../../../images/misc/bg_alliance_complete.png); } -.col-avatar, -.col-items { - width:70px !important; +.col-avatar, .col-items { + width:70px; } .col-main { diff --git a/application/modules/character/models/Character_model.php b/application/modules/character/models/Character_model.php index 278a5e09b..d86612ff6 100644 --- a/application/modules/character/models/Character_model.php +++ b/application/modules/character/models/Character_model.php @@ -42,7 +42,7 @@ public function characterExists() { $this->connect(); - $query = $this->connection->query("SELECT COUNT(*) AS total FROM " . table("characters", $this->realmId) . " WHERE " . column("characters", "guid", false, $this->realmId) . "= ?", array($this->id)); + $query = $this->connection->query("SELECT COUNT(*) AS total FROM " . table("characters", $this->realmId) . " WHERE " . column("characters", "guid", false, $this->realmId) . "= ?", [$this->id]); $row = $query->getResultArray(); if ($row[0]['total'] > 0) { @@ -59,7 +59,7 @@ public function getCharacter() { $this->connect(); - $query = $this->connection->query(query('get_character', $this->realmId), array($this->id)); + $query = $this->connection->query(query('get_character', $this->realmId), [$this->id]); if ($query && $query->getNumRows() > 0) { $row = $query->getResultArray(); @@ -84,7 +84,7 @@ public function getStats() { $this->connect(); - $query = $this->connection->query("SELECT " . allColumns("character_stats", $this->realmId) . " FROM " . table("character_stats", $this->realmId) . " WHERE " . column("character_stats", "guid", false, $this->realmId) . "= ?", array($this->id)); + $query = $this->connection->query("SELECT " . allColumns("character_stats", $this->realmId) . " FROM " . table("character_stats", $this->realmId) . " WHERE " . column("character_stats", "guid", false, $this->realmId) . "= ?", [$this->id]); if ($query && $query->getNumRows() > 0) { $row = $query->getResultArray(); @@ -102,7 +102,7 @@ public function getItems() { $this->connect(); - $query = $this->connection->query(query("get_inventory_item", $this->realmId), array($this->id)); + $query = $this->connection->query(query("get_inventory_item", $this->realmId), [$this->id]); if ($query && $query->getNumRows() > 0) { return $query->getResultArray(); @@ -134,7 +134,7 @@ public function getGuild() { $this->connect(); - $query = $this->connection->query("SELECT " . column("guild_member", "guildid", true, $this->realmId) . " FROM " . table("guild_member", $this->realmId) . " WHERE " . column("guild_member", "guid", false, $this->realmId) . "= ?", array($this->id)); + $query = $this->connection->query("SELECT " . column("guild_member", "guildid", true, $this->realmId) . " FROM " . table("guild_member", $this->realmId) . " WHERE " . column("guild_member", "guid", false, $this->realmId) . "= ?", [$this->id]); if ($this->connection->error()) { $error = $this->connection->error(); @@ -149,7 +149,7 @@ public function getGuild() return $row[0]['guildid']; } else { - $query2 = $this->connection->query("SELECT " . column("guild", "guildid", true, $this->realmId) . " FROM " . table("guild", $this->realmId) . " WHERE " . column("guild", "leaderguid", false, $this->realmId) . "= ?", array($this->id)); + $query2 = $this->connection->query("SELECT " . column("guild", "guildid", true, $this->realmId) . " FROM " . table("guild", $this->realmId) . " WHERE " . column("guild", "leaderguid", false, $this->realmId) . "= ?", [$this->id]); if ($this->connection->error()) { $error = $this->connection->error(); @@ -176,7 +176,7 @@ public function getGuildName($id) } else { $this->connect(); - $query = $this->connection->query("SELECT " . column("guild", "name", true, $this->realmId) . " FROM " . table("guild", $this->realmId) . " WHERE " . column("guild", "guildid", false, $this->realmId) . "= ?", array($id)); + $query = $this->connection->query("SELECT " . column("guild", "name", true, $this->realmId) . " FROM " . table("guild", $this->realmId) . " WHERE " . column("guild", "guildid", false, $this->realmId) . "= ?", [$this->id]); if ($query && $query->getNumRows() > 0) { $row = $query->getResultArray(); diff --git a/application/modules/character/views/character.tpl b/application/modules/character/views/character.tpl index 020d2292f..9a951712e 100644 --- a/application/modules/character/views/character.tpl +++ b/application/modules/character/views/character.tpl @@ -1,22 +1,22 @@
-
-
- -
-
-
-
- {$name} -
-
{$raceName} {$className}
-
{if $guildName}❮{$guildName}❯{/if} {$realmName}
-
-
-
+
+
+ +
+
+
+
+ {$name} +
+
{$raceName} {$className}
+
{if $guildName}❮{$guildName}❯{/if} {$realmName}
+
+
+
-
+