<?php

/**
 * File name: ordonează-fluxul-după-dată.php
 * Sort an RSS feed by pubDate
 *
 * (C) Copyright 2013 Friedrich-Ebert-Stiftung (http://fes.ro)
 * Author: Tiberiu C. Turbureanu (tct@ceata.org)
 *
 * This file is part of the project funded by FES
 *
 * This is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

require_once 'utile.php';

// Load the list of persons
$persons = array();
$xmla = new DOMDocument();
$xmla->load('../20131013-consilieri.xml');
$xpatha = new DOMXpath($xmla);
$persons = $xpatha->query("/xml/person");

foreach($persons as $person)
{

  $comname = $xpatha->query("comname", $person)->item(0)->nodeValue;
  $surname = $xpatha->query("surname", $person)->item(0)->nodeValue;

  $res_file = $rss_file = '../fluxuri/02-teste/'.$comname.'-'.$surname.'.xml';
  $xsl_file = '../stiluri/flux-ordonat-după-dată.xsl';

  transformă($rss_file, $xsl_file);
}

?>
