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)
Description | Date | Debit | Credit | Category | Account | ||
Description | Date | Debit | Credit | Category | Account | Tag | "; echo " | " . $_SESSION["user"]->GetAccountName($operation["account"]) . " | "; + echo "" . $tag["name"] . " | "; echo "\n"; } ?> @@ -351,6 +353,6 @@ foreach($operations as $i => $operation)