added news

This commit is contained in:
Tóth Richárd
2019-07-30 13:38:51 +02:00
parent 0e414de243
commit 27522d0053
16 changed files with 610 additions and 147 deletions

View File

@@ -0,0 +1,27 @@
<div class="form_wrapper">
<form method="post">
<input type="hidden" name="action" value="news_create">
<div>
<label for="n_title">Cím:</label>
<div><input type="text" name="n_title" id="n_title"></div>
</div>
<div>
<label for="n_date">Dátum:</label>
<div><input type="text" name="n_date" id="n_date" value='{$smarty.now|date_format:"%Y-%m-%d %H:%M"}' required></div>
</div>
<div>
<label for="n_text">Szöveg:</label>
<div><textarea type="text" name="n_text" id="n_text"></textarea></div>
</div>
<div>
<div>
<input class="button black" type="submit" value="Létrehozás">
</div>
</div>
</form>
</div>
<script type="text/javascript">
CKEDITOR.replace('n_text');
</script>

View File

@@ -0,0 +1,31 @@
<div class="form_wrapper">
<div class="buttons">
<a href="/admin/delete_news/{$news->get_n_id()}" class="addbutton delete-big">Hír törlése</a>
</div>
<form method="post">
<input type="hidden" name="action" value="news_update">
<input type="hidden" name="n_id" value="{$news->get_n_id()}">
<div>
<label for="n_title">Cím:</label>
<div><input type="text" name="n_title" id="n_title" value="{$news->get_n_title()}"></div>
</div>
<div>
<label for="n_date">Dátum:</label>
<div><input type="text" name="n_date" id="n_date" value='{$news->get_n_date()|date_format:"%Y-%m-%d %H:%M"}' required></div>
</div>
<div>
<label for="n_text">Szöveg:</label>
<div><textarea type="text" name="n_text" id="n_text">{$news->get_n_text()}</textarea></div>
</div>
<div>
<div>
<input class="button black" type="submit" value="Mentés">
</div>
</div>
</form>
</div>
<script type="text/javascript">
CKEDITOR.replace('n_text');
</script>

View File

@@ -0,0 +1,15 @@
<div class="buttons">
<a href="/admin/create/news" class="addbutton add-big">Új hír hozzádása</a>
</div>
<div class="list">
{foreach $news_array as $news}
<a href="/admin/news/{$news->get_n_id()}">
<div class="list_item">
<img src="/_image/news.png">
{$news->get_n_title()}
<span style="font-weight: normal; font-style: italic;"> {$news->get_n_date()|date_format:"%Y.%m.%d %H:%M"}</span>
</div>
</a>
{/foreach}
</div>

View File

@@ -1,155 +1,175 @@
<div class="list">
<div class="diary_container">
{foreach $actions as $action}
<div class="list half_width entries">
{if $action@first}
<div style="margin-bottom: 30px;">
<div class="list_item line_height14 bigger_space actual_balance">
<span class="size20 bold">
Aktuális egyenleg: {$action->get_de_balance()|number_format:0:'':' '} Ft
</span>
{foreach $actions as $action}
{if $action@first}
<div style="margin-bottom: 30px;">
<div class="list_item line_height14 bigger_space actual_balance">
<span class="size20 bold">
Aktuális egyenleg: {$action->get_de_balance()|number_format:0:'':' '} Ft
</span>
</div>
</div>
{/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
}
</div>
{/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
}
</div>
<span onclick="block_action('block_{$action->get_de_training()->get_tr_date()|substr:0:4}{$action->get_de_training()->get_tr_date()|substr:5:2}');" class="date_separator clickable">{$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)
<div class="diary_header">
<span class="balance_text" id="balance_text_{$action->get_de_training()->get_tr_date()|substr:0:4}{$action->get_de_training()->get_tr_date()|substr:5:2}">Egyenleg</span>
<img src="/_image/open_folder.png">
</div>
</span>
<div id="block_{$action->get_de_training()->get_tr_date()|substr:0:4}{$action->get_de_training()->get_tr_date()|substr:5:2}" class="month_block">
{elseif $action@first}
<span onclick="block_action('block_{$action->get_de_training()->get_tr_date()|substr:0:4}{$action->get_de_training()->get_tr_date()|substr:5:2}');" class="date_separator clickable">{$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)
<div class="diary_header">
<span class="balance_text" id="balance_text_{$action->get_de_training()->get_tr_date()|substr:0:4}{$action->get_de_training()->get_tr_date()|substr:5:2}">Egyenleg</span>
<img src="/_image/open_folder.png">
</div>
</span>
<div id="block_{$action->get_de_training()->get_tr_date()|substr:0:4}{$action->get_de_training()->get_tr_date()|substr:5:2}" class="month_block">
{/if}
<div class="row">
<div class="list_item line_height14 bigger_space">
<span class="size20 bold">
{$action->get_de_training()->get_tr_date()|substr:0:4}.
<span onclick="block_action('block_{$action->get_de_training()->get_tr_date()|substr:0:4}{$action->get_de_training()->get_tr_date()|substr:5:2}');" class="date_separator clickable">{$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)
<div class="diary_header">
<span class="balance_text" id="balance_text_{$action->get_de_training()->get_tr_date()|substr:0:4}{$action->get_de_training()->get_tr_date()|substr:5:2}">Egyenleg</span>
<img src="/_image/open_folder.png">
</div>
</span>
<br>
{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}
<div id="block_{$action->get_de_training()->get_tr_date()|substr:0:4}{$action->get_de_training()->get_tr_date()|substr:5:2}" class="month_block">
{elseif $action@first}
<span onclick="block_action('block_{$action->get_de_training()->get_tr_date()|substr:0:4}{$action->get_de_training()->get_tr_date()|substr:5:2}');" class="date_separator clickable">{$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)
<div class="diary_header">
<span class="balance_text" id="balance_text_{$action->get_de_training()->get_tr_date()|substr:0:4}{$action->get_de_training()->get_tr_date()|substr:5:2}">Egyenleg</span>
<img src="/_image/open_folder.png">
</div>
</span>
<div id="block_{$action->get_de_training()->get_tr_date()|substr:0:4}{$action->get_de_training()->get_tr_date()|substr:5:2}" class="month_block">
{/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}
<div class="extra_row">
<span class="bold">Egyenleg: {if $action->get_de_balance()>0}+{/if}{$action->get_de_balance()|number_format:0:'':' '} Ft</span>
{if $discount != ""}<br>{$discount}{/if}
</div>
</div>
<div class="side_block">
<span class="bold" style="font-size: 20px;">{if $action->get_de_balance()>0}+{/if}{$action->get_de_balance()|number_format:0:'':' '} Ft</span><br>{$discount}
</div>
</div>
{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
}
</div>
<span onclick="block_action('block_{$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}');" class="date_separator clickable">{$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)
<img src="/_image/open_folder.png">
</span>
<div id="block_{$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}" class="month_block">
{elseif $action@first}
<span onclick="block_action('block_{$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}');" class="date_separator clickable">{$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)
<img src="/_image/open_folder.png">
</span>
<div id="block_{$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}" class="month_block">
{/if}
<div class="row">
<div class="list_item line_height14 bigger_space money_deposit">
<div class="row">
<div class="list_item line_height14 bigger_space">
<span class="size20 bold">
{$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()}
</span>
<br>
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}
<div class="extra_row">
<span class="bold">Egyenleg: {if $action->get_de_balance()>0}+{/if}{$action->get_de_balance()|number_format:0:'':' '} Ft</span>
{if $discount != ""}<br>{$discount}{/if}
</div>
</div>
<div class="side_block">
{assign var="discount" value=""}
<span class="bold" style="font-size: 20px;">{if $action->get_de_balance()>0}+{/if}{$action->get_de_balance()|number_format:0:'':' '} Ft</span><br>{$discount}
</div>
</div>
{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
}
</div>
<span onclick="block_action('block_{$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}');" class="date_separator clickable">{$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)
<img src="/_image/open_folder.png">
</span>
<div id="block_{$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}" class="month_block">
{elseif $action@first}
<span onclick="block_action('block_{$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}');" class="date_separator clickable">{$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)
<img src="/_image/open_folder.png">
</span>
<div id="block_{$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}" class="month_block">
{/if}
<div class="row">
<div class="list_item line_height14 bigger_space money_deposit">
<span class="size20 bold">
{$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()}.
</span>
<br>
befizetés: {$action->get_de_money_deposit()->get_mod_money_income()->get_mi_sum(true)} Ft
</div>
<div class="side_block">
{assign var="discount" value=""}
<span class="bold" style="font-size: 20px;">{if $action->get_de_balance()>0}+{/if}{$action->get_de_balance()|number_format:0:'':' '} Ft</span><br>{$discount}
</div>
</div>
{/if}
{if $action@last}
</div>
{/if}
{/foreach}
</div>
<div class="info-wall">
<div class="list news">
<div style="margin-bottom: 40px;">
<h1 class="size20 bold">
Hírek, információk
</h1>
</div>
{/if}
{if $action@last}
</div>
{/if}
{/foreach}
{foreach $news_array as $news}
<span onclick="news_block_action('news_block_{$news->get_n_id()}');" class="date_separator clickable">
{$news->get_n_title()} - {$news->get_n_date()|date_format:"%Y.%m.%d %H:%M"}
</span>
<div id="news_block_{$news->get_n_id()}" class="news_block">
{$news->get_n_text()}
</div>
{/foreach}
</div>
</div>
</div>
<script>
@@ -157,8 +177,6 @@
function open_block(block_id) {
$("#"+block_id).slideDown("slow");
$("#balance_text_"+block_id.substr(-6)).addClass('active_header');
}
function close_block(block_id) {
@@ -166,6 +184,14 @@ function close_block(block_id) {
$("#balance_text_"+block_id.substr(-6)).removeClass('active_header');
}
function open_news_block(block_id) {
$("#"+block_id).slideDown();
}
function close_news_block(block_id) {
$("#"+block_id).slideUp();
}
function block_action(block_id) {
if ($("#"+block_id).is(':hidden')) {
open_block(block_id);
@@ -175,6 +201,14 @@ function block_action(block_id) {
}
}
function news_block_action(block_id) {
if ($("#"+block_id).is(':hidden')) {
open_news_block(block_id);
}
else {
close_news_block(block_id);
}
}
$( document ).ready(function() {
var divs = $( "div[class=month_block]" );
@@ -183,6 +217,15 @@ $( document ).ready(function() {
open_block(div_list[0].id);
var divs = $( "div[class=news_block]" );
$( ".list.news" ).find( divs ).hide();
var div_list = $( ".list" ).find( divs );
var i = 1;
while (i <= div_list.length && i <= 3) {
open_news_block(div_list[i-1].id);
++i;
}
});