diff --git a/www/User.php b/www/User.php index 32c8c63..00b46b0 100755 --- a/www/User.php +++ b/www/User.php @@ -23,6 +23,7 @@ class User public $id; public $accounts; public $categories; + public $tags; public $preferences; function GetCategory($id) @@ -44,6 +45,22 @@ class User return LoadCategory($this, $id); } + function GetTag($id) + { + if ($id == "" || $id == "0") + { + $tag["id"] = 0; + $tag["name"] = ""; + + return $tag; + } + + foreach($this->tags as $i => $tag) + if ($tag["id"] == "$id") return $tag; + + return LoadTag($this, $id); + } + function IsAccountBlocked($id) { foreach($this->accounts as $i => $account) diff --git a/www/database.php b/www/database.php index 8ab6e65..10abff2 100755 --- a/www/database.php +++ b/www/database.php @@ -140,6 +140,22 @@ function LoadCategory(&$user, $id) return ""; } +function LoadTag(&$user, $id) +{ + global $db; + + $result = $db->query("SELECT * FROM tag WHERE id='$id'"); + + if ($row = $result->fetchArray()) + { + array_push($user->tags, $row); + + return $row; + } + + return ""; +} + function GetAccountAmount($id, $month, $year) { global $db; diff --git a/www/index.php b/www/index.php index cd7e7b6..54a77ca 100755 --- a/www/index.php +++ b/www/index.php @@ -245,7 +245,7 @@ function toggleOperations(parent, operations)

- + $operation) { $category = $_SESSION["user"]->GetCategory($operation["category"]); + $tag = $_SESSION["user"]->GetTag($operation["tag"]); if ($operation["fix_cost"] == "0") { $cur_week = date("W", mktime(0, 0, 0, $operation["month"]+1, $operation["day"]+1, $operation["year"])); @@ -294,6 +295,7 @@ foreach($operations as $i => $operation) else echo ""; + echo ""; echo "\n"; } ?> @@ -351,6 +353,6 @@ foreach($operations as $i => $operation)

-
KissCount © 2010-2012 Grégory Soutadé
+
KissCount © 2010-2014 Grégory Soutadé
\ No newline at end of file
DescriptionDateDebitCreditCategoryAccount
DescriptionDateDebitCreditCategoryAccountTag
"; echo "" . $_SESSION["user"]->GetAccountName($operation["account"]) . "" . $tag["name"] . "