Plugin Directory

Changeset 690149


Ignore:
Timestamp:
04/01/2013 04:03:46 PM (13 years ago)
Author:
finalan
Message:
  • added sorting for last matches (14 Tage), to show the max number of matches by date
Location:
ttlive/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ttlive/trunk/index.php

    r690042 r690149  
    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.8.2
     6Version: 0.8.3
    77Author: finalan
    88Author URI: http://www.svbb-tischtennis.de
     
    360360}
    361361
     362
     363function xsort(&$nodes, $child_name, $order=SORT_ASC)
     364{
     365    $sort_proxy = array();
     366
     367    foreach ($nodes as $k => $node) {
     368        $sort_proxy[$k] = (string) $node->$child_name;
     369    }
     370
     371    array_multisort($sort_proxy, $order, $nodes);
     372}
     373
    362374function getTTLive14Tage(&$params){
    363375    $debug = 0;
     
    384396       
    385397        $expiration_date = new DateTime(date("d-m-Y",strtotime($op.$params['showxdays'].' day')));
    386        
     398               
     399        if ($params['display_type'] == 0) {
     400            $nodes = $xml->xpath('/LetzteSpiele/Content/Spiel');
     401   
     402            // Sort by date, descending
     403            xsort($nodes, 'Datum', SORT_DESC);
     404        } else {
     405            $nodes = $xml->xpath('/NachsteSpiele/Content/Spiel');
     406        }
    387407        $plan .= "<table class='" . $tableclassname . "'>\n";
    388408        $plan .= "<tr><th></th><th style='text-align:center'>Datum</th>\n";
     
    397417        }
    398418        $plan .= "</tr>\n";
    399         $zeile; 
    400         foreach($xml->Content->Spiel as $key => $attribute)
     419        $zeile;
     420         
     421        foreach($nodes as $key => $attribute)
    401422        {
    402423            $zeile++;           
     
    539560        $expiration_date = new DateTime(date("d-m-Y",strtotime($op.$params['showxdays'].' day')));
    540561       
     562        if ($params['display_type'] == 0) {
     563            $nodes = $xml->xpath('/LetzteSpiele/Content/Spiel');
     564   
     565            // Sort by date, descending
     566            xsort($nodes, 'Datum', SORT_DESC);
     567        } else {
     568            $nodes = $xml->xpath('/NachsteSpiele/Content/Spiel');
     569        }
     570       
    541571        $zeile;
    542572        $plan .= '<dl>'; 
    543         foreach($xml->Content->Spiel as $key => $attribute)
     573        foreach($nodes as $key => $attribute)
    544574        {
    545575            $zeile++;           
  • ttlive/trunk/readme.txt

    r690039 r690149  
    55Requires at least: 3.0.1
    66Tested up to: 3.5.1
    7 Stable tag: 0.8.2
     7Stable tag: 0.8.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    8080== Changelog ==
    8181
    82 = 0.8.2 =
    83 * false version number corrected
     82= 0.8.3 =
     83* added sorting for last matches (14 Tage), to show the max number of matches by date
    8484
    8585= 0.8.1 =
Note: See TracChangeset for help on using the changeset viewer.