assoc_array('select * from user_kid order by uk_name asc;'); foreach ($users as $key => $value) { $user = new user_kid(); $user->set_user_data_by_id($value['uk_id']); $action_list_query = " SELECT object_id, TIMESTAMP(object_date) AS object_date, object_type, expire_date, IF(expire_date <= NOW(), 1, 0) AS expired FROM ((SELECT pr_training_tr_id AS object_id, TIMESTAMP(tr_date) AS object_date, IF(pr_training_tr_id IS NOT NULL, 'training', NULL) AS object_type, NULL AS expire_date FROM presence JOIN training ON (tr_id = pr_training_tr_id AND tr_locked = 1) WHERE pr_user_kid_uk_id = {$user->get_uk_id()} AND tr_deleted = 0) UNION (SELECT mod_id, TIMESTAMP(mi_date), IF(mod_id IS NOT NULL, 'money_deposit', NULL) AS object_type, mod_expire_date AS expire_date FROM money_deposit JOIN money_income ON mi_id = mod_money_income_mi_id WHERE mod_user_kid_uk_id = {$user->get_uk_id()} AND mod_deleted = 0)) actions ORDER BY object_date ASC; "; $action_assoc_array = $sql->assoc_array($action_list_query); $actions = array(); $de_array = 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; $new_diary_entry = new diary_entry($action['object_id'], $action['object_date'], $action['object_type'], 0, 0, 0, 0, $new_training, null); } elseif ($action['object_type'] == 'money_deposit') { $new_mod = new money_deposit(); $new_mod->set_mod_data_by_id($action['object_id']); //$actions[] = $new_mod; $new_diary_entry = new diary_entry($action['object_id'], $action['object_date'], $action['object_type'], 0, 0, 0, $action['expired'], null, $new_mod); } $de_array[] = $new_diary_entry; } //itt csak hivatkozással adjuk át a tömböt, a calculate_balance kiszámolja, belerakja és visszadja $user->calculate_balance($de_array, $user); //var_dump($de_array); //$smarty->assign('actions', $actions); } header('Location: /admin/balance_list' . ($this->is_id()?'/'.$this->get_id():'')); ?>