Plugin Directory

Changeset 976090


Ignore:
Timestamp:
08/31/2014 01:48:26 PM (12 years ago)
Author:
finalan
Message:

0.9.1

  • added new elementname: Rangliste - displays Rangliste by LivePZ (example: [ttlive elementname="Rangliste"])
  • new parameter for element "Rangliste": display_all (default: 1) - display_all=0, hides players with LivePZ "k.A."
  • bugfix in widget: if there is no value to display, the header will be hidden
Location:
ttlive/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ttlive/trunk/index.php

    r965047 r976090  
    44Plugin URI: http://www.svbb-tischtennis.de/
    55Description: 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
     6Version: 0.9.1
    77Author: finalan
    88Author URI: http://www.svbb-tischtennis.de
     
    1313function TTLive_func( $atts, $content = null ) {
    1414    $a = shortcode_atts( array(
    15         'elementname' => '',        // Rueckgabe-Element "Spielplan", "Tabelle" oder "14Tage"
     15        'elementname' => '',        // Rueckgabe-Element "Spielplan", "Tabelle", "14Tage" oder "Rangliste"
    1616        'mannschaft_id' => get_post_meta(get_the_ID(), "mannschaft_id", true),      // TTLive Mannschaft ID
    1717        'staffel_id' => get_post_meta(get_the_ID(), "staffel_id", true),        // TTLive Staffel ID
     
    3232        'relegation' => '',         // Relegationsplätze
    3333        //ENDE nur für Tabelle
     34        'display_all' => false,      //Rangliste: zeigt alle oder nur Spieler mit gültiger LivePZ
    3435        'display_type' => false,    // die letzten 14Tage (0 - default) oder die naechsten 14Tage (1)       
    3536        'refresh' => get_option('TTLive_refreshHours'),             // Anzahl Stunden bis die Daten erneut vom Live-System aktualisiert werden sollen       
     
    7071            }
    7172            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;
    7278        default:
    7379            $retval = "Konnte Elementname nicht auswerten";
     
    126132          $plan .= "</tr></thead>\n";
    127133          $tableRow = "even";
    128           $zeile;
     134          $zeile = 0;
     135
     136          $dateOld = null;
    129137          foreach($xml->Content->Spielplan->Spiel as $key => $attribute)
    130138          {
     
    372380}
    373381
     382function 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
    374448function getTTLive14Tage(&$params){
    375449    $debug = 0;
     
    405479            $nodes = $xml->xpath('/NachsteSpiele/Content/Spiel');
    406480        }
    407         $plan .= "<table class='" . $tableclassname . "'>\n";
     481        $plan = "<table class='" . $tableclassname . "'>\n";
    408482        $plan .= "<tr><th></th><th>Datum</th>\n";
    409483        $plan .= "<th>Zeit</th>\n";
     
    417491        }
    418492        $plan .= "</tr>\n";
    419         $zeile;
     493        $zeile = 0;
    420494         
    421495        foreach($nodes as $key => $attribute)
     
    447521                    $plan .=  " class='odd'>";
    448522                }                       
    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";
    450524                $plan .= "<td>$time</td>\n";
    451525                $staffel = explode(", ", $attribute->Staffelname);
     
    581655        }
    582656       
    583         $zeile;
    584         $plan .= '<dl>'; 
     657        $zeile = 0;
     658        $plan = '<dl>';
    585659        foreach($nodes as $key => $attribute)
    586660        {
     
    604678            if ( !$hide) {     
    605679                             
    606                 $plan .= '<dt>'.$marker.$attribute->Tag.', '.$thedate->format('d.m.Y');
     680                $plan .= '<dt>'.$attribute->Tag.', '.$thedate->format('d.m.Y');
    607681                $plan .= " - $time Uhr<br />";
    608682                $staffel = explode(", ", $attribute->Staffelname);
     
    924998        $title_results = apply_filters( 'widget_title', $instance['title_results'] );
    925999        $title_preview = apply_filters( 'widget_title', $instance['title_preview'] );
    926        
    927         echo $before_widget;
     1000        echo '<aside class="widget widget-ttlive">';
    9281001        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>";
    9321005        $arr = array("elementname" => "14Tage", "display_type" => "0", "widget" => "1", "showxdays" => $showxdays, "max" => $maxnumber);
    9331006        if ( empty($maxnumber) ) unset($arr["max"]);
    9341007        if ( empty($showxdays) ) unset($arr["showxdays"]);     
    9351008        $tmp = ttlive_func($arr,null);
    936         echo $header.$tmp;
     1009        if ($tmp != "") echo $header.$tmp;
    9371010        $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>';
    9411015    }
    9421016
  • ttlive/trunk/readme.txt

    r965040 r976090  
    44Tags:
    55Requires at least: 3.0.1
    6 Tested up to: 3.5.1
    7 Stable tag: 0.8.5
     6Tested up to: 3.8.2
     7Stable tag: 0.9.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3030
    3131Parameters:
    32 `elementname` - Rueckgabe-Element - mögliche Werte: Mannschaft, Spielplan, Tabelle oder 14Tage
     32`elementname` - Rueckgabe-Element - mögliche Werte: Mannschaft, Spielplan, Tabelle, 14Tage oder Rangliste
    3333`mannschaft_id` - TTLive Mannschaft ID
    3434`staffel_id` - TTLive Staffel ID
     
    4747`abstiegsplatz` - Nur für die Tabelle:  Abstiegsplaetze ab (default: 9)
    4848`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
    4950`display_type` - Nur für die 14Tage: die letzten 14Tage (0 - default) oder die naechsten 14Tage (1)     
    5051`refresh` - Anzahl Stunden bis die Daten erneut vom Live-System aktualisiert werden sollen
     
    5657`[ttlive elementname="14Tage" tableclassname="TTLive14Tage" display_type=0]`
    5758`[ttlive elementname="14Tage" tableclassname="TTLive14Tage" display_type=1]`
     59`[ttlive elementname="Rangliste" tableclassname="TTLiveRangliste" display_all=0]`
    5860
    5961css Example:
     
    7981
    8082== 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
    8188
    8289= 0.9 =
Note: See TracChangeset for help on using the changeset viewer.