Changeset 583439
- Timestamp:
- 08/09/2012 08:47:39 AM (14 years ago)
- Location:
- volleytnt/trunk
- Files:
-
- 7 edited
-
admin/volleytnt_finali.php (modified) (4 diffs)
-
admin/volleytnt_partite.php (modified) (1 diff)
-
core/the_plugin.php (modified) (16 diffs)
-
js/admin_finali.js (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
style/admin.css (modified) (1 diff)
-
volleytnt.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
volleytnt/trunk/admin/volleytnt_finali.php
r575704 r583439 42 42 `squadra_1` = %d, 43 43 `squadra_2` = %d, 44 `visibile` = %d 44 `visibile` = %d, 45 `testo_1` = %s, 46 `testo_2` = %s 45 47 WHERE `categoria` = %s 46 48 AND `finale` = %s … … 49 51 $_POST['set2_sq1'], 50 52 $_POST['set3_sq1'], 51 $_POST['set4_sq1'],52 $_POST['set5_sq1'],53 isset( $_POST['set4_sq1'] ) ? $_POST['set4_sq1'] : 0, 54 isset( $_POST['set5_sq1'] ) ? $_POST['set5_sq1'] : 0, 53 55 $_POST['set1_sq2'], 54 56 $_POST['set2_sq2'], 55 57 $_POST['set3_sq2'], 56 $_POST['set4_sq2'],57 $_POST['set5_sq2'],58 isset( $_POST['set4_sq2'] ) ? $_POST['set4_sq2'] : 0, 59 isset( $_POST['set5_sq2'] ) ? $_POST['set5_sq2'] : 0, 58 60 $_POST['squadra_1'], 59 61 $_POST['squadra_2'], 60 62 $_POST['visibile'], 63 $_POST['testo_1'], 64 $_POST['testo_2'], 61 65 $_POST['categoria'], 62 66 $_POST['id_partita'], … … 77 81 $_POST['id_partita'], 78 82 $this->opts->corrente ) ); 83 84 if ( !$row->label_1 ) $row->label_1 = $row->testo_1; 85 if ( !$row->label_2 ) $row->label_2 = $row->testo_2; 79 86 80 87 $row->set1 = $row->set2 = 0; … … 155 162 </tbody> 156 163 </table> 157 <p><input type="checkbox" id="partita_visibile" tabindex="13"><label for="partita_visibile"><?php _e('Partita giocata', 'volleytnt'); ?></label></p> 158 <p><input type="submit" class="button-primary" value="<?php echo esc_attr( __('Salva partita', 'volleytnt' ) ); ?>" tabindex="14"></p> 164 <p> 165 <input type="checkbox" id="partita_visibile" tabindex="13"> <label for="partita_visibile"><?php _e('Partita giocata', 'volleytnt'); ?></label> 166 <input type="text" id="testo_1" tabindex="14"> <label for="testo_1"><?php _e('Testo 1', 'volleytnt'); ?></label> 167 <input type="text" id="testo_2" tabindex="15"> <label for="testo_2"><?php _e('Testo 2', 'volleytnt'); ?></label> 168 169 </p> 170 <p><input type="submit" class="button-primary" value="<?php echo esc_attr( __('Salva partita', 'volleytnt' ) ); ?>" tabindex="16"></p> 159 171 </form> 160 172 <?php -
volleytnt/trunk/admin/volleytnt_partite.php
r576316 r583439 14 14 $this->add_case( 'firstpage' ); 15 15 16 $this->trigger( 'rigenerapartitegironi', array( $this, 'rigenera_partite_gironi' ), '?page= VolleyTNT_Partite' );16 $this->trigger( 'rigenerapartitegironi', array( $this, 'rigenera_partite_gironi' ), '?page=volleytnt_partite' ); 17 17 18 18 add_action( 'wp_ajax_volleytnt_partite_orari', array( $this, 'ajax_partite_orari' ) ); -
volleytnt/trunk/core/the_plugin.php
r579121 r583439 58 58 59 59 add_shortcode( 'volleytnt_classifiche_gironi', array( $this, 'sc_classifiche_gironi' ) ); 60 add_shortcode( 'volleytnt_classifiche_intergironi', array( $this, 'sc_classifiche_intergironi' ) ); 60 61 add_shortcode( 'volleytnt_risultati', array( $this, 'sc_risultati' ) ); 61 62 add_shortcode( 'volleytnt_calendario', array( $this, 'sc_calendario' ) ); … … 219 220 'corrente' => 0 ) ); 220 221 $this->torneo = $wpdb->get_row("SELECT * FROM `{$this->prefix}tornei` WHERE `id`={$this->opts->corrente}"); 221 $this->torneo->categorie = explode( ',', $this->torneo->categorie ); 222 $this->torneo->set_partita = absint( $this->torneo->set_partita ); 223 $this->torneo->campi = absint( $this->torneo->campi ); 224 $this->torneo->durata_turno = absint( $this->torneo->durata_turno ); 225 $this->torneo->finali_M = absint( $this->torneo->finali_M ); 226 $this->torneo->finali_F = absint( $this->torneo->finali_F ); 227 $this->torneo->finali_X = absint( $this->torneo->finali_X ); 228 222 if ( $this->torneo ) { 223 $this->torneo->categorie = explode( ',', $this->torneo->categorie ); 224 $this->torneo->set_partita = absint( $this->torneo->set_partita ); 225 $this->torneo->campi = absint( $this->torneo->campi ); 226 $this->torneo->durata_turno = absint( $this->torneo->durata_turno ); 227 $this->torneo->finali_M = absint( $this->torneo->finali_M ); 228 $this->torneo->finali_F = absint( $this->torneo->finali_F ); 229 $this->torneo->finali_X = absint( $this->torneo->finali_X ); 230 } else { 231 $this->torneo = new stdClass(); 232 $this->torneo->categorie = array(); 233 $this->torneo->set_partita = 3; 234 $this->torneo->campi = 2; 235 $this->torneo->durata_turno = 30; 236 $this->torneo->finali_M = 8; 237 $this->torneo->finali_F = 8; 238 $this->torneo->finali_X = 8; 239 } 229 240 VolleyTNT_Form::manage_cbs_save(); 230 241 foreach ( $this->pages as $page ) $page->do_triggers(); … … 359 370 `{$this->prefix}squadre`.`id` 360 371 ORDER BY 372 `{$this->prefix}squadre`.`categoria` ASC, 373 `{$this->prefix}gironi`.`girone` ASC, 361 374 `{$this->prefix}squadre`.`label` ASC, 362 375 `{$this->prefix}atleti`.`cognome` ASC, … … 393 406 if ( !isset( $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ] ) ) 394 407 $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ] = array( 'giocate' => 0, 408 'punti_class' => 0, 395 409 'vinti' => 0, 396 410 'persi' => 0, … … 401 415 if ( !isset( $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ] ) ) 402 416 $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ] = array( 'giocate' => 0, 417 'punti_class' => 0, 403 418 'vinti' => 0, 404 419 'persi' => 0, … … 438 453 439 454 if ( $set1_sq1 > $set1_sq2 ) { 455 $vinti1++; 440 456 $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['vinti']++; 441 457 $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['persi']++; 442 458 } else { 459 $vinti2++; 443 460 $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['vinti']++; 444 461 $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['persi']++; 445 462 } 446 463 if ( $set2_sq1 > $set2_sq2 ) { 464 $vinti1++; 447 465 $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['vinti']++; 448 466 $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['persi']++; 449 467 } else { 468 $vinti2++; 450 469 $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['vinti']++; 451 470 $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['persi']++; … … 453 472 if ( $this->torneo->set_partita == 5 ) { 454 473 if ( $set3_sq1 > $set3_sq2 ) { 474 $vinti1++; 455 475 $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['vinti']++; 456 476 $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['persi']++; 457 477 } else { 478 $vinti2++; 458 479 $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['vinti']++; 459 480 $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['persi']++; 460 481 } 461 482 if ( $set4_sq1 or $set4_sq2 ) if ( $set4_sq1 > $set4_sq2 ) { 483 $vinti1++; 462 484 $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['vinti']++; 463 485 $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['persi']++; 464 486 } else { 487 $vinti2++; 465 488 $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['vinti']++; 466 489 $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['persi']++; 467 490 } 468 491 if ( $set5_sq1 or $set5_sq2 ) if ( $set5_sq1 > $set5_sq2 ) { 492 $vinti1++; 469 493 $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['vinti']++; 470 494 $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['persi']++; 471 495 } else { 496 $vinti2++; 472 497 $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['vinti']++; 473 498 $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['persi']++; … … 475 500 } else { 476 501 if ( $set3_sq1 or $set3_sq2 ) if ( $set3_sq1 > $set3_sq2 ) { 502 $vinti1++; 477 503 $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['vinti']++; 478 504 $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['persi']++; 479 505 } else { 506 $vinti2++; 480 507 $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['vinti']++; 481 508 $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['persi']++; 482 509 } 483 510 } 511 if ( $this->torneo->set_partita == 5 ) { 512 if ( $vinti1 > $vinti2 ) { 513 if ( $vinti2 == 2 ) { 514 $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['punti_class'] += 2; 515 $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['punti_class'] += 1; 516 } else { 517 $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['punti_class'] += 3; 518 } 519 } else { 520 if ( $vinti1 == 2 ) { 521 $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['punti_class'] += 1; 522 $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['punti_class'] += 2; 523 } else { 524 $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['punti_class'] += 3; 525 } 526 } 527 } else { 528 if ( $vinti1 > $vinti2 ) { 529 $work[ $row->categoria ][ $row->girone ][ $row->squadra_1 ]['punti_class'] += 3; 530 } else { 531 $work[ $row->categoria ][ $row->girone ][ $row->squadra_2 ]['punti_class'] += 3; 532 } 533 } 484 534 } 485 535 } … … 488 538 foreach ( $i_gironi as $girone => $squadre ) { 489 539 foreach ( $squadre as $id_squadra => $dati ) { 540 $dati['q_punti_class'] = $dati['giocate'] ? round( $dati['punti_class'] / $dati['giocate'], 2 ) : 0; 490 541 $dati['q_vinti'] = $dati['giocate'] ? round( $dati['vinti'] / $dati['giocate'], 2 ) : 0; 491 542 $dati['d_set'] = $dati['vinti'] - $dati['persi']; … … 506 557 507 558 private function sort_classifica( $a, $b ) { 508 if ( $a['vinti'] == $b['vinti'] ) { 509 if ( $a['qd_set'] == $b['qd_set'] ) { 510 if ( $a['qd_punti'] == $b['qd_punti'] ) { 511 if ( $a['giocate'] == $b['giocate'] ) { 512 return 0; 513 } else return $a['giocate'] > $b['giocate'] ? 1 : -1; 514 } else return $a['qd_punti'] < $b['qd_punti'] ? 1 : -1; 515 } else return $a['qd_set'] < $b['qd_set'] ? 1 : -1; 516 } else return $a['vinti'] < $b['vinti'] ? 1 : -1; 559 if ( $a['punti_class'] == $b['punti_class'] ) { 560 if ( $a['vinti'] == $b['vinti'] ) { 561 if ( $a['d_set'] == $b['d_set'] ) { 562 if ( $a['d_punti'] == $b['d_punti'] ) { 563 if ( $a['giocate'] == $b['giocate'] ) { 564 return strcmp( $a['label'], $b['label'] ); 565 } else return $a['giocate'] > $b['giocate'] ? 1 : -1; 566 } else return $a['d_punti'] < $b['d_punti'] ? 1 : -1; 567 } else return $a['d_set'] < $b['d_set'] ? 1 : -1; 568 } else return $a['vinti'] < $b['vinti'] ? 1 : -1; 569 } else return $a['punti_class'] < $b['punti_class'] ? 1 : -1; 570 } 571 572 private function sort_classifica_intergironi( $a, $b ) { 573 if ( $a['q_punti_class'] == $b['q_punti_class'] ) { 574 if ( $a['q_vinti'] == $b['q_vinti'] ) { 575 if ( $a['qd_set'] == $b['qd_set'] ) { 576 if ( $a['qd_punti'] == $b['qd_punti'] ) { 577 return strcmp( $a['label'], $b['label'] ); 578 } else return $a['qd_punti'] < $b['qd_punti'] ? 1 : -1; 579 } else return $a['qd_set'] < $b['qd_set'] ? 1 : -1; 580 } else return $a['q_vinti'] < $b['q_vinti'] ? 1 : -1; 581 } else return $a['q_punti_class'] < $b['q_punti_class'] ? 1 : -1; 517 582 } 518 583 … … 663 728 } 664 729 730 public function sc_classifiche_intergironi( $atts, $content = '' ) { 731 extract( shortcode_atts( array( 732 'torneo' => $this->opts->corrente 733 ), $atts ) ); 734 if ( !$torneo ) return ''; 735 $_ = '<div class="tornei_classifiche_intergironi">'; 736 $classifiche = $this->get_classifiche( $torneo ); 737 foreach ( $classifiche as $categoria => $gironi ) { 738 $_ .= '<h3>' . $this->l_categorie[ $categoria ] . '</h3>'; 739 $work = array(); 740 foreach ( $gironi as $girone => $squadre ) { 741 foreach ( $squadre as $pos => $value ) { 742 $work[ $pos + 1 ][] = $value; 743 } 744 } 745 foreach ( $work as $pos => $squadre ) { 746 747 $_ .= '<h4>' . sprintf( __('%d<sup>e</sup> classificate', 'volleytnt'), $pos ) . '</h4>'; 748 $_ .= '<table><thead><tr>'; 749 $_ .= '<th class="posizione">' . __('Pos.', 'volleytnt') . '</th>'; 750 $_ .= '<th class="squadra">' . __('Squadra', 'volleytnt') . '</th>'; 751 $_ .= '<th class="partite">' . __('Partite', 'volleytnt') . '</th>'; 752 $_ .= '<th class="pticlass">' . __('Q. p.ti class.', 'volleytnt') . '</th>'; 753 $_ .= '<th class="setvinti">' . __('Q. set vinti', 'volleytnt') . '</th>'; 754 $_ .= '<th class="diffset">' . __('Q. diff. set', 'volleytnt') . '</th>'; 755 $_ .= '<th class="diffpti">' . __('Q. diff. p.ti', 'volleytnt') . '</th>'; 756 $_ .= '</tr></thead><tbody>'; 757 $subpos = 1; 758 usort( $squadre, array( $this, 'sort_classifica_intergironi') ); 759 foreach ( $squadre as $s ) { 760 $_ .= '<tr>'; 761 $_ .= '<td class="posizione">' . $subpos . 'º</td>'; 762 $_ .= '<td class="squadra">' . $s['label'] . '</td>'; 763 $_ .= '<td class="partite">' . $s['giocate'] . '</td>'; 764 $_ .= '<td class="pticlass">' . $s['q_punti_class'] . '</td>'; 765 $_ .= '<td class="setvinti">' . $s['q_vinti'] . '</td>'; 766 $_ .= '<td class="diffset">' . $s['qd_set'] . '</td>'; 767 $_ .= '<td class="diffpti">' . $s['qd_punti'] . '</td>'; 768 $_ .= '</tr>'; 769 $subpos++; 770 } 771 $_ .= '</tbody></table>'; 772 } 773 } 774 775 return $_ . '</div>'; 776 } 777 778 665 779 666 780 public function sc_classifiche_gironi( $atts, $content = '' ) { … … 675 789 $_ .= '<h3>' . sprintf( __('Girone %s', 'volleytnt'), $categoria . $girone ) . '</h3>'; 676 790 $_ .= '<table><thead><tr>'; 677 $_ .= '<th class="posizione" >' . __('Pos.', 'volleytnt') . '</th>';791 $_ .= '<th class="posizione" colspan="2">' . __('Pos.', 'volleytnt') . '</th>'; 678 792 $_ .= '<th class="squadra">' . __('Squadra', 'volleytnt') . '</th>'; 679 793 $_ .= '<th class="partite">' . __('Partite', 'volleytnt') . '</th>'; … … 684 798 $_ .= '<tr>'; 685 799 $_ .= '<td class="posizione">' . $pos . 'º</td>'; 800 $_ .= '<td class="punticlass">' . $s['punti_class'] . '</td>'; 686 801 $_ .= '<td class="squadra">' . $s['label'] . '</td>'; 687 802 $_ .= '<td class="partite">' . $s['giocate'] . '</td>'; 688 $_ .= '<td class="set">' . $s['vinti'] . 'v, ' . $s['persi'] . 'p <em>(' . $s[' qd_set'] . ')</em></td>';689 $_ .= '<td class="punti">' . $s['fatti'] . 'f, ' . $s['subiti'] . 's <em>(' . $s[' qd_punti'] . ')</em></td>';803 $_ .= '<td class="set">' . $s['vinti'] . 'v, ' . $s['persi'] . 'p <em>(' . $s['d_set'] . ')</em></td>'; 804 $_ .= '<td class="punti">' . $s['fatti'] . 'f, ' . $s['subiti'] . 's <em>(' . $s['d_punti'] . ')</em></td>'; 690 805 $_ .= '</tr>'; 691 806 $pos++; … … 878 993 $p->set5_sq1 = ''; 879 994 $p->set5_sq2 = ''; 995 $p->testo_1 = ''; 996 $p->testo_2 = ''; 880 997 $class = 'partita nongiocata'; 881 998 } … … 893 1010 ?> 894 1011 <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; ?>"> 895 <div class="squadra squadra1"><?php echo isset( $this->squadre[ $p->categoria ][ $p->squadra_1 ] ) ? $this->squadre[ $p->categoria ][ $p->squadra_1 ] : ''; ?></div>1012 <div class="squadra squadra1"><?php echo ( $p->squadra_1 and isset( $this->squadre[ $p->categoria ][ $p->squadra_1 ] ) ) ? $this->squadre[ $p->categoria ][ $p->squadra_1 ] : $p->testo_1; ?></div> 896 1013 <div class="separatore"> 897 1014 <div class="punti punti1"> … … 917 1034 </div> 918 1035 </div> 919 <div class="squadra squadra2"><?php echo isset( $this->squadre[ $p->categoria ][ $p->squadra_2 ] ) ? $this->squadre[ $p->categoria ][ $p->squadra_2 ] : ''; ?></div>1036 <div class="squadra squadra2"><?php echo ( $p->squadra_2 and isset( $this->squadre[ $p->categoria ][ $p->squadra_2 ] ) ) ? $this->squadre[ $p->categoria ][ $p->squadra_2 ] : $p->testo_2; ?></div> 920 1037 </div> 921 1038 <?php -
volleytnt/trunk/js/admin_finali.js
r575704 r583439 23 23 set4_sq2: $('#formfinale .set4_sq2').val(), 24 24 set5_sq2: $('#formfinale .set5_sq2').val(), 25 visibile: $('#partita_visibile').prop('checked') ? 1 : 0 }; 25 visibile: $('#partita_visibile').prop('checked') ? 1 : 0, 26 testo_1: $('#formfinale #testo_1').val(), 27 testo_2: $('#formfinale #testo_2').val(), }; 26 28 $('body').addClass('loading'); 27 29 $.post( ajaxurl, … … 84 86 $('#formfinale').attr('id_partita', partita.attr('id_partita') ); 85 87 $('#partita_visibile').prop('checked', !partita.hasClass('nongiocata') ); 88 89 $('#formfinale #testo_1').val( partita.attr('squadra_1') == '0' ? partita.find('.squadra.squadra1').text() : '' ); 90 $('#formfinale #testo_2').val( partita.attr('squadra_2') == '0' ? partita.find('.squadra.squadra2').text() : '' ); 86 91 $('#formfinale').dialog('open'); 87 92 } ); -
volleytnt/trunk/readme.txt
r579127 r583439 36 36 * **[volleytnt_risultati]** the results of the first phases 37 37 * **[volleytnt_classifiche_gironi]** the standings of the round 38 * **[volleytnt_classifiche_intergironi]** the standings between all rounds, merged by position 38 39 * **[volleytnt_finali]** the final knock-out tree 39 40 … … 48 49 * Added dashboard widget to calculate the number of matches needed. 49 50 * Added RSS, RSS2 and Atom feed for matches results 51 * Added standings between all rounds 52 * Added custom labels in finals matches 50 53 * Bug fixes: 51 54 * Team deletion now run properly -
volleytnt/trunk/style/admin.css
r578816 r583439 169 169 } 170 170 171 #formfinale #testo_1, 172 #formfinale #testo_2 { 173 width:160px; 174 margin-left:50px; 175 } 176 171 177 #formfinale select { 172 178 width:100%; -
volleytnt/trunk/volleytnt.php
r578816 r583439 72 72 `tornei_id` BIGINT(20) UNSIGNED NOT NULL, 73 73 `visibile` TINYINT(1) NOT NULL DEFAULT '1', 74 `testo_1` VARCHAR(100) DEFAULT NULL, 75 `testo_2` VARCHAR(100) DEFAULT NULL, 74 76 PRIMARY KEY (`id`) 75 77 ) DEFAULT CHARSET=utf8",
Note: See TracChangeset
for help on using the changeset viewer.