20161215
This commit is contained in:
@@ -42,12 +42,14 @@ if ($this->is_id()) {
|
||||
$presence_query = "
|
||||
SELECT `pr_user_kid_uk_id` , count( `pr_id` ) AS 'presence'
|
||||
FROM `presence`
|
||||
JOIN user_kid ON uk_id = pr_user_kid_uk_id
|
||||
WHERE `pr_training_tr_id`
|
||||
IN ( " . implode(',', $tr_ids) . " )
|
||||
GROUP BY `pr_user_kid_uk_id`
|
||||
ORDER BY count( `pr_id` ) DESC;
|
||||
ORDER BY count( `pr_id` ) DESC, uk_name ASC;
|
||||
";
|
||||
//echo $presence_query;
|
||||
//echo $presence_query;
|
||||
if (!empty($tr_ids)) {
|
||||
$presence_assoc_array = $sql->assoc_array($presence_query);
|
||||
foreach ($presence_assoc_array as $presence) {
|
||||
@@ -76,7 +78,7 @@ if ($this->is_id()) {
|
||||
|
||||
|
||||
//TRAINING-COACH ARRAY
|
||||
$trc_query = "SELECT * FROM training_coach WHERE trc_training_tr_id = " . $this->get_id();
|
||||
$trc_query = "SELECT * FROM training_coach WHERE trc_helper = 0 AND trc_training_tr_id = " . $this->get_id();
|
||||
$trc_coaches = array();
|
||||
$trc_assoc_array = $sql->assoc_array($trc_query);
|
||||
foreach ($trc_assoc_array as $trc_data) {
|
||||
@@ -85,17 +87,50 @@ if ($this->is_id()) {
|
||||
$trc_coaches[] = $new_coach;
|
||||
}
|
||||
|
||||
//TRAINING-HELPER ARRAY
|
||||
$trc_query = "SELECT * FROM training_coach WHERE trc_helper = 1 AND trc_training_tr_id = " . $this->get_id();
|
||||
$trc_helpers = array();
|
||||
$trc_assoc_array = $sql->assoc_array($trc_query);
|
||||
foreach ($trc_assoc_array as $trc_data) {
|
||||
$new_coach = new user();
|
||||
$new_coach->set_user_data_by_id($trc_data['trc_coach_uc_id']);
|
||||
$trc_helpers[] = $new_coach;
|
||||
}
|
||||
|
||||
//var_dump($users);
|
||||
|
||||
//headcount
|
||||
$headcount_query = "SELECT * FROM presence WHERE pr_training_tr_id = " . $this->get_id() . ";";
|
||||
$headcount = $sql->num_of_rows($headcount_query);
|
||||
|
||||
|
||||
//csak lista
|
||||
$s_users = array();
|
||||
$presence_query = "
|
||||
SELECT `pr_user_kid_uk_id`
|
||||
FROM `presence`
|
||||
JOIN user_kid ON uk_id = pr_user_kid_uk_id
|
||||
WHERE `pr_training_tr_id` = ".$this->get_id()."
|
||||
ORDER BY uk_name ASC;
|
||||
";
|
||||
|
||||
$presence_assoc_array = $sql->assoc_array($presence_query);
|
||||
foreach ($presence_assoc_array as $presence) {
|
||||
$s_user = new user_kid();
|
||||
$s_user->set_user_data_by_id($presence['pr_user_kid_uk_id']);
|
||||
$s_users[] = $s_user;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$smarty->assign('training', $training);
|
||||
$smarty->assign('trainings', $tr_ids);
|
||||
$smarty->assign('headcount', $headcount);
|
||||
$smarty->assign("trc_coaches", $trc_coaches);
|
||||
$smarty->assign("trc_helpers", $trc_helpers);
|
||||
$smarty->assign('presence_assoc_array', $presence_assoc_array);
|
||||
$smarty->assign('users', $users);
|
||||
$smarty->assign('sorted_users', $s_users);
|
||||
$smarty->assign('rest_users', $rest_users);
|
||||
$smarty->assign('tr_id', $this->get_id());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user