diff --git a/_class/class_page.php b/_class/class_page.php index 8a44c7d..bd974ad 100755 --- a/_class/class_page.php +++ b/_class/class_page.php @@ -160,6 +160,10 @@ class page { # BEÁLLÍTÁSOK include('include_balance_list.php'); break; + case 'stats': + # STATISZTIKÁK + include('include_stats.php'); + break; case 'delete_training_type': # EDZÉS TÍPUS TÖRLÉS include('include_delete_training_type.php'); diff --git a/_class/class_stat.php b/_class/class_stat.php new file mode 100644 index 0000000..d92c70d --- /dev/null +++ b/_class/class_stat.php @@ -0,0 +1,57 @@ +stat_id = $_item; + } + + public function set_stat_name($_item) { + $this->stat_name = $_item; + } + + public function set_stat_order($_item) { + $this->stat_order = $_item; + } + + public function set_stat_deleted($_item) { + $this->stat_deleted = $_item; + } + + public function get_stat_id() { + return $this->stat_id; + } + + public function get_stat_name() { + return $this->stat_name; + } + + public function get_stat_order() { + return $this->stat_order; + } + + public function get_stat_deleted() { + return $this->stat_deleted; + } + + public function set_stat_data_by_id($_stat_id) { + global $sql; + $stat_data_assoc_array = $sql->assoc_array("select * from statistics where stat_id = " . $_stat_id); + $stat_data_array = $stat_data_assoc_array[0]; + foreach ($stat_data_array as $field => $value) { + $function_name = "set_" . $field; + $this->$function_name($value); + + } + } + +} + + + +?> \ No newline at end of file diff --git a/_include/include_stats.php b/_include/include_stats.php new file mode 100644 index 0000000..5a6b4fc --- /dev/null +++ b/_include/include_stats.php @@ -0,0 +1,56 @@ +is_id()) { + + # ADOTT STAT MEGJELENÍTÉSE + # nem lehet rá univerzális megoldást adni, mindegyiknél más kell majd + # todo: stat_group-ok és stat_value-k + + if (1 == $this->get_id()) { + $balance_query = " + select + (select + sum(mod_sum) + from + money_deposit) - (select + sum(mox_sum) + from + money_expense) as diff + from dual; + "; + + $balance = $sql->single_variable($balance_query); + + $smarty->assign('balance',$balance); + $smarty->display('stat_balance.tpl'); + } + +} + +else { + + # STAT LISTA + + $stat_query = "SELECT * FROM statistics WHERE stat_deleted = 0 ORDER BY stat_order ASC;"; + $stat_assoc_array = $sql->assoc_array($stat_query); + + $stats = array(); + foreach ($stat_assoc_array as $stat) { + $new_stat = new stat(); + $new_stat->set_stat_data_by_id($stat['stat_id']); + $stats[] = $new_stat; + } + + $smarty->assign('stats',$stats); + $smarty->display('stat_list.tpl'); + +} + + + + + +?> \ No newline at end of file diff --git a/template/templates/stat_balance.html b/template/templates/stat_balance.html new file mode 100644 index 0000000..bbf3825 --- /dev/null +++ b/template/templates/stat_balance.html @@ -0,0 +1,9 @@ +
\ No newline at end of file diff --git a/template/templates/stat_balance.tpl b/template/templates/stat_balance.tpl new file mode 100644 index 0000000..69621f8 --- /dev/null +++ b/template/templates/stat_balance.tpl @@ -0,0 +1,14 @@ + + \ No newline at end of file diff --git a/template/templates/stat_list.tpl b/template/templates/stat_list.tpl new file mode 100644 index 0000000..70b9cb9 --- /dev/null +++ b/template/templates/stat_list.tpl @@ -0,0 +1,11 @@ +
+ {$stat->get_stat_name()}
+