File: //opt/Newsmag/resumeusergame.php
<?php
/*
Template Name: Resoconto Teams Partita
*/
$uri = $_SERVER['REQUEST_URI'];
//$totalPosts = str_replace("/","",str_replace("/ultime-news-","",$uri));
$totalPosts = $_GET['num'];
$current_user = wp_get_current_user();
$bannerLaterale = $wpdb->get_var( "SELECT immagine FROM wp_plugin_atalantini_banner where tipo = 'QUADRATO'" );
$username = $wpdb->get_var( "SELECT user_login FROM wp_users where id = " . $_GET['user_id'] );
$avatar = $wpdb->get_var( "SELECT avatar FROM wp_plugin_atalantini_avatar where user_id = " . $_GET['user_id']);
?>
<?php get_header(); ?>
<div class="td-main-content-wrap">
<div class="td-container">
<div class="td-container-border">
<div class="td-pb-row">
<div class="td-pb-span12 td-main-content">
<img src="/wp-content/themes/atalantini/images/adagurdam.jpg" width="100%">
<?php
$team1 = "";
$team2 = "";
$img1 = "";
$img2 = "";
$game = "";
$ids = "";
$rs1 = "";
$rs2 = "";
$ruoli = array();
$ruoli[] = "PORTIERE";
$ruoli[] = "DIFENSORE";
$ruoli[] = "CENTROCAMPISTA";
$ruoli[] = "ATTACCANTE";
$ruoli[] = "ALLENATORE";
$sql = "select id, sq1, sq2, immagine1, immagine2,resultsq1, resultsq2,players from wp_plugin_atalantini_team where attivo = 'SI' or attivo = 'CHIUSO';";
$teams = $wpdb->get_results($sql);
foreach ( $teams as $team ) {
$game = $team->id;
$team1 = $team->sq1;
$img1 = $team->immagine1;
$rs1 = $team->resultsq1;
$team2 = $team->sq2;
$img2 = $team->immagine2;
$ids = $team->players;
$rs2 = $team->resultsq2;
}
if ($img2 == "palermo.jpg") {
$img2 = "palermo.png";
}
?>
<br>
<div class="td-pb-row">
<div class="td-pb-span6 td-main-content">
<center>
<h1><?= $team1 ?></h1>
<img width="201" src="/wp-content/themes/atalantini/squadre/<?= $img1 ?>">
<div class="iis-caption-game">
<center>
<h2><?= $rs1 ?></h2>
</center>
</div>
</center>
</div>
<div class="td-pb-span6 td-main-content">
<center>
<h1><?= $team2 ?></h1>
<img width="201" src="/wp-content/themes/atalantini/squadre/<?= $img2 ?>">
<div class="iis-caption-game">
<center>
<h2><?= $rs2 ?></h2>
</center>
</div>
</center>
</div>
</div>
<div class="td-pb-row">
<div class="td-pb-span12 td-main-content">
<div class="title_bucomment" style="height:51px;">
<?php if ($avatar != "") { ?>
<img style="height:51px;float:right;" src="/wp-content/uploads/avatar/<?= $_GET['user_id'] ?>/<?= $avatar ?>" style="float:right">
<?php } ?>
<b><div style="float:left;margin-left:10px; margin-top:10px; font-size:23px;"><span class="authorcomment">Votazioni di: <?= $username ?></span></div></b> <br>
</div>
</div>
</div><!-- /post day -->
<div class="td-pb-row">
<div class="grid_4 omega">
<center>
<h2>MVP della community</h2><br>
<?php
$nominativo = "";
$filename = "";
$id_player = "";
$sql = "select player_id from wp_plugin_votazioni where vote != 's.v.' and vote != '' and game = " . $game . " and player_id in (select distinct(id) from wp_plugin_atalantini_player where ruolo != 'ALLENATORE') group by player_id order by avg(vote) desc limit 1";
$players = $wpdb->get_results($sql);
foreach ( $players as $player ) {
$id_player = $player->player_id;
}
$sql = "select nominativo, file_player from wp_plugin_atalantini_player where id =" . $id_player . ";";
$players = $wpdb->get_results($sql);
foreach ( $players as $player ) {
$nominativo = $player->nominativo;
$filename = $player->file_player;
}
?>
<b><?= $nominativo ?></b><br>
<img src="/wp-content/themes/atalantini/player/<?= $filename ?>">
<br><br>
</div>
<div class="grid_8">
<center><h2>Votazioni:</h2></center><br>
Ecco la media voti dei nostri lettori per la partita <b><?= $team1 ?> - <?= $team2 ?></b>:<br><br>
<table width="100%">
<?php
foreach ($ruoli as $ruolo) {
$sql = "select id, numero, nominativo, ruolo, (select (vote) from wp_plugin_votazioni where game = " . $game . " and username = '" . $username . "' and vote != '' and vote != 's.v.' and player_id = wp_plugin_atalantini_player.id) as voto from wp_plugin_atalantini_player where ruolo = '" . $ruolo . "' and id in (" . $ids . ") ;";
$players = $wpdb->get_results($sql);
foreach ( $players as $player ) {
?>
<tr>
<td width="100%">
<?php
$sql = "select * from wp_plugin_votazioni where username = '" . $username . "' and game = " . $game . " and player_id = " . $player->id;
$voters = $wpdb->get_results($sql);
foreach ( $voters as $vote ) {
?>
<div style="padding-left:2px;background-color:#e5e3ca;font-size:12pt;font-family: arial,sans serif;color:#000;">
<div class="title_bucomment" style="height:31px;">
<?= $player->nominativo ?>
<div style="float:right">
<?php if ($vote->sign == "lode") { ?>
<img src="/wp-content/uploads/avatar/award.png" style="margin-top:4px;">
<?php } ?>
</div>
<div style="float:right">
Voto: <?= $vote->vote?>
</div>
</div>
<?= $vote->comment ?><br><br>
</div>
<br>
<?php
}
?>
</td>
</tr>
<?php
}
}
?>
</table>
</div>
</div><!-- /post day -->
</div><!-- /grid11 -->
</div><!-- /grid12 -->
</div><!-- /row -->
</div><!-- /end page content -->
</div><!-- /end page content -->
<?php get_footer(); ?>