Plugin Directory

Changeset 575201


Ignore:
Timestamp:
07/20/2012 04:41:03 PM (14 years ago)
Author:
belinde
Message:

Gestione albero finali

Location:
volleytnt/trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • volleytnt/trunk/admin/volleytnt_risultati.php

    r574270 r575201  
    108108            echo '<th>' . __('Squadre', 'volleytnt') . '</th>';
    109109            echo '<th>' . __('Risultato', 'volleytnt') . '</th>';
    110             echo '<th>' . __('1° set', 'volleytnt') . '</th>';
    111             echo '<th>' . __('2° set', 'volleytnt') . '</th>';
    112             echo '<th>' . __('3° set', 'volleytnt') . '</th>';
     110            echo '<th>' . sprintf( __('%d&ordm; set', 'volleytnt'), 1 ) . '</th>';
     111            echo '<th>' . sprintf( __('%d&ordm; set', 'volleytnt'), 2 ) . '</th>';
     112            echo '<th>' . sprintf( __('%d&ordm; set', 'volleytnt'), 3 ) . '</th>';
    113113            if ( $this->torneo->set_partita == 5 ) {
    114                 echo '<th>' . __('4° set', 'volleytnt') . '</th>';
    115                 echo '<th>' . __('5° set', 'volleytnt') . '</th>';
     114                echo '<th>' . sprintf( __('%d&ordm; set', 'volleytnt'), 4 ) . '</th>';
     115                echo '<th>' . sprintf( __('%d&ordm; set', 'volleytnt'), 5 ) . '</th>';
    116116            }
    117117            echo '<th>&nbsp;</th>';
  • volleytnt/trunk/core/the_plugin.php

    r574270 r575201  
    3838        $this->register_page('VolleyTNT_Partite');
    3939        $this->register_page('VolleyTNT_Risultati');
     40        $this->register_page('VolleyTNT_Finali');
    4041        $this->register_page('VolleyTNT_Opzioni');
    4142       
     
    168169        $_ = array();
    169170        if ( $dati ) foreach ( $dati as $row ) $_[ $row->giorno ][ $row->campo ][ $row->id ] = $row;
     171        return $_;
     172    }
     173   
     174   
     175    private function get_risultati( $id_torneo ) {
     176        global $wpdb;
     177        $dati = $wpdb->get_results("SELECT
     178                                      `sq1`.`label`              AS `nome1`,
     179                                      `sq2`.`label`              AS `nome2`,
     180                                      `{$this->prefix}partite`.*,
     181                                      DATE_FORMAT(`{$this->prefix}slots`.`giorno`, '" . volleytnt_date_format('sql') . "') AS `giorno`,
     182                                      DATE_FORMAT(`{$this->prefix}slots`.`inizio`, '%k:%i') AS `inizio`,
     183                                      DATE_FORMAT(`{$this->prefix}slots`.`fine`, '%k:%i') AS `fine`,
     184                                      `{$this->prefix}slots`.`campo`
     185                                    FROM `{$this->prefix}partite`
     186                                      LEFT JOIN `{$this->prefix}slots`
     187                                        ON `{$this->prefix}slots`.`id` = `{$this->prefix}partite`.`slots_id`
     188                                      LEFT JOIN `{$this->prefix}squadre` AS `sq1`
     189                                        ON `sq1`.`id` = `{$this->prefix}partite`.`squadra_1`
     190                                      LEFT JOIN `{$this->prefix}squadre` AS `sq2`
     191                                        ON `sq2`.`id` = `{$this->prefix}partite`.`squadra_2`
     192                                    WHERE `{$this->prefix}partite`.`tornei_id` = $id_torneo
     193                                        AND `{$this->prefix}partite`.`girone` <> 0
     194                                    ORDER BY `{$this->prefix}partite`.`categoria` ASC, `{$this->prefix}partite`.`girone` ASC");
     195        $_ = array();
     196        if ( $dati ) foreach ( $dati as $row ) $_[ $row->categoria ][ $row->girone ][ $row->id ] = $row;
    170197        return $_;
    171198    }
     
    205232    }
    206233   
     234   
     235    private function get_classifiche( $id_torneo ) {
     236        global $wpdb;
     237        $work = array();
     238        $dati = $wpdb->get_results("    SELECT
     239                                            `{$this->prefix}partite`.*,
     240                                            `sq1`.`label` AS `label_1`,
     241                                            `sq2`.`label` AS `label_2`
     242                                        FROM
     243                                            `{$this->prefix}partite`
     244                                        LEFT JOIN `{$this->prefix}squadre` AS `sq1`
     245                                            ON `{$this->prefix}partite`.`squadra_1`=`sq1`.`id`
     246                                        LEFT JOIN `{$this->prefix}squadre` AS `sq2`
     247                                            ON `{$this->prefix}partite`.`squadra_2`=`sq2`.`id`
     248                                        WHERE
     249                                            `{$this->prefix}partite`.`tornei_id`=$id_torneo AND `{$this->prefix}partite`.`girone`<>0");
     250        if ( $dati ) {
     251            foreach ( $dati as $row ) {
     252                if ( !isset( $work[ $row->categoria ][ $row->girone ] ) ) $work[ $row->categoria ][ $row->girone ] = array();
     253
     254                if ( !isset( $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ] ) )
     255                    $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ] = array(    'giocate'       => 0,
     256                                                                                            'vinti'         => 0,
     257                                                                                            'persi'         => 0,
     258                                                                                            'fatti'         => 0,
     259                                                                                            'subiti'        => 0,
     260                                                                                            'id'            => $row->squadra_1,
     261                                                                                            'label'         => $row->label_1 );
     262                if ( !isset( $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ] ) )
     263                    $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ] = array(    'giocate'       => 0,
     264                                                                                            'vinti'         => 0,
     265                                                                                            'persi'         => 0,
     266                                                                                            'fatti'         => 0,
     267                                                                                            'subiti'        => 0,
     268                                                                                            'id'            => $row->squadra_2,
     269                                                                                            'label'         => $row->label_2  );
     270
     271               
     272                $set1_sq1 = absint( $row->set1_sq1 );
     273                $set1_sq2 = absint( $row->set1_sq2 );
     274                $set2_sq1 = absint( $row->set2_sq1 );
     275                $set2_sq2 = absint( $row->set2_sq2 );
     276                $set3_sq1 = absint( $row->set3_sq1 );
     277                $set3_sq2 = absint( $row->set3_sq2 );
     278                if ( $this->torneo->set_partita == 5 ) {
     279                    $set4_sq1 = absint( $row->set4_sq1 );
     280                    $set4_sq2 = absint( $row->set4_sq2 );
     281                    $set5_sq1 = absint( $row->set5_sq1 );
     282                    $set5_sq2 = absint( $row->set5_sq2 );
     283                }
     284                $vinti1 = $vinti2 = 0;
     285                if ( ( $set1_sq1 or $set1_sq2 ) and ( $set2_sq1 or $set2_sq2 ) ) { // la partita è stata giocata
     286                    $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['giocate']++;
     287                    $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['giocate']++;
     288                    $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['fatti'] += $set1_sq1 + $set2_sq1 + $set3_sq1;
     289                    $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['fatti'] += $set1_sq2 + $set2_sq2 + $set3_sq2;
     290                    $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['subiti'] += $set1_sq2 + $set2_sq2 + $set3_sq2;
     291                    $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['subiti'] += $set1_sq1 + $set2_sq1 + $set3_sq1;
     292                   
     293                    if ( $this->torneo->set_partita == 5 ) {
     294                        $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['fatti'] += $set4_sq1 + $set5_sq1;
     295                        $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['fatti'] += $set4_sq2 + $set5_sq2;
     296                        $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['subiti'] += $set4_sq2 + $set5_sq2;
     297                        $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['subiti'] += $set4_sq1 + $set5_sq1;
     298                    }
     299                   
     300                    if ( $set1_sq1 > $set1_sq2 ) {
     301                        $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['vinti']++;
     302                        $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['persi']++;
     303                    } else {
     304                        $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['vinti']++;
     305                        $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['persi']++;
     306                    }
     307                    if ( $set2_sq1 > $set2_sq2 ) {
     308                        $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['vinti']++;
     309                        $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['persi']++;
     310                    } else {
     311                        $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['vinti']++;
     312                        $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['persi']++;
     313                    }
     314                    if ( $this->torneo->set_partita == 5 ) {
     315                        if ( $set3_sq1 > $set3_sq2 ) {
     316                            $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['vinti']++;
     317                            $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['persi']++;
     318                        } else {
     319                            $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['vinti']++;
     320                            $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['persi']++;
     321                        }
     322                        if ( $set4_sq1 or $set4_sq2 ) if ( $set4_sq1 > $set4_sq2 ) {
     323                            $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['vinti']++;
     324                            $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['persi']++;
     325                        } else {
     326                            $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['vinti']++;
     327                            $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['persi']++;
     328                        }
     329                        if ( $set5_sq1 or $set5_sq2 ) if ( $set5_sq1 > $set5_sq2 ) {
     330                            $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['vinti']++;
     331                            $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['persi']++;
     332                        } else {
     333                            $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['vinti']++;
     334                            $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['persi']++;
     335                        }
     336                    } else {
     337                        if ( $set3_sq1 or $set3_sq2 ) if ( $set3_sq1 > $set3_sq2 ) {
     338                            $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['vinti']++;
     339                            $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['persi']++;
     340                        } else {
     341                            $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['vinti']++;
     342                            $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['persi']++;
     343                        }
     344                    }
     345                }
     346            }
     347           
     348            foreach ( $work as $categoria => $i_gironi ) {
     349                foreach ( $i_gironi as $girone => $squadre ) {
     350                    foreach ( $squadre as $id_squadra => $dati ) {
     351                        $dati['q_vinti'] = $dati['giocate'] ? round( $dati['vinti'] / $dati['giocate'], 2 ) : 0;
     352                        $dati['d_set'] = $dati['vinti'] - $dati['persi'];
     353                        $dati['qd_set'] = $dati['giocate'] ? round( $dati['d_set'] / $dati['giocate'], 2 ) : 0;
     354                        $dati['q_fatti'] = $dati['giocate'] ? round( $dati['fatti'] / $dati['giocate'], 2 ) : 0;
     355                        $dati['d_punti'] = $dati['fatti'] - $dati['subiti'];
     356                        $dati['qd_punti'] = $dati['giocate'] ? round( $dati['d_punti'] / $dati['giocate'], 2 ) : 0;
     357                        $work[ $categoria ][ $girone ][ $id_squadra ] = $dati;
     358                    }
     359                    usort( $work[ $categoria ][ $girone ], array( $this, 'sort_classifica') );
     360                }
     361                ksort( $work[ $categoria ] );
     362            }
     363            ksort( $work );
     364        }
     365        return $work;   
     366    }
     367   
     368    private function sort_classifica( $a, $b ) {
     369        if ( $a['vinti'] == $b['vinti'] ) {
     370            if ( $a['qd_set'] == $b['qd_set'] ) {
     371                if ( $a['qd_punti'] == $b['qd_punti'] ) {
     372                    if ( $a['giocate'] == $b['giocate'] ) {
     373                        return 0;
     374                    } else return $a['giocate'] > $b['giocate'] ? 1 : -1;
     375                } else return $a['qd_punti'] < $b['qd_punti'] ? 1 : -1;
     376            } else return $a['qd_set'] < $b['qd_set'] ? 1 : -1;
     377        } else return $a['vinti'] < $b['vinti'] ? 1 : -1;
     378    }
     379
    207380    public function sc_squadre( $atts, $content = '' ) {
    208381        extract( shortcode_atts( array(
     
    226399    }
    227400   
     401   
     402    public function sc_risultati( $atts, $content = '' ) {
     403        extract( shortcode_atts( array(
     404            'torneo' => $this->opts->corrente
     405        ), $atts ) );
     406        if ( !$torneo ) return '';
     407        $_ = '<div class="tornei_risultati">';
     408        $dati = $this->get_risultati( $torneo );
     409        foreach ( $dati as $categoria => $gironi ) foreach ( $gironi as $girone => $partite ) {
     410            $_ .= '<h3>Girone ' . $categoria . $girone . '</h3>';
     411            $_ .= '<table>';
     412            $_ .= '<thead><tr>';
     413            $_ .= '<th class="partita">' . __('Partita', 'volleytnt') . '</th>';
     414            $_ .= '<th class="squadre">' . __('Squadre', 'volleytnt') . '</th>';
     415            $_ .= '<th class="risultato">' . __('Risultato', 'volleytnt') . '</th>';
     416            $_ .= '<th class="set set1">' . sprintf( __('%d&ordm; set', 'volleytnt'), 1 ) . '</th>';
     417            $_ .= '<th class="set set2">' . sprintf( __('%d&ordm; set', 'volleytnt'), 2 ) . '</th>';
     418            $_ .= '<th class="set set3">' . sprintf( __('%d&ordm; set', 'volleytnt'), 3 ) . '</th>';
     419            if ( $this->torneo->set_partita == 5 ) {
     420                $_ .= '<th class="set set4">' . sprintf( __('%d&ordm; set', 'volleytnt'), 4 ) . '</th>';
     421                $_ .= '<th class="set set5">' . sprintf( __('%d&ordm; set', 'volleytnt'), 5 ) . '</th>';
     422            }
     423            $_ .= '</tr></thead>';
     424            $_ .= '<tbody>';
     425            foreach ( $partite as $id_partita => $row ) {
     426               
     427                $set1 = $set2 = 0;
     428                if ( !$row->set1_sq1 and !$row->set1_sq2 ) {
     429                    $row->set1_sq1 = $row->set1_sq2 = '';
     430                } else if ( $row->set1_sq1 > $row->set1_sq2 ) $set1++; else $set2++;
     431                if ( !$row->set2_sq1 and !$row->set2_sq2 ) {
     432                    $row->set2_sq1 = $row->set2_sq2 = '';
     433                } else if ( $row->set2_sq1 > $row->set2_sq2 ) $set1++; else $set2++;
     434                if ( !$row->set3_sq1 and !$row->set3_sq2 ) {
     435                    $row->set3_sq1 = $row->set3_sq2 = '';
     436                } else if ( $row->set3_sq1 > $row->set3_sq2 ) $set1++; else $set2++;
     437                if ( $this->torneo->set_partita == 5 ) {
     438                    if ( !$row->set4_sq1 and !$row->set4_sq2 ) {
     439                        $row->set4_sq1 = $row->set4_sq2 = '';
     440                    } else if ( $row->set4_sq1 > $row->set4_sq2 ) $set1++; else $set2++;
     441                    if ( !$row->set5_sq1 and !$row->set5_sq2 ) {
     442                        $row->set5_sq1 = $row->set5_sq2 = '';
     443                    } else if ( $row->set5_sq1 > $row->set5_sq2 ) $set1++; else $set2++;
     444                }
     445                if ( !$set1 and !$set2 ) $set1 = $set2 = '';
     446                $_ .= '<tr>';
     447               
     448                $_ .= '<th>';
     449                $_ .= sprintf( __('Girone %s', 'volleytnt'), $row->categoria . $row->girone );
     450                if ( $row->campo ) $_ .= '<br/>' . sprintf( __('%s, %s-%s, campo %s', 'volleytnt'), $row->giorno, $row->inizio, $row->fine, $row->campo );
     451                $_ .= '</th>';
     452               
     453                $_ .= '<td>';
     454                $_ .= '<div class="squadra sq1">' . $row->nome1 . '</div>';
     455                $_ .= '<div class="squadra sq2">' . $row->nome2 . '</div>';
     456                $_ .= '</td>';
     457               
     458                $_ .= '<td>';
     459                $_ .= '<div class="risultato sq1">' . $set1 . '</div>';
     460                $_ .= '<div class="risultato sq2">' . $set2 . '</div>';
     461                $_ .= '</td>';
     462               
     463                $_ .= '<td>';
     464                $_ .= '<div class="riga sq1">' . $row->set1_sq1 . '</div>';
     465                $_ .= '<div class="riga sq2">' . $row->set1_sq2 . '</div>';
     466                $_ .= '</td>';
     467               
     468                $_ .= '<td>';
     469                $_ .= '<div class="riga sq1">' . $row->set2_sq1 . '</div>';
     470                $_ .= '<div class="riga sq2">' . $row->set2_sq2 . '</div>';
     471                $_ .= '</td>';
     472               
     473                $_ .= '<td>';
     474                $_ .= '<div class="riga sq1">' . $row->set3_sq1 . '</div>';
     475                $_ .= '<div class="riga sq2">' . $row->set3_sq2 . '</div>';
     476                $_ .= '</td>';
     477
     478                if ( $this->torneo->set_partita == 5 ) {
     479               
     480                    $_ .= '<td>';
     481                    $_ .= '<div class="riga sq1">' . $row->set4_sq1 . '</div>';
     482                    $_ .= '<div class="riga sq2">' . $row->set4_sq2 . '</div>';
     483                    $_ .= '</td>';
     484                   
     485                    $_ .= '<td>';
     486                    $_ .= '<div class="riga sq1">' . $row->set5_sq1 . '</div>';
     487                    $_ .= '<div class="riga sq2">' . $row->set5_sq2 . '</div>';
     488                    $_ .= '</td>';
     489
     490                }
     491                               
     492                $_ .= '<tr>';
     493            }
     494            $_ .= '</tbody></table>';
     495        }
     496        return $_ . '</div>';
     497    }
     498
     499   
     500    public function sc_classifiche_gironi( $atts, $content = '' ) {
     501        extract( shortcode_atts( array(
     502            'torneo' => $this->opts->corrente
     503        ), $atts ) );
     504        if ( !$torneo ) return '';
     505        $_ = '<div class="tornei_classifiche_gironi">';
     506        $classifiche = $this->get_classifiche( $torneo );
     507        foreach ( $classifiche as $categoria => $gironi ) foreach ( $gironi as $girone => $squadre ) {
     508            $pos = 1;
     509            $_ .= '<h3>' . sprintf( __('Girone %s', 'volleytnt'), $categoria . $girone ) . '</h3>';
     510            $_ .= '<table><thead><tr>';
     511            $_ .= '<th class="posizione">' . __('Pos.', 'volleytnt') . '</th>';
     512            $_ .= '<th class="squadra">' . __('Squadra', 'volleytnt') . '</th>';
     513            $_ .= '<th class="partite">' . __('Partite', 'volleytnt') . '</th>';
     514            $_ .= '<th class="set">' . __('Set', 'volleytnt') . '</th>';
     515            $_ .= '<th class="punti">' . __('Punti', 'volleytnt') . '</th>';
     516            $_ .= '</tr></thead><tbody>';
     517            foreach ( $squadre as $s ) {
     518                $_ .= '<tr>';
     519                $_ .= '<td class="posizione">' . $pos . '&ordm;</td>';
     520                $_ .= '<td class="squadra">' . $s['label'] . '</td>';
     521                $_ .= '<td class="partite">' . $s['giocate'] . '</td>';
     522                $_ .= '<td class="set">' . $s['vinti'] . 'v, ' . $s['persi'] . 'p <em>(' . $s['qd_set'] . ')</em></td>';
     523                $_ .= '<td class="punti">' . $s['fatti'] . 'f, ' . $s['subiti'] . 's <em>(' . $s['qd_punti'] . ')</em></td>';
     524                $_ .= '</tr>';
     525                $pos++;
     526            }
     527            $_ .= '</tbody></table>';
     528        }
     529       
     530        return $_ . '</div>';
     531    }
    228532   
    229533    public function sc_calendario( $atts, $content = '' ) {
     
    355659}
    356660
     661class VolleyTNT_Tree {
     662    public $torneo = false;
     663    public $squadre = array();
     664    public $finali = array();
     665   
     666    public function __construct( $torneo = null ) {
     667        global $wpdb;
     668        $torneo = is_null( $torneo ) ?  $this->opts->corrente : absint( $torneo );
     669        $this->torneo = $wpdb->get_row("SELECT * FROM `{$this->prefix}tornei` WHERE `id`={$torneo}");
     670        if ( $tmp = $wpdb->get_results("SELECT * FROM `{$this->prefix}partite` WHERE `finale`<>'' AND `tornei_id`={$torneo} AND `visibile`=1" ) ) {
     671            foreach ( $tmp as $row ) $this->finali[ $row->categoria ][ $row->finale ] = $row;
     672        }
     673        if ( $tmp = $wpdb->get_results("SELECT `id`, `label`, `categoria` FROM `{$this->prefix}squadre` WHERE `tornei_id`={$torneo}" ) ) {
     674            foreach ( $tmp as $row ) $this->squadre[ $row->categoria ][ $row->id ] = $row->label;
     675        }
     676        if ( isset( $this->squadre['M'] ) ) asort( $this->squadre['M'] );
     677        if ( isset( $this->squadre['F'] ) ) asort( $this->squadre['F'] );
     678        if ( isset( $this->squadre['X'] ) ) asort( $this->squadre['X'] );
     679    }
     680
     681    final public function __get( $attr ) {
     682        global $VolleyTNT;
     683        if ( isset( $VolleyTNT->$attr ) ) {
     684            $this->$attr = &$VolleyTNT->$attr;
     685            return $this->$attr;
     686        } else {
     687            return false;
     688        }
     689    }
     690   
     691    private function partita( $categoria, $id ) {
     692        if ( isset( $this->finali[ $categoria ][ $id ] ) ) {
     693            $p = $this->finali[ $categoria ][ $id ];
     694            $class = 'partita';
     695        } else {
     696            $p = new stdClass();
     697            $p->categoria = $categoria;
     698            $p->squadra_1 = 0;
     699            $p->squadra_2 = 0;
     700            $p->set1_sq1 = '';
     701            $p->set1_sq2 = '';
     702            $p->set2_sq1 = '';
     703            $p->set2_sq2 = '';
     704            $p->set3_sq1 = '';
     705            $p->set3_sq2 = '';
     706            $p->set4_sq1 = '';
     707            $p->set4_sq2 = '';
     708            $p->set5_sq1 = '';
     709            $p->set5_sq2 = '';
     710            $class = 'partita nongiocata____';
     711        }
     712       
     713            $p = new stdClass();
     714            $p->categoria = $categoria;
     715            $p->squadra_1 = 20;
     716            $p->squadra_2 = 22;
     717            $p->set1_sq1 = 21;
     718            $p->set1_sq2 = 12;
     719            $p->set2_sq1 = 12;
     720            $p->set2_sq2 = 21;
     721            $p->set3_sq1 = 21;
     722            $p->set3_sq2 = 12;
     723            $p->set4_sq1 = 12;
     724            $p->set4_sq2 = 21;
     725            $p->set5_sq1 = 21;
     726            $p->set5_sq2 = 12;
     727            $class = 'partita';
     728
     729        $p->set1 = $p->set2 = 0;
     730        if ( $p->set1_sq1 or $p->set1_sq2 ) if ( $p->set1_sq1 > $p->set1_sq2 ) $p->set1++; else $p->set2++;
     731        if ( $p->set2_sq1 or $p->set2_sq2 ) if ( $p->set2_sq1 > $p->set2_sq2 ) $p->set1++; else $p->set2++;
     732        if ( $p->set3_sq1 or $p->set3_sq2 ) if ( $p->set3_sq1 > $p->set3_sq2 ) $p->set1++; else $p->set2++;
     733        if ( !$p->set1 and !$p->set2 ) $p->set1 = $p->set2 = $p->set1_sq1 = $p->set1_sq2 = $p->set2_sq1 = $p->set2_sq2 = $p->set3_sq1 = $p->set3_sq2 = '';
     734        $class .= ' p' . $id;
     735        ?>
     736        <div class="<?php echo $class; ?>" squadra_1="<?php echo $p->squadra_1; ?>" squadra_2="<?php echo $p->squadra_2; ?>" categoria="<?php echo $p->categoria; ?>" id_partita="<?php echo $id; ?>">
     737            <div class="squadra squadra1"><?php echo isset( $this->squadre[ $p->categoria ][ $p->squadra_1 ] ) ? $this->squadre[ $p->categoria ][ $p->squadra_1 ] : ''; ?></div>
     738            <div class="separatore">
     739                <div class="punti punti1">
     740                    <div class="risultato risultato1"><?php echo $p->set1; ?></div>
     741                    <span class="set set1 sq1 set1_sq1"><?php echo $p->set1_sq1; ?></span>
     742                    <span class="set set2 sq1 set2_sq1"><?php echo $p->set2_sq1; ?></span>
     743                    <span class="set set3 sq1 set3_sq1"><?php echo $p->set3_sq1; ?></span>
     744                </div>
     745                <div class="sottoseparatore"></div>
     746                <div class="punti punti2">
     747                    <div class="risultato risultato2"><?php echo $p->set2; ?></div>
     748                    <span class="set set1 sq2 set1_sq2"><?php echo $p->set1_sq2; ?></span>
     749                    <span class="set set2 sq2 set2_sq2"><?php echo $p->set2_sq2; ?></span>
     750                    <span class="set set3 sq2 set3_sq2"><?php echo $p->set3_sq2; ?></span>
     751                </div>
     752            </div>
     753            <div class="squadra squadra2"><?php echo isset( $this->squadre[ $p->categoria ][ $p->squadra_2 ] ) ? $this->squadre[ $p->categoria ][ $p->squadra_2 ] : ''; ?></div>
     754        </div>
     755        <?php
     756    }
     757
     758    public function show( $categoria ) {
     759        $this->torneo->finali = 32;
     760
     761        echo '<div class="tabellonefinale base' . $this->torneo->finali . '">';
     762        echo '<div class="fasi">';
     763        if ( $this->torneo->finali >= 32 ) echo '<h4>' . __('Trentaduesimi', 'volleytnt') . '</h4>';
     764        if ( $this->torneo->finali >= 16 ) echo '<h4>' . __('Sedicesimi', 'volleytnt') . '</h4>';
     765        if ( $this->torneo->finali >= 8 ) echo '<h4>' . __('Ottavi', 'volleytnt') . '</h4>';
     766        if ( $this->torneo->finali >= 4 ) echo '<h4>' . __('Quarti', 'volleytnt') . '</h4>';
     767        if ( $this->torneo->finali >= 2 ) echo '<h4>' . __('Semifinali', 'volleytnt') . '</h4>';
     768        echo '<h4>' . __('Finalina', 'volleytnt') . '</h4>';
     769        echo '<h4>' . __('Finale', 'volleytnt') . '</h4>';
     770        echo '<br style="clear:both" />';
     771        echo '</div>';
     772       
     773        if ( $this->torneo->finali >= 32 ) {
     774            echo '<div class="trentaduesimi colonna">';
     775            for ( $i = 1; $i <= 32; $i++ ) $this->partita( $categoria, '32_' . $i );
     776            echo '</div>';
     777        }
     778        if ( $this->torneo->finali >= 16 ) {
     779            echo '<div class="sedicesimi colonna">';
     780            for ( $i = 1; $i <= 16; $i++ ) $this->partita( $categoria, '16_' . $i );
     781            echo '</div>';
     782        }
     783        if ( $this->torneo->finali >= 8 ) {
     784            echo '<div class="ottavi colonna">';
     785            for ( $i = 1; $i <= 8; $i++ ) $this->partita( $categoria, '8_' . $i );
     786            echo '</div>';
     787        }
     788        if ( $this->torneo->finali >= 4 ) {
     789            echo '<div class="quarti colonna">';
     790            for ( $i = 1; $i <= 4; $i++ ) $this->partita( $categoria, '4_' . $i );
     791            echo '</div>';
     792        }
     793        if ( $this->torneo->finali >= 2 ) {
     794            echo '<div class="semifinali colonna">';
     795            $this->partita( $categoria, '2_1' );
     796            $this->partita( $categoria, '2_2' );
     797            echo '</div>';
     798
     799            echo '<div class="finalina colonna">';
     800            $this->partita( $categoria, '1_1' );
     801            echo '</div>';
     802        }
     803       
     804        echo '<div class="finale colonna">';
     805        $this->partita( $categoria, '0_1' );
     806        echo '</div>';
     807
     808        echo '</div>';
     809        echo '<br style="clear:both" />';
     810    }
     811}
     812
    357813global $VolleyTNT;
    358814if ( !isset( $VolleyTNT ) or !( $VolleyTNT instanceof VolleyTNT ) ) $VolleyTNT = new VolleyTNT();
  • volleytnt/trunk/style/common.css

    r471987 r575201  
     1.tabellonefinale .fasi h4,
     2.tabellonefinale .colonna {
     3    float:left;
     4    width:120px;
     5    clear:none;
     6}
     7
     8.tabellonefinale .partita {
     9    -moz-border-radius: 8px;
     10    -webkit-border-radius: 8px;
     11    -khtml-border-radius: 8px;
     12    border-radius: 8px;
     13}
     14
     15.tabellonefinale .partita .squadra {
     16    height:20px;
     17    line-height:20px;
     18    padding-left:3px;
     19}
     20
     21.tabellonefinale .partita .risultato {
     22    float: right;
     23    font-style: normal;
     24    font-weight: bold;
     25    font-size:16px;
     26    margin-right: 5px;
     27}
     28.tabellonefinale .partita .risultato.risultato1 {
     29    margin-top:1px;
     30}
     31.tabellonefinale .partita .separatore {
     32    border-style:solid;
     33    border-color:#000;
     34    border-width:2px 2px 2px 0;
     35    -moz-border-radius-topright: 8px;
     36    -webkit-border-top-right-radius: 8px;
     37    -khtml-border-top-right-radius: 8px;
     38    border-top-right-radius: 8px;
     39    -moz-border-radius-bottomright: 8px;
     40    -webkit-border-bottom-right-radius: 8px;
     41    -khtml-border-bottom-right-radius: 8px;
     42    border-bottom-right-radius: 8px;
     43}
     44
     45.tabellonefinale .partita.nongiocata .separatore {
     46    border-color:transparent;
     47}
     48
     49.tabellonefinale .partita.nongiocata .squadra,
     50.tabellonefinale .partita.nongiocata .punti {
     51    color:transparent;
     52}
     53
     54.tabellonefinale .partita .punti {
     55    color:#aaa;
     56    font-size:10px;
     57    line-height:10px;
     58    font-style:italic;
     59    margin:2px;
     60    height:15px;   
     61}
     62
     63.tabellonefinale .partita .punti2 {
     64    vertical-align:text-bottom;
     65}
     66
     67.tabellonefinale .partita .punti span {
     68    padding-right:4px;
     69}
     70
     71
     72.tabellonefinale .colonna.trentaduesimi .partita.p32_32,
     73.tabellonefinale .colonna.sedicesimi .partita.p16_16,
     74.tabellonefinale .colonna.ottavi .partita.p8_8,
     75.tabellonefinale .colonna.quarti .partita.p4_4,
     76.tabellonefinale .colonna.semifinali .partita.p2_2 {
     77    margin-bottom:0px;
     78}
     79
     80.tabellonefinale.base32 .trentaduesimi .partita,
     81.tabellonefinale.base16 .sedicesimi .partita,
     82.tabellonefinale.base8 .ottavi .partita,
     83.tabellonefinale.base4 .quarti .partita,
     84.tabellonefinale.base2 .semifinali .partita {
     85    margin-bottom:15px;
     86}
     87
     88.tabellonefinale.base32 .trentaduesimi .separatore,
     89.tabellonefinale.base16 .sedicesimi .separatore,
     90.tabellonefinale.base8 .ottavi .separatore,
     91.tabellonefinale.base4 .quarti .separatore,
     92.tabellonefinale.base2 .semifinali .separatore,
     93.tabellonefinale.base1 .finale .separatore {
     94    height:30px;   
     95}
     96
     97.tabellonefinale.base32 .trentaduesimi .sottoseparatore,
     98.tabellonefinale.base16 .sedicesimi .sottoseparatore,
     99.tabellonefinale.base8 .ottavi .sottoseparatore,
     100.tabellonefinale.base4 .quarti .sottoseparatore,
     101.tabellonefinale.base2 .semifinali .sottoseparatore,
     102.tabellonefinale.base1 .finale .sottoseparatore {
     103    height:0px;
     104}
     105
     106.tabellonefinale.base32 .sedicesimi .partita,
     107.tabellonefinale.base16 .ottavi .partita,
     108.tabellonefinale.base8 .quarti .partita,
     109.tabellonefinale.base4 .semifinali .partita {
     110    margin-top:16px;
     111    margin-bottom:48px;
     112}
     113
     114.tabellonefinale.base32 .sedicesimi .separatore,
     115.tabellonefinale.base16 .ottavi .separatore,
     116.tabellonefinale.base8 .quarti .separatore,
     117.tabellonefinale.base4 .semifinali .separatore {
     118    height:86px;   
     119}
     120
     121.tabellonefinale.base32 .sedicesimi .sottoseparatore,
     122.tabellonefinale.base16 .ottavi .sottoseparatore,
     123.tabellonefinale.base8 .quarti .sottoseparatore,
     124.tabellonefinale.base4 .semifinali .sottoseparatore {
     125    height:54px;   
     126}
     127
     128.tabellonefinale.base32 .ottavi .partita,
     129.tabellonefinale.base16 .quarti .partita,
     130.tabellonefinale.base8 .semifinali .partita {
     131    margin-top:60px;
     132    margin-bottom:136px;
     133}
     134
     135.tabellonefinale.base32 .ottavi .separatore,
     136.tabellonefinale.base16 .quarti .separatore,
     137.tabellonefinale.base8 .semifinali .separatore {
     138    height:176px;   
     139}
     140
     141.tabellonefinale.base32 .ottavi .sottoseparatore,
     142.tabellonefinale.base16 .quarti .sottoseparatore,
     143.tabellonefinale.base8 .semifinali .sottoseparatore {
     144    height:144px;   
     145}
     146
     147.tabellonefinale.base32 .quarti .partita,
     148.tabellonefinale.base16 .semifinali .partita {
     149    margin-top:149px;
     150    margin-bottom:314px;
     151}
     152
     153.tabellonefinale.base32 .quarti .separatore,
     154.tabellonefinale.base16 .semifinali .separatore {
     155    height:354px;   
     156}
     157
     158.tabellonefinale.base32 .quarti .sottoseparatore,
     159.tabellonefinale.base16 .semifinali .sottoseparatore {
     160    height:322px;   
     161}
     162
     163.tabellonefinale.base32 .semifinali .partita {
     164    margin-top:327px;
     165    margin-bottom:670px;
     166}
     167
     168.tabellonefinale.base32 .semifinali .separatore {
     169    height:710px;   
     170}
     171
     172.tabellonefinale.base32 .semifinali .sottoseparatore {
     173    height:677px;   
     174}
     175
     176
     177
     178
     179
     180
     181.tabellonefinale.base32 {
     182    width: 860px;
     183}
     184
     185.tabellonefinale.base32 .colonna {
     186    height:2860px;
     187}
     188
     189.tabellonefinale.base32 .finalina .partita {
     190    margin-top:683px;
     191}
     192
     193.tabellonefinale.base32 .finalina .separatore {
     194    height:1422px; 
     195}
     196
     197.tabellonefinale.base32 .finalina .sottoseparatore {
     198    height:1390px; 
     199}
     200
     201.tabellonefinale.base32 .finale .partita {
     202    margin-top:783px;
     203}
     204
     205.tabellonefinale.base32 .finale .separatore {
     206    height:1222px; 
     207}
     208
     209.tabellonefinale.base32 .finale .sottoseparatore {
     210    height:1190px; 
     211}
     212
     213
     214
     215
     216
     217
     218
     219
     220
     221
     222.tabellonefinale.base16 {
     223    width: 740px;
     224}
     225
     226.tabellonefinale.base16 .colonna {
     227    height:1430px;
     228}
     229
     230.tabellonefinale.base16 .finalina .partita {
     231    margin-top:322px;
     232}
     233
     234.tabellonefinale.base16 .finalina .separatore {
     235    height:700px;   
     236}
     237
     238.tabellonefinale.base16 .finalina .sottoseparatore {
     239    height:668px;   
     240}
     241
     242.tabellonefinale.base16 .finale .partita {
     243    margin-top:422px;
     244}
     245
     246.tabellonefinale.base16 .finale .separatore {
     247    height:500px;   
     248}
     249
     250.tabellonefinale.base16 .finale .sottoseparatore {
     251    height:468px;   
     252}
     253
     254
     255
     256
     257
     258
     259
     260
     261
     262.tabellonefinale.base8 {
     263    width: 620px;
     264}
     265
     266.tabellonefinale.base8 .colonna {
     267    height:715px;
     268}
     269
     270.tabellonefinale.base8 .finalina .partita {
     271    margin-top:150px;
     272}
     273
     274.tabellonefinale.base8 .finalina .separatore {
     275    height:352px;   
     276}
     277
     278.tabellonefinale.base8 .finalina .sottoseparatore {
     279    height:320px;   
     280}
     281
     282.tabellonefinale.base8 .finale .partita {
     283    margin-top:200px;
     284}
     285
     286.tabellonefinale.base8 .finale .separatore {
     287    height:250px;   
     288}
     289
     290.tabellonefinale.base8 .finale .sottoseparatore {
     291    height:218px;   
     292}
     293
     294
     295
     296
     297
     298
     299
     300
     301
     302.tabellonefinale.base4 {
     303    width: 500px;
     304}
     305
     306.tabellonefinale.base4 .colonna {
     307    height:365px;
     308}
     309
     310.tabellonefinale.base4 .finalina .partita {
     311    margin-top:60px;
     312}
     313
     314.tabellonefinale.base4 .finalina .separatore {
     315    height:176px;   
     316}
     317
     318.tabellonefinale.base4 .finalina .sottoseparatore {
     319    height:144px;   
     320}
     321
     322.tabellonefinale.base4 .finale .partita {
     323    margin-top:90px;
     324}
     325
     326.tabellonefinale.base4 .finale .separatore {
     327    height:116px;   
     328}
     329
     330.tabellonefinale.base4 .finale .sottoseparatore {
     331    height:84px;   
     332}
     333
     334
     335
     336
     337
     338
     339
     340
     341
     342
     343.tabellonefinale.base2 {
     344    width: 380px;
     345}
     346
     347.tabellonefinale.base2 .colonna {
     348    height:190px;
     349}
     350
     351.tabellonefinale.base2 .finalina .partita {
     352    margin-top:16px;
     353}
     354
     355.tabellonefinale.base2 .finalina .separatore {
     356    height:86px;   
     357}
     358
     359.tabellonefinale.base2 .finalina .sottoseparatore {
     360    height:54px;   
     361}
     362
     363.tabellonefinale.base2 .finale .partita {
     364    margin-top:40px;
     365}
     366
     367.tabellonefinale.base2 .finale .separatore {
     368    height:39px;   
     369}
     370
     371.tabellonefinale.base2 .finale .sottoseparatore {
     372    height:7px;
     373}
     374
     375
     376
     377
     378
     379
     380
     381
     382
     383
     384
     385.tabellonefinale.base1 {
     386    width: 140px;
     387}
     388
     389.tabellonefinale.base1 .colonna {
     390    height:90px;
     391}
Note: See TracChangeset for help on using the changeset viewer.