diff --git a/_class/class_money_deposit.php b/_class/class_money_deposit.php index ae52dee..b05c3f4 100644 --- a/_class/class_money_deposit.php +++ b/_class/class_money_deposit.php @@ -52,8 +52,19 @@ class money_deposit { return $this->mod_date; } - public function get_mod_sum() { - return $this->mod_sum; + public function get_mod_date_day() { + $day = date("d", strtotime($this->mod_date)); + if (substr($day, 0, 1) == '0') return substr($day, 1, 1); + return date("d", strtotime($this->mod_date)); + } + + public function get_mod_sum($formatted = null) { + if (!$formatted) { + return $this->mod_sum; + } + else { + return number_format($this->mod_sum, 0, '', ' '); + } } public function get_mod_deleted() { diff --git a/_css/default_view.css b/_css/default_view.css index 3ef828a..7fe065b 100644 --- a/_css/default_view.css +++ b/_css/default_view.css @@ -28,4 +28,16 @@ ul.topnav li a:hover, ul.topnav li a span:hover { background: transparent; color: #01112b; text-decoration: underline; +} + +div.list div.money_deposit { + background-color: #FD9500; + border-left: 2px solid #002E4C; + color: #020372; +} + +.list .money_deposit:hover { + background-color: #F3BF75; + border-left: 2px solid #000; + color: #002E4C; } \ No newline at end of file diff --git a/_include/include_diary.php b/_include/include_diary.php index 0326232..2a695dc 100644 --- a/_include/include_diary.php +++ b/_include/include_diary.php @@ -7,25 +7,46 @@ if ($this->is_id()) { else { # EDZÉS LISTA - $training_list_query = " - SELECT pr_training_tr_id FROM presence - JOIN training ON tr_id = pr_training_tr_id - WHERE - pr_user_kid_uk_id = ".$user->get_uk_id()." - AND tr_deleted = 0 - ORDER BY tr_date DESC; + $action_list_query = " + SELECT + * + FROM + ((SELECT + pr_training_tr_id as object_id, + tr_date as object_date, + if(pr_training_tr_id is not null, 'training', null) as object_type + FROM + presence + JOIN training ON tr_id = pr_training_tr_id + WHERE + pr_user_kid_uk_id = ". $user->get_uk_id() . " + AND tr_deleted = 0) UNION (SELECT + mod_id, + mod_date, + if(mod_id is not null, 'money_deposit', null) as object_type + FROM + money_deposit + WHERE + mod_user_kid_uk_id = ". $user->get_uk_id() . " and mod_deleted = 0)) actions + order by object_date DESC; "; - $training_assoc_array = $sql->assoc_array($training_list_query); + $action_assoc_array = $sql->assoc_array($action_list_query); - $trainings = array(); - foreach ($training_assoc_array as $training) { - $new_training = new training(); - $new_training->set_training_data_by_id($training['pr_training_tr_id']); - $trainings[] = $new_training; + $actions = array(); + foreach ($action_assoc_array as $action) { + if ($action['object_type'] == 'training') { + $new_training = new training(); + $new_training->set_training_data_by_id($action['object_id']); + $actions[] = $new_training; + } + elseif ($action['object_type'] == 'money_deposit') { + $new_mod = new money_deposit(); + $new_mod->set_mod_data_by_id($action['object_id']); + $actions[] = $new_mod; + } } - - $smarty->assign('training_array', $trainings); + $smarty->assign('actions', $actions); $smarty->display('user_diary.tpl'); } diff --git a/template/templates/user_diary.tpl b/template/templates/user_diary.tpl index 542befc..58223a5 100644 --- a/template/templates/user_diary.tpl +++ b/template/templates/user_diary.tpl @@ -1,44 +1,104 @@
+ {$actions[$action@index]->get_tr_date()|substr:0:4}.
+ {$months[$actions[$action@index]->get_tr_date()|substr:5:2]}
+
-
+
+
+
+
+
+