Add category color/font support for web view
This commit is contained in:
parent
2c7a1ca252
commit
41ace4621e
|
@ -1,3 +1,4 @@
|
|||
<?php
|
||||
/*
|
||||
Copyright 2010 Grégory Soutadé
|
||||
|
||||
|
@ -17,8 +18,6 @@
|
|||
along with KissCount. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
<?php
|
||||
|
||||
class User
|
||||
{
|
||||
public $id;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<?php
|
||||
/*
|
||||
Copyright 2010 Grégory Soutadé
|
||||
|
||||
|
@ -17,8 +18,6 @@
|
|||
along with KissCount. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
<?php
|
||||
|
||||
$BDD_FILE = '/var/nfs/kc.bdd';
|
||||
|
||||
try {
|
||||
|
@ -52,6 +51,28 @@ function IsUserValid($user, $password)
|
|||
return $result->fetchArray();
|
||||
}
|
||||
|
||||
function ExtractStyle(&$category)
|
||||
{
|
||||
$s = "background-color:" . $category["backcolor"] . ";";
|
||||
$s .= "color:" . $category["forecolor"] . ";";
|
||||
|
||||
if ($category["font"] != "")
|
||||
{
|
||||
$params = explode(";", $category["font"]);
|
||||
|
||||
// size ; xx ; 93 italic ; 92 bold ; face name
|
||||
|
||||
$s .= "font-size:" . $params[0] . "px;";
|
||||
if ($params[2] == "93")
|
||||
$s .= "font-style:italic;";
|
||||
if ($params[3] == "92")
|
||||
$s .= "font-weight:bold;";
|
||||
$s .= "font-family:" . $params[4] . ";";
|
||||
}
|
||||
|
||||
$category["style"] = $s;
|
||||
}
|
||||
|
||||
function LoadUser($name)
|
||||
{
|
||||
global $db;
|
||||
|
@ -79,7 +100,10 @@ function LoadUser($name)
|
|||
$user->categories = array();
|
||||
|
||||
while ($row = $result->fetchArray())
|
||||
{
|
||||
ExtractStyle($row);
|
||||
array_push($user->categories, $row);
|
||||
}
|
||||
|
||||
$result = $db->query("SELECT * FROM preference WHERE user='$user->id' ORDER by name");
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<?php
|
||||
/*
|
||||
Copyright 2010 Grégory Soutadé
|
||||
|
||||
|
@ -17,7 +18,6 @@
|
|||
along with KissCount. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
<?php
|
||||
include "kisscount.php" ;
|
||||
|
||||
session_start();
|
||||
|
@ -209,7 +209,7 @@ while($operation = $operations->fetchArray())
|
|||
else
|
||||
$tr_class = "";
|
||||
}
|
||||
echo "<tr $tr_class bgcolor='" . $category["color"] ."'><td>" . $operation["description"] . "</td>";
|
||||
echo "<tr $tr_class style='" . $category["style"] . "'><td>" . $operation["description"] . "</td>";
|
||||
echo "<td>" . date("d/m/Y", mktime(0, 0, 0, $operation["month"]+1, $operation["day"]+1, $operation["year"])) . "</td>";
|
||||
if ($operation["amount"] < 0)
|
||||
echo "<td align='right'>" . number_format(-$operation["amount"], 2) . "</td><td />";
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<?php
|
||||
/*
|
||||
Copyright 2010 Grégory Soutadé
|
||||
|
||||
|
@ -17,7 +18,6 @@
|
|||
along with KissCount. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
<?php
|
||||
include "User.php";
|
||||
include "database.php";
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user