From 90f6601d9959475df9685bae10f4e8c2193472d9 Mon Sep 17 00:00:00 2001 From: Thomas Mudrunka Date: Fri, 31 May 2013 06:43:44 +0200 Subject: [PATCH] JSON API ke kase --- apis/bank.inc.php | 3 +++ assistants/bank.inc.php | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 apis/bank.inc.php diff --git a/apis/bank.inc.php b/apis/bank.inc.php new file mode 100644 index 0000000..419dd35 --- /dev/null +++ b/apis/bank.inc.php @@ -0,0 +1,3 @@ +$acc,"${bank_table}_total"=>bank_get_total($ctx, $acc)); + foreach($accounts as $acc) $overview[]=array("${prefix}account"=>$acc,"${prefix}total"=>bank_get_total($ctx, $acc)); return $overview; } +if(isset($bank_json_only) && $bank_json_only) die(json_encode(array( + 'overview'=>bank_get_overview($this) +))); + if(isset($_POST['create_account'])) { bank_add_account($this, $_POST['account_name']); $this->post_redirect_get("$URL_INTERNAL","Účet byl vytvořen"); @@ -105,7 +109,7 @@ switch($SUBPATH[0]) { $result = $this->db->safe_query_fetch("SELECT SUM(${bank_table}_amount) as troughput FROM ${bank_table};"); echo("Obrat: ".$result[0]['troughput'].' '.$bank_currency); $result = $this->db->safe_query_fetch("SELECT * FROM `${bank_table}` ORDER BY ${bank_table}_time DESC;"); - echo $this->html->render_item_table(bank_get_overview($this),'bank'); + echo $this->html->render_item_table(bank_get_overview($this, $bank_table.'_'),'bank'); echo ("

Přehled transakcí

"); } else { $account=bank_name($_GET['account']); -- 2.30.2