function calcVesTeam($team_id) { include "config.php"; \go\DB\autoloadRegister(); $db = go\DB\DB::create($db_params, 'mysql'); $team = $db->query('SELECT `id`,`size`,`pol` FROM {peop} WHERE `team_id` = ?', array($team_id))->assoc(); $team_ves = 0; foreach ($team as $peop) { $team_ves = $team_ves + calcVes($peop['size'], $peop['pol']); } return $team_ves; }
$get_team_props_polm = $db->query('SELECT COUNT(`id`) FROM `peop` WHERE `pol` = "m" AND `team_id` = ?', array($team))->el(); $get_team_props_polj = $db->query('SELECT COUNT(`id`) FROM `peop` WHERE `pol` = "j" AND `team_id` = ?', array($team))->el(); $get_team_props_polv = $get_team_props_polm + $get_team_props_polj; print ' <div class="panel panel-default"> <div class="panel-heading" role="tab" id="heading' . $team . '"> <a class="panel-title" data-toggle="collapse" data-parent="#accordion" href="#collapse' . $team . '" aria-expanded="true" aria-controls="collapse' . $team . '"> ' . $get_teams[$team]['name'] . ' Вес команды - ' . @calcVesTeam($team) . ' Мальчиков - ' . $get_team_props_polm . ', Девочек - ' . $get_team_props_polj . ', Всего - ' . $get_team_props_polv . ' </a> </div> <div id="collapse' . $team . '" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="heading' . $team . '"> <div class="panel-body"> '; if (@count($get_peops_bteam[$team]) > 0) { #shuffle($get_peops_bteam[$team]); foreach ($get_peops_bteam[$team] as $peop) { print '<a href=edit.php?peop_id=' . $peop['id'] . '>' . $peop['name'] . '</a> - ' . $peop['dept'] . ' - ' . calcVes($peop['size'], $peop['pol']) . '<a href=random.php?delete_team=' . $peop['id'] . '>(Удалить из команды)</a>)<br>'; } } else { print 'Нет участников'; } print ' </div> </div> </div> '; } print '</div>'; print '</div>'; print '</div>'; include "html/tail.php";