extranet/includes/graydon/graydon_functions.php

121 lines
3.0 KiB
PHP

<?php
/**
* @file
* Fonctions utiles pour l'utilisation du webservice graydon
*
*/
function parseReport($type){
$doc = new DOMDocument;
$doc->preserveWhiteSpace = false;
$doc->loadxml($xml);
}
/*
* Parcours le contenu du rapport en XML
*
* return array
*/
function parseReportXML($xml)
{
require_once realpath(dirname(__FILE__)).'/graydon_xml.php';
global $firephp;
$tabReport = array();
global $xpath;
$query = '/GraydonUKCompanySchema/CompanyReportPage/CompanyReport';
$report = $xpath->query($query);
//Liste des elements à parser
$elements = array( 'Company', 'Name', 'Address', 'Communication', 'Country', 'Credit_Rating',
'Date', 'DirectorsDetail', 'Employees', 'Financial_Summary', 'Legal_Form',
'Share_CapitalSummary', 'Taxonomy', 'FreeText', 'AccountItem'
);
foreach($elements as $elementName){
//Pour chaque element, nouvelle requete xpath
$queryElement = $query.'/'.$elementName;
switch($elementName){
case "Company" :
$tabReport['Company'] = pxmlCompany($queryElement);
break;
case "Name" :
$name = pxmlName($queryElement);
if ($name) $tabReport['Name'] = $name;
break;
case "Address" :
$tabReport['Address'] = pxmlAddress($queryElement);
break;
case "Communication":
$tabReport['Communication'] = pxmlCommunication($queryElement);
break;
case "Country" :
$country = pxmlCountry($queryElement);
if($country) $tabReport['Country'] = $country;
break;
case "Credit_Rating" :
$creditRating = pxmlCreditRating($queryElement);
if($creditRating) $tabReport['CreditRating'] = $creditRating;
break;
case "Date" :
$tabReport['Date'] = pxmlDate($queryElement);
break;
case "DirectorsDetail" :
$directorsdetail = pxmlDirectorsDetail($queryElement);
if($directorsdetail){ $tabReport['DirectorsDetail'] = $directorsdetail; }
break;
case "Employees" :
$employees = pxmlEmployees($queryElement);
if($employees) $tabReport['Employees'] = $employees;
break;
case "Financial_Summary" :
$financialsummary = pxmlFinancialSummary($queryElement);
if($financialsummary) $tabReport['FinancialSummary'] = $financialsummary;
break;
case "Legal_Form" :
$legalform = pxmlLegalForm($queryElement);
if($legalform) $tabReport['LegalForm'] = $legalform;
break;
case "Share_CapitalSummary";
$sharecapitalsummary = pxmlShareCapitalSummary($queryElement);
if($sharecapitalsummary) $tabReport['ShareCapitalSummary'] = $sharecapitalsummary;
break;
case "Taxonomy" :
$taxonomy = pxmlTaxonomy($queryElement);
if($taxonomy) $tabReport['Taxonomy'] = $taxonomy;
break;
case "FreeText" :
$freetext = pxmlFreeText($queryElement);
if($freetext) $tabReport['Text'] = $freetext;
break;
case "AccountItem";
$AccountItem = pxmlAccountItem($queryElement);
if($AccountItem) $tabReport['AccountItem'] = $AccountItem;
break;
}
}
return $tabReport;
}
function parseReportHTML()
{
}
function parseReportDOC()
{
}
function reportFormat()
{
return array('xml', 'html');
}
?>