From 27522d0053d90ca98bf7b307435934ef5702520e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B3th=20Rich=C3=A1rd?= Date: Tue, 30 Jul 2019 13:38:51 +0200 Subject: [PATCH] added news --- _class/class_news.php | 211 +++++++++++++++++ _class/class_page.php | 12 +- _css/default.css | 21 ++ _css/default_view.css | 22 ++ _image/news.png | Bin 0 -> 17252 bytes _include/include_create.php | 4 + _include/include_delete_news.php | 9 + _include/include_diary.php | 12 + _include/include_information.php | 29 ++- _include/include_information_wall.php | 14 ++ event_handler.php | 15 ++ queries/news_20190729.sql | 16 ++ template/templates/news_create.tpl | 27 +++ template/templates/news_data_edit.tpl | 31 +++ template/templates/news_list.tpl | 15 ++ template/templates/user_diary.tpl | 319 +++++++++++++++----------- 16 files changed, 610 insertions(+), 147 deletions(-) create mode 100644 _class/class_news.php create mode 100644 _image/news.png create mode 100644 _include/include_delete_news.php create mode 100644 _include/include_information_wall.php create mode 100644 queries/news_20190729.sql create mode 100644 template/templates/news_create.tpl create mode 100644 template/templates/news_data_edit.tpl create mode 100644 template/templates/news_list.tpl diff --git a/_class/class_news.php b/_class/class_news.php new file mode 100644 index 0000000..c78ddf9 --- /dev/null +++ b/_class/class_news.php @@ -0,0 +1,211 @@ +assoc_array("select * from news where n_id = " . $_n_id); + $news_data_array = $news_data_assoc_array[0]; + foreach ($news_data_array as $field => $value) { + $function_name = "set_" . $field; + $this->$function_name($value); //alapadatok beállítása + if ($field == 'n_user_ua_id' && !empty($value)) { + $coach = new user(); + $coach->set_user_data_by_id($value); + $this->set_n_user($coach); + } + } + } + + public static function create_news($_values, $user_id = null) { + global $sql, $user; + if (null === $user_id) { + $user_id = $user->get_ua_id(); + } + + if (!isset($_values['n_title'])) { + $title = 'null'; + } + else { + $title = $_values['n_title']; + } + + return $sql->insert_into('news', array( + 'n_title' => $title, + 'n_user_ua_id' => $user_id, + 'n_text' => $_values['n_text'], + 'n_date' => $_values['n_date'] + )); + } + + public static function update_news($_values, $n_id) { + global $sql, $user; + + if (!isset($_values['n_title'])) { + $title = 'null'; + } + else { + $title = $_values['n_title']; + } + + $sql->update_table('news', array( + 'n_title' => $title, + 'n_text' => $_values['n_text'], + 'n_date' => $_values['n_date'] + ), array( + 'n_id' => $n_id, + )); + } + + /** + * @return mixed + */ + public function get_n_id() + { + return $this->n_id; + } + + /** + * @param mixed $n_id + * + * @return self + */ + public function set_n_id($n_id) + { + $this->n_id = $n_id; + + return $this; + } + + /** + * @return mixed + */ + public function get_n_title() + { + return $this->n_title; + } + + /** + * @param mixed $n_title + * + * @return self + */ + public function set_n_title($n_title) + { + $this->n_title = $n_title; + + return $this; + } + + /** + * @return mixed + */ + public function get_n_date() + { + return $this->n_date; + } + + /** + * @param mixed $n_date + * + * @return self + */ + public function set_n_date($n_date) + { + $this->n_date = $n_date; + + return $this; + } + + /** + * @return mixed + */ + public function get_n_text() + { + return $this->n_text; + } + + /** + * @param mixed $n_text + * + * @return self + */ + public function set_n_text($n_text) + { + $this->n_text = $n_text; + + return $this; + } + + /** + * @return mixed + */ + public function get_n_deleted() + { + return $this->n_deleted; + } + + /** + * @param mixed $n_deleted + * + * @return self + */ + public function set_n_deleted($n_deleted) + { + $this->n_deleted = $n_deleted; + + return $this; + } + + /** + * @return mixed + */ + public function get_n_user_ua_id() + { + return $this->n_user_ua_id; + } + + /** + * @param mixed $n_user_ua_id + * + * @return self + */ + public function set_n_user_ua_id($n_user_ua_id) + { + $this->n_user_ua_id = $n_user_ua_id; + + return $this; + } + + /** + * @return mixed + */ + public function get_n_user() + { + return $this->n_user; + } + + /** + * @param mixed $n_user + * + * @return self + */ + public function set_n_user($n_user) + { + $this->n_user = $n_user; + + return $this; + } +} + + +?> diff --git a/_class/class_page.php b/_class/class_page.php index 6749ac2..c1a0221 100644 --- a/_class/class_page.php +++ b/_class/class_page.php @@ -244,6 +244,10 @@ class page { # STATISZTIKÁK include('include_stats.php'); break; + case 'news': + # INFORMÁCIÓS FAL + include('include_information.php'); + break; case 'delete_training_type': # EDZÉS TÍPUS TÖRLÉS include('include_delete_training_type.php'); @@ -288,6 +292,10 @@ class page { # BEVÉTEL TÖRLÉS include('include_delete_money_income.php'); break; + case 'delete_news': + # HÍR TÖRLÉS + include('include_delete_news.php'); + break; case 'logout': # kijelentkezés $from = "admin"; @@ -321,7 +329,7 @@ class page { break; case 'information': # információk - include('include_information.php'); + include('include_information_wall.php'); break; default: include('include_diary.php'); @@ -341,7 +349,7 @@ class page { break; case 'information': # információk - include('include_information.php'); + include('include_information_wall.php'); break; default: include('include_diary.php'); diff --git a/_css/default.css b/_css/default.css index 2f7e7f7..3a6b520 100644 --- a/_css/default.css +++ b/_css/default.css @@ -317,6 +317,15 @@ a.addbutton.noti { margin-bottom: 5px; } +.list.news .date_separator { + color: black; + background-color: #19f40c; +} + +.list.news .date_separator:hover { + background-color: #24991e; +} + .list_item label { font-weight: bold; } @@ -604,6 +613,12 @@ h1.apply { border-left: 3px solid black; } +.info-wall { + border-top: 2px solid #0a4404; + border-left: none; + margin-top: 20px; +} + .toggle { width: 50px; height: 120px; @@ -847,6 +862,12 @@ form#auto_filters > div > label { margin: 20px; } + .info-wall { + border-left: 2px solid #0a4404; + border-top: none; + margin-top: 0; + } + .diary_header { width: 35%; } diff --git a/_css/default_view.css b/_css/default_view.css index 0a03ae8..7714407 100644 --- a/_css/default_view.css +++ b/_css/default_view.css @@ -97,3 +97,25 @@ div.list div.actual_balance:hover { .full { display: inline-block; } + +.diary_container { + display: flex; + justify-content: stretch; + flex-wrap: wrap; + flex-direction: column; +} + +.diary_container > div { + flex: 1 1 50%; +} + +@media (min-width: 1250px) { + .diary_container { + flex-direction: row; + } + + .list.news, .list.entries { + width: 100%; + padding: 15px; + } +} diff --git a/_image/news.png b/_image/news.png new file mode 100644 index 0000000000000000000000000000000000000000..ef53c32a64a84a2939aa3ed012797d92640db048 GIT binary patch literal 17252 zcmeHvdmz*8`@fEqN|IDgMMXI*QHrs8B1x!{jtOKcp5Rz<_YRO@dl5AEJ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^C1=&06n`h7K;1B3htqlKzJPt2S!A&*8KK9*4Bx?^@7IY)-)s z_|S`uELQ>OR0>e1&}O-P4~_g&fcD09q(5Dj@sFYDSw78bu=mD83m;z$M0i7f?>pE? zbK*$0$Vc8CRGROEIzbTo%RId)=MepT>z_}@5iE(UY9!j`V|$DR@V{rs*jhVSmHc() G`u_oiw{rXd literal 0 HcmV?d00001 diff --git a/_include/include_create.php b/_include/include_create.php index 944494a..f4abb94 100644 --- a/_include/include_create.php +++ b/_include/include_create.php @@ -186,6 +186,10 @@ switch ($this->get_id()) { $smarty->display('training_template_create.tpl'); break; + case 'news': + # hír létrehozása + $smarty->display('news_create.tpl'); + break; default: # code... break; diff --git a/_include/include_delete_news.php b/_include/include_delete_news.php new file mode 100644 index 0000000..3291cb5 --- /dev/null +++ b/_include/include_delete_news.php @@ -0,0 +1,9 @@ +is_id()) { + $sql->update_table('news', array('n_deleted' => 1), array('n_id' => $this->get_id())); + log::register('delete_news', $this->get_id()); + header("Location: /admin/news"); +} + +?> diff --git a/_include/include_diary.php b/_include/include_diary.php index ba62783..7ce1833 100644 --- a/_include/include_diary.php +++ b/_include/include_diary.php @@ -70,6 +70,18 @@ order by object_date ASC; $smarty->assign('actions', $de_array); $smarty->assign('balance_transfer', $balance_transfer); + //get news + $news_assoc_array = $sql->assoc_array('SELECT * FROM news WHERE n_deleted = 0 ORDER BY n_date DESC;'); + + $news_array = array(); + foreach ($news_assoc_array as $key => $news) { + $new_news = new news(); + $new_news->set_news_data_by_id($news['n_id']); + $news_array[] = $new_news; + } + + $smarty->assign('news_array',$news_array); + //$smarty->assign('balance', $balance); $smarty->display('user_diary.tpl'); diff --git a/_include/include_information.php b/_include/include_information.php index cd98a8d..854128c 100644 --- a/_include/include_information.php +++ b/_include/include_information.php @@ -1,14 +1,29 @@ is_id()) { + $news = new news(); + $news->set_news_data_by_id($this->get_id()); - $setv_id = $sql->single_variable($info_query); + $smarty->assign('news',$news); + $smarty->display('news_data_edit.tpl'); +} +else { + //lista + $news_query = "SELECT * FROM news WHERE n_deleted = 0 AND n_user_ua_id = " . $user->get_ua_id() . " ORDER BY n_date DESC"; - $new_setval = new setting_value(); - $new_setval->set_setting_value_data_by_id($setv_id); - $smarty->assign('setting', $new_setval); + $news_assoc_array = $sql->assoc_array($news_query); + + $news_array = array(); + foreach ($news_assoc_array as $key => $news) { + $new_news = new news(); + $new_news->set_news_data_by_id($news['n_id']); + $news_array[] = $new_news; + } + + $smarty->assign('news_array', $news_array); + $smarty->display('news_list.tpl'); +} - $smarty->display('information.tpl'); ?> diff --git a/_include/include_information_wall.php b/_include/include_information_wall.php new file mode 100644 index 0000000..cd98a8d --- /dev/null +++ b/_include/include_information_wall.php @@ -0,0 +1,14 @@ +single_variable($info_query); + + $new_setval = new setting_value(); + $new_setval->set_setting_value_data_by_id($setv_id); + $smarty->assign('setting', $new_setval); + + $smarty->display('information.tpl'); +?> diff --git a/event_handler.php b/event_handler.php index 28ca85a..0efefa5 100644 --- a/event_handler.php +++ b/event_handler.php @@ -568,6 +568,21 @@ if (isset($_POST['action'])) { log::register('update_training_template', $_POST['tt_id']); header('Location: /admin/training_templates/'.$_POST['tt_id']); break; + case 'news_create': + # új hír + unset($_POST['action']); + $new_news_id = news::create_news($_POST); + log::register('new_news', $new_news_id); + header('Location: /admin/news/'.$new_news_id); + break; + case 'news_update': + unset($_POST['action']); + $n_id = $_POST['n_id']; + unset($_POST['n_id']); + news::update_news($_POST, $n_id); + log::register('update_news', $n_id); + header('Location: /admin/news/'.$n_id); + break; default: # code... break; diff --git a/queries/news_20190729.sql b/queries/news_20190729.sql new file mode 100644 index 0000000..bb0c04a --- /dev/null +++ b/queries/news_20190729.sql @@ -0,0 +1,16 @@ +CREATE TABLE `news` ( + `n_id` INT NOT NULL AUTO_INCREMENT, + `n_title` VARCHAR(255) NULL DEFAULT NULL, + `n_date` DATETIME NOT NULL, + `n_text` TEXT NULL DEFAULT NULL, + `n_user_ua_id` INT NOT NULL, + `n_deleted` INT NULL DEFAULT 0, + PRIMARY KEY (`n_id`)); + +INSERT INTO `subpage` (`spage_url`, `spage_title`, `spage_page_id`) VALUES ('news', 'Információk', '1'); + +INSERT INTO `log_category` (`logc_name`, `logc_title`, `logc_type`, `logc_table`, `logc_field`, `logc_selector`) VALUES ('new_news', 'Új hír', '1', 'news', 'n_title', 'n_id'); +INSERT INTO `log_category` (`logc_name`, `logc_title`, `logc_type`, `logc_table`, `logc_field`, `logc_selector`) VALUES ('update_news', 'Hír módosítása', '1', 'news', 'n_title', 'n_id'); +INSERT INTO `log_category` (`logc_name`, `logc_title`, `logc_type`, `logc_table`, `logc_field`, `logc_selector`) VALUES ('delete_news', 'Hír törlése', '1', 'news', 'n_title', 'n_id'); + +DELETE FROM `subpage` WHERE `spage_name` = 'information'; diff --git a/template/templates/news_create.tpl b/template/templates/news_create.tpl new file mode 100644 index 0000000..9b95575 --- /dev/null +++ b/template/templates/news_create.tpl @@ -0,0 +1,27 @@ +
+
+ + +
+ +
+
+
+ +
+
+
+ +
+
+
+
+ +
+
+
+
+ + diff --git a/template/templates/news_data_edit.tpl b/template/templates/news_data_edit.tpl new file mode 100644 index 0000000..5eba347 --- /dev/null +++ b/template/templates/news_data_edit.tpl @@ -0,0 +1,31 @@ +
+ +
+ + + +
+ +
+
+
+ +
+
+
+ +
+
+
+
+ +
+
+
+
+ + diff --git a/template/templates/news_list.tpl b/template/templates/news_list.tpl new file mode 100644 index 0000000..c5611cb --- /dev/null +++ b/template/templates/news_list.tpl @@ -0,0 +1,15 @@ + + + diff --git a/template/templates/user_diary.tpl b/template/templates/user_diary.tpl index 6d44f9a..733abee 100644 --- a/template/templates/user_diary.tpl +++ b/template/templates/user_diary.tpl @@ -1,155 +1,175 @@ -
+
- {foreach $actions as $action} +
- {if $action@first} -
-
- - Aktuális egyenleg: {$action->get_de_balance()|number_format:0:'':' '} Ft - + {foreach $actions as $action} + + {if $action@first} +
+
+ + Aktuális egyenleg: {$action->get_de_balance()|number_format:0:'':' '} Ft + +
+ {/if} + + {if $action->get_de_training()|is_a:'training'} + + {if !$action@first && + $actions[$action@index-1]->get_de_training()|is_a:'training' && + $actions[$action@index]->get_de_training()->get_tr_date()|substr:5:2 != $actions[$action@index-1]->get_de_training()->get_tr_date()|substr:5:2 + + || + + !$action@first && + $actions[$action@index-1]->get_de_money_deposit()|is_a:'money_deposit' && + $actions[$action@index]->get_de_training()->get_tr_date()|substr:5:2 != $actions[$action@index-1]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2 + + } +
- {/if} - - {if $action->get_de_training()|is_a:'training'} - - {if !$action@first && - $actions[$action@index-1]->get_de_training()|is_a:'training' && - $actions[$action@index]->get_de_training()->get_tr_date()|substr:5:2 != $actions[$action@index-1]->get_de_training()->get_tr_date()|substr:5:2 - - || - - !$action@first && - $actions[$action@index-1]->get_de_money_deposit()|is_a:'money_deposit' && - $actions[$action@index]->get_de_training()->get_tr_date()|substr:5:2 != $actions[$action@index-1]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2 - - } - -
- {$actions[$action@index]->get_de_training()->get_tr_date()|substr:0:4}. - {$months[$actions[$action@index]->get_de_training()->get_tr_date()|substr:5:2]} - ({$user_login->get_training_number_in_month({$action->get_de_training()->get_tr_date()|substr:0:4},{$action->get_de_training()->get_tr_date()|substr:5:2})} edzés) -
- Egyenleg - -
-
-
- - {elseif $action@first} - {$actions[$action@index]->get_de_training()->get_tr_date()|substr:0:4}. - {$months[$actions[$action@index]->get_de_training()->get_tr_date()|substr:5:2]} - ({$user_login->get_training_number_in_month({$action->get_de_training()->get_tr_date()|substr:0:4},{$action->get_de_training()->get_tr_date()|substr:5:2})} edzés) -
- Egyenleg - -
-
-
- - {/if} -
-
- - {$action->get_de_training()->get_tr_date()|substr:0:4}. + {$actions[$action@index]->get_de_training()->get_tr_date()|substr:0:4}. {$months[$actions[$action@index]->get_de_training()->get_tr_date()|substr:5:2]} - {$action->get_de_training()->get_tr_date_day()}. - {$days[$action->get_de_training()->get_tr_date_day_of_week()]} - {$action->get_de_training()->get_tr_date_time()} + ({$user_login->get_training_number_in_month({$action->get_de_training()->get_tr_date()|substr:0:4},{$action->get_de_training()->get_tr_date()|substr:5:2})} edzés) +
+ Egyenleg + +
-
- {if $action->get_de_training()->get_tr_training_type_trt_id()}{$action->get_de_training()->get_tr_type_name_by_id()} edzés{/if} - {$action->get_de_training()->get_tr_duration()} p - {if $action->get_de_training()->is_coach()} - {foreach $action->get_de_training()->get_tr_coaches_name() as $coach_name} - {if $coach_name@first}({/if}{$coach_name}{if $coach_name@last}){else}, {/if} - {/foreach} +
+ + {elseif $action@first} + {$actions[$action@index]->get_de_training()->get_tr_date()|substr:0:4}. + {$months[$actions[$action@index]->get_de_training()->get_tr_date()|substr:5:2]} + ({$user_login->get_training_number_in_month({$action->get_de_training()->get_tr_date()|substr:0:4},{$action->get_de_training()->get_tr_date()|substr:5:2})} edzés) +
+ Egyenleg + +
+
+
+ {/if} - - {assign var="discount" value=""} - {if $action->get_de_has_discount()} - {if $action->get_de_discount_id() == 1} - {assign var="discount" value="Próba kedvezmény"} - {elseif $action->get_de_discount_id() == 2} - {assign var="discount" value="Havi 10+ kedvezmény"} - {elseif $action->get_de_discount_id() == 3} - {assign var="discount" value="Duplázó kedvezmény"} - {/if} - {/if} - -
- Egyenleg: {if $action->get_de_balance()>0}+{/if}{$action->get_de_balance()|number_format:0:'':' '} Ft - {if $discount != ""}
{$discount}{/if} -
-
- -
- - - {if $action->get_de_balance()>0}+{/if}{$action->get_de_balance()|number_format:0:'':' '} Ft
{$discount} -
-
- - {elseif $action->get_de_money_deposit()|is_a:'money_deposit'} - - - {if !$action@first && - $actions[$action@index-1]->get_de_training()|is_a:'training' && - $actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2 != $actions[$action@index-1]->get_de_training()->get_tr_date()|substr:5:2 - - || - - !$action@first && - $actions[$action@index-1]->get_de_money_deposit()|is_a:'money_deposit' && - $actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2 != $actions[$action@index-1]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2 - - } - -
- {$actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:0:4}. - {$months[$actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2]} - ({$user_login->get_training_number_in_month({$action->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:0:4},{$action->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2})} edzés) - - -
- - {elseif $action@first} - - {$actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:0:4}. - {$months[$actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2]} - ({$user_login->get_training_number_in_month({$action->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:0:4},{$action->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2})} edzés) - - -
- - - {/if} -
-
+
+
- {$action->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:0:4}. - {$months[$actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2]} - {$action->get_de_money_deposit()->get_mod_money_income()->get_mi_date_day()}. + {$action->get_de_training()->get_tr_date()|substr:0:4}. + {$months[$actions[$action@index]->get_de_training()->get_tr_date()|substr:5:2]} + {$action->get_de_training()->get_tr_date_day()}. + {$days[$action->get_de_training()->get_tr_date_day_of_week()]} + {$action->get_de_training()->get_tr_date_time()}
- befizetés: {$action->get_de_money_deposit()->get_mod_money_income()->get_mi_sum(true)} Ft + {if $action->get_de_training()->get_tr_training_type_trt_id()}{$action->get_de_training()->get_tr_type_name_by_id()} edzés{/if} + {$action->get_de_training()->get_tr_duration()} p + {if $action->get_de_training()->is_coach()} + {foreach $action->get_de_training()->get_tr_coaches_name() as $coach_name} + {if $coach_name@first}({/if}{$coach_name}{if $coach_name@last}){else}, {/if} + {/foreach} + {/if} + + {assign var="discount" value=""} + {if $action->get_de_has_discount()} + {if $action->get_de_discount_id() == 1} + {assign var="discount" value="Próba kedvezmény"} + {elseif $action->get_de_discount_id() == 2} + {assign var="discount" value="Havi 10+ kedvezmény"} + {elseif $action->get_de_discount_id() == 3} + {assign var="discount" value="Duplázó kedvezmény"} + {/if} + {/if} + +
+ Egyenleg: {if $action->get_de_balance()>0}+{/if}{$action->get_de_balance()|number_format:0:'':' '} Ft + {if $discount != ""}
{$discount}{/if} +
- {assign var="discount" value=""} + + {if $action->get_de_balance()>0}+{/if}{$action->get_de_balance()|number_format:0:'':' '} Ft
{$discount}
+
+ + {elseif $action->get_de_money_deposit()|is_a:'money_deposit'} + + + {if !$action@first && + $actions[$action@index-1]->get_de_training()|is_a:'training' && + $actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2 != $actions[$action@index-1]->get_de_training()->get_tr_date()|substr:5:2 + + || + + !$action@first && + $actions[$action@index-1]->get_de_money_deposit()|is_a:'money_deposit' && + $actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2 != $actions[$action@index-1]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2 + + } + +
+ {$actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:0:4}. + {$months[$actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2]} + ({$user_login->get_training_number_in_month({$action->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:0:4},{$action->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2})} edzés) + + +
+ + {elseif $action@first} + + {$actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:0:4}. + {$months[$actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2]} + ({$user_login->get_training_number_in_month({$action->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:0:4},{$action->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2})} edzés) + + +
+ + + {/if} +
+
+ + {$action->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:0:4}. + {$months[$actions[$action@index]->get_de_money_deposit()->get_mod_money_income()->get_mi_date()|substr:5:2]} + {$action->get_de_money_deposit()->get_mod_money_income()->get_mi_date_day()}. + +
+ befizetés: {$action->get_de_money_deposit()->get_mod_money_income()->get_mi_sum(true)} Ft +
+ +
+ {assign var="discount" value=""} + {if $action->get_de_balance()>0}+{/if}{$action->get_de_balance()|number_format:0:'':' '} Ft
{$discount} +
+
+ + {/if} + + {if $action@last} + +
+ + {/if} + {/foreach} +
+
+
+
+

+ Hírek, információk +

- - {/if} - - {if $action@last} - -
- - {/if} - {/foreach} + {foreach $news_array as $news} + + {$news->get_n_title()} - {$news->get_n_date()|date_format:"%Y.%m.%d %H:%M"} + +
+ {$news->get_n_text()} +
+ {/foreach} +
+