created stats menu with balance stat
This commit is contained in:
@@ -160,6 +160,10 @@ class page {
|
|||||||
# BEÁLLÍTÁSOK
|
# BEÁLLÍTÁSOK
|
||||||
include('include_balance_list.php');
|
include('include_balance_list.php');
|
||||||
break;
|
break;
|
||||||
|
case 'stats':
|
||||||
|
# STATISZTIKÁK
|
||||||
|
include('include_stats.php');
|
||||||
|
break;
|
||||||
case 'delete_training_type':
|
case 'delete_training_type':
|
||||||
# EDZÉS TÍPUS TÖRLÉS
|
# EDZÉS TÍPUS TÖRLÉS
|
||||||
include('include_delete_training_type.php');
|
include('include_delete_training_type.php');
|
||||||
|
|||||||
57
_class/class_stat.php
Normal file
57
_class/class_stat.php
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class stat {
|
||||||
|
private $stat_id;
|
||||||
|
private $stat_name;
|
||||||
|
private $stat_order;
|
||||||
|
private $stat_deleted;
|
||||||
|
|
||||||
|
|
||||||
|
public function set_stat_id($_item) {
|
||||||
|
$this->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);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
56
_include/include_stats.php
Normal file
56
_include/include_stats.php
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
# STATISZTIKÁK
|
||||||
|
|
||||||
|
if ($this->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');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
9
template/templates/stat_balance.html
Normal file
9
template/templates/stat_balance.html
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<div class="list">
|
||||||
|
<a href="#">
|
||||||
|
<div class="list_item">
|
||||||
|
<img src="/_image/stat.png">
|
||||||
|
Egyenleg: {$balance|number_format:0:'':' '} Ft
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
14
template/templates/stat_balance.tpl
Normal file
14
template/templates/stat_balance.tpl
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<div class="buttons">
|
||||||
|
|
||||||
|
<a href="/admin/stats" class="addbutton big">Vissza a statisztikákhoz</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="list">
|
||||||
|
<a href="#">
|
||||||
|
<div class="list_item">
|
||||||
|
<img src="/_image/stat.png">
|
||||||
|
Egyenleg: {$balance|number_format:0:'':' '} Ft
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
11
template/templates/stat_list.tpl
Normal file
11
template/templates/stat_list.tpl
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<div class="list">
|
||||||
|
{foreach $stats as $stat}
|
||||||
|
<a href="/admin/stats/{$stat->get_stat_id()}">
|
||||||
|
<div class="list_item">
|
||||||
|
<img src="/_image/stat.png">
|
||||||
|
{$stat->get_stat_name()}
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
{/foreach}
|
||||||
|
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user