diary updated with money deposit objects
This commit is contained in:
@@ -52,8 +52,19 @@ class money_deposit {
|
|||||||
return $this->mod_date;
|
return $this->mod_date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_mod_sum() {
|
public function get_mod_date_day() {
|
||||||
return $this->mod_sum;
|
$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() {
|
public function get_mod_deleted() {
|
||||||
|
|||||||
@@ -29,3 +29,15 @@ ul.topnav li a:hover, ul.topnav li a span:hover {
|
|||||||
color: #01112b;
|
color: #01112b;
|
||||||
text-decoration: underline;
|
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;
|
||||||
|
}
|
||||||
@@ -7,25 +7,46 @@ if ($this->is_id()) {
|
|||||||
else {
|
else {
|
||||||
# EDZÉS LISTA
|
# EDZÉS LISTA
|
||||||
|
|
||||||
$training_list_query = "
|
$action_list_query = "
|
||||||
SELECT pr_training_tr_id FROM presence
|
SELECT
|
||||||
JOIN training ON tr_id = pr_training_tr_id
|
*
|
||||||
WHERE
|
FROM
|
||||||
pr_user_kid_uk_id = ".$user->get_uk_id()."
|
((SELECT
|
||||||
AND tr_deleted = 0
|
pr_training_tr_id as object_id,
|
||||||
ORDER BY tr_date DESC;
|
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();
|
$actions = array();
|
||||||
foreach ($training_assoc_array as $training) {
|
foreach ($action_assoc_array as $action) {
|
||||||
$new_training = new training();
|
if ($action['object_type'] == 'training') {
|
||||||
$new_training->set_training_data_by_id($training['pr_training_tr_id']);
|
$new_training = new training();
|
||||||
$trainings[] = $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('actions', $actions);
|
||||||
$smarty->assign('training_array', $trainings);
|
|
||||||
$smarty->display('user_diary.tpl');
|
$smarty->display('user_diary.tpl');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,44 +1,104 @@
|
|||||||
<div class="list">
|
<div class="list">
|
||||||
{foreach $training_array as $training}
|
{foreach $actions as $action}
|
||||||
|
|
||||||
{if
|
{if $action|is_a:'training'}
|
||||||
$training@first ||
|
|
||||||
(
|
{if !$action@first &&
|
||||||
$training_array[$training@index]->get_tr_date()|substr:5:2 != $training_array[$training@index-1]->get_tr_date()|substr:5:2
|
$actions[$action@index-1]|is_a:'training' &&
|
||||||
)
|
$actions[$action@index]->get_tr_date()|substr:5:2 != $actions[$action@index-1]->get_tr_date()|substr:5:2
|
||||||
|
|
||||||
|
||
|
||||||
|
|
||||||
|
!$action@first &&
|
||||||
|
$actions[$action@index-1]|is_a:'money_deposit' &&
|
||||||
|
$actions[$action@index]->get_tr_date()|substr:5:2 != $actions[$action@index-1]->get_mod_date()|substr:5:2
|
||||||
|
|
||||||
}
|
}
|
||||||
{if !$training@first &&
|
|
||||||
$training_array[$training@index]->get_tr_date()|substr:5:2 != $training_array[$training@index-1]->get_tr_date()|substr:5:2
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
<span class="date_separator">{$actions[$action@index]->get_tr_date()|substr:0:4}.
|
||||||
<span class="date_separator">{$training_array[$training@index]->get_tr_date()|substr:0:4}.
|
{$months[$actions[$action@index]->get_tr_date()|substr:5:2]}
|
||||||
{$months[$training_array[$training@index]->get_tr_date()|substr:5:2]}
|
<img src="/_image/open_folder.png" onclick="block_action('block_{$action->get_tr_date()|substr:0:4}{$action->get_tr_date()|substr:5:2}');">
|
||||||
({$user_login->get_training_number_in_month({$training->get_tr_date()|substr:0:4},{$training->get_tr_date()|substr:5:2})} edzés)
|
|
||||||
<img src="/_image/open_folder.png" onclick="block_action('block_{$training->get_tr_date()|substr:0:4}{$training->get_tr_date()|substr:5:2}');">
|
|
||||||
</span>
|
</span>
|
||||||
<div id="block_{$training->get_tr_date()|substr:0:4}{$training->get_tr_date()|substr:5:2}" class="month_block">
|
<div id="block_{$action->get_tr_date()|substr:0:4}{$action->get_tr_date()|substr:5:2}" class="month_block">
|
||||||
|
|
||||||
|
{elseif $action@first}
|
||||||
|
<span class="date_separator">{$actions[$action@index]->get_tr_date()|substr:0:4}.
|
||||||
|
{$months[$actions[$action@index]->get_tr_date()|substr:5:2]}
|
||||||
|
<img src="/_image/open_folder.png" onclick="block_action('block_{$action->get_tr_date()|substr:0:4}{$action->get_tr_date()|substr:5:2}');">
|
||||||
|
</span>
|
||||||
|
<div id="block_{$action->get_tr_date()|substr:0:4}{$action->get_tr_date()|substr:5:2}" class="month_block">
|
||||||
|
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class="list_item line_height14 bigger_space">
|
<div class="list_item line_height14 bigger_space">
|
||||||
<span class="size20 bold">
|
<span class="size20 bold">
|
||||||
{$training->get_tr_date()|substr:0:4}.
|
{$action->get_tr_date()|substr:0:4}.
|
||||||
{$months[$training_array[$training@index]->get_tr_date()|substr:5:2]}
|
{$months[$actions[$action@index]->get_tr_date()|substr:5:2]}
|
||||||
{$training->get_tr_date_day()}.
|
{$action->get_tr_date_day()}.
|
||||||
{$days[$training->get_tr_date_day_of_week()]}
|
{$days[$action->get_tr_date_day_of_week()]}
|
||||||
{$training->get_tr_date_time()}
|
{$action->get_tr_date_time()}
|
||||||
</span>
|
</span>
|
||||||
<br>
|
<br>
|
||||||
{if $training->get_tr_training_type_trt_id()}{$training->get_tr_type_name_by_id()} edzés{/if}
|
{if $action->get_tr_training_type_trt_id()}{$action->get_tr_type_name_by_id()} edzés{/if}
|
||||||
{$training->get_tr_duration()} p
|
{$action->get_tr_duration()} p
|
||||||
{if $training->is_coach()}
|
{if $action->is_coach()}
|
||||||
{foreach $training->get_tr_coaches_name() as $coach_name}
|
{foreach $action->get_tr_coaches_name() as $coach_name}
|
||||||
{if $coach_name@first}({/if}{$coach_name}{if $coach_name@last}){else}, {/if}
|
{if $coach_name@first}({/if}{$coach_name}{if $coach_name@last}){else}, {/if}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{if $training@last}
|
|
||||||
|
{elseif $action|is_a:'money_deposit'}
|
||||||
|
|
||||||
|
{if !$action@first &&
|
||||||
|
$actions[$action@index-1]|is_a:'training' &&
|
||||||
|
$actions[$action@index]->get_mod_date()|substr:5:2 != $actions[$action@index-1]->get_tr_date()|substr:5:2
|
||||||
|
|
||||||
|
||
|
||||||
|
|
||||||
|
!$action@first &&
|
||||||
|
$actions[$action@index-1]|is_a:'money_deposit' &&
|
||||||
|
$actions[$action@index]->get_mod_date()|substr:5:2 != $actions[$action@index-1]->get_mod_date()|substr:5:2
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<span class="date_separator">{$actions[$action@index]->get_mod_date()|substr:0:4}.
|
||||||
|
{$months[$actions[$action@index]->get_mod_date()|substr:5:2]}
|
||||||
|
<img src="/_image/open_folder.png" onclick="block_action('block_{$action->get_mod_date()|substr:0:4}{$action->get_mod_date()|substr:5:2}');">
|
||||||
|
</span>
|
||||||
|
<div id="block_{$action->get_mod_date()|substr:0:4}{$action->get_mod_date()|substr:5:2}" class="month_block">
|
||||||
|
|
||||||
|
{elseif $action@first}
|
||||||
|
|
||||||
|
<span class="date_separator">{$actions[$action@index]->get_mod_date()|substr:0:4}.
|
||||||
|
{$months[$actions[$action@index]->get_mod_date()|substr:5:2]}
|
||||||
|
<img src="/_image/open_folder.png" onclick="block_action('block_{$action->get_mod_date()|substr:0:4}{$action->get_mod_date()|substr:5:2}');">
|
||||||
|
</span>
|
||||||
|
<div id="block_{$action->get_mod_date()|substr:0:4}{$action->get_mod_date()|substr:5:2}" class="month_block">
|
||||||
|
|
||||||
|
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<div class="list_item line_height14 bigger_space money_deposit">
|
||||||
|
<span class="size20 bold">
|
||||||
|
{$action->get_mod_date()|substr:0:4}.
|
||||||
|
{$months[$actions[$action@index]->get_mod_date()|substr:5:2]}
|
||||||
|
{$action->get_mod_date_day()}.
|
||||||
|
</span>
|
||||||
|
<br>
|
||||||
|
befizetés: {$action->get_mod_sum(true)} Ft
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{if $action@last}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
{/if}
|
{/if}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user