created coach site

This commit is contained in:
Ricsi
2017-04-22 20:01:23 +02:00
parent acfa06e40a
commit 04beae7eca
16 changed files with 287 additions and 55 deletions

View File

@@ -0,0 +1,32 @@
<?php
$action_list_query = "
SELECT
*
FROM
training
JOIN
training_coach ON trc_training_tr_id = tr_id
WHERE
trc_coach_uc_id = " . $user->get_ua_id() . "
ORDER BY tr_date DESC
;
";
$action_assoc_array = $sql->assoc_array($action_list_query);
$trainings = array();
foreach ($action_assoc_array as $action) {
$new_training = new training();
$new_training->set_training_data_by_id($action['tr_id']);
$trainings[] = $new_training;
}
$smarty->assign('trainings', $trainings);
$smarty->display('coach_diary.tpl');
?>

View File

@@ -8,9 +8,13 @@ if ($this->is_id()) {
$user_data_query = "SELECT * FROM user_coach WHERE ua_id = " . $this->get_id();
$user_data_assoc_array = $sql->assoc_array($user_data_query);
$new_coach = new user();
$new_coach->set_user_data_by_id($user_data_assoc_array[0]['ua_id']);
//smarty thingz
$smarty->assign('user_data', $user_data_assoc_array[0]);
$smarty->assign('coach', $new_coach);
$smarty->display('coach_data_edit.tpl');
}
else {

View File

@@ -1,16 +1,23 @@
<?php
if ($from == 'coach') {
if ($from == 'admin') {
$log_c = 'admin_logout';
$cookie = 'admin';
}
elseif ($from == 'parent') {
elseif ($from == 'view') {
$log_c = 'kid_logout';
$cookie = 'parent';
}
log::register($log_c, $_COOKIE['badminton_'.$from.'_user']);
elseif ($from == 'coach') {
$log_c = 'coach_logout';
$cookie = 'coach';
}
log::register($log_c, $_COOKIE['badminton_'.$cookie.'_user']);
setcookie('badminton_'.$from.'_user', 'null', time()-60*60*72, '/');
unset($_COOKIE['badminton_'.$from.'_user']);
header('Location: http://' . $_SERVER['HTTP_HOST']);
unset($_COOKIE['badminton_'.$cookie.'_user']);
header('Location: http://' . $_SERVER['HTTP_HOST'] . '/' . $from);
?>