Changeset 976090
- Timestamp:
- 08/31/2014 01:48:26 PM (12 years ago)
- Location:
- ttlive/trunk
- Files:
-
- 2 edited
-
index.php (modified) (12 diffs)
-
readme.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ttlive/trunk/index.php
r965047 r976090 4 4 Plugin URI: http://www.svbb-tischtennis.de/ 5 5 Description: A simple wordpress plugin to get the data from the ttlive-system and show it on my wp-post or wp-page 6 Version: 0.9 6 Version: 0.9.1 7 7 Author: finalan 8 8 Author URI: http://www.svbb-tischtennis.de … … 13 13 function TTLive_func( $atts, $content = null ) { 14 14 $a = shortcode_atts( array( 15 'elementname' => '', // Rueckgabe-Element "Spielplan", "Tabelle" oder "14Tage"15 'elementname' => '', // Rueckgabe-Element "Spielplan", "Tabelle", "14Tage" oder "Rangliste" 16 16 'mannschaft_id' => get_post_meta(get_the_ID(), "mannschaft_id", true), // TTLive Mannschaft ID 17 17 'staffel_id' => get_post_meta(get_the_ID(), "staffel_id", true), // TTLive Staffel ID … … 32 32 'relegation' => '', // Relegationsplätze 33 33 //ENDE nur für Tabelle 34 'display_all' => false, //Rangliste: zeigt alle oder nur Spieler mit gültiger LivePZ 34 35 'display_type' => false, // die letzten 14Tage (0 - default) oder die naechsten 14Tage (1) 35 36 'refresh' => get_option('TTLive_refreshHours'), // Anzahl Stunden bis die Daten erneut vom Live-System aktualisiert werden sollen … … 70 71 } 71 72 break; 73 case "Rangliste": 74 $a['filename'] = "wp-content/plugins/ttlive/ttlive-files/ttliveRangliste.xml"; 75 $a['url'] = $a['baseurl']."/Export/default.aspx?SpartenID=".get_option('TTLive_divisionID')."&Format=XML&SportArt=96&Area=VereinLivePZ"; 76 $retval = getTTLiveRangliste($a); 77 break; 72 78 default: 73 79 $retval = "Konnte Elementname nicht auswerten"; … … 126 132 $plan .= "</tr></thead>\n"; 127 133 $tableRow = "even"; 128 $zeile; 134 $zeile = 0; 135 136 $dateOld = null; 129 137 foreach($xml->Content->Spielplan->Spiel as $key => $attribute) 130 138 { … … 372 380 } 373 381 382 function getTTLiveRangliste(&$params){ 383 $debug = 0; 384 /** 385 * XML aus lokalem tmp Folder laden 386 */ 387 $tableclassname = get_option('TTLive_tableclassname_Rangliste'); 388 if ($params['tableclassname'] != '') { $tableclassname = $params['tableclassname']; } 389 390 refreshTTLiveData($params); 391 if($xml = simplexml_load_file($params['filename'], NULL, ($debug==1)?LIBXML_NOERROR:NULL)) 392 { 393 394 $nodes = $xml->xpath('/LivePZ/Content/Spieler'); 395 396 $plan = "<table class='" . $tableclassname . "'>\n"; 397 $plan .= "<tr><th>Nr.</th><th>Spieler</th>\n"; 398 $plan .= "<th>Geb.jahr</th>\n"; 399 $plan .= "<th>Geschlecht</th>\n"; 400 $plan .= "<th>LivePZ</th>\n"; 401 $plan .= "<th>Stichtag 1</th>\n"; 402 $plan .= "<th>Stichtag 2</th>\n"; 403 $plan .= "<th>Stichtag 3</th>\n"; 404 $plan .= "</tr>\n"; 405 $zeile = 0; 406 407 foreach($nodes as $key => $attribute) 408 { 409 $showSpieler = true; 410 if (!$params['display_all']) { 411 if ($attribute->LivePZ == "k.A."){ 412 $showSpieler = false; 413 } 414 } 415 if ($showSpieler){ 416 $zeile++; 417 418 419 $plan .= "<tr"; 420 if ($zeile % 2 !=0) { 421 //ungerade 422 $plan .= " class='even'>"; 423 } else { 424 //gerade 425 $plan .= " class='odd'>"; 426 } 427 $plan .= "<td>$zeile</td>\n"; 428 $plan .= "<td>$attribute->Spielername</td>\n"; 429 $plan .= "<td>$attribute->Gebdatum</td>\n"; 430 $plan .= "<td>$attribute->Geschlecht</td>\n"; 431 $plan .= "<td>$attribute->LivePZ</td>\n"; 432 $plan .= "<td>$attribute->Stichtag1</td>\n"; 433 $plan .= "<td>$attribute->Stichtag2</td>\n"; 434 $plan .= "<td>$attribute->Stichtag3</td>\n"; 435 $plan .= "</tr>\n"; 436 } 437 } 438 $plan .= "</table>\n"; 439 $plan .= "<br/>\n"; 440 return $plan; 441 } 442 else 443 { 444 return 'Konnte TT-Live-XML nicht laden'; 445 } 446 } 447 374 448 function getTTLive14Tage(&$params){ 375 449 $debug = 0; … … 405 479 $nodes = $xml->xpath('/NachsteSpiele/Content/Spiel'); 406 480 } 407 $plan .= "<table class='" . $tableclassname . "'>\n";481 $plan = "<table class='" . $tableclassname . "'>\n"; 408 482 $plan .= "<tr><th></th><th>Datum</th>\n"; 409 483 $plan .= "<th>Zeit</th>\n"; … … 417 491 } 418 492 $plan .= "</tr>\n"; 419 $zeile ;493 $zeile = 0; 420 494 421 495 foreach($nodes as $key => $attribute) … … 447 521 $plan .= " class='odd'>"; 448 522 } 449 $plan .= '<td>'.$ marker.$attribute->Tag.'</td><td>'.$thedate->format('d.m.').'</td>'."\n";523 $plan .= '<td>'.$attribute->Tag.'</td><td>'.$thedate->format('d.m.').'</td>'."\n"; 450 524 $plan .= "<td>$time</td>\n"; 451 525 $staffel = explode(", ", $attribute->Staffelname); … … 581 655 } 582 656 583 $zeile ;584 $plan .= '<dl>';657 $zeile = 0; 658 $plan = '<dl>'; 585 659 foreach($nodes as $key => $attribute) 586 660 { … … 604 678 if ( !$hide) { 605 679 606 $plan .= '<dt>'.$ marker.$attribute->Tag.', '.$thedate->format('d.m.Y');680 $plan .= '<dt>'.$attribute->Tag.', '.$thedate->format('d.m.Y'); 607 681 $plan .= " - $time Uhr<br />"; 608 682 $staffel = explode(", ", $attribute->Staffelname); … … 924 998 $title_results = apply_filters( 'widget_title', $instance['title_results'] ); 925 999 $title_preview = apply_filters( 'widget_title', $instance['title_preview'] ); 926 927 echo $before_widget; 1000 echo '<aside class="widget widget-ttlive">'; 928 1001 if ( ! empty( $title ) ) { 929 echo $before_title . $title . $after_title;930 } 931 $header .= "<em>$title_results</em>";1002 echo '<h1 class="widget-title">'.$title.'</h1>'; 1003 } 1004 $header = "<em>$title_results</em>"; 932 1005 $arr = array("elementname" => "14Tage", "display_type" => "0", "widget" => "1", "showxdays" => $showxdays, "max" => $maxnumber); 933 1006 if ( empty($maxnumber) ) unset($arr["max"]); 934 1007 if ( empty($showxdays) ) unset($arr["showxdays"]); 935 1008 $tmp = ttlive_func($arr,null); 936 echo $header.$tmp;1009 if ($tmp != "") echo $header.$tmp; 937 1010 $arr["display_type"] = "1"; 938 echo "<em>$title_preview</em>"; 939 echo ttlive_func($arr,null); 940 echo $after_widget; 1011 $title_preview = "<em>$title_preview</em>"; 1012 $tmp_prev = ttlive_func($arr,null); 1013 if ($tmp_prev != "") echo $title_preview.$tmp_prev; 1014 echo '</aside>'; 941 1015 } 942 1016 -
ttlive/trunk/readme.txt
r965040 r976090 4 4 Tags: 5 5 Requires at least: 3.0.1 6 Tested up to: 3. 5.17 Stable tag: 0. 8.56 Tested up to: 3.8.2 7 Stable tag: 0.9.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 30 30 31 31 Parameters: 32 `elementname` - Rueckgabe-Element - mögliche Werte: Mannschaft, Spielplan, Tabelle oder 14Tage32 `elementname` - Rueckgabe-Element - mögliche Werte: Mannschaft, Spielplan, Tabelle, 14Tage oder Rangliste 33 33 `mannschaft_id` - TTLive Mannschaft ID 34 34 `staffel_id` - TTLive Staffel ID … … 47 47 `abstiegsplatz` - Nur für die Tabelle: Abstiegsplaetze ab (default: 9) 48 48 `relegation` - Nur für die Tabelle: Relegationsplätze (default: '') Beispiel: relegation="2,8" -> 2 für die Relegation Aufstieg, und 8 für Abstieg 49 `display_type` - Nur für Rangliste: (default: 1) Wenn 0, dann werden nur die Spieler angezeigt die eine gültige LivePZ haben 49 50 `display_type` - Nur für die 14Tage: die letzten 14Tage (0 - default) oder die naechsten 14Tage (1) 50 51 `refresh` - Anzahl Stunden bis die Daten erneut vom Live-System aktualisiert werden sollen … … 56 57 `[ttlive elementname="14Tage" tableclassname="TTLive14Tage" display_type=0]` 57 58 `[ttlive elementname="14Tage" tableclassname="TTLive14Tage" display_type=1]` 59 `[ttlive elementname="Rangliste" tableclassname="TTLiveRangliste" display_all=0]` 58 60 59 61 css Example: … … 79 81 80 82 == Changelog == 83 84 = 0.9.1 = 85 * added new elementname: Rangliste - displays Rangliste by LivePZ (example: [ttlive elementname="Rangliste"]) 86 * new parameter for element "Rangliste": display_all (default: 1) - display_all=0, hides players with LivePZ "k.A." 87 * bugfix in widget: if there is no value to display, the header will be hidden 81 88 82 89 = 0.9 =
Note: See TracChangeset
for help on using the changeset viewer.