diary updated with money deposit objects
This commit is contained in:
@@ -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');
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user